public override void Bind() { base.Bind(); // Bind each button to handler: // When button is clicked, handler is excuted // Ex: When we press LevelSelectButton, we publish // RequestMainMenuScreenCommand and pass LevelSelectScreenViewModel type this.BindButtonToHandler(LevelSelectButton, () => { /*Publish(new RequestMainMenuScreenCommand() * { * ScreenType = typeof (LevelSelectScreenViewModel) * }); */ var evt = new RequestMainMenuScreenCommand(); evt.ScreenType = typeof(LevelSelectScreenViewModel); Publish(evt); }); this.BindButtonToHandler(SettingsButton, () => { Publish(new RequestMainMenuScreenCommand() { ScreenType = typeof(SettingsScreenViewModel) }); }); // This follows the same logic, but we use Method Group syntax. // And we do not publish event. We just quit. this.BindButtonToHandler(ExitButton, Application.Quit); //Equivalent to //this.BindButtonToHandler(ExitButton, () => { Application.Quit; }); }
public override void Bind() { base.Bind (); // Bind each button to handler: // When button is clicked, handler is excuted // Ex: When we press LevelSelectButton, we publish // RequestMainMenuScreenCommand and pass LevelSelectScreenViewModel type this.BindButtonToHandler (LevelSelectButton, () => { // Publish(new RequestMainMenuScreenCommand() // { // ScreenType = typeof (LevelSelectScreenViewModel) // }); RequestMainMenuScreenCommand command = new RequestMainMenuScreenCommand(); command.ScreenType = typeof(LevelSelectScreenViewModel); Publish(command); }); this.BindButtonToHandler (SettingsButton, () => { Publish (new RequestMainMenuScreenCommand () { ScreenType = typeof (SettingsScreenViewModel) }); }); // This follows the same logic, but we use Method Group syntax. // And we do not publish event. We just quit. this.BindButtonToHandler (ExitButton, Application.Quit); //Equivalent to //this.BindButtonToHandler(ExitButton, () => { Application.Quit; }); }
/// <sumarry> // This method is executed when using this.Publish(new RequestMainMenuScreenCommand()) /// </sumarry> public override void RequestMainMenuScreenCommandHandler(RequestMainMenuScreenCommand data) { base.RequestMainMenuScreenCommandHandler(data); // Process the commands information. Also, you can publish new events by using the line below. // this.Publish(new AnotherEvent()) //Change screen to what was requested MainMenuRoot.CurrentScreenType = data.ScreenType; }
public override void RequestMainMenuScreenCommandHandler(RequestMainMenuScreenCommand data) { base.RequestMainMenuScreenCommandHandler(data); //Change screen to what was requested MainMenuRoot.CurrentScreenType = data.ScreenType; }
/// <summary> // This method is executed when using this.Publish(new RequestMainMenuScreenCommand()) /// </summary> public virtual void RequestMainMenuScreenCommandHandler(RequestMainMenuScreenCommand data) { // Process the commands information. Also, you can publish new events by using the line below. // this.Publish(new AnotherEvent()) }
public override void Bind() { base.Bind(); // Bind each button to handler: // When button is clicked, handler is excuted // Ex: When we press LevelSelectButton, we publish // RequestMainMenuScreenCommand and pass LevelSelectScreenViewModel type var evt = new RequestMainMenuScreenCommand(); var evtPopUp = new NotifyCommand(); this.BindButtonToHandler(LevelSelectButton, () => { evt.ScreenType = typeof(LevelSelectScreenViewModel); Publish(evt); //Publish(new RequestMainMenuScreenCommand() //{ // ScreenType = typeof(LevelSelectScreenViewModel) //}); }); this.BindButtonToHandler(SettingsButton, () => { evt.ScreenType = typeof(SettingsScreenViewModel); Publish(evt); }); this.BindButtonToHandler(NoticeButton, () => { evt.ScreenType = typeof(NoticeScreenViewModel); Publish(evt); }); this.BindButtonToHandler(HeadButton, () => { evt.ScreenType = typeof(SampleScreenViewModel); Publish(evt); }); this.BindButtonToHandler(CardButton, () => { evt.ScreenType = typeof(CardScreenViewModel); Publish(evt); }); this.BindButtonToHandler(CharPageButton, () => { evt.ScreenType = typeof(CharPageScreenViewModel); Publish(evt); }); this.BindButtonToHandler(ShopButton, () => { evt.ScreenType = typeof(ShopScreenViewModel); Publish(evt); }); this.BindButtonToHandler(AcademyButton, () => { evt.ScreenType = typeof(AcademyScreenViewModel); Publish(evt); }); this.BindButtonToHandler(ArtisanButton, () => { evt.ScreenType = typeof(ArtisanScreenViewModel); Publish(evt); }); this.BindButtonToHandler(TrainButton, () => { evt.ScreenType = typeof(TrainScreenViewModel); Publish(evt); }); this.BindButtonToHandler(ConferenceButton, () => { evt.ScreenType = typeof(ConferenceScreenViewModel); Publish(evt); }); this.BindButtonToHandler(ParallelButton, () => { evt.ScreenType = typeof(ParallelScreenViewModel); Publish(evt); }); this.BindButtonToHandler(CompanionButton, () => { evt.ScreenType = typeof(CompanionScreenViewModel); Publish(evt); }); this.BindButtonToHandler(TechnologyTreeButton, () => { evt.ScreenType = typeof(TechnologyTreeScreenViewModel); Publish(evt); }); //Temp use this.BindButtonToHandler(SetBattleButton, () => { evt.ScreenType = typeof(SetBattleScreenViewModel); Publish(evt); /* Publish(new UnloadSceneCommand() { SceneName = "MainMenuScene" // Unload main menu scene }); Publish(new LoadSceneCommand() { //SceneName = arg.LevelScene // Load level scene SceneName = "MainGameScene" // Load level scene }); */ //Publish(new MainMenuFinishedEvent()); }); this.BindButtonToHandler(SampleButton, () => { evt.ScreenType = typeof(SampleScreenViewModel); Publish(evt); }); // This follows the same logic, but we use Method Group syntax. // And we do not publish event. We just quit. this.BindButtonToHandler(ExitButton, Application.Quit); //Equivalent to //this.BindButtonToHandler(ExitButton, () => { Application.Quit; }); //this.BindButtonToHandler(TryButton, Application.Quit); }
public virtual void RequestMainMenuScreenCommandHandler(RequestMainMenuScreenCommand data) { }