public PhaseCreator(Area battleArea, Province friendProvince, Action battleFinish) { _result = BattleResult.None; _battleArea = battleArea; _friendProvince = friendProvince; _battleFinish = battleFinish; }
// ----- ----- ----- ----- ----- 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]; }
/// <summary> /// ゲームを開始する /// コルーチンとして動作 /// </summary> public IEnumerable<Phase> Start() { while (true) { switch (this._turnPhase) { case Phase.TurnStart: this.ProvinceDieCheck(); TurnStartEvent(); _turnQueue.Clear(); foreach (var p in _liveProvs) _turnQueue.Enqueue(p); yield return Phase.TurnStart; this._turnPhase = Phase.PlayerTurn; goto case Phase.PlayerTurn; case Phase.PlayerTurn: if (_turnQueue.Count == 0) { this._turnPhase = Phase.TurnEnd; goto case Phase.TurnEnd; } this.ProvinceDieCheck(); _actingProvince = _turnQueue.Dequeue(); yield return Phase.PlayerTurn; _actingProvince = null; this._turnPhase = Phase.PlayerTurn; goto case Phase.PlayerTurn; case Phase.TurnEnd: TurnEndEvent(); if (this.WinGame()) yield return Phase.Win; if (!WatchingMode && !_liveProvs.Any(p => p.IsPlayer)) yield return Phase.GameOver; this._turnPhase = Phase.TurnStart; goto case Phase.TurnStart; } } }
public AutoDeployPhaseCreator(Area battleArea, Province friendProvince, Action battleFinish) : base(battleArea, friendProvince, battleFinish) { }
/// <summary> /// 全ての勢力を作成 /// </summary> private List<Province> CreateProvinces(IUniqueUnitCollection uniques) { var list = new List<Province>(); var masters = _root.SelectedGame.MastersData.Masters; var units = _root.SelectedGame.Units; var player = _root.SelectedMastersNo; list.Add(new Province(0, "", _data.WorldMap.NewtralFlagImage)); var provs = from d in masters join u in units on d.ID equals u.ID let isPlayer = player.Contains(d.No) select new { No = d.No, Name = d.Name, Unit = u, IsPlayer = isPlayer}; foreach (var p in provs) { var po = new Province(p.No, p.Name, p.Unit) { IsPlayer = p.IsPlayer, Money = 50 }; list.Add(po); } return list; }