Verse Library verse

01 Snippet

Displays a formatted HHMMSS timer on a player UI canvas, tracking elapsed or countdown time dynamically.

extracted-snippets/community/snippets/jMVQ/fortnite-clock-hh-mm-ss/01-snippet.verse

# Source URL: https://dev.epicgames.com/community/snippets/jMVQ/fortnite-clock-hh-mm-ss
# Local doc:  epic-docs/community/snippets/jMVQ/fortnite-clock-hh-mm-ss.md
  using { /UnrealEngine.com/Temporary/Diagnostics }
  using { /UnrealEngine.com/Temporary/UI }
  using { /UnrealEngine.com/Temporary/SpatialMath }
  using { /Verse.org/Simulation }
  using { /Fortnite.com/UI }
  using { /Verse.org/Colors/NamedColors }
  StringToMessage<localizes>(value:int, value2:int, value3:int) : message = "{value}:{value2}:{value3}"
  StringToMessageZero<localizes>(value:int, value2:int, value3:int) : message = "0{value}:0{value2}:0{value3}"
  StringToMessageZeroS<localizes>(value:int, value2:int, value3:int) : message = "0{value}:{value2}:0{value3}"
  StringToMessageZeroM<localizes>(value:int, value2:int, value3:int) : message = "0{value}:0{value2}:{value3}"
  MakeCountupTimer<constructor><public>(InPlayer : agent) := countup_timer:
  ElapsedTime := 0.0
  MaybePlayerUI := option{GetPlayerUI[player[InPlayer]]}
  countup_timer := class:
  block:
  set Canvas = canvas:
  Slots := array:
  canvas_slot:
  Anchors := anchors:
  Minimum := vector2{X := 0.5, Y := 0.05}
  Maximum := vector2{X := 0.0, Y := 0.0}
  Alignment := vector2{X := 0.0, Y := 0.0 }
  Offsets := margin{Top := 0.0, Left := 0.0, Bottom := 0.0, Right := 0.0}
  SizeToContent := true
  Widget := ElapsedTimeTextBlock
  CountdownEndedEvent<public> : event(float) = event(float){}
  StartCountdown<public>() : void =
  if (PlayerUI := MaybePlayerUI?):

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in