Exemple #1
0
		private void Updated(string apiname, dynamic data)
		{

			KCDatabase db = KCDatabase.Instance;
			BattleManager bm = db.Battle;
			bool hideDuringBattle = Utility.Configuration.Config.FormBattle.HideDuringBattle;

			BaseLayoutPanel.SuspendLayout();
			TableTop.SuspendLayout();
			TableBottom.SuspendLayout();
			switch (apiname)
			{

				case "api_port/port":
					BaseLayoutPanel.Visible = false;
					ToolTipInfo.RemoveAll();
					break;

				case "api_req_map/start":
				case "api_req_map/next":
					if (!bm.Compass.HasAirRaid)
						goto case "api_port/port";

					SetFormation(bm);
					ClearSearchingResult();
					ClearBaseAirAttack();
					SetAerialWarfare(null, ((BattleBaseAirRaid)bm.BattleDay).BaseAirRaid);
					SetHPBar(bm.BattleDay);
					SetDamageRate(bm);

					BaseLayoutPanel.Visible = !hideDuringBattle;
					break;


				case "api_req_sortie/battle":
				case "api_req_practice/battle":
				case "api_req_sortie/ld_airbattle":
				case "api_req_sortie/ld_shooting":
					{

						SetFormation(bm);
						SetSearchingResult(bm.BattleDay);
						SetBaseAirAttack(bm.BattleDay.BaseAirAttack);
						SetAerialWarfare(bm.BattleDay.JetAirBattle, bm.BattleDay.AirBattle);
						SetHPBar(bm.BattleDay);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_battle_midnight/battle":
				case "api_req_practice/midnight_battle":
					{

						SetNightBattleEvent(bm.BattleNight.NightInitial);
						SetHPBar(bm.BattleNight);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_battle_midnight/sp_midnight":
					{

						SetFormation(bm);
						ClearBaseAirAttack();
						ClearAerialWarfare();
						ClearSearchingResult();
						SetNightBattleEvent(bm.BattleNight.NightInitial);
						SetHPBar(bm.BattleNight);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_sortie/airbattle":
					{

						SetFormation(bm);
						SetSearchingResult(bm.BattleDay);
						SetBaseAirAttack(bm.BattleDay.BaseAirAttack);
						SetAerialWarfare(bm.BattleDay.JetAirBattle, bm.BattleDay.AirBattle, ((BattleAirBattle)bm.BattleDay).AirBattle2);
						SetHPBar(bm.BattleDay);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_sortie/night_to_day":
					{
						// 暫定
						var battle = bm.BattleNight as BattleDayFromNight;

						SetFormation(bm);
						ClearAerialWarfare();
						ClearSearchingResult();
						ClearBaseAirAttack();
						SetNightBattleEvent(battle.NightInitial);

						if (battle.NextToDay)
						{
							SetSearchingResult(battle);
							SetBaseAirAttack(battle.BaseAirAttack);
							SetAerialWarfare(battle.JetAirBattle, battle.AirBattle);
						}

						SetHPBar(bm.BattleDay);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_combined_battle/battle":
				case "api_req_combined_battle/battle_water":
				case "api_req_combined_battle/ld_airbattle":
				case "api_req_combined_battle/ec_battle":
				case "api_req_combined_battle/each_battle":
				case "api_req_combined_battle/each_battle_water":
				case "api_req_combined_battle/ld_shooting":
					{

						SetFormation(bm);
						SetSearchingResult(bm.BattleDay);
						SetBaseAirAttack(bm.BattleDay.BaseAirAttack);
						SetAerialWarfare(bm.BattleDay.JetAirBattle, bm.BattleDay.AirBattle);
						SetHPBar(bm.BattleDay);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_combined_battle/airbattle":
					{

						SetFormation(bm);
						SetSearchingResult(bm.BattleDay);
						SetBaseAirAttack(bm.BattleDay.BaseAirAttack);
						SetAerialWarfare(bm.BattleDay.JetAirBattle, bm.BattleDay.AirBattle, ((BattleCombinedAirBattle)bm.BattleDay).AirBattle2);
						SetHPBar(bm.BattleDay);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_combined_battle/midnight_battle":
				case "api_req_combined_battle/ec_midnight_battle":
					{

						SetNightBattleEvent(bm.BattleNight.NightInitial);
						SetHPBar(bm.BattleNight);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_combined_battle/sp_midnight":
					{

						SetFormation(bm);
						ClearAerialWarfare();
						ClearSearchingResult();
						ClearBaseAirAttack();
						SetNightBattleEvent(bm.BattleNight.NightInitial);
						SetHPBar(bm.BattleNight);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_combined_battle/ec_night_to_day":
					{
						var battle = bm.BattleNight as BattleDayFromNight;

						SetFormation(bm);
						ClearAerialWarfare();
						ClearSearchingResult();
						ClearBaseAirAttack();
						SetNightBattleEvent(battle.NightInitial);

						if (battle.NextToDay)
						{
							SetSearchingResult(battle);
							SetBaseAirAttack(battle.BaseAirAttack);
							SetAerialWarfare(battle.JetAirBattle, battle.AirBattle);
						}

						SetHPBar(battle);
						SetDamageRate(bm);

						BaseLayoutPanel.Visible = !hideDuringBattle;
					}
					break;

				case "api_req_sortie/battleresult":
				case "api_req_combined_battle/battleresult":
				case "api_req_practice/battle_result":
					{

						SetMVPShip(bm);

						BaseLayoutPanel.Visible = true;
					}
					break;

			}

			TableTop.ResumeLayout();
			TableBottom.ResumeLayout();

			BaseLayoutPanel.ResumeLayout();


			if (Utility.Configuration.Config.UI.IsLayoutFixed)
				TableTop.Width = TableTop.GetPreferredSize(BaseLayoutPanel.Size).Width;
			else
				TableTop.Width = TableBottom.ClientSize.Width;
			TableTop.Height = TableTop.GetPreferredSize(BaseLayoutPanel.Size).Height;

		}
        private void Updated(string apiname, dynamic data)
        {
            KCDatabase    db = KCDatabase.Instance;
            BattleManager bm = db.Battle;

            BaseLayoutPanel.SuspendLayout();
            TableTop.SuspendLayout();
            TableBottom.SuspendLayout();
            switch (apiname)
            {
            case "api_req_map/start":
            case "api_req_map/next":
            case "api_port/port":
                BaseLayoutPanel.Visible = false;
                ToolTipInfo.RemoveAll();
                break;


            case "api_req_sortie/battle":
            case "api_req_practice/battle": {
                int[] hp = bm.BattleDay.EmulateBattle();

                SetFormation(bm.BattleDay);
                SetSearchingResult(bm.BattleDay);
                SetAerialWarfare(bm.BattleDay);
                SetHPNormal(hp, bm.BattleDay);
                SetDamageRateNormal(hp, bm.BattleDay);

                BaseLayoutPanel.Visible = true;
            } break;

            case "api_req_battle_midnight/battle":
            case "api_req_practice/midnight_battle": {
                int[] hp = bm.BattleNight.EmulateBattle();

                SetNightBattleEvent(hp, false, bm.BattleNight);
                SetHPNormal(hp, bm.BattleNight);
                SetDamageRateNormal(hp, bm.BattleDay);

                BaseLayoutPanel.Visible = true;
            } break;

            case "api_req_battle_midnight/sp_midnight": {
                int[] hp = bm.BattleNight.EmulateBattle();

                SetFormation(bm.BattleNight);
                ClearAerialWarfare();
                ClearSearchingResult();
                SetNightBattleEvent(hp, false, bm.BattleNight);
                SetHPNormal(hp, bm.BattleNight);
                SetDamageRateNormal(hp, bm.BattleNight);

                BaseLayoutPanel.Visible = true;
            } break;

            case "api_req_combined_battle/battle":
            case "api_req_combined_battle/battle_water": {
                int[] hp = bm.BattleDay.EmulateBattle();

                SetFormation(bm.BattleDay);
                SetSearchingResult(bm.BattleDay);
                SetAerialWarfare(bm.BattleDay);
                SetHPCombined(hp, bm.BattleDay);
                SetDamageRateCombined(hp, bm.BattleDay);

                BaseLayoutPanel.Visible = true;
            } break;

            case "api_req_combined_battle/airbattle": {
                int[] hp = bm.BattleDay.EmulateBattle();

                SetFormation(bm.BattleDay);
                SetSearchingResult(bm.BattleDay);
                SetAerialWarfareAirBattle(bm.BattleDay);
                SetHPCombined(hp, bm.BattleDay);
                SetDamageRateCombined(hp, bm.BattleDay);

                BaseLayoutPanel.Visible = true;
            } break;

            case "api_req_combined_battle/midnight_battle": {
                int[] hp = bm.BattleNight.EmulateBattle();

                SetNightBattleEvent(hp, true, bm.BattleNight);
                SetHPCombined(hp, bm.BattleNight);
                SetDamageRateCombined(hp, bm.BattleDay);

                BaseLayoutPanel.Visible = true;
            } break;

            case "api_req_combined_battle/sp_midnight": {
                int[] hp = bm.BattleNight.EmulateBattle();

                SetFormation(bm.BattleNight);
                ClearAerialWarfare();
                ClearSearchingResult();
                SetNightBattleEvent(hp, true, bm.BattleNight);
                SetHPCombined(hp, bm.BattleNight);
                SetDamageRateCombined(hp, bm.BattleNight);

                BaseLayoutPanel.Visible = true;
            } break;
            }
            TableTop.ResumeLayout();
            TableBottom.ResumeLayout();
            BaseLayoutPanel.ResumeLayout();
        }