private void ResponseCallback(WWWResult www)
        {
            if (FlowNode_Network.HasCommonError(www))
            {
                return;
            }
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                switch (errCode)
                {
                case Network.EErrCode.MultiMaintenance:
                case Network.EErrCode.VsMaintenance:
                case Network.EErrCode.MultiVersionMaintenance:
                case Network.EErrCode.MultiTowerMaintenance:
                    Network.RemoveAPI();
                    ((Behaviour)this).set_enabled(false);
                    break;

                default:
                    if (errCode != Network.EErrCode.OutOfDateQuest)
                    {
                        if (errCode == Network.EErrCode.MultiVersionMismatch || errCode == Network.EErrCode.VS_Version)
                        {
                            Network.RemoveAPI();
                            Network.ResetError();
                            ((Behaviour)this).set_enabled(false);
                            break;
                        }
                        FlowNode_Network.Retry();
                        break;
                    }
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    break;
                }
            }
            else
            {
                if (this.mAPIType == RankMatchMissionWindow.APIType.MISSION)
                {
                    Dictionary <string, ReqRankMatchMission.MissionProgress> mission_progs    = new Dictionary <string, ReqRankMatchMission.MissionProgress>();
                    WebAPI.JSON_BodyResponse <ReqRankMatchMission.Response>  jsonBodyResponse = (WebAPI.JSON_BodyResponse <ReqRankMatchMission.Response>)JsonUtility.FromJson <WebAPI.JSON_BodyResponse <ReqRankMatchMission.Response> >(www.text);
                    DebugUtility.Assert(jsonBodyResponse != null, "res == null");
                    if (jsonBodyResponse.body != null && jsonBodyResponse.body.missionprogs != null)
                    {
                        PlayerData player = MonoSingleton <GameManager> .Instance.Player;
                        player.RankMatchMissionState.Clear();
                        foreach (ReqRankMatchMission.MissionProgress missionprog in jsonBodyResponse.body.missionprogs)
                        {
                            RankMatchMissionState matchMissionState = new RankMatchMissionState();
                            matchMissionState.Deserialize(missionprog.iname, missionprog.prog, missionprog.rewarded_at);
                            player.RankMatchMissionState.Add(matchMissionState);
                            mission_progs.Add(missionprog.iname, missionprog);
                        }
                    }
                    GameManager instance = MonoSingleton <GameManager> .Instance;
                    List <VersusRankMissionParam> versusRankMissionList = instance.GetVersusRankMissionList(instance.RankMatchScheduleId);
                    versusRankMissionList.Sort((Comparison <VersusRankMissionParam>)((m1, m2) =>
                    {
                        int num1 = 0;
                        int num2 = 0;
                        if (mission_progs.ContainsKey(m1.IName))
                        {
                            if (string.IsNullOrEmpty(mission_progs[m1.IName].rewarded_at))
                            {
                                if (mission_progs[m1.IName].prog >= m1.IVal)
                                {
                                    num1 = 1;
                                }
                            }
                            else
                            {
                                num1 = -1;
                            }
                        }
                        if (mission_progs.ContainsKey(m2.IName))
                        {
                            if (string.IsNullOrEmpty(mission_progs[m2.IName].rewarded_at))
                            {
                                if (mission_progs[m2.IName].prog >= m2.IVal)
                                {
                                    num2 = 1;
                                }
                            }
                            else
                            {
                                num2 = -1;
                            }
                        }
                        if (num1 != num2)
                        {
                            return(num2 - num1);
                        }
                        return(m1.IName.CompareTo(m2.IName));
                    }));
                    for (int index = 0; index < versusRankMissionList.Count; ++index)
                    {
                        VersusRankMissionParam data = versusRankMissionList[index];
                        if (!mission_progs.ContainsKey(data.IName) || string.IsNullOrEmpty(mission_progs[data.IName].rewarded_at))
                        {
                            RankMatchMissionItem matchMissionItem = (RankMatchMissionItem)UnityEngine.Object.Instantiate <RankMatchMissionItem>((M0)this.ListItem);
                            DataSource.Bind <VersusRankMissionParam>(((Component)matchMissionItem).get_gameObject(), data);
                            if (mission_progs.ContainsKey(data.IName))
                            {
                                DataSource.Bind <ReqRankMatchMission.MissionProgress>(((Component)matchMissionItem).get_gameObject(), mission_progs[data.IName]);
                            }
                            this.AddItem((ListItemEvents)matchMissionItem);
                            ((Component)matchMissionItem).get_transform().SetParent(((Component)this).get_transform(), false);
                            ((Component)matchMissionItem).get_gameObject().SetActive(true);
                            matchMissionItem.Initialize(this);
                        }
                    }
                }
                else if (this.mAPIType == RankMatchMissionWindow.APIType.MISSION_EXEC)
                {
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 10);
                }
                Network.RemoveAPI();
            }
        }
示例#2
0
        public override void OnSuccess(WWWResult www)
        {
            DebugUtility.Log(nameof(OnSuccess));
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.MultiMaintenance:
                case Network.EErrCode.VsMaintenance:
                case Network.EErrCode.MultiVersionMaintenance:
                case Network.EErrCode.MultiTowerMaintenance:
                    Network.RemoveAPI();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(6000);
                    break;

                case Network.EErrCode.OutOfDateQuest:
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(4802);
                    break;

                case Network.EErrCode.MultiVersionMismatch:
                case Network.EErrCode.VS_Version:
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(5000);
                    break;

                default:
                    this.OnFailed();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <ReqRankMatchMission.Response> jsonBodyResponse = (WebAPI.JSON_BodyResponse <ReqRankMatchMission.Response>)JsonUtility.FromJson <WebAPI.JSON_BodyResponse <ReqRankMatchMission.Response> >(www.text);
                DebugUtility.Assert(jsonBodyResponse != null, "res == null");
                if (jsonBodyResponse.body == null)
                {
                    this.OnFailed();
                }
                else
                {
                    if (jsonBodyResponse.body.missionprogs != null)
                    {
                        PlayerData player = MonoSingleton <GameManager> .Instance.Player;
                        player.RankMatchMissionState.Clear();
                        foreach (ReqRankMatchMission.MissionProgress missionprog in jsonBodyResponse.body.missionprogs)
                        {
                            RankMatchMissionState matchMissionState = new RankMatchMissionState();
                            matchMissionState.Deserialize(missionprog.iname, missionprog.prog, missionprog.rewarded_at);
                            player.RankMatchMissionState.Add(matchMissionState);
                        }
                    }
                    Network.RemoveAPI();
                    this.Success();
                }
            }
        }