3[
EditorAttribute(
"box",
"GameLib/Scripted",
"Worlds menu",
"-0.25 -0.25 -0.25",
"0.25 0.25 0.25",
"255 0 0 255")]
9WorldsMenuClass WorldsMenuSource;
11class WorldsMenu: GenericEntity
13 int m_DbgListSelection = 0;
14 int m_WorldsCount = 0;
15 string DEFAULT_WORLD =
"worlds/default.ent";
17 ref ImageWidget m_MouseWidget;
24 Class.
CastTo(m_MouseWidget,
GetGame().GetWorkspace().CreateWidgets(
"gui/layouts/mouse.layout"));
25 m_MouseWidget.SetSort(1024);
41 override void EOnPostFrame(
IEntity other,
int extra)
43 InputManager im =
GetGame().GetInputManager();
44 im.ActivateContext(
"MenuContext");
45 bool menuSelect = im.GetActionTriggered(
"MenuSelect");
46 bool menuBack = im.GetActionTriggered(
"MenuBack");
50 DbgUI.
Text(
"Select world to load from worlds directory");
52 if (m_DbgOptions.Count() > 0)
54 DbgUI.
List(
"Worlds", m_DbgListSelection, m_DbgOptions);
57 string worldToLoad = m_DbgOptions.Get(m_DbgListSelection);
58 GetGame().SetWorldFile(worldToLoad,
true);
75 InsertWorldToList(fileName);
78 InsertWorldToList(fileName);
82 m_WorldsCount = m_DbgOptions.Count();
85 void InsertWorldToList(
string fileName)
88 if (
path != DEFAULT_WORLD)
Super root of all classes in Enforce script.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
proto native void SetFlags(ShapeFlags flags)
static proto void List(string label, out int selection, TStringArray elems)
static proto native void End()
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native bool Button(string txt, int minWidth=0)
static proto native void Text(string label)
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
string String(string s)
Helper for passing string expression to functions with void parameter. Example: Print(String("Hello "...
EntityEvent
Entity events for event-mask, or throwing event from code.
void EditorAttribute(string style, string category, string description, vector sizeMin, vector sizeMax, string color, string color2="0 0 0 0", bool visible=true, bool insertable=true, bool dynamicBox=false)
proto native void CloseFindFile(FindFileHandle handle)
enum FindFileFlags FindFile(string pattern, out string fileName, out FileAttr fileAttributes, FindFileFlags flags)
proto bool FindNextFile(FindFileHandle handle, out string fileName, out FileAttr fileAttributes)