public void Create() { // Root の作成 Root root = new Root(); { root.LoadGames(); var pair = root.Pairs.Single(p => p.Loader.GameDirPath == _save.GamePath); int index; for (index = 0; index < root.Pairs.Count; index++) if (root.Pairs[index].Loader.GameDirPath == _save.GamePath) break; root.GameIndex = index; var loader = pair.Loader; { loader.LoadGame(); loader.LoadScenarios(); loader.LoadMasterData(); loader.LoadUnits(); } root.ScenarioIndex = _save.ScenarioNo - 1; } var creator = new NewGame(root); var manager = creator.Create(); _save.OverrideData(manager); var uiManager = new ReignWindowManager(manager, _owner); }
// ----- ----- ----- Method ----- ----- ----- public NewGame(Root root) { Contract.Requires(root != null, "root"); _root = root; var path = root.Pairs[root.GameIndex].Loader.GameDirPath; _loader = new ReignLoader(path, root.RootDir); _data = _loader.Load(); }
// ----- ----- ----- イベント用メソッド ----- ----- ----- private void btn_WorldMap_Click(object sender, EventArgs e) { // ユーザ選択の代わりに適当なデータを与えゲームを始める。 var root = new Root(); { root.LoadGames(); root.GameIndex = 0; var loader = root.Pairs[root.GameIndex].Loader; { loader.LoadGame(); loader.LoadScenarios(); loader.LoadMasterData(); loader.LoadUnits(); } root.ScenarioIndex = 1; root.SelectedMastersNo.Add(1); } ShowReignWindow(root); }
/// <summary> /// 戦略ウィンドウの表示 /// </summary> private void ShowReignWindow(Root root) { var creator = new Reign.NewGame(root); var manager = creator.Create(); var uiManager = new ReignWindowManager(manager, this); }