3 [
EditorAttribute(
"box",
"GameLib/Scripted",
"Worlds menu",
"-0.25 -0.25 -0.25",
"0.25 0.25 0.25",
"255 0 0 255")]
9 WorldsMenuClass WorldsMenuSource;
11 class 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");
48 DbgUI.Begin(
"Load world", 400, 100);
50 DbgUI.Text(
"Select world to load from worlds directory");
52 if (m_DbgOptions.Count() > 0)
54 DbgUI.List(
"Worlds", m_DbgListSelection, m_DbgOptions);
55 if (
DbgUI.Button(
"Start") || menuSelect)
57 string worldToLoad = m_DbgOptions.Get(m_DbgListSelection);
58 GetGame().SetWorldFile(worldToLoad,
true);
61 if (
DbgUI.Button(
"Exit") || menuBack)
77 InsertWorldToList(fileName);
81 InsertWorldToList(fileName);
86 m_WorldsCount = m_DbgOptions.Count();
89 void InsertWorldToList(
string fileName)
92 if (
path != DEFAULT_WORLD)