Esempio n. 1
0
 public CmdActionPhaseModel(FromMiddleBattleDayData data, Dictionary <int, ShipModel_BattleAll> ships)
 {
     if (data.Production != null)
     {
         _eff = new __EffectModel__(data.Production);
     }
     if (data.F_BattleData != null)
     {
         if (data.F_BattleData.FmtType == 1)
         {
             HougekiDayBattleFmt hougekiDayBattleFmt = data.F_BattleData as HougekiDayBattleFmt;
             _data_f = new HougekiListModel(hougekiDayBattleFmt.AttackData, ships);
         }
         else if (data.F_BattleData.FmtType == 2)
         {
             Raigeki      data2        = data.F_BattleData as Raigeki;
             RaigekiModel raigekiModel = new RaigekiModel(data2, ships);
             if (raigekiModel.Count_f > 0 || raigekiModel.Count_e > 0)
             {
                 _data_f = raigekiModel;
             }
         }
     }
     if (data.E_BattleData == null)
     {
         return;
     }
     if (data.E_BattleData.FmtType == 1)
     {
         HougekiDayBattleFmt hougekiDayBattleFmt2 = data.E_BattleData as HougekiDayBattleFmt;
         _data_e = new HougekiListModel(hougekiDayBattleFmt2.AttackData, ships);
     }
     else if (data.E_BattleData.FmtType == 2)
     {
         Raigeki      data3         = data.E_BattleData as Raigeki;
         RaigekiModel raigekiModel2 = new RaigekiModel(data3, ships);
         if (raigekiModel2.Count_f > 0 || raigekiModel2.Count_e > 0)
         {
             _data_e = raigekiModel2;
         }
     }
 }
 public void __createCacheDataAfterCommand__()
 {
     if (this._phase != CombatPhase.DAY)
     {
         return;
     }
     if (!this.IsTakeCommand())
     {
         return;
     }
     this._cache_opening_effect = null;
     if (this._battleData.DayBattle.OpeningProduction != null)
     {
         this._cache_opening_effect = new __EffectModel__(this._battleData.DayBattle.OpeningProduction);
     }
     this._cache_kouku = null;
     if (this._battleData.DayBattle.AirBattle != null)
     {
         int count  = this._battleData.DayBattle.AirBattle.F_PlaneFrom.get_Count();
         int count2 = this._battleData.DayBattle.AirBattle.E_PlaneFrom.get_Count();
         if (count > 0 || count2 > 0)
         {
             this._cache_kouku = new KoukuuModel(this._ships_f, this._ships_e, this._battleData.DayBattle.AirBattle);
         }
     }
     this._cache_shien = null;
     if (this._battleData.DayBattle.SupportAtack != null)
     {
         SupportAtack       supportAtack = this._battleData.DayBattle.SupportAtack;
         int                deck_Id      = supportAtack.Deck_Id;
         DeckModel          deck         = base.UserInfo.GetDeck(deck_Id);
         BattleSupportKinds supportType  = supportAtack.SupportType;
         if (supportType == BattleSupportKinds.AirAtack)
         {
             this._cache_shien = new ShienModel_Air(deck, this._ships_f, this._ships_e, supportAtack);
         }
         else if (supportType == BattleSupportKinds.Hougeki)
         {
             this._cache_shien = new ShienModel_Hou(deck, this._ships_f, this._ships_e, supportAtack);
         }
         else if (supportType == BattleSupportKinds.Raigeki)
         {
             this._cache_shien = new ShienModel_Rai(deck, this._ships_f, this._ships_e, supportAtack);
         }
     }
     this._cache_kaimaku = null;
     if (this._battleData.DayBattle.OpeningAtack != null)
     {
         this._cache_kaimaku = new RaigekiModel(this._ships_f, this._ships_e, this._battleData.DayBattle.OpeningAtack);
         if (this._cache_kaimaku.Count_f == 0 && this._cache_kaimaku.Count_e == 0)
         {
             this._cache_kaimaku = null;
         }
     }
     this._cache_cmd_actions = null;
     if (this._battleData.DayBattle.FromMiddleDayBattle != null)
     {
         this._cache_cmd_actions = new List <CmdActionPhaseModel>();
         Dictionary <int, ShipModel_BattleAll> ships = this._GetShipsDic();
         for (int i = 0; i < this._battleData.DayBattle.FromMiddleDayBattle.get_Count(); i++)
         {
             FromMiddleBattleDayData data = this._battleData.DayBattle.FromMiddleDayBattle.get_Item(i);
             CmdActionPhaseModel     cmdActionPhaseModel = new CmdActionPhaseModel(data, ships);
             this._cache_cmd_actions.Add(cmdActionPhaseModel);
         }
         if (this._cache_cmd_actions.TrueForAll((CmdActionPhaseModel model) => model == null || !model.HasAction()))
         {
             this._cache_cmd_actions = null;
         }
         else if (this._cache_cmd_actions.get_Count() == 0)
         {
             this._cache_cmd_actions = null;
         }
     }
     this._cache_raigeki = null;
     if (this._battleData.DayBattle.Raigeki != null)
     {
         this._cache_raigeki = new RaigekiModel(this._ships_f, this._ships_e, this._battleData.DayBattle.Raigeki);
         if (this._cache_raigeki.Count_f == 0 && this._cache_raigeki.Count_e == 0)
         {
             this._cache_raigeki = null;
         }
     }
     this._cache_kouku2 = null;
     if (this._battleData.DayBattle.AirBattle2 != null)
     {
         int count3 = this._battleData.DayBattle.AirBattle2.F_PlaneFrom.get_Count();
         int count4 = this._battleData.DayBattle.AirBattle2.E_PlaneFrom.get_Count();
         if (count3 > 0 || count4 > 0)
         {
             this._cache_kouku2 = new KoukuuModel(this._ships_f, this._ships_e, this._battleData.DayBattle.AirBattle2);
         }
     }
     if (this._cache_opening_effect != null)
     {
         ShipModel_Battle nextActionShip = this._GetFirstActionShip(0);
         ((__EffectModel__)this._cache_opening_effect).SetNextActionShip(nextActionShip);
     }
     if (this._cache_cmd_actions != null)
     {
         for (int j = 0; j < this._cache_cmd_actions.get_Count(); j++)
         {
             CmdActionPhaseModel cmdActionPhaseModel2 = this._cache_cmd_actions.get_Item(j);
             if (cmdActionPhaseModel2 != null && cmdActionPhaseModel2.Effect != null)
             {
                 ShipModel_Battle nextActionShip = this._GetFirstActionShip(j + 1);
                 ((__EffectModel__)cmdActionPhaseModel2.Effect).SetNextActionShip(nextActionShip);
             }
         }
     }
 }
Esempio n. 3
0
        public void __createCacheDataAfterCommand__()
        {
            if (_phase != 0 || !IsTakeCommand())
            {
                return;
            }
            _cache_opening_effect = null;
            if (_battleData.DayBattle.OpeningProduction != null)
            {
                _cache_opening_effect = new __EffectModel__(_battleData.DayBattle.OpeningProduction);
            }
            _cache_kouku = null;
            if (_battleData.DayBattle.AirBattle != null)
            {
                int count  = _battleData.DayBattle.AirBattle.F_PlaneFrom.Count;
                int count2 = _battleData.DayBattle.AirBattle.E_PlaneFrom.Count;
                if (count > 0 || count2 > 0)
                {
                    _cache_kouku = new KoukuuModel(_ships_f, _ships_e, _battleData.DayBattle.AirBattle);
                }
            }
            _cache_shien = null;
            if (_battleData.DayBattle.SupportAtack != null)
            {
                SupportAtack supportAtack = _battleData.DayBattle.SupportAtack;
                int          deck_Id      = supportAtack.Deck_Id;
                DeckModel    deck         = base.UserInfo.GetDeck(deck_Id);
                switch (supportAtack.SupportType)
                {
                case BattleSupportKinds.AirAtack:
                    _cache_shien = new ShienModel_Air(deck, _ships_f, _ships_e, supportAtack);
                    break;

                case BattleSupportKinds.Hougeki:
                    _cache_shien = new ShienModel_Hou(deck, _ships_f, _ships_e, supportAtack);
                    break;

                case BattleSupportKinds.Raigeki:
                    _cache_shien = new ShienModel_Rai(deck, _ships_f, _ships_e, supportAtack);
                    break;
                }
            }
            _cache_kaimaku = null;
            if (_battleData.DayBattle.OpeningAtack != null)
            {
                _cache_kaimaku = new RaigekiModel(_ships_f, _ships_e, _battleData.DayBattle.OpeningAtack);
                if (_cache_kaimaku.Count_f == 0 && _cache_kaimaku.Count_e == 0)
                {
                    _cache_kaimaku = null;
                }
            }
            _cache_cmd_actions = null;
            if (_battleData.DayBattle.FromMiddleDayBattle != null)
            {
                _cache_cmd_actions = new List <CmdActionPhaseModel>();
                Dictionary <int, ShipModel_BattleAll> ships = _GetShipsDic();
                for (int i = 0; i < _battleData.DayBattle.FromMiddleDayBattle.Count; i++)
                {
                    FromMiddleBattleDayData data = _battleData.DayBattle.FromMiddleDayBattle[i];
                    CmdActionPhaseModel     item = new CmdActionPhaseModel(data, ships);
                    _cache_cmd_actions.Add(item);
                }
                if (_cache_cmd_actions.TrueForAll((CmdActionPhaseModel model) => model == null || !model.HasAction()))
                {
                    _cache_cmd_actions = null;
                }
                else if (_cache_cmd_actions.Count == 0)
                {
                    _cache_cmd_actions = null;
                }
            }
            _cache_raigeki = null;
            if (_battleData.DayBattle.Raigeki != null)
            {
                _cache_raigeki = new RaigekiModel(_ships_f, _ships_e, _battleData.DayBattle.Raigeki);
                if (_cache_raigeki.Count_f == 0 && _cache_raigeki.Count_e == 0)
                {
                    _cache_raigeki = null;
                }
            }
            _cache_kouku2 = null;
            if (_battleData.DayBattle.AirBattle2 != null)
            {
                int count3 = _battleData.DayBattle.AirBattle2.F_PlaneFrom.Count;
                int count4 = _battleData.DayBattle.AirBattle2.E_PlaneFrom.Count;
                if (count3 > 0 || count4 > 0)
                {
                    _cache_kouku2 = new KoukuuModel(_ships_f, _ships_e, _battleData.DayBattle.AirBattle2);
                }
            }
            if (_cache_opening_effect != null)
            {
                ShipModel_Battle nextActionShip = _GetFirstActionShip(0);
                ((__EffectModel__)_cache_opening_effect).SetNextActionShip(nextActionShip);
            }
            if (_cache_cmd_actions == null)
            {
                return;
            }
            for (int j = 0; j < _cache_cmd_actions.Count; j++)
            {
                CmdActionPhaseModel cmdActionPhaseModel = _cache_cmd_actions[j];
                if (cmdActionPhaseModel != null && cmdActionPhaseModel.Effect != null)
                {
                    ShipModel_Battle nextActionShip = _GetFirstActionShip(j + 1);
                    ((__EffectModel__)cmdActionPhaseModel.Effect).SetNextActionShip(nextActionShip);
                }
            }
        }