public void OverrideData(ReignManager manager) { // 基本データのセット manager.SetData(_turn, _level, _league); manager.DiedProvCache.Clear(); // 勢力データの上書き foreach (var p in manager.AllProvince) _provs[p.No].OverrideData(p); // エリアデータの上書き foreach (var a in manager.WorldMap.Areas) _areas[a.No].OverrideData(a, manager.AllProvince, manager.UnitsData); // TurnQueue&LiveProvの上書き var provs = manager.AllProvince; var queue = manager.TurnQueue; queue.Clear(); foreach (var i in _turnQueue) queue.Enqueue(provs.Single(p => p.No == i)); var live = manager.LiveProvs; live.Clear(); foreach (var i in _liveProv) live.Add(provs.Single(p => p.No == i)); }
/// <summary> /// マネージャ作成 /// </summary> public ReignManager Create() { var uniques = new UniqueUnitCollection( _root.SelectedGame.Units, (id, units) => new Unit(units.Single(u => u.ID == id))); var provinces = CreateProvinces(uniques); var areas = CreateAreas(provinces); var map = new WorldMap(areas, _data.WorldMap); int level = _root.Level; int turn = _root.SelectedScenario.StartTurn; var gPath = _root.Pairs[_root.GameIndex].Loader.GameDirPath; var script = new ScriptLoader().Load( Path.Combine(gPath, Path.Combine("Data", "EventScript")), _root.SelectedGame.Units); var manager = new ReignManager(map, provinces, level, turn, _root.ScenarioIndex + 1) { UnitsData = _root.SelectedGame.Units, Script = script, Callable = _data.Callables, GamePath = gPath, }; SetLeague(manager.League); return manager; }
// ----- ----- ----- ----- ----- CTOR ----- ----- ----- ----- ----- public ProvinceInfo(Province prov, IList<Area> areas, ReignManager manager) { Contract.Requires(prov != null, "prov"); Contract.Requires(areas != null, "areas"); _prov = prov; foreach (var area in areas) { _nArea++; _income += area.Income; foreach (var unit in area.Units) { if (unit.IsMaster) _area = area; else if (unit.IsUnique) _nUnique++; _power += unit.Potential; } } _league = manager.League[_prov.No, manager.ActingProv.No]; }
Queue<int> _turnQueue; // 行動中のもつっこむこと #endregion Fields #region Constructors public Save(ReignManager manager) { _turnQueue = new Queue<int>(manager.TurnQueue.Select(p => p.No)); _liveProv = new List<int>(manager.LiveProvs.Select(p => p.No)); _turn = manager.Turn; _level = manager.Level; _scenario = manager.ScenarioNo; _league = manager.League; _gamepath = manager.GamePath; _areas = new List<Save.Area>(); foreach (var a in manager.WorldMap.Areas) { _areas.Extend(a.No + 1); _areas[a.No] = new Save.Area(a); } _provs = new List<Save.Province>(); foreach (var p in manager.AllProvince) { _provs.Extend(p.No + 1); _provs[p.No] = new Save.Province(p); } }