void ExitSelected(object sender, EventArgs e) { MenuButton mbNo = new MenuButton("No"); MenuButton mbYes = new MenuButton("Yes"); mbNo.Selected += CancelExit; mbYes.Selected += QuitSelected; List<MenuButton> menuexitbuttons = new List<MenuButton>() {mbNo, mbYes}; menuexitbuttons[0].Tex2dButtonTexture = tex2ExitMenuButtons[0]; menuexitbuttons[1].Tex2dButtonTexture = tex2ExitMenuButtons[1]; PopUpState psSureExit = new PopUpState ("Sure you want to exit?", menuexitbuttons); psSureExit.ID = "MenuExit"; psSureExit.Cancelled += CancelExit; bPause = true; GSM.Instance.AddState (psSureExit); }
public override void HandleInput() { InputController IC = InputController.Instance; if (IC.IsKey (Keys.Escape) || (IC.IsMouse (0, recUIPausePos))) { MenuButton mbResume = new MenuButton ("Resume"); MenuButton mbQuit = new MenuButton ("Quit"); mbResume.Selected += ResumeSelected; mbResume.Tex2dButtonTexture = tex2PauseMenuButtons [1]; mbQuit.Selected += QuitSelected; mbQuit.Tex2dButtonTexture = tex2PauseMenuButtons [0]; List<MenuButton> pauseButtons = new List<MenuButton> () {mbResume, mbQuit}; //pauseButtons [0].Tex2dButtonTexture = new Texture2D[] {tex2PauseMenuButtons [0], tex2PauseMenuButtons [1]}; //pauseButtons [1].Tex2dButtonTexture = new Texture2D[] {tex2PauseMenuButtons [2], tex2PauseMenuButtons [3]}; PopUpState psPause = new PopUpState ("Would you like to quit?", pauseButtons); psPause.ID = "levelPause"; psPause.Cancelled += pauseCancel; bPause = true; GSM.Instance.AddState (psPause); } MouseOverUI (IC, ref recUIPos [0], ref recUIPos [1], ref bBookOpen); MouseOverUI (IC, ref recUIPos [2], ref recUIPos [3], ref bRadioOpen); if (!bBookOpen && !bRadioOpen) { foreach (Civilian c in lCivilians) { c.HandleInput (); if (c.BSelected) { //bad code but shouldnt effect game on this scale lCivilians.ForEach (delegate(Civilian ci) { if (ci != c) ci.BSelected = false; }); if (IC.IsKey (Keys.Enter)) { if (oPlayer.Arrests > 0 && !c.Arrested) { oPlayer.Arrests--; if (c.Tracked){ oPlayer.Trackers++; c.Tracked = false; } c.Arrested = true; c.BSelected = false; c.Sm.ChangeState (new ArrestedState (oPlayer)); } } if (IC.IsKey (Keys.Space) && !c.Arrested) { if (oPlayer.Trackers > 0) { if (!c.Tracked) { //not tracked oPlayer.Trackers--; c.Tracked = true; } else { // tracked oPlayer.Trackers++; c.Tracked = false; } } else { if (c.Tracked) { oPlayer.Trackers++; c.Tracked = false; } } } } } } }