Пример #1
0
        public override void OnSuccess(WWWResult www)
        {
            if (TowerErrorHandle.Error((FlowNode_Network)this))
            {
                return;
            }
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;

            WebAPI.JSON_BodyResponse <FlowNode_ReqTowerReset.Json_ReqTowerReset> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqTowerReset.Json_ReqTowerReset> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            Network.RemoveAPI();
            this.rtime = jsonObject.body.rtime;
            Json_PlayerData json = new Json_PlayerData();

            json.coin      = new Json_Coin();
            json.coin.free = jsonObject.body.coin.free;
            json.coin.paid = jsonObject.body.coin.paid;
            json.coin.com  = jsonObject.body.coin.com;
            this.round     = jsonObject.body.round;
            if (jsonObject.body.rank != null)
            {
                towerResuponse.speedRank = jsonObject.body.rank.spd_rank;
                towerResuponse.techRank  = jsonObject.body.rank.tec_rank;
                towerResuponse.spd_score = jsonObject.body.rank.spd_score;
                towerResuponse.tec_score = jsonObject.body.rank.tec_score;
                towerResuponse.ret_score = jsonObject.body.rank.ret_score;
                towerResuponse.rcv_score = jsonObject.body.rank.rcv_score;
            }
            MonoSingleton <GameManager> .Instance.Player.Deserialize(json, PlayerData.EDeserializeFlags.Coin);

            GameParameter.UpdateValuesOfType(GameParameter.ParameterTypes.GLOBAL_PLAYER_COIN);
            GlobalVars.SelectedQuestID = MonoSingleton <GameManager> .Instance.FindFirstTowerFloor(MonoSingleton <GameManager> .Instance.TowerResuponse.TowerID).iname;

            this.Success();
        }
Пример #2
0
        public override void OnSuccess(WWWResult www)
        {
            if (TowerErrorHandle.Error((FlowNode_Network)this))
            {
                return;
            }
            WebAPI.JSON_BodyResponse <FlowNode_ReqTowerRecover.JSON_ReqTowerRecoverResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqTowerRecover.JSON_ReqTowerRecoverResponse> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            Network.RemoveAPI();
            GameManager instance = MonoSingleton <GameManager> .Instance;

            try
            {
                instance.Deserialize(jsonObject.body.player);
                instance.TowerResuponse.Deserialize(jsonObject.body.pdeck);
                instance.TowerResuponse.rtime       = (long)jsonObject.body.rtime;
                instance.TowerResuponse.recover_num = jsonObject.body.rcv_num;
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return;
            }
            this.Success();
        }
Пример #3
0
        public bool Error()
        {
            if (!Network.IsError)
            {
                return(false);
            }
            if (Network.ErrCode == Network.EErrCode.NotExist_tower)
            {
                if (this.mResume)
                {
                    GlobalVars.BtlID.Set(this.btlID);
                    CriticalSection.Leave(CriticalSections.SceneChange);
                    Network.RequestResult = Network.RequestResults.Back;
                    if (Network.IsImmediateMode)
                    {
                        return(true);
                    }
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(7);
                    return(true);
                }
                this.OnFailed();
                return(true);
            }
            Network.EErrCode errCode = Network.ErrCode;
            switch (errCode)
            {
            case Network.EErrCode.UnSelectable:
                this.OnBack();
                return(true);

            case Network.EErrCode.OutOfDateQuest:
                this.OnBack();
                return(true);

            case Network.EErrCode.ChallengeLimit:
                this.OnBack();
                return(true);

            default:
                if (errCode != Network.EErrCode.QuestEnd)
                {
                    if (errCode != Network.EErrCode.NoBtlInfo)
                    {
                        return(TowerErrorHandle.Error((FlowNode_Network)this));
                    }
                    this.OnFailed();
                    return(true);
                }
                this.OnFailed();
                return(true);
            }
        }
Пример #4
0
 public override void OnSuccess(WWWResult www)
 {
     if (TowerErrorHandle.Error((FlowNode_Network)this))
     {
         return;
     }
     WebAPI.JSON_BodyResponse <JSON_ReqTowerResuponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <JSON_ReqTowerResuponse> >(www.text);
     DebugUtility.Assert(jsonObject != null, "res == null");
     Network.RemoveAPI();
     this.Deserialize(jsonObject.body);
     this.Success();
 }
Пример #5
0
        public override void OnSuccess(WWWResult www)
        {
            if (TowerErrorHandle.Error((FlowNode_Network)this))
            {
                return;
            }
            TowerResuponse towerResuponse = MonoSingleton <GameManager> .Instance.TowerResuponse;

            WebAPI.JSON_BodyResponse <ReqTowerRank.JSON_TowerRankResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqTowerRank.JSON_TowerRankResponse> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            Network.RemoveAPI();
            towerResuponse.Deserialize(jsonObject.body);
            this.Success();
        }
Пример #6
0
        public override void OnSuccess(WWWResult www)
        {
            if (TowerErrorHandle.Error((FlowNode_Network)this))
            {
                return;
            }
            WebAPI.JSON_BodyResponse <ReqTowerFloorMission.Json_Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqTowerFloorMission.Json_Response> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            Network.RemoveAPI();
            try
            {
                QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

                if (quest != null)
                {
                    ReqTowerFloorMission.Json_Response body = jsonObject.body;
                    for (int index = 0; index < quest.MissionNum; ++index)
                    {
                        quest.SetMissionFlag(index, false);
                        quest.SetMissionValue(index, 0);
                    }
                    if (body != null && body.missions != null)
                    {
                        for (int index = 0; index < body.missions.Length; ++index)
                        {
                            int  num     = body.missions_val[index];
                            bool isClear = body.missions[index] > 0;
                            quest.SetMissionFlag(index, isClear);
                            quest.SetMissionValue(index, num);
                        }
                    }
                }
                this.ActivateOutputLinks(100);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return;
            }
            ((Behaviour)this).set_enabled(false);
        }
        public override void OnSuccess(WWWResult www)
        {
            if (TowerErrorHandle.Error((FlowNode_Network)this))
            {
                return;
            }
            WebAPI.JSON_BodyResponse <ReqTowerFloorRanking.Json_Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqTowerFloorRanking.Json_Response> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            Network.RemoveAPI();
            try
            {
                MonoSingleton <GameManager> .Instance.TowerResuponse.OnFloorRanking(jsonObject.body);

                this.ActivateOutputLinks(100);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return;
            }
            ((Behaviour)this).set_enabled(false);
        }
        private void OnBtlComEnd(WWWResult www)
        {
            if (FlowNode_Network.HasCommonError(www) || GlobalVars.QuestType == QuestTypes.Tower && TowerErrorHandle.Error((FlowNode_Network)null))
            {
                return;
            }
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.QuestEnd:
                case Network.EErrCode.ColoNoBattle:
                    FlowNode_Network.Failed();
                    break;

                default:
                    FlowNode_Network.Retry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                if (jsonObject.body == null)
                {
                    FlowNode_Network.Retry();
                }
                else
                {
                    try
                    {
                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.units);

                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.items);

                        if (jsonObject.body.mails != null)
                        {
                            MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.mails);
                        }
                    }
                    catch (Exception ex)
                    {
                        DebugUtility.LogException(ex);
                        FlowNode_Network.Failed();
                        return;
                    }
                    Network.RemoveAPI();
                    this.LoadStartScene();
                }
            }
        }