Esempio n. 1
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);
        }
Esempio n. 2
0
        public override void OnSuccess(WWWResult www)
        {
            if (this.Error())
            {
                return;
            }
            FlowNode_TowerStartQuest.Json_TowerStartQuest jsonTowerStartQuest = (FlowNode_TowerStartQuest.Json_TowerStartQuest)null;
            WebAPI.JSON_BodyResponse <FlowNode_TowerStartQuest.Json_TowerResume> jsonBodyResponse = (WebAPI.JSON_BodyResponse <FlowNode_TowerStartQuest.Json_TowerResume>)null;
            if (this.mResume)
            {
                jsonBodyResponse = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_TowerStartQuest.Json_TowerResume> >(www.text);
                if (jsonBodyResponse.body.pdeck != null)
                {
                    MonoSingleton <GameManager> .Instance.TowerResuponse.Deserialize(jsonBodyResponse.body.pdeck);
                }
                if (jsonBodyResponse.body.edeck != null)
                {
                    MonoSingleton <GameManager> .Instance.TowerResuponse.Deserialize(jsonBodyResponse.body.edeck);
                }
                jsonTowerStartQuest         = new FlowNode_TowerStartQuest.Json_TowerStartQuest();
                jsonTowerStartQuest.btlinfo = jsonBodyResponse.body.btlinfo;
                jsonTowerStartQuest.btlid   = jsonBodyResponse.body.btlid;
                MonoSingleton <GameManager> .Instance.TowerResuponse.round = jsonBodyResponse.body.round;
            }
            WebAPI.JSON_BodyResponse <FlowNode_TowerStartQuest.Json_TowerStartQuest> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_TowerStartQuest.Json_TowerStartQuest> >(www.text);
            if (jsonObject.body == null)
            {
                this.OnRetry();
            }
            else
            {
                if (jsonTowerStartQuest == null)
                {
                    jsonTowerStartQuest = jsonObject.body;
                }
                if (this.mResume && jsonBodyResponse == null)
                {
                    jsonTowerStartQuest.btlinfo = jsonBodyResponse.body.btlinfo;
                }
                Network.RemoveAPI();
                BattleCore.Json_Battle json = new BattleCore.Json_Battle();
                json.btlid   = jsonTowerStartQuest.btlid;
                json.btlinfo = (BattleCore.Json_BtlInfo)jsonTowerStartQuest.btlinfo;
                if (json.btlinfo != null)
                {
                    json.btlinfo.qid = jsonTowerStartQuest.btlinfo.floor_iname;
                }
                QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(json.btlinfo.qid);

                if (quest != null)
                {
                    if (jsonObject.body.missions != null)
                    {
                        for (int index = 0; index < jsonObject.body.missions.Length; ++index)
                        {
                            bool isClear = jsonObject.body.missions[index] == 1;
                            quest.SetMissionFlag(index, isClear);
                        }
                    }
                    if (jsonObject.body.missions_val != null)
                    {
                        for (int index = 0; index < jsonObject.body.missions_val.Length; ++index)
                        {
                            int num = jsonObject.body.missions_val[index];
                            quest.SetMissionValue(index, num);
                        }
                    }
                }
                this.StartCoroutine(this.StartScene(json));
            }
        }