public void Initialize() { if (!NewGameController.CanCreateGame) { return; } controller = new NewGameController(LoadingMethods.GameDataSources()); updatePlayerViews(); foreach (var start in MapAssets.Starts) { setupStartSelector.Items.Add(new Tag <StartingConditions>(start, start.Name)); } this.customStartIndex = setupStartSelector.Items.Count; setupStartSelector.Items.Add(new Tag <StartingConditions>(controller.CustomStart, LocalizationManifest.Get.CurrentLanguage["StartingConditions"][NewGameController.CustomStartNameKey].Text())); setupStartSelector.Items.Add(new Tag <StartingConditions>(null, LocalizationManifest.Get.CurrentLanguage["StartingConditions"]["customize"].Text())); if (NewGameController.LastStartingCondition != null) { int i = new List <StartingConditions>(MapAssets.Starts).FindIndex(x => x.Equals(NewGameController.LastStartingCondition)); setupStartSelector.SelectedIndex = (i != -1) ? i : setupStartSelector.Items.Count - 2; } else { setupStartSelector.SelectedItem = new Tag <StartingConditions>(NewGameController.DefaultStartingCondition, null); } updateMapDescription(); }
private void languageSelector_SelectedIndexChanged(object sender, EventArgs e) { if (languageSelector.SelectedItem == null || !initialized) { return; } var langId = (languageSelector.SelectedItem as Tag <string>).Value; SettingsWinforms.Get.ChangeLanguage(langId, LoadingMethods.LoadLanguage(langId)); setLanguage(); }
private void showSaveGame() { using (var form = new FormSaveLoad(gameController)) if (form.ShowDialog() == DialogResult.OK && form.Result == MainMenuResult.LoadGame) { this.gameController.Stop(); var saveController = new SavesController(gameController, SettingsWinforms.Get.FileStorageRootPath); saveController.Load(form.SelectedGameData, LoadingMethods.GameDataSources()); this.gameController.Start(this); this.initPlayers(); this.restartRenderers(); //TODO(v0.8) render thread my try to draw old map before new one is available } }
//TODO(v0.6) expose NewGameController and perform this at caller //TODO(later) make option for shuffling players public void CreateGame(GameController gameController) { controller.ShufflePlayers(new Random()); gameController.CreateGame(controller, LoadingMethods.GameDataSources()); }