/// <summary> /// The main game flow function. Is called whenever a new game screen/state /// is to be displayed/entered. /// </summary> /// <param name="newState">The new game state to enter.</param> /// <param name="chartToUse">The "optional" chart location (is sent null if not used).</param> private void ChangeGameState(object sender, ScreenChange myEvent) { Screen currScreen = ScreenManager.CurrentScreen; GameState newState = myEvent.newState; switch (newState) { case GameState.QuitGame: Exit(); break; case GameState.MainMenu: currScreen.MoveToScreen(typeof(MainMenu).FullName); break; case GameState.Options: currScreen.MoveToScreen(typeof(Options).FullName); break; case GameState.SinglePlayer: //EnterNewGameScreen(new SinglePlayerScreen(this, graphics, chartToUse)); break; case GameState.SongSelection: currScreen.MoveToScreen(typeof(SongSelection).FullName); break; } }
public override void Activity(bool firstTimeCalled) { Boolean escapeKeyPressed = InputManager.Keyboard.KeyPushed(Keys.Escape); if (escapeKeyPressed) { ScreenChange newEvent = new ScreenChange(GameState.MainMenu); EventBus <ScreenChange> .instance.fireEvent(this, newEvent); } base.Activity(firstTimeCalled); }
public void Start() { sc = GameObject.FindObjectOfType <ScreenChange>(); if (menu.transform.localPosition.x <= 470) { menuIsOnScreen = false; } else { menuIsOnScreen = true; } MenuOut(); }
private void ChangeScreen(ScreenChange change, int screenIndex, bool on = true) { var currScreenMode = this.FormBorderStyle == System.Windows.Forms.FormBorderStyle.None ? ScreenMode.Fullscreen : ScreenMode.Window; var currScreenIndex = CurrentScreen; ScreenMode newScreenMode; if (change == ScreenChange.Toggle || (on ? currScreenMode == ScreenMode.Window : change == ScreenChange.Normal)) { newScreenMode = currScreenMode == ScreenMode.Fullscreen ? ScreenMode.Window : ScreenMode.Fullscreen; } else { newScreenMode = currScreenIndex == screenIndex ? currScreenMode : ScreenMode.Fullscreen; // always fullscreen when changing screens } SetScreenMode(newScreenMode, screenIndex); }
public override void Activity(bool firstTimeCalled) { bool escapeKeyPressed = InputManager.Keyboard.KeyPushed(Keys.Escape); if (escapeKeyPressed) { ScreenChange newEvent = new ScreenChange(GameState.QuitGame); EventBus <ScreenChange> .instance.fireEvent(this, newEvent); } bool enterKeyPressed = InputManager.Keyboard.KeyPushed(Keys.Enter); if (enterKeyPressed) { // Get selected item GameState newState = (GameState)menuList.GetFirstHighlightedObject(); ScreenChange newEvent = new ScreenChange(newState); EventBus <ScreenChange> .instance.fireEvent(this, newEvent); } base.Activity(firstTimeCalled); }
protected void ChangeScreen(ScreenName name) { ScreenChange?.Invoke(this, name); }
// Start is called before the first frame update void Start() { sc = GameObject.FindObjectOfType <ScreenChange>(); }