Skip to content

Instantly share code, notes, and snippets.

@LionGet
Last active October 20, 2023 08:05
Show Gist options
  • Save LionGet/56b6eaf06b5c8e7a45f688c1694820a4 to your computer and use it in GitHub Desktop.
Save LionGet/56b6eaf06b5c8e7a45f688c1694820a4 to your computer and use it in GitHub Desktop.
Ultimate UI
# 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