Verse Library verse

07 Creating The Ui

Constructs a score manager instance, binding a player and device while initializing the main UI canvas and widget hierarchy.

extracted-snippets/documentation/en-us/fortnite/pizza-pursuit-4-managing-and-displaying-the-score-for-time-trial-in-verse/07-creating-the-ui.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/pizza-pursuit-4-managing-and-displaying-the-score-for-time-trial-in-verse
# Local doc:  epic-docs/documentation/en-us/fortnite/pizza-pursuit-4-managing-and-displaying-the-score-for-time-trial-in-verse.md
# Section:    Creating the UI
using { /UnrealEngine.com/Temporary/SpatialMath}
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/Devices }
using { /Fortnite.com/UI }
using { /Verse.org/Colors }
using { /Verse.org/Simulation }
MakeScoreManager<constructor><public>(InPlayer : agent, InScoreManagerDevice : score_manager_device) := score_manager:
MaybePlayer := option{InPlayer}
MaybePlayerUI := option{GetPlayerUI[player[InPlayer]]}
score_manager := class:
<# Since we won't recreate the canvas during the score manager lifetime, do it once anytime an object of this type is created.>
block:
set Canvas = canvas:
Slots := array:
canvas_slot:
Anchors := anchors{Minimum := vector2{X := 0.0, Y := 0.25}, Maximum := vector2{X := 0.0, Y := 0.25} }
Offsets := margin{Top := 0.0, Left := 25.0, Right := 0.0, Bottom := 0.0}
Alignment := vector2{X := 0.0, Y := 0.0}
SizeToContent := true
Widget := stack_box:
Orientation := orientation.Vertical
Slots := array:
stack_box_slot:
HorizontalAlignment := horizontal_alignment.Left
Widget := TotalGameScoreWidget
stack_box_slot:
HorizontalAlignment := horizontal_alignment.Left

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