Esempio n. 1
0
 public WarInitializer(IList<UnitData> unitDatas,
     Area area, IList<Tuple<int, IList<Unit>, Area>> conquerInfo,
     PhaseCreator phaseCreator, string gamepath)
 {
     _units = unitDatas;
     _area = area;
     _conquerInfo = conquerInfo;
     _conquerInfo.OrderBy(conquer => conquer.Item1);
     _phaseCreator = phaseCreator;
     _gamePath = gamepath;
 }
        private void btn_Finish_Click(object sender, EventArgs e)
        {
            if (_battler.Count == 0)
            {
                MessageBox.Show("部隊が一つも選択されていません");
                return;
            }
            // 呼び出しようのデータ作成
            var area = TargetArea;
            var conquerList = new List<Tuple<int, IList<Unit>, Area>>();
            for (int i = 0; i < area.Adjacent.Count; i++)
            {
                var adj = area.Adjacent[i];
                var list = adj.Units
                    .Where(u => _battler.Contains(u))
                    .ToList();
                if (list.Count > 0)
                    conquerList.Add(new Tuple<int, IList<Unit>, Area>(i, list, adj));
            }

            var owner = this.Owner;
            this.Close();
            RWManager.AreaInfoWindow.Visible = false;
            RWManager.MasterWindow.Visible = false;
            owner.Visible = false;

            //TODO: 戦闘終了時に実行するデリゲートの作成。今は全体を終了させている
            var phaseCreator = new PhaseCreator(area, AdjArea[0].Province, delegate {

                owner.Visible = true;
                RWManager.MasterWindow.Visible = true;
                RWManager.AreaInfoWindow.Visible = true;
                RWManager.AreaInfoWindow.ResetUnit();
            });
            new War.WarInitializer(RManager.UnitsData, area, conquerList, phaseCreator, RManager.GamePath).Initialize();
        }