Esempio n. 1
0
        private void Setup(int idx)
        {
            if (this.mIsActivatePinAfterSelectedFloor)
            {
                this.mIsActivatePinAfterSelectedFloor = false;
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 10);
            }
            GameManager          instance     = MonoSingleton <GameManager> .Instance;
            MultiTowerFloorParam mtFloorParam = instance.GetMTFloorParam(GlobalVars.SelectedMultiTowerID, idx);

            if (mtFloorParam == null || !UnityEngine.Object.op_Inequality((UnityEngine.Object) this.QuestInfo, (UnityEngine.Object)null))
            {
                return;
            }
            int mtChallengeFloor  = instance.GetMTChallengeFloor();
            int mtClearedMaxFloor = instance.GetMTClearedMaxFloor();
            int num1 = int.MaxValue;

            if (!this.IsMultiTowerTop)
            {
                num1 = this.GetCanCharengeFloor();
            }
            this.SetButtonIntractable(((int)mtFloorParam.floor <= mtClearedMaxFloor || (int)mtFloorParam.floor == mtChallengeFloor) && (int)mtFloorParam.floor <= num1);
            MultiTowerFloorParam dataOfClass = DataSource.FindDataOfClass <MultiTowerFloorParam>(this.QuestInfo, (MultiTowerFloorParam)null);

            if (dataOfClass != null && (int)mtFloorParam.floor == (int)dataOfClass.floor)
            {
                return;
            }
            DebugUtility.Log("設定" + mtFloorParam.name);
            QuestParam questParam = mtFloorParam.GetQuestParam();

            DataSource.Bind <MultiTowerFloorParam>(this.QuestInfo, mtFloorParam);
            DataSource.Bind <QuestParam>(this.QuestInfo, questParam);
            GameParameter.UpdateAll(this.QuestInfo);
            MultiTowerQuestInfo component = (MultiTowerQuestInfo)this.QuestInfo.GetComponent <MultiTowerQuestInfo>();

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
            {
                component.Refresh();
            }
            GlobalVars.SelectedMultiTowerID    = mtFloorParam.tower_id;
            GlobalVars.SelectedQuestID         = questParam.iname;
            GlobalVars.SelectedMultiTowerFloor = (int)mtFloorParam.floor;
            int num2 = questParam.RequiredApWithPlayerLv(instance.Player.Lv, true);

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.QuestAP, (UnityEngine.Object)null))
            {
                this.QuestAP.set_text(num2.ToString());
            }
            if (!UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ChangeQuestAP, (UnityEngine.Object)null))
            {
                return;
            }
            this.ChangeQuestAP.set_text(num2.ToString());
        }
        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.MultiVersionMismatch:
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(5000);
                    break;

                case Network.EErrCode.RoomNoRoom:
                case Network.EErrCode.VS_NoRoom:
                case Network.EErrCode.MT_AlreadyFinish:
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(7000);
                    break;

                default:
                    this.OnFailed();
                    break;
                }
            }
            else
            {
                if (this.mType == FlowNode_MultiPlayResume.RESUME_TYPE.MULTI)
                {
                    WebAPI.JSON_BodyResponse <ReqMultiPlayResume.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqMultiPlayResume.Response> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnFailed();
                        return;
                    }
                    GlobalVars.SelectedQuestID = jsonObject.body.quest.iname;
                    GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                    GlobalVars.SelectedMultiPlayRoomName    = jsonObject.body.token;
                    GlobalVars.ResumeMultiplayPlayerID      = int.Parse(jsonObject.body.btlinfo.plid);
                    GlobalVars.ResumeMultiplaySeatID        = int.Parse(jsonObject.body.btlinfo.seat);
                    FlowNode_MultiPlayResume.BtlInfo        = jsonObject.body.btlinfo;
                }
                else if (this.mType == FlowNode_MultiPlayResume.RESUME_TYPE.VERSUS)
                {
                    WebAPI.JSON_BodyResponse <ReqVersusResume.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqVersusResume.Response> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnFailed();
                        return;
                    }
                    GlobalVars.SelectedQuestID = jsonObject.body.quest.iname;
                    GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                    GlobalVars.SelectedMultiPlayRoomName    = jsonObject.body.token;
                    GlobalVars.ResumeMultiplayPlayerID      = int.Parse(jsonObject.body.btlinfo.plid);
                    GlobalVars.ResumeMultiplaySeatID        = int.Parse(jsonObject.body.btlinfo.seat);
                    if (string.Compare(jsonObject.body.type, VERSUS_TYPE.Free.ToString().ToLower()) == 0)
                    {
                        GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Free;
                    }
                    else if (string.Compare(jsonObject.body.type, VERSUS_TYPE.Tower.ToString().ToLower()) == 0)
                    {
                        MonoSingleton <GameManager> .Instance.VersusTowerMatchBegin = true;
                        GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Tower;
                    }
                    else if (string.Compare(jsonObject.body.type, VERSUS_TYPE.Friend.ToString().ToLower()) == 0)
                    {
                        GlobalVars.SelectedMultiPlayVersusType = VERSUS_TYPE.Friend;
                    }
                    FlowNode_MultiPlayResume.BtlInfo = jsonObject.body.btlinfo;
                }
                else if (this.mType == FlowNode_MultiPlayResume.RESUME_TYPE.TOWER)
                {
                    GameManager instance = MonoSingleton <GameManager> .Instance;
                    WebAPI.JSON_BodyResponse <ReqMultiTwResume.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqMultiTwResume.Response> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnFailed();
                        return;
                    }
                    GlobalVars.SelectedMultiTowerID         = jsonObject.body.btlinfo.qid;
                    GlobalVars.SelectedMultiTowerFloor      = jsonObject.body.btlinfo.floor;
                    GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                    GlobalVars.SelectedMultiPlayRoomName    = jsonObject.body.token;
                    GlobalVars.ResumeMultiplayPlayerID      = int.Parse(jsonObject.body.btlinfo.plid);
                    GlobalVars.ResumeMultiplaySeatID        = int.Parse(jsonObject.body.btlinfo.seat);
                    GlobalVars.SelectedMultiPlayRoomID      = jsonObject.body.btlinfo.roomid;
                    MultiTowerFloorParam mtFloorParam = instance.GetMTFloorParam(GlobalVars.SelectedMultiTowerID, GlobalVars.SelectedMultiTowerFloor);
                    if (mtFloorParam != null)
                    {
                        GlobalVars.SelectedQuestID = mtFloorParam.GetQuestParam().iname;
                    }
                    FlowNode_MultiPlayResume.BtlInfo             = jsonObject.body.btlinfo;
                    FlowNode_MultiPlayResume.BtlInfo.multi_floor = FlowNode_MultiPlayResume.BtlInfo.floor;
                }
                Network.RemoveAPI();
                ((Behaviour)this).set_enabled(false);
                this.ActivateOutputLinks(300);
            }
        }
        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;

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

                case Network.EErrCode.RoomIllegalComment:
                case Network.EErrCode.VS_IllComment:
                    if (this.API == FlowNode_MultiPlayAPI.EAPI.MAKE)
                    {
                        string str = LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT");
                        PlayerPrefsUtility.SetString(PlayerPrefsUtility.ROOM_COMMENT_KEY, str, false);
                    }
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(4801);
                    break;

                case Network.EErrCode.RoomNoRoom:
                case Network.EErrCode.VS_NoRoom:
                    Network.RemoveAPI();
                    Network.ResetError();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(4900);
                    break;

                case Network.EErrCode.VS_NotLINERoomInfo:
                    Network.RemoveAPI();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(7000);
                    break;

                case Network.EErrCode.VS_FailRoomID:
                    Network.RemoveAPI();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(8000);
                    break;

                case Network.EErrCode.VS_NotPhotonAppID:
                    Network.RemoveAPI();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(9000);
                    break;

                case Network.EErrCode.VS_FaildSeasonGift:
                    Network.RemoveAPI();
                    ((Behaviour)this).set_enabled(false);
                    this.ActivateOutputLinks(10000);
                    break;

                default:
                    this.OnFailed();
                    break;
                }
            }
            else
            {
                if (this.API == FlowNode_MultiPlayAPI.EAPI.MAKE)
                {
                    WebAPI.JSON_BodyResponse <ReqMPRoomMake.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqMPRoomMake.Response> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnFailed();
                        return;
                    }
                    GlobalVars.SelectedMultiPlayRoomID      = jsonObject.body.roomid;
                    GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                    GlobalVars.SelectedMultiPlayRoomName    = jsonObject.body.token;
                    DebugUtility.Log("MakeRoom RoomID:" + (object)GlobalVars.SelectedMultiPlayRoomID + " AppID:" + GlobalVars.SelectedMultiPlayPhotonAppID + " Name:" + GlobalVars.SelectedMultiPlayRoomName);
                }
                else if (this.API == FlowNode_MultiPlayAPI.EAPI.ROOM)
                {
                    WebAPI.JSON_BodyResponse <ReqMPRoom.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqMPRoom.Response> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnFailed();
                        return;
                    }
                    FlowNode_MultiPlayAPI.RoomList = jsonObject.body;
                    if (FlowNode_MultiPlayAPI.RoomList == null)
                    {
                        DebugUtility.Log("ListRoom null");
                    }
                    else if (FlowNode_MultiPlayAPI.RoomList.rooms == null)
                    {
                        DebugUtility.Log("ListRoom rooms null");
                    }
                    else
                    {
                        DebugUtility.Log("ListRoom num:" + (object)FlowNode_MultiPlayAPI.RoomList.rooms.Length);
                    }
                }
                else if (this.API == FlowNode_MultiPlayAPI.EAPI.JOIN)
                {
                    WebAPI.JSON_BodyResponse <ReqMPRoomJoin.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqMPRoomJoin.Response> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnFailed();
                        return;
                    }
                    if (jsonObject.body.quest == null || string.IsNullOrEmpty(jsonObject.body.quest.iname))
                    {
                        this.OnFailed();
                        return;
                    }
                    GlobalVars.SelectedQuestID = jsonObject.body.quest.iname;
                    GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                    GlobalVars.SelectedMultiPlayRoomName    = jsonObject.body.token;
                    DebugUtility.Log("JoinRoom  AppID:" + GlobalVars.SelectedMultiPlayPhotonAppID + " Name:" + GlobalVars.SelectedMultiPlayRoomName);
                }
                else if (this.API != FlowNode_MultiPlayAPI.EAPI.UPDATE && this.API != FlowNode_MultiPlayAPI.EAPI.VERSION)
                {
                    if (this.API == FlowNode_MultiPlayAPI.EAPI.VERSUS_START)
                    {
                        WebAPI.JSON_BodyResponse <ReqVersusStart.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqVersusStart.Response> >(www.text);
                        DebugUtility.Assert(jsonObject != null, "res == null");
                        if (jsonObject.body == null)
                        {
                            this.OnFailed();
                            return;
                        }
                        GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                        switch (GlobalVars.SelectedMultiPlayVersusType)
                        {
                        case VERSUS_TYPE.Free:
                            GlobalVars.SelectedQuestID = jsonObject.body.maps.free;
                            break;

                        case VERSUS_TYPE.Friend:
                            GlobalVars.SelectedQuestID = jsonObject.body.maps.friend;
                            break;
                        }
                        DebugUtility.Log("MakeRoom RoomID: AppID:" + GlobalVars.SelectedMultiPlayPhotonAppID + "/ QuestID:" + GlobalVars.SelectedQuestID);
                    }
                    else if (this.API == FlowNode_MultiPlayAPI.EAPI.VERSUS_MAKE)
                    {
                        WebAPI.JSON_BodyResponse <ReqVersusMake.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqVersusMake.Response> >(www.text);
                        DebugUtility.Assert(jsonObject != null, "res == null");
                        if (jsonObject.body == null)
                        {
                            this.OnFailed();
                            return;
                        }
                        GlobalVars.SelectedMultiPlayRoomID   = jsonObject.body.roomid;
                        GlobalVars.SelectedMultiPlayRoomName = jsonObject.body.token;
                        if (GlobalVars.SelectedMultiPlayVersusType == VERSUS_TYPE.Friend)
                        {
                            GlobalVars.EditMultiPlayRoomPassCode = "1";
                        }
                    }
                    else if (this.API == FlowNode_MultiPlayAPI.EAPI.VERSUS_JOIN)
                    {
                        WebAPI.JSON_BodyResponse <ReqVersusRoomJoin.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqVersusRoomJoin.Response> >(www.text);
                        DebugUtility.Assert(jsonObject != null, "res == null");
                        if (jsonObject.body == null)
                        {
                            this.OnFailed();
                            return;
                        }
                        if (jsonObject.body.quest == null || string.IsNullOrEmpty(jsonObject.body.quest.iname))
                        {
                            this.OnFailed();
                            return;
                        }
                        GlobalVars.SelectedQuestID = jsonObject.body.quest.iname;
                        GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                        GlobalVars.SelectedMultiPlayRoomName    = jsonObject.body.token;
                        DebugUtility.Log("JoinRoom  AppID:" + GlobalVars.SelectedMultiPlayPhotonAppID + " Name:" + GlobalVars.SelectedMultiPlayRoomName);
                    }
                    else if (this.API != FlowNode_MultiPlayAPI.EAPI.VERSUS_LINE_REQ && this.API != FlowNode_MultiPlayAPI.EAPI.VERSUS_LINE_MAKE)
                    {
                        if (this.API == FlowNode_MultiPlayAPI.EAPI.VERSUS_STATUS)
                        {
                            WebAPI.JSON_BodyResponse <ReqVersusStatus.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqVersusStatus.Response> >(www.text);
                            if (jsonObject == null)
                            {
                                this.OnFailed();
                                return;
                            }
                            GameManager instance = MonoSingleton <GameManager> .Instance;
                            instance.Player.SetTowerMatchInfo(jsonObject.body.floor, jsonObject.body.key, jsonObject.body.wincnt, jsonObject.body.is_give_season_gift != 0);
                            instance.VersusTowerMatchBegin   = !string.IsNullOrEmpty(jsonObject.body.vstower_id);
                            instance.VersusTowerMatchReceipt = jsonObject.body.is_season_gift != 0;
                            instance.VersusTowerMatchName    = jsonObject.body.tower_iname;
                            instance.VersusTowerMatchEndAt   = jsonObject.body.end_at;
                            instance.VersusCoinRemainCnt     = jsonObject.body.daycnt;
                            instance.VersusLastUid           = jsonObject.body.last_enemyuid;
                            GlobalVars.SelectedQuestID       = jsonObject.body.vstower_id;
                            instance.Player.UpdateVersusTowerTrophyStates(jsonObject.body.tower_iname, jsonObject.body.floor);
                        }
                        else if (this.API == FlowNode_MultiPlayAPI.EAPI.VERSUS_SEASON)
                        {
                            WebAPI.JSON_BodyResponse <ReqVersusSeason.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqVersusSeason.Response> >(www.text);
                            if (jsonObject == null)
                            {
                                this.OnFailed();
                                return;
                            }
                            PlayerData player = MonoSingleton <GameManager> .Instance.Player;
                            player.VersusSeazonGiftReceipt = false;
                            player.UnreadMailPeriod       |= jsonObject.body.unreadmail == 1;
                        }
                        else if (this.API == FlowNode_MultiPlayAPI.EAPI.VERSUS_FRIEND)
                        {
                            WebAPI.JSON_BodyResponse <ReqVersusFriendScore.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqVersusFriendScore.Response> >(www.text);
                            if (jsonObject == null)
                            {
                                this.OnFailed();
                                return;
                            }
                            MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.friends);
                        }
                        else if (this.API == FlowNode_MultiPlayAPI.EAPI.MT_STATUS)
                        {
                            WebAPI.JSON_BodyResponse <ReqMultiTwStatus.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqMultiTwStatus.Response> >(www.text);
                            Debug.Log((object)www.text);
                            if (jsonObject == null)
                            {
                                this.OnFailed();
                                return;
                            }
                            GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.appid;
                            MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.floors);
                        }
                        else if (this.API == FlowNode_MultiPlayAPI.EAPI.MT_JOIN)
                        {
                            WebAPI.JSON_BodyResponse <ReqMultiTwRoomJoin.Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqMultiTwRoomJoin.Response> >(www.text);
                            DebugUtility.Assert(jsonObject != null, "res == null");
                            if (jsonObject.body == null)
                            {
                                this.OnFailed();
                                return;
                            }
                            if (jsonObject.body.quest == null || string.IsNullOrEmpty(jsonObject.body.quest.iname))
                            {
                                this.OnFailed();
                                return;
                            }
                            GameManager instance = MonoSingleton <GameManager> .Instance;
                            if (instance.GetMTChallengeFloor() < jsonObject.body.quest.floor)
                            {
                                Network.RemoveAPI();
                                ((Behaviour)this).set_enabled(false);
                                this.ActivateOutputLinks(11000);
                                return;
                            }
                            GlobalVars.SelectedMultiTowerID         = jsonObject.body.quest.iname;
                            GlobalVars.SelectedMultiTowerFloor      = jsonObject.body.quest.floor;
                            GlobalVars.SelectedMultiPlayPhotonAppID = jsonObject.body.app_id;
                            GlobalVars.SelectedMultiPlayRoomName    = jsonObject.body.token;
                            MultiTowerFloorParam mtFloorParam = instance.GetMTFloorParam(GlobalVars.SelectedMultiTowerID, GlobalVars.SelectedMultiTowerFloor);
                            if (mtFloorParam != null)
                            {
                                QuestParam questParam = mtFloorParam.GetQuestParam();
                                if (questParam != null)
                                {
                                    GlobalVars.SelectedQuestID = questParam.iname;
                                }
                            }
                            DebugUtility.Log("JoinRoom  AppID:" + GlobalVars.SelectedMultiPlayPhotonAppID + " Name:" + GlobalVars.SelectedMultiPlayRoomName);
                        }
                    }
                }
                Network.RemoveAPI();
                this.Success();
            }
        }