Last active
October 20, 2023 08:05
-
-
Save LionGet/56b6eaf06b5c8e7a45f688c1694820a4 to your computer and use it in GitHub Desktop.
Ultimate UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ULTIMATE UI | |
CreateUIForPlayer(Ultimate: int):canvas= | |
UltimateWidget.SetText(UltimateText(Ultimate)) | |
MyCanvas : canvas = canvas: | |
Slots := array: | |
canvas_slot: | |
Anchors := anchors{Minimum := vector2{X := 0.4, Y := 0.7}, Maximum := vector2{X := 0.6, Y := 0.0}} | |
Offsets := margin{Top := 100.0, Left := 0.0, Right := 0.0, Bottom := 0.0} | |
Alignment := vector2{X := 0.5, Y := 0.5} | |
SizeToContent := false | |
Widget := UltimateWidget | |
ShowUI(Agent: agent): void = | |
if (InPlayer := player[Agent], PlayerUI := GetPlayerUI[Player]): | |
NewUI := CreateUIForPlayer(0) | |
PlayerUI.AddWidget(NewUI, player_ui_slot{InputMode := ui_input_mode.None}) | |
spawn: | |
UpdateUltimate() | |
UpdateUltimate()<suspends>: void = | |
loop: | |
Sleep(0.1) | |
Ultimate := GetUltimateCharge() | |
UltimateWidget.SetText(UltimateText(Ultimate)) | |
GetUltimateCharge(): int = | |
if (UltimateInt := Floor(UltimateCharge/5)): | |
if (UltimateInt <= 100): | |
return UltimateInt | |
return 100 | |
return 0 | |
Init():void= | |
if: | |
Agent:=agent[Player] | |
FortCharacter:=Agent.GetFortCharacter[] | |
Ultimate:=GetUltimateCharge | |
then: | |
CreateUIForPlayer(Ultimate()) | |
ShowUI(Agent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment