示例#1
0
 public Situation(WarMap warMap, IList<WarSide> troops, WarUnitCollection units)
 {
     _map = warMap;
     Sides = troops;
     _units = units;
     _phaseManager = new PhaseManager();
     _turnManager = new TurnManager();
 }
示例#2
0
        public void Initialize()
        {
            // 戦争用データのロード
            var areaFileName = string.Format("BMap_NO{0}", _area.No);
            // TODO: 地形の読み込みは一回だけで良い
            var landformLoader = new LandformLoader(_gamePath);
            landformLoader.Load();
            var warMapLoader = new WarMapLoader(_gamePath);
            var warMap = warMapLoader.Load(areaFileName, 100, 200, 300,
                _conquerInfo.SelectToList(conquer => conquer.Item1));

            // キャラクタのロード
            var friends = new WarSide(true);
            var enemies = new WarSide(false);
            var units = new WarUnitCollection();

            //初期配置の時に必要になるので用意
            var friendUnits = new List<List<WarUnit>>();
            var enemyUnits = new List<WarUnit>();

            WarGlobal.UnitBuilder = new WarUnitBuilder(_gamePath, _units);

            // 味方軍
            foreach (var conquer in _conquerInfo)
            {
                friendUnits.Add(new List<WarUnit>());
                foreach (var unit in conquer.Item2)
                {
                    var warUnit = WarGlobal.UnitBuilder.Create(unit, friends, conquer.Item3);
                    units.AddUnit(warUnit);
                    friendUnits.Last().Add(warUnit);
                }
            }

            //敵軍
            foreach (var unit in _area.Units)
            {
                var warUnit = WarGlobal.UnitBuilder.Create(unit, enemies, _area);
                units.AddUnit(warUnit);
                enemyUnits.Add(warUnit);
            }

            // クラスの初期化
            var situation = new Situation(warMap, new[] { friends, enemies }, units);
            var model = new WarPresentationModel(situation);

            // ウィンドウの表示
            var mainWindow = new MainWindow();
            mainWindow.ShowMapWindow(situation, model);
            mainWindow.Show();

            //PhaseManager関連
            _phaseCreator.CreatePhase(model, friendUnits, enemyUnits, mainWindow);

            // 配置フェーズの開始
            situation.PhaseManager.StartPhase(situation, Phases.DeployUnitPhase);
        }