private XRootDebugMenu() { mListener_FiveContacts = new XListener <XTouch.FiveContacts>(1, eEventQueueFullBehaviour.Assert, "5contacts"); mListener_SelectorSelection = new XListener <XUI.SelectorSelectionEvent>(1, eEventQueueFullBehaviour.Assert, "dmss"); mBroadcaster_MenuSelection = new XBroadcaster <MenuSelectionEvent>(); mRootSelector = null; String spacer = XUI.Instance().GetSpacerString(); mOptions = new String[5] { "Map", spacer, "Exit", spacer, "Quit" }; }
public void Update() { // check for create menu var enumerator_fiveContacts = mListener_FiveContacts.CreateEnumerator(); if (enumerator_fiveContacts.MoveNext()) { if (mRootSelector == null) { mRootSelector = XUI.Instance().CreateSelector(new XUI._Position(), "Debug Menu", XUI.eStyle.Frontend, XUI.eStyle.FrontendButton, XUI.eStyle.FrontendTitle, mOptions); } } // check for menu selection var selection_data = mListener_SelectorSelection.GetMaxOne(); if (selection_data != null) { if (selection_data.mSelectorID == mRootSelector.GetID()) { // destroy this selector XUI.Instance().DestroySelector(mRootSelector.GetID()); mRootSelector = null; switch (selection_data.mIndexSelected) { case 0: // map selected, sent message for that system to do what it wants Console.WriteLine("map selected"); mBroadcaster_MenuSelection.Post(new MenuSelectionEvent(selection_data.mSelectorID, mOptions[0])); break; case 2: // exit selected, do nothing, menu will close break; case 4: // quit selected, send message to end program. this menu will close XBulletinBoard.Instance().mBroadcaster_ExitGameEvent.Post(new Game1.ExitGameEvent()); break; default: // problem XUtils.Assert(false); break; } } } }