コード例 #1
0
 private void Deserialize(JSON_ReqTowerResuponse json)
 {
     if (json == null)
     {
         return;
     }
     MonoSingleton <GameManager> .Instance.Deserialize(json);
 }
コード例 #2
0
ファイル: TowerResuponse.cs プロジェクト: zunaalabaya/TAC-BOT
        public void Deserialize(JSON_ReqTowerResuponse res)
        {
            if (res == null)
            {
                return;
            }
            this.TowerID = GlobalVars.SelectedTowerID;
            this.rtime   = res.rtime;
            if (res.stats != null)
            {
                this.Deserialize(res.stats);
            }
            else
            {
                TowerFloorParam firstTowerFloor = MonoSingleton <GameManager> .Instance.FindFirstTowerFloor(this.TowerID);

                if (firstTowerFloor != null)
                {
                    this.Deserialize(new JSON_ReqTowerResuponse.Json_TowerStatus()
                    {
                        fname       = firstTowerFloor.iname,
                        questStates = QuestStates.New
                    });
                }
            }
            if (res.pdeck != null)
            {
                this.pdeck = new List <TowerResuponse.PlayerUnit>();
                for (int index = 0; index < res.pdeck.Length; ++index)
                {
                    this.pdeck.Add(new TowerResuponse.PlayerUnit());
                    this.pdeck[index].dmg      = res.pdeck[index].damage;
                    this.pdeck[index].unitname = res.pdeck[index].uname;
                    this.pdeck[index].is_died  = res.pdeck[index].is_died;
                }
            }
            this.reset_cost = res.reset_cost;
            this.round      = res.round;
            this.is_reset   = res.is_reset == (byte)1;
            if (res.lot_enemies != null && res.lot_enemies.Length > 0)
            {
                this.lot_enemies = new RandDeckResult[res.lot_enemies.Length];
                for (int index = 0; index < res.lot_enemies.Length; ++index)
                {
                    this.lot_enemies[index] = new RandDeckResult()
                    {
                        id     = res.lot_enemies[index].id,
                        set_id = res.lot_enemies[index].set_id
                    }
                }
                ;
            }
            this.Deserialize(res.edeck);
            this.Deserialize(res.rank);
            this.UpdateCurrentFloor();
        }
コード例 #3
0
        private void Success()
        {
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;

            ((Behaviour)this).set_enabled(false);
            JSON_ReqTowerResuponse json = new JSON_ReqTowerResuponse();

            json.is_reset = (byte)0;
            json.round    = this.round;
            json.rank     = new JSON_ReqTowerResuponse.Json_RankStatus();
            if (json.rank != null)
            {
                json.rank.spd_rank  = towerResuponse.speedRank;
                json.rank.tec_rank  = towerResuponse.techRank;
                json.rank.spd_score = towerResuponse.spd_score;
                json.rank.tec_score = towerResuponse.tec_score;
                json.rank.ret_score = towerResuponse.ret_score;
                json.rank.rcv_score = towerResuponse.rcv_score;
            }
            MonoSingleton <GameManager> .Instance.Deserialize(json);

            MonoSingleton <GameManager> .Instance.TowerResuponse.rtime = this.rtime;
            this.ActivateOutputLinks(1);
        }
コード例 #4
0
        public void Deserialize(JSON_ReqTowerResuponse res)
        {
            if (res == null)
            {
                return;
            }
            this.TowerID = GlobalVars.SelectedTowerID;
            this.rtime   = res.rtime;
            if (res.stats != null)
            {
                this.Deserialize(res.stats);
            }
            else
            {
                TowerFloorParam firstTowerFloor = MonoSingleton <GameManager> .Instance.FindFirstTowerFloor(this.TowerID);

                if (firstTowerFloor != null)
                {
                    this.Deserialize(new JSON_ReqTowerResuponse.Json_TowerStatus()
                    {
                        fname       = firstTowerFloor.iname,
                        questStates = QuestStates.New
                    });
                }
            }
            if (res.pdeck != null)
            {
                this.pdeck = new List <TowerResuponse.PlayerUnit>();
                for (int index = 0; index < res.pdeck.Length; ++index)
                {
                    this.pdeck.Add(new TowerResuponse.PlayerUnit());
                    this.pdeck[index].dmg      = res.pdeck[index].damage;
                    this.pdeck[index].unitname = res.pdeck[index].uname;
                    this.pdeck[index].is_died  = res.pdeck[index].is_died;
                }
            }
            this.reset_cost = res.reset_cost;
            this.round      = res.round;
            this.is_reset   = (int)res.is_reset == 1;
            if (res.lot_enemies != null)
            {
                this.lot_enemies = new byte[res.lot_enemies.Length];
                for (int index = 0; index < res.lot_enemies.Length; ++index)
                {
                    this.lot_enemies[index] = (byte)res.lot_enemies[index];
                }
            }
            this.Deserialize(res.edeck);
            if (res.rank != null)
            {
                this.turn_num    = res.rank.turn_num;
                this.died_num    = res.rank.died_num;
                this.retire_num  = res.rank.retire_num;
                this.recover_num = res.rank.recovery_num;
                this.speedRank   = res.rank.spd_rank;
                this.techRank    = res.rank.tec_rank;
                this.spd_score   = res.rank.spd_score;
                this.tec_score   = res.rank.tec_score;
                this.ret_score   = res.rank.ret_score;
                this.rcv_score   = res.rank.rcv_score;
            }
            this.UpdateCurrentFloor();
        }