public static void Initialize(int screenwidth, int screenheight) { choosen_map_ = Editor.Next_map_; menus_ = new Dictionary <int, Dictionary <int, WTuple <string, Delegate> > >(); titles_ = new Dictionary <int, string>(); Dictionary <int, WTuple <string, Delegate> > actions1 = new Dictionary <int, WTuple <string, Delegate> >(); int i = 0; int rows = screenheight / 30 - 1; foreach (var entry in Maps.Maps_.OrderBy(entry => entry.Key)) { if (entry.Key == choosen_map_) { state_ = i; } actions1[i] = new WTuple <string, Delegate>(entry.Key, new Func <object>(ChooseMap)); i++; } actions1[i] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[0] = actions1; titles_[0] = "CHOOSE THE NEXT MAP"; max_height_ = screenheight - 20; max_width_ = screenwidth - (int)Textures.Font_.MeasureString(titles_[0]).X - 20; map_ = new MapEditor(actions1[state_].Item1_); ComputeSize(); rows_ = screenheight / 30 - 1; SetState(state_); }
public static void Update(int screenwidth, int screenheight) { max_height_ = screenheight - 20; max_width_ = screenwidth - (int)Textures.Font_.MeasureString(titles_[4]).X - 20; rows_ = screenheight / 30 - 1; if (Input.IsPressedOnce(Keys.Down)) { state_++; if (state_ >= offset_ + (rows_ - 2)) { offset_++; } if (state_ < 0) { state_ = menus_[menu_].Count - 1; offset_ = menus_[menu_].Count - rows_; } else if (state_ >= menus_[menu_].Count) { state_ = 0; offset_ = 0; } offset_ = Math.Min(Math.Max(0, offset_), menus_[menu_].Count - rows_); if (menu_ == 4 && state_ != menus_[menu_].Count - 1) { map_ = new MapEditor(menus_[menu_].Values.ToList()[state_].Item1_); ComputeSize(); } } else if (Input.IsPressedOnce(Keys.Up)) { state_--; if (state_ <= offset_ + 1) { offset_--; } if (state_ < 0) { state_ = menus_[menu_].Count - 1; offset_ = menus_[menu_].Count - rows_; } else if (state_ >= menus_[menu_].Count) { state_ = 0; offset_ = 0; } offset_ = Math.Min(Math.Max(0, offset_), menus_[menu_].Count - rows_); if (menu_ == 4 && state_ != menus_[menu_].Count - 1) { map_ = new MapEditor(menus_[menu_].Values.ToList()[state_].Item1_); ComputeSize(); } } else if (Input.IsPressedOnce(Keys.Escape)) { Back(); } menus_[menu_].Values.ToList()[state_].Item2_.DynamicInvoke(); }
public static void Initialize(int width, int height) { InitContents(); map_ = new MapEditor(width, height); width_ = width; height_ = height; name_ = ""; next_map_ = ""; shade_ = 0; thread_part1_ = false; thread_part2_ = false; thread_part1_str_ = ""; thread_part2_str_ = ""; }
public static void Initialize(string choosen_map) { InitContents(); map_ = new MapEditor(choosen_map); next_map_ = Maps.Maps_[choosen_map].Next_map_; tutorial_ = Maps.Maps_[choosen_map].Tutorial_; custom_ = !Maps.Maps_[choosen_map].Official_; width_ = map_.Width_; height_ = map_.Height_; name_ = choosen_map; shade_ = 0; thread_part1_ = false; thread_part2_ = false; thread_part1_str_ = ""; thread_part2_str_ = ""; }
public static void Initialize() { int screenwidth = Drawer.Graphics_.PreferredBackBufferWidth; int screenheight = Drawer.Graphics_.PreferredBackBufferHeight; //gameplay_ = GamePlay.None; menus_ = new Dictionary <int, Dictionary <int, WTuple <string, Delegate> > >(); titles_ = new Dictionary <int, string>(); Dictionary <int, WTuple <string, Delegate> > actions1 = new Dictionary <int, WTuple <string, Delegate> >(); actions1[0] = new WTuple <string, Delegate>("Editor", new Func <object>(ChooseEditor)); actions1[1] = new WTuple <string, Delegate>("Play", new Func <object>(ChoosePlay)); actions1[2] = new WTuple <string, Delegate>("Options", new Func <object>(ChooseOptions)); actions1[3] = new WTuple <string, Delegate>("Quit", new Func <object>(ChooseQuit)); menus_[0] = actions1; titles_[0] = "TITLE SCREEN"; Dictionary <int, WTuple <String, Delegate> > actions2 = new Dictionary <int, WTuple <string, Delegate> >(); actions2[0] = new WTuple <string, Delegate>("Quality: " + (Drawer.Hd_ ? "HIGH" : "LOW"), new Func <object>(ChooseQuality)); actions2[1] = new WTuple <string, Delegate>("Full screen: OPTION DISABLED", new Func <object>(DoNothing)); //actions2[1] = new WTuple<string, Delegate>("Full screen: " + (Drawer.Full_screen_ ? "ON" : "OFF"), new Func<object>(ChooseFullScreen)); actions2[2] = new WTuple <string, Delegate>("Sounds: " + (GameHandler.Sounds_ ? "ON" : "OFF"), new Func <object>(ChooseSounds)); actions2[3] = new WTuple <string, Delegate>("Delete best scores", new Func <object>(ChooseDeleteScores)); //actions2[3] = new WTuple<string, Delegate>("Delete best scores (OPTION DISABLED)", new Func<object>(DoNothing)); actions2[4] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[1] = actions2; titles_[1] = "OPTIONS"; Dictionary <int, WTuple <String, Delegate> > actions3 = new Dictionary <int, WTuple <string, Delegate> >(); actions3[0] = new WTuple <string, Delegate>("Width: " + width_, new Func <object>(ChooseWidth)); actions3[1] = new WTuple <string, Delegate>("Height: " + height_, new Func <object>(ChooseHeight)); actions3[2] = new WTuple <string, Delegate>("Done", new Func <object>(ChooseDone)); actions3[3] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[2] = actions3; titles_[2] = "CREATE A NEW MAP"; Dictionary <int, WTuple <String, Delegate> > actions4 = new Dictionary <int, WTuple <string, Delegate> >(); int i = 0; if (Maps.Maps_.Where(map => map.Value.Tutorial_).Count() != 0) { actions4[i++] = new WTuple <string, Delegate>("Tutorial", new Func <object>(ChooseTutorial)); } if (Maps.Maps_.Where(map => map.Value.Official_ && !map.Value.Tutorial_).Count() != 0) { actions4[i++] = new WTuple <string, Delegate>("Official maps", new Func <object>(ChooseOfficialMaps)); } if (Maps.Maps_.Where(map => !map.Value.Official_).Count() != 0) { actions4[i++] = new WTuple <string, Delegate>("Custom maps", new Func <object>(ChooseCustomMaps)); } actions4[i] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[3] = actions4; titles_[3] = "PLAY"; Dictionary <int, WTuple <String, Delegate> > actions8 = new Dictionary <int, WTuple <string, Delegate> >(); i = 0; foreach (var entry in Maps.GetNamesAndScores().OrderBy(entry => entry.Key).Where(entry => entry.Value.Item2)) { actions8[i] = new WTuple <string, Delegate>(entry.Key + entry.Value.Item1, new Func <object>(ChooseMap)); i++; } actions8[i] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[7] = actions8; titles_[7] = "TUTORIAL - CHOOSE A MAP"; /* Tutorial */ Dictionary <int, WTuple <String, Delegate> > actions9 = new Dictionary <int, WTuple <string, Delegate> >(); i = 0; foreach (var entry in Maps.GetNamesAndScores().OrderBy(entry => entry.Key).Where(entry => entry.Value.Item3 && !entry.Value.Item2)) { actions9[i] = new WTuple <string, Delegate>(entry.Key + entry.Value.Item1, new Func <object>(ChooseMap)); i++; } actions9[i] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[8] = actions9; titles_[8] = "OFFICIAL MAPS - CHOOSE A MAP"; /* Official maps */ Dictionary <int, WTuple <String, Delegate> > actions10 = new Dictionary <int, WTuple <string, Delegate> >(); i = 0; foreach (var entry in Maps.GetNamesAndScores().OrderBy(entry => entry.Key).Where(entry => !entry.Value.Item3)) { actions10[i] = new WTuple <string, Delegate>(entry.Key + entry.Value.Item1, new Func <object>(ChooseMap)); i++; } actions10[i] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[9] = actions10; titles_[9] = "CUSTOM MAPS - CHOOSE A MAP"; /* Custom maps */ Dictionary <int, WTuple <String, Delegate> > actions5 = new Dictionary <int, WTuple <string, Delegate> >(); i = 0; foreach (var entry in Maps.Maps_.OrderBy(entry => entry.Key)) { if (entry.Value.Read_only_) { continue; } actions5[i] = new WTuple <string, Delegate>(entry.Key, new Func <object>(ChooseMapEdit)); i++; } actions5[i] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[4] = actions5; titles_[4] = "EDIT A EXISTING MAP"; max_height_ = screenheight - 20; max_width_ = screenwidth - (int)Textures.Font_.MeasureString(titles_[4]).X - 20; map_ = new MapEditor(actions5[0].Item1_); ComputeSize(); Dictionary <int, WTuple <String, Delegate> > actions6 = new Dictionary <int, WTuple <string, Delegate> >(); actions6[0] = new WTuple <string, Delegate>("Create a new map", new Func <object>(ChooseNewMap)); actions6[1] = new WTuple <string, Delegate>("Edit a existing map", new Func <object>(ChooseExistingMap)); actions6[2] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[5] = actions6; titles_[5] = "EDITOR"; Dictionary <int, WTuple <String, Delegate> > actions7 = new Dictionary <int, WTuple <string, Delegate> >(); actions7[0] = new WTuple <string, Delegate>("Yes", new Func <object>(ChooseDeleteYes)); actions7[1] = new WTuple <string, Delegate>("No", new Func <object>(ChooseBack)); actions7[2] = new WTuple <string, Delegate>("Back", new Func <object>(ChooseBack)); menus_[6] = actions7; titles_[6] = "DELETE BEST SCORES ?"; /*state_ = 0; * menu_ = 0;*/ }