Verse Library verse

01 Snippet

Provides container classes and helper methods for managing and displaying custom UI screens.

extracted-snippets/community/snippets/ee3x/fortnite-ezui-container-api-module/01-snippet.verse

# Source URL: https://dev.epicgames.com/community/snippets/ee3x/fortnite-ezui-container-api-module
# Local doc:  epic-docs/community/snippets/ee3x/fortnite-ezui-container-api-module.md
  <#
  A bare minimum script for building upon the EZUI method of displaying UI
  #>
  using { /Fortnite.com/Devices }
  using { /Verse.org/Simulation }
  using { /UnrealEngine.com/Temporary/Diagnostics }
  #imports
  using { /UnrealEngine.com/Temporary/UI }
  using { /Fortnite.com/UI }
  using {EZUI}
  EZ_UIClass := class ()
  {
  EZ_LinkedCreativeDevice<public> : ez_ui_container # a backreference to the device that created this EZUI class
  EZ_LinkedPlayer<public> : player # the player linked to this instance of the EZUI class
  EZ_UI_ID<public> : int # used to control what UI is drawn by EZUI
  var IsInitialized<private> : logic = false # a lock to prevent recreating the canvas after the first execution of Initialize()
  var MainCanvas<private> : canvas = canvas{} # the canvas that holds all the screen elements and will be added to the PlayerUI
  # do all the things
  Ini<public>() : void =
  if (IsInitialized?):
  return
  if(EZ_UI_ID = 1): # for if you want multiple UI per device, defaults to 1
  GetMainCanvas<public>() : canvas = MainCanvas
  OpenUI<public>() : void =
  EZUI.InsertWidget(EZ_LinkedPlayer,GetMainCanvas())
  Print("EZUI: MainCanvas Opened. Thank you for using EZUI :)")
  } # END EZ_UI ------------------------------------------------------------------------------------------------------------------------------------
  ez_ui_container := class(creative_device):

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