private void SetInfoBarControls() { //Settings button TopStatusBarInstance.MenuButtonInstanceClick += OnMenuButtonClick; TopStatusBarInstance.PauseButtonInstanceClick += OnPauseButtonClick; TopStatusBarInstance.PlayButtonInstanceClick += OnPlayButtonClick; TopStatusBarInstance.FastForwardButtonInstanceClick += OnFastForwardButtonClick; MenuWindowInstance.AssignEventToCloseButton(OnMenuCloseButtonClick); MenuWindowInstance.AssignEventToButton1((window) => ConfirmationWindowInstance.Confirm("Quit level and lose current progress?", () => { AnalyticsManager.FlushDeferredEvents(); LoadingScreen.TransitionToScreen(typeof(MapScreen)); }) ); MenuWindowInstance.ButtonType2State = ButtonFrameRuntime.ButtonType.Restart; MenuWindowInstance.AssignEventToButton2((window) => ConfirmationWindowInstance.Confirm("Restart level and lose current progress?", () => { RestartLevel(window); }) ); if (CurrentLevel.MapName != "Chapter1") { //MenuWindowInstance.ButtonType3State = ButtonFrameRuntime.ButtonType.History; //MenuWindowInstance.AssignEventToButton3(window => //{ // ChatHistoryInstance.PopulateWithAllChatHistory(); // ChatHistoryInstance.Visible = true; // ChatHistoryInstance.CloseButtonClick = (sender, args) => ChatHistoryInstance.Visible = false; //}); } }
private void LoadLevel(IWindow window) { //Don't react to level button presses if menu is open if (MapScreenGumInstance.CurrentMenuDisplayState != MapScreenGumRuntime.MenuDisplay.MenuHidden) { return; } if (TowerSelectionBoxInstance.Visible) { return; } var windowAsLevelButton = window as LevelButtonRuntime; //Don't do anything if level is disabled if (windowAsLevelButton == null || !windowAsLevelButton.IsEnabled) { return; } var levelName = windowAsLevelButton.LevelName; var assembly = Assembly.GetExecutingAssembly(); var type = assembly.GetTypes() .First(t => t.Name == levelName); var level = (BaseLevel)Activator.CreateInstance(type); GameStateManager.CurrentLevel = level; LocalLogManager.AddLine("Main Menu - Load Level " + level); MapScreenGumInstance.FadeOutAnimation.Play(); this.Call(() => LoadingScreen.TransitionToScreen(typeof(GameScreen))).After(MapScreenGumInstance.FadeOutAnimation.Length); }
void CustomActivity(bool firstTimeCalled) { SoundManager.Update(); if (MainMenuGumRuntime.CurrentAnyKeyState == MainMenuGumRuntime.AnyKey.Ready && (InputManager.Keyboard.AnyKeyPushed() || InputManager.Mouse.AnyButtonPushed())) { MainMenuGumRuntime.FadeOutAnimation.Play(); LocalLogManager.AddLine("Transition to MapScreen"); this.Call(() => LoadingScreen.TransitionToScreen(typeof(MapScreen))).After(MainMenuGumRuntime.FadeOutAnimation.Length); } else if (LeftEye.CurrentEyeOpeningState == MainMenuEyeRuntime.EyeOpening.Open && !MainMenuGumRuntime.OpenEyesAnimation.IsPlaying() && !MainMenuGumRuntime.BlinkEyesAnimation.IsPlaying()) { var random = FlatRedBallServices.Random.NextDouble(); if (random >= 0.995f) { MainMenuGumRuntime.BlinkEyesAnimation.Play(this); } } if (MainMenuGumRuntime.CurrentFadeState == MainMenuGumRuntime.Fade.NotFaded) { MainMenuGumRuntime.UpdateDimming(); } }
private void ReturnToMenu() { PlayerDataManager.WipeToRestart(); LoadingScreen.TransitionToScreen(typeof(MainMenu)); }