Esempio n. 1
0
    public void Start()
    {
        if (BattleMode == BattleModes.Auto)
        {
            if (academy.HasTrainingBrain)
            {
                battleMode = BattleModes.Training;
            }
            else if (academy.HasTrainedBrain && !academy.HasPlayerBrain)
            {
                battleMode = BattleModes.DataCollection;
            }
            else
            {
                battleMode = BattleModes.SingleBattle;
            }
        }

        queue    = new TurnQueue(this);
        nBattles = 0;
        foreach (DecisionLog log in decisionLogs)
        {
            log.ClearLog();
        }
        if (BattleMode != BattleModes.Training)
        {
            StartBattle();
        }
    }
        public override void LoadFromResponse(string apiname, dynamic data)
        {
            //base.LoadFromResponse( apiname, data );	//不要

            switch (apiname)
            {
            case "api_req_map/start":
            case "api_req_map/next":
                BattleDay   = null;
                BattleNight = null;
                Result      = null;
                BattleMode  = BattleModes.Undefined;
                Compass     = new CompassData();
                Compass.LoadFromResponse(apiname, data);
                break;

            case "api_req_sortie/battle":
                BattleMode = BattleModes.Normal;
                BattleDay  = new BattleNormalDay();
                BattleDay.LoadFromResponse(apiname, data);
                break;

            case "api_req_battle_midnight/battle":
                BattleNight = new BattleNormalNight();
                BattleNight.LoadFromResponse(apiname, data);
                break;

            case "api_req_battle_midnight/sp_midnight":
                BattleMode  = BattleModes.NightOnly;
                BattleNight = new BattleNightOnly();
                BattleNight.LoadFromResponse(apiname, data);
                break;

            case "api_req_combined_battle/battle":
                BattleMode = BattleModes.Normal | BattleModes.CombinedTaskForce;
                BattleDay  = new BattleCombinedNormalDay();
                BattleDay.LoadFromResponse(apiname, data);
                break;

            case "api_req_combined_battle/midnight_battle":
                BattleNight = new BattleCombinedNormalNight();
                BattleNight.LoadFromResponse(apiname, data);
                break;

            case "api_req_combined_battle/sp_midnight":
                BattleMode  = BattleModes.NightOnly | BattleModes.CombinedMask;
                BattleNight = new BattleCombinedNightOnly();
                BattleNight.LoadFromResponse(apiname, data);
                break;

            case "api_req_combined_battle/airbattle":
                BattleMode = BattleModes.AirBattle | BattleModes.CombinedTaskForce;
                BattleDay  = new BattleCombinedAirBattle();
                BattleDay.LoadFromResponse(apiname, data);
                break;

            case "api_req_combined_battle/battle_water":
                BattleMode = BattleModes.Normal | BattleModes.CombinedSurface;
                BattleDay  = new BattleCombinedWater();
                BattleDay.LoadFromResponse(apiname, data);
                break;

            case "api_req_practice/battle":
                BattleMode = BattleModes.Practice;
                BattleDay  = new BattlePracticeDay();
                BattleDay.LoadFromResponse(apiname, data);
                break;

            case "api_req_practice/midnight_battle":
                BattleNight = new BattlePracticeNight();
                BattleNight.LoadFromResponse(apiname, data);
                break;

            case "api_req_sortie/battleresult":
            case "api_req_combined_battle/battleresult":
            case "api_req_practice/battle_result":
                Result = new BattleResultData();
                Result.LoadFromResponse(apiname, data);
                BattleFinished();
                break;

            case "api_port/port":
                Compass     = null;
                BattleDay   = null;
                BattleNight = null;
                Result      = null;
                BattleMode  = BattleModes.Undefined;
                break;
            }
        }