User Tools

Site Tools


ixe:irpl:ui:createui

CreateUI

CreateUi(<-UIName <-json <-data)

Description

Creates a custom ui with the string UIName as an identifier. The JSON data specifes the UI. Data should be a table of name value pairs that the UI uses.

Examples

switch
    case(<-state 0 ==)
		if (GetEditMode <-editModeProceed ! &&)
			if (GetKey("Tab" true))
				DebugAllSp("Proceed")
				true ->editModeProceed
			endif
		else
			@SetState(1)
		endif	
    endcase
    case(<-state 1 ==)
    endcase
 
endswitch	
 
:SetState
	->newState
	switch
		case(<-newState 1 ==)
			ShowBubbleMessage("YOU CAN BUILD SHIELDS HERE TO DELAY THE CREEPER FROM ESCAPING. REVIEW THE VIDEO HELP ON SHIELDS FOR HOW TO BUILD.", V2(418 437), -1, 2, 1,"") ->bubble0
			CreateTable() ->uiTable
			CreateUI("ui", @UIHelpJSON, <-uiTable) ->result ->resultString
		endcase
	endswitch	
	<-newState ->state
 
:Awake
	RegisterForMsg("OpenHelpClicked", "OnOpenHelpClicked")
 
:OnOpenHelpClicked	
	SetHelpOpen(true 1 4)
	DestroyUI("ui")
 
:UIHelpJSON
	"{
		'anchor': [0.5, 1],
		'pos': [0, -170],
		'pivot': [0.5, 0.5],
		'width': 200,
		'height': 60,
		'bgcolor': '#00000000',
		'Components': 	[
							{
								'type': 'button', 
								'pos': [0, 0], 
								'width': 200, 
								'height': 60,
								'color':'#000000', 
								'bgcolor':'#f0fff0',
								'text':'OPEN HELP ON SHIELDS', 
								'name':'open_help_button',
								'events': ['OpenHelpClicked']
							},	
						]
 
	}"	
ixe/irpl/ui/createui.txt · Last modified: 2025/01/16 13:36 by Karsten75