/// <summary> /// Do work with the main menu. /// </summary> public virtual void DoWork(IMainMenu mainMenu) { // Only show the properties view once. var view = mainMenu.Views.OfType<PropertiesView>().FirstOrDefault(); if (view != null) { mainMenu.ActiveView = view; return; } mainMenu.Show(new PropertiesView()); }
/// <summary> /// Do work with the main menu. /// </summary> public virtual void DoWork(IMainMenu mainMenu) { // Only show the new game values view once. var existing = mainMenu.Views.OfType<NewGameValuesView>().FirstOrDefault(); if (existing != null) { mainMenu.ActiveView = existing; return; } var view = new NewGameValuesView(); var data = new byte[RomMap.NewGameValuesLength]; Array.Copy(mainMenu.Rom.Data, RomMap.NewGameValuesOffset, data, 0, data.Length); view.Parameters.Add("Data", data); mainMenu.Show(view); }
/// <summary> /// Do work with the main menu. /// </summary> public void DoWork(IMainMenu mainMenu) { // Only allow one view per overworld. var existing = mainMenu.Views.OfType<OverworldMapView>().Where(v => v.Parameters["Offset"].Equals(this.Offset)).FirstOrDefault(); if (existing != null) { mainMenu.ActiveView = existing; return; } // Create a new array to store a copy of the map in. var data = new byte[this.Length]; Array.Copy(mainMenu.Rom.Data, this.Offset, data, 0, this.Length); // Load the overworld view. var view = new OverworldMapView(); view.Parameters.Add("Data", data); view.Parameters.Add("Title", this.Title); view.Parameters.Add("Offset", this.Offset); mainMenu.Show(view); }