コード例 #1
0
        public override void OnSuccess(WWWResult www)
        {
            WebAPI.JSON_BodyResponse <Json_FriendArray> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_FriendArray> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            if (Network.IsError)
            {
                this.OnRetry();
            }
            else if (jsonObject.body == null)
            {
                this.OnRetry();
            }
            else
            {
                if (!string.IsNullOrEmpty(this.mTargetFuid))
                {
                    try
                    {
                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.friends, FriendStates.Friend);

                        FriendData friendData = MonoSingleton <GameManager> .Instance.Player.Friends.Find((Predicate <FriendData>)(f => f.FUID == this.mTargetFuid));

                        if (friendData != null)
                        {
                            GlobalVars.SelectedFriend = friendData;
                        }
                    }
                    catch (Exception ex)
                    {
                        this.OnRetry(ex);
                        return;
                    }
                }
                Network.RemoveAPI();
                this.Success();
            }
        }
コード例 #2
0
        /// <summary>
        /// 加载Map对应的Scene成功
        /// </summary>
        private void OnLoadMapSceneCompleted(string pathOrAddress, Scene scene, object userData)
        {
            DebugUtility.Assert(scene.IsValid(), Constants.LOG_TAG, "Load Map Scene");

            DebugUtility.Log(Constants.LOG_TAG, string.Format("Map({0}) Loaded Map Scene", m_MapUid));

            m_MapScene = scene;
            SceneManager.SetActiveScene(m_MapScene);
            GameObject[] rootGameObjects = m_MapScene.GetRootGameObjects();
            m_NeedOriginPointOffsets             = new List <EnableOriginPointOffset>(rootGameObjects.Length);
            m_NeedForcedLockingDistanceToPlayers = new List <ForcedLockingDistanceToPlayer>(rootGameObjects.Length);
            for (int iGameObject = 0; iGameObject < rootGameObjects.Length; iGameObject++)
            {
                GameObject iterGameObject = rootGameObjects[iGameObject];
                EnableOriginPointOffset iterEnableOriginPointOffset = iterGameObject.GetComponent <EnableOriginPointOffset>();
                if (iterEnableOriginPointOffset)
                {
                    iterEnableOriginPointOffset._RealWorldPostion = iterEnableOriginPointOffset.transform.localPosition;
                    m_NeedOriginPointOffsets.Add(iterEnableOriginPointOffset);
                }

                ForcedLockingDistanceToPlayer iterForcedLockingDistanceToPlayer = iterGameObject.GetComponent <ForcedLockingDistanceToPlayer>();
                if (iterForcedLockingDistanceToPlayer)
                {
                    iterForcedLockingDistanceToPlayer._DistanceToPlayer = iterForcedLockingDistanceToPlayer.transform.localPosition;
                    m_NeedForcedLockingDistanceToPlayers.Add(iterForcedLockingDistanceToPlayer);
                }
            }

            DoUpdate_NeedOriginPointOffset(true);
            DoUpdate_ForcedLockingDistanceToPlayer(true);

            // 加载当前Area
            DoUpdate_Area(true);
            // HACK 因为DoUpdate_Area会把State改为ChangingArea
            m_State = State.LoadingMap;
        }
コード例 #3
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_GachaList> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaList> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         if (jsonObject.body == null)
         {
             this.Failure();
         }
         else
         {
             GameManager instance = MonoSingleton <GameManager> .Instance;
             try
             {
                 if (!instance.Deserialize(jsonObject.body))
                 {
                     this.Failure();
                     return;
                 }
             }
             catch (Exception ex)
             {
                 DebugUtility.LogException(ex);
                 this.Failure();
                 return;
             }
             this.Success();
         }
     }
 }
コード例 #4
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                this.OnFailed();
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                Network.RemoveAPI();
                if (jsonObject.body == null)
                {
                    this.OnFailed();
                }
                else
                {
                    try
                    {
                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

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

                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.units);
                    }
                    catch (Exception ex)
                    {
                        DebugUtility.LogException(ex);
                        this.OnFailed();
                        return;
                    }
                    CriticalSection.Enter(CriticalSections.Network);
                    this.StartCoroutine(this.WaitDownloadAsync());
                }
            }
        }
コード例 #5
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <FlowNode_ReqBtlCom.JSON_ReqBtlComResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqBtlCom.JSON_ReqBtlComResponse> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         GameManager instance = MonoSingleton <GameManager> .Instance;
         instance.Player.SetQuestListDirty();
         instance.ResetJigenQuests(false);
         if (!instance.Deserialize(jsonObject.body.quests))
         {
             this.Failure();
         }
         else
         {
             if (jsonObject.body.towers != null)
             {
                 for (int index = 0; index < jsonObject.body.towers.Length; ++index)
                 {
                     JSON_ReqTowerResuponse.Json_TowerProg tower1 = jsonObject.body.towers[index];
                     TowerParam tower2 = instance.FindTower(tower1.iname);
                     if (tower2 != null)
                     {
                         tower2.is_unlock = tower1.is_open == 1;
                     }
                 }
             }
             this.Success();
         }
     }
 }
コード例 #6
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <JSON_ShopListArray> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <JSON_ShopListArray> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         if (jsonObject.body.shops == null || jsonObject.body.shops.Length <= 0)
         {
             MonoSingleton <GameManager> .Instance.LimitedShopEndAt = 0L;
             MonoSingleton <GameManager> .Instance.LimitedShopList  = (JSON_ShopListArray.Shops[])null;
         }
         else
         {
             for (int index = 0; index < jsonObject.body.shops.Length; ++index)
             {
                 if (jsonObject.body.shops[index] == null)
                 {
                     this.OnRetry();
                     return;
                 }
             }
             MonoSingleton <GameManager> .Instance.LimitedShopEndAt = this.GetLimitedShopPeriodEndAt(jsonObject.body);
             if (this.inputPin != 2)
             {
                 this.limited_shop_list.SetLimitedShopList(jsonObject.body.shops);
             }
             MonoSingleton <GameManager> .Instance.LimitedShopList = jsonObject.body.shops;
         }
         this.Success();
     }
 }
コード例 #7
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_ResAwardList> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ResAwardList> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         if (jsonObject.body == null)
         {
             this.Failure();
         }
         else
         {
             string[] awards = jsonObject.body.awards;
             if (awards != null)
             {
                 for (int index = 0; index < awards.Length; ++index)
                 {
                     if (!string.IsNullOrEmpty(awards[index]))
                     {
                         GameCenterManager.SendAchievementProgress(awards[index]);
                     }
                 }
                 this.Success();
             }
             else
             {
                 this.Failure();
             }
         }
     }
 }
コード例 #8
0
 public override void Complete(WWWResult www)
 {
     if (Network.IsError)
     {
         MultiInvitationBadge.isValid = false;
         this.Failed();
     }
     else
     {
         DebugMenu.Log("API", this.url + ":" + www.text);
         WebAPI.JSON_BodyResponse <FlowNode_ReqMultiInvitation.Api_NotifyInvitation.Json> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqMultiInvitation.Api_NotifyInvitation.Json> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         if (jsonObject.body != null)
         {
             MultiInvitationReceiveWindow.SetBadge(jsonObject.body.player != null && jsonObject.body.player.multi_inv != 0);
         }
         else
         {
             MultiInvitationReceiveWindow.SetBadge(false);
         }
         Network.RemoveAPI();
         this.Success();
     }
 }
コード例 #9
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         switch (Network.ErrCode)
         {
         case Network.EErrCode.QR_OutOfPeriod:
         case Network.EErrCode.QR_InvalidQRSerial:
         case Network.EErrCode.QR_CanNotReward:
         case Network.EErrCode.QR_LockSerialCampaign:
             Network.RemoveAPI();
             Network.ResetError();
             this.Finished(Network.ErrMsg);
             break;
         }
     }
     else
     {
         WebAPI.JSON_BodyResponse <FlowNode_ReqQRCodeAccess.JSON_QRCodeAccess> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqQRCodeAccess.JSON_QRCodeAccess> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         this.Finished(jsonObject.body.message);
     }
 }
コード例 #10
0
 public override void OnSuccess(WWWResult www)
 {
     if (Object.op_Equality((Object)this, (Object)null))
     {
         Network.RemoveAPI();
         Network.IsIndicator = true;
     }
     else if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         Network.RemoveAPI();
         Network.IsIndicator = true;
         ((Behaviour)this).set_enabled(false);
         this.mSetup = false;
         this.ActivateOutputLinks(100);
     }
     else
     {
         DebugMenu.Log("API", "chat:message:{" + www.text + "}");
         WebAPI.JSON_BodyResponse <JSON_ChatLog> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <JSON_ChatLog> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         Network.IsIndicator = true;
         ChatLog log = new ChatLog();
         if (jsonObject.body != null)
         {
             log.Deserialize(jsonObject.body);
             MultiInvitationReceiveWindow.SetBadge(jsonObject.body.player != null && jsonObject.body.player.multi_inv != 0);
         }
         else
         {
             MultiInvitationReceiveWindow.SetBadge(false);
         }
         this.Success(log);
     }
 }
コード例 #11
0
        /// <summary>
        /// 加载MapInfo成功
        /// </summary>
        private void OnLoadMapInfoCompleted(string pathOrAddress, UnityEngine.Object obj, object userData)
        {
            DebugUtility.Assert(obj != null, Constants.LOG_TAG, "Load Map Info");

            DebugUtility.Log(Constants.LOG_TAG, string.Format("Map({0}) Loaded Map Info", m_MapUid));
            //m_MapInfo = obj as MapInfo;
            TextAsset text = obj as TextAsset;

            m_MapInfo = new MapInfo();
            m_MapInfo.Deserialize(text.bytes);
            m_MapInfo.Initialize();

            if (GameFacade.Instance != null)
            {
                GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
                if (gameplayProxy != null)
                {
                    Vector3 realWorldPos = MapManager.GetInstance()._PlayerInfo.RealWorldPosition;
                    Vector3 gameWorldPos = gameplayProxy.WorldPositionToServerAreaOffsetPosition(realWorldPos);
                    MapManager.GetInstance().SetPlayerPosition(realWorldPos, gameWorldPos);
                }
            }
            AssetUtil.LoadSceneAsync(m_MapInfo.SceneAddressableKey, OnLoadMapSceneCompleted, null, LoadSceneMode.Additive);
        }
コード例 #12
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                this.OnRetry();
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    try
                    {
                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

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

                        MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.artifacts, false);
                    }
                    catch (Exception ex)
                    {
                        DebugUtility.LogException(ex);
                        this.OnRetry();
                        return;
                    }
                    Network.RemoveAPI();
                    this.Success();
                }
            }
        }
コード例 #13
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         if (Network.ErrCode == Network.EErrCode.NotGpsQuest)
         {
             Network.RemoveAPI();
             Network.ResetError();
             this.SuccessNotQuest();
         }
         else
         {
             this.OnRetry();
         }
     }
     else
     {
         WebAPI.JSON_BodyResponse <FlowNode_ReqBtlComGps.JSON_ReqBtlComGpsResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqBtlComGps.JSON_ReqBtlComGpsResponse> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         GameManager instance = MonoSingleton <GameManager> .Instance;
         instance.ResetGpsQuests();
         if (jsonObject.body.quests == null || jsonObject.body.quests.Length == 0)
         {
             this.SuccessNotQuest();
         }
         else if (!instance.DeserializeGps(jsonObject.body.quests))
         {
             this.Failure();
         }
         else
         {
             this.Success();
         }
     }
 }
コード例 #14
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                if (Network.ErrCode == Network.EErrCode.SessionFailure)
                {
                    this.OnFailed();
                }
                else
                {
                    this.OnFailed();
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <FlowNode_GetSessionID.JSON_DeviceID> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_GetSessionID.JSON_DeviceID> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                MonoSingleton <GameManager> .Instance.SaveAuth(jsonObject.body.device_id);

                Network.RemoveAPI();
                this.ActivateOutputLinks(1);
                ((Behaviour)this).set_enabled(false);
            }
        }
コード例 #15
0
        public override void OnSuccess(WWWResult www)
        {
            if (TowerErrorHandle.Error((FlowNode_Network)this))
            {
                return;
            }
            WebAPI.JSON_BodyResponse <ReqTowerFloorReset.Json_Response> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <ReqTowerFloorReset.Json_Response> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            Network.RemoveAPI();
            try
            {
                MonoSingleton <GameManager> .Instance.Player.SetTowerFloorResetCoin(jsonObject.body);

                MonoSingleton <GameManager> .Instance.TowerResuponse.OnFloorReset();

                this.ActivateOutputLinks(100);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return;
            }
            ((Behaviour)this).set_enabled(false);
        }
コード例 #16
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                this.OnFailed();
            }
            else
            {
                WebAPI.JSON_BodyResponse <JSON_MasterParam> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <JSON_MasterParam> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                Network.RemoveAPI();
                if (!MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body))
                {
                    this.Failure();
                }
                else
                {
                    MonoSingleton <GameManager> .Instance.MasterParam.DumpLoadedLog();

                    this.Success();
                }
            }
        }
コード例 #17
0
 public override void Complete(WWWResult www)
 {
     if (Network.IsError)
     {
         this.m_Node.OnFailed();
     }
     else
     {
         DebugMenu.Log("API", this.url + ":" + www.text);
         WebAPI.JSON_BodyResponse <FlowNode_ReqSupportList.Api_SupportList.Json> jsonBodyResponse = (WebAPI.JSON_BodyResponse <FlowNode_ReqSupportList.Api_SupportList.Json>)JsonUtility.FromJson <WebAPI.JSON_BodyResponse <FlowNode_ReqSupportList.Api_SupportList.Json> >(www.text);
         DebugUtility.Assert(jsonBodyResponse != null, "res == null");
         if (jsonBodyResponse.body != null)
         {
             FlowNode_ReqSupportList.SupportList supportList = new FlowNode_ReqSupportList.SupportList(this.m_Element);
             supportList.Deserialize(jsonBodyResponse.body.supports);
             if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_Node.m_Window, (UnityEngine.Object)null) && this.m_Node.m_Window.rootWindow != null)
             {
                 this.m_Node.m_Window.rootWindow.AddData("data_supportres", (object)supportList);
             }
         }
         Network.RemoveAPI();
         this.Success();
     }
 }
コード例 #18
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         this.OnFailed();
     }
     else
     {
         DebugMenu.Log("API", "friend:" + www.text);
         WebAPI.JSON_BodyResponse <Json_FriendList> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_FriendList> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         GameManager instance = MonoSingleton <GameManager> .Instance;
         try
         {
             instance.Deserialize(jsonObject.body.friends, FriendStates.Friend);
             if (this.IsFollower)
             {
                 instance.Player.FollowerNum = jsonObject.body.follower_count;
                 InnWindow componentInChildren = (InnWindow)((Component)this).get_gameObject().GetComponentInChildren <InnWindow>();
                 if (UnityEngine.Object.op_Inequality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null))
                 {
                     componentInChildren.Refresh();
                 }
             }
             instance.Player.FirstFriendCount = jsonObject.body.first_count;
             this.Success();
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             return;
         }
         ((Behaviour)this).set_enabled(false);
     }
 }
コード例 #19
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         this.OnBack();
     }
     else
     {
         WebAPI.JSON_BodyResponse <JSON_ChatPlayerData> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <JSON_ChatPlayerData> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         ChatPlayerData data = new ChatPlayerData();
         data.Deserialize(jsonObject.body);
         if (Object.op_Inequality((Object)this.window, (Object)null))
         {
             this.window.Player = data;
         }
         if (Object.op_Inequality((Object)this.detail, (Object)null))
         {
             this.detail.SetChatPlayerData(data);
         }
         this.Success();
     }
 }
コード例 #20
0
ファイル: TowerResuponse.cs プロジェクト: zunaalabaya/TAC-BOT
        private void UpdateCurrentFloor()
        {
            if (this.status == null)
            {
                this.currentFloor = MonoSingleton <GameManager> .Instance.FindFirstTowerFloor(GlobalVars.SelectedTowerID);
            }
            else
            {
                this.currentFloor = MonoSingleton <GameManager> .Instance.FindTowerFloor(this.status.fname);

                DebugUtility.Assert(this.currentFloor != null, string.Format("フロア [{0}] が見つかりません", (object)this.status.fname));
                if (this.currentFloor == null || this.status.state != QuestStates.Cleared)
                {
                    return;
                }
                TowerFloorParam nextTowerFloor = MonoSingleton <GameManager> .Instance.FindNextTowerFloor(this.currentFloor.tower_id, this.currentFloor.iname);

                if (nextTowerFloor == null)
                {
                    return;
                }
                this.currentFloor = nextTowerFloor;
            }
        }
コード例 #21
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            ShopData shopData = player.GetShopData(GlobalVars.ShopType);

            if (shopData == null)
            {
                this.ActivateOutputLinks(104);
            }
            else
            {
                ShopItem shopItem = shopData.items[GlobalVars.ShopBuyIndex];
                if (shopItem.is_soldout)
                {
                    this.ActivateOutputLinks(105);
                }
                else
                {
                    ItemParam itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopItem.iname);

                    if (!player.CheckItemCapacity(itemParam, shopItem.num))
                    {
                        this.ActivateOutputLinks(106);
                    }
                    else
                    {
                        switch (shopItem.saleType)
                        {
                        case ESaleType.Gold:
                            if (player.Gold < (int)itemParam.buy * shopItem.num)
                            {
                                this.ActivateOutputLinks(107);
                                return;
                            }
                            break;

                        case ESaleType.Coin:
                            if (player.Coin < (int)itemParam.coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(108);
                                return;
                            }
                            break;

                        case ESaleType.TourCoin:
                            if (player.TourCoin < (int)itemParam.tour_coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(109);
                                return;
                            }
                            break;

                        case ESaleType.ArenaCoin:
                            if (player.ArenaCoin < (int)itemParam.arena_coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(110);
                                return;
                            }
                            break;

                        case ESaleType.PiecePoint:
                            if (player.PiecePoint < (int)itemParam.piece_point * shopItem.num)
                            {
                                this.ActivateOutputLinks(111);
                                return;
                            }
                            break;

                        case ESaleType.MultiCoin:
                            if (player.MultiCoin < (int)itemParam.multi_coin * shopItem.num)
                            {
                                this.ActivateOutputLinks(112);
                                return;
                            }
                            break;

                        case ESaleType.EventCoin:
                            DebugUtility.Assert("There is no common price in the event coin.");
                            this.ActivateOutputLinks(113);
                            return;
                        }
                        this.mShopType = GlobalVars.ShopType;
                        int shopBuyIndex = GlobalVars.ShopBuyIndex;
                        if (Network.Mode == Network.EConnectMode.Offline)
                        {
                            player.DEBUG_BUY_ITEM(this.mShopType, shopBuyIndex);
                            ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                            player.OnBuyAtShop(shopParam.iname, itemParam.iname, shopItem.num);
                            this.Success();
                        }
                        else
                        {
                            this.ExecRequest((WebAPI) new ReqItemShopBuypaid(this.mShopType.ToString(), shopBuyIndex, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                            ((Behaviour)this).set_enabled(true);
                        }
                    }
                }
            }
        }
コード例 #22
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopSoldOut:
                case Network.EErrCode.ShopBuyCostShort:
                case Network.EErrCode.ShopBuyLvShort:
                case Network.EErrCode.ShopBuyNotFound:
                case Network.EErrCode.ShopBuyItemNotFound:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    ShopData shop = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop);

                        ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                        if (shopParam != null)
                        {
                            PlayerData player    = MonoSingleton <GameManager> .Instance.Player;
                            ShopItem   shopItem  = shop.items[GlobalVars.ShopBuyIndex];
                            ItemParam  itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopItem.iname);

                            int num = 0;
                            switch (shopItem.saleType)
                            {
                            case ESaleType.Gold:
                                num = (int)itemParam.buy * shopItem.num;
                                break;

                            case ESaleType.Coin:
                                num = (int)itemParam.coin * shopItem.num;
                                break;

                            case ESaleType.TourCoin:
                                num = (int)itemParam.tour_coin * shopItem.num;
                                break;

                            case ESaleType.ArenaCoin:
                                num = (int)itemParam.arena_coin * shopItem.num;
                                break;

                            case ESaleType.PiecePoint:
                                num = (int)itemParam.piece_point * shopItem.num;
                                break;

                            case ESaleType.MultiCoin:
                                num = (int)itemParam.multi_coin * shopItem.num;
                                break;

                            case ESaleType.EventCoin:
                                num = 0;
                                DebugUtility.Assert("There is no common price in the event coin.");
                                break;
                            }
                            player.OnBuyAtShop(shopParam.iname, itemParam.iname, shopItem.num);
                            AnalyticsManager.TrackCurrencyObtain((AnalyticsManager.CurrencyType)(itemParam.type != EItemType.Ticket ? 4 : 2), AnalyticsManager.CurrencySubType.FREE, (long)shopItem.num, "Shop", new Dictionary <string, object>()
                            {
                                {
                                    "item_id",
                                    (object)shopItem.iname
                                }
                            });
                        }
                        this.Success();
                    }
                }
            }
        }
コード例 #23
0
        public void SetData(VersusTowerRewardItem.REWARD_TYPE type, int idx = 0)
        {
            GameManager      instance    = MonoSingleton <GameManager> .Instance;
            VersusTowerParam dataOfClass = DataSource.FindDataOfClass <VersusTowerParam>(((Component)this).get_gameObject(), (VersusTowerParam)null);
            int versusTowerFloor         = instance.Player.VersusTowerFloor;

            if (dataOfClass == null)
            {
                return;
            }
            VERSUS_ITEM_TYPE versusItemType = VERSUS_ITEM_TYPE.item;
            string           str            = string.Empty;
            int num = 0;

            if (type == VersusTowerRewardItem.REWARD_TYPE.Arrival)
            {
                versusItemType = dataOfClass.ArrivalItemType;
                str            = (string)dataOfClass.ArrivalIteminame;
                num            = (int)dataOfClass.ArrivalItemNum;
            }
            else if (idx >= 0 && idx < dataOfClass.SeasonIteminame.Length)
            {
                versusItemType = dataOfClass.SeasonItemType[idx];
                str            = (string)dataOfClass.SeasonIteminame[idx];
                num            = (int)dataOfClass.SeasonItemnum[idx];
            }
            if (Object.op_Inequality((Object)this.itemObj, (Object)null))
            {
                this.itemObj.SetActive(true);
            }
            if (Object.op_Inequality((Object)this.amountObj, (Object)null))
            {
                this.amountObj.SetActive(true);
            }
            if (Object.op_Inequality((Object)this.unitObj, (Object)null))
            {
                this.unitObj.SetActive(false);
            }
            switch (versusItemType)
            {
            case VERSUS_ITEM_TYPE.item:
                if (Object.op_Inequality((Object)this.itemObj, (Object)null) && Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    ArtifactIcon componentInChildren = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        ((Behaviour)componentInChildren).set_enabled(false);
                    }
                    this.itemObj.SetActive(true);
                    DataSource component1 = (DataSource)this.itemObj.GetComponent <DataSource>();
                    if (Object.op_Inequality((Object)component1, (Object)null))
                    {
                        component1.Clear();
                    }
                    DataSource component2 = (DataSource)this.amountObj.GetComponent <DataSource>();
                    if (Object.op_Inequality((Object)component2, (Object)null))
                    {
                        component2.Clear();
                    }
                    ItemParam itemParam = instance.GetItemParam(str);
                    DataSource.Bind <ItemParam>(this.itemObj, itemParam);
                    ItemData data = new ItemData();
                    data.Setup(0L, itemParam, num);
                    DataSource.Bind <ItemData>(this.amountObj, data);
                    Transform child = this.itemObj.get_transform().FindChild("icon");
                    if (Object.op_Inequality((Object)child, (Object)null))
                    {
                        GameParameter component3 = (GameParameter)((Component)child).GetComponent <GameParameter>();
                        if (Object.op_Inequality((Object)component3, (Object)null))
                        {
                            ((Behaviour)component3).set_enabled(true);
                        }
                    }
                    GameParameter.UpdateAll(this.itemObj);
                    if (Object.op_Inequality((Object)this.iconParam, (Object)null))
                    {
                        this.iconParam.UpdateValue();
                    }
                    if (Object.op_Inequality((Object)this.frameParam, (Object)null))
                    {
                        this.frameParam.UpdateValue();
                    }
                    if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                    {
                        this.rewardName.set_text(itemParam.name + string.Format(LocalizedText.Get("sys.CROSS_NUM"), (object)num));
                        break;
                    }
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.gold:
                if (Object.op_Inequality((Object)this.itemTex, (Object)null))
                {
                    GameParameter component = (GameParameter)((Component)this.itemTex).GetComponent <GameParameter>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.itemTex.set_texture(this.goldTex);
                }
                if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.goldBase, (Object)null))
                {
                    this.frameTex.set_sprite(this.goldBase);
                }
                if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    this.rewardName.set_text(num.ToString() + LocalizedText.Get("sys.GOLD"));
                }
                if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    this.amountObj.SetActive(false);
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.coin:
                if (Object.op_Inequality((Object)this.itemTex, (Object)null))
                {
                    GameParameter component = (GameParameter)((Component)this.itemTex).GetComponent <GameParameter>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        ((Behaviour)component).set_enabled(false);
                    }
                    this.itemTex.set_texture(this.coinTex);
                }
                if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.coinBase, (Object)null))
                {
                    this.frameTex.set_sprite(this.coinBase);
                }
                if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                {
                    this.rewardName.set_text(string.Format(LocalizedText.Get("sys.CHALLENGE_REWARD_COIN"), (object)num));
                }
                if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    this.amountObj.SetActive(false);
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.unit:
                if (Object.op_Inequality((Object)this.unitObj, (Object)null))
                {
                    if (Object.op_Inequality((Object)this.itemObj, (Object)null))
                    {
                        this.itemObj.SetActive(false);
                    }
                    this.unitObj.SetActive(true);
                    UnitParam unitParam = instance.GetUnitParam(str);
                    DebugUtility.Assert(unitParam != null, "Invalid unit:" + str);
                    UnitData data = new UnitData();
                    data.Setup(str, 0, 1, 0, (string)null, 1, EElement.None, 0);
                    DataSource.Bind <UnitData>(this.unitObj, data);
                    GameParameter.UpdateAll(this.unitObj);
                    if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                    {
                        this.rewardName.set_text(string.Format(LocalizedText.Get("sys.MULTI_VERSUS_REWARD_UNIT"), (object)unitParam.name));
                        break;
                    }
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.artifact:
                if (Object.op_Inequality((Object)this.itemObj, (Object)null))
                {
                    DataSource component = (DataSource)this.itemObj.GetComponent <DataSource>();
                    if (Object.op_Inequality((Object)component, (Object)null))
                    {
                        component.Clear();
                    }
                    ArtifactParam artifactParam = instance.MasterParam.GetArtifactParam(str);
                    DataSource.Bind <ArtifactParam>(this.itemObj, artifactParam);
                    ArtifactIcon componentInChildren = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        ((Behaviour)componentInChildren).set_enabled(true);
                        componentInChildren.UpdateValue();
                        if (Object.op_Inequality((Object)this.rewardName, (Object)null))
                        {
                            this.rewardName.set_text(string.Format(LocalizedText.Get("sys.MULTI_VERSUS_REWARD_ARTIFACT"), (object)artifactParam.name));
                        }
                        if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                        {
                            this.amountObj.SetActive(false);
                            break;
                        }
                        break;
                    }
                    break;
                }
                break;

            case VERSUS_ITEM_TYPE.award:
                if (Object.op_Inequality((Object)this.itemObj, (Object)null) && Object.op_Inequality((Object)this.amountObj, (Object)null))
                {
                    ArtifactIcon componentInChildren = (ArtifactIcon)this.itemObj.GetComponentInChildren <ArtifactIcon>();
                    if (Object.op_Inequality((Object)componentInChildren, (Object)null))
                    {
                        ((Behaviour)componentInChildren).set_enabled(false);
                    }
                    this.itemObj.SetActive(true);
                    AwardParam awardParam = instance.GetAwardParam(str);
                    Transform  child      = this.itemObj.get_transform().FindChild("icon");
                    if (Object.op_Inequality((Object)child, (Object)null))
                    {
                        IconLoader iconLoader = GameUtility.RequireComponent <IconLoader>(((Component)child).get_gameObject());
                        if (!string.IsNullOrEmpty(awardParam.icon))
                        {
                            iconLoader.ResourcePath = AssetPath.ItemIcon(awardParam.icon);
                        }
                        GameParameter component = (GameParameter)((Component)child).GetComponent <GameParameter>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            ((Behaviour)component).set_enabled(false);
                        }
                    }
                    if (Object.op_Inequality((Object)this.frameTex, (Object)null) && Object.op_Inequality((Object)this.coinBase, (Object)null))
                    {
                        this.frameTex.set_sprite(this.coinBase);
                    }
                    if (Object.op_Inequality((Object)this.amountObj, (Object)null))
                    {
                        this.amountObj.SetActive(false);
                        break;
                    }
                    break;
                }
                break;
            }
            this.mType      = type;
            this.mSeasonIdx = idx;
            if (type == VersusTowerRewardItem.REWARD_TYPE.Arrival)
            {
                if (Object.op_Inequality((Object)this.currentMark, (Object)null))
                {
                    this.currentMark.SetActive((int)dataOfClass.Floor - 1 == versusTowerFloor);
                }
                if (Object.op_Inequality((Object)this.current_fil, (Object)null))
                {
                    this.current_fil.SetActive((int)dataOfClass.Floor - 1 == versusTowerFloor);
                }
            }
            else
            {
                if (Object.op_Inequality((Object)this.currentMark, (Object)null))
                {
                    this.currentMark.SetActive((int)dataOfClass.Floor == versusTowerFloor);
                }
                if (Object.op_Inequality((Object)this.current_fil, (Object)null))
                {
                    this.current_fil.SetActive((int)dataOfClass.Floor == versusTowerFloor);
                }
            }
            if (Object.op_Inequality((Object)this.clearMark, (Object)null))
            {
                this.clearMark.SetActive((int)dataOfClass.Floor - 1 < versusTowerFloor);
            }
            if (!Object.op_Inequality((Object)this.cleared_fil, (Object)null))
            {
                return;
            }
            this.cleared_fil.SetActive((int)dataOfClass.Floor - 1 < versusTowerFloor);
        }
コード例 #24
0
        private void Refresh()
        {
            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            LimitedShopData limitedShopData = MonoSingleton <GameManager> .Instance.Player.GetLimitedShopData();

            DebugUtility.Assert(limitedShopData != null, "ショップ情報が存在しない");
            this.ShopName.set_text(GlobalVars.LimitedShopItem.shops.info.title);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Updated, (UnityEngine.Object)null))
            {
                this.Updated.SetActive(GlobalVars.LimitedShopItem.btn_update);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Update, (UnityEngine.Object)null))
            {
                this.Update.SetActive(GlobalVars.LimitedShopItem.btn_update);
            }
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.Lineup, (UnityEngine.Object)null))
            {
                this.Lineup.SetActive(GlobalVars.LimitedShopItem.btn_update);
            }
            for (int index = 0; index < this.mBuyItems.Count; ++index)
            {
                this.mBuyItems[index].get_gameObject().SetActive(false);
            }
            int      count      = limitedShopData.items.Count;
            DateTime serverTime = TimeManager.ServerTime;
            List <LimitedShopItem> nearbyTimeout = new List <LimitedShopItem>();

            for (int index = 0; index < count; ++index)
            {
                LimitedShopItem data1 = limitedShopData.items[index];
                if (data1.end != 0L)
                {
                    DateTime dateTime = TimeManager.FromUnixTime(data1.end);
                    if (!(serverTime >= dateTime))
                    {
                        if ((dateTime - serverTime).TotalHours < 1.0)
                        {
                            nearbyTimeout.Add(data1);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                if (index >= this.mBuyItems.Count)
                {
                    GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate);
                    gameObject.get_transform().SetParent((Transform)this.ItemLayoutParent, false);
                    this.mBuyItems.Add(gameObject);
                }
                GameObject         mBuyItem            = this.mBuyItems[index];
                LimitedShopBuyList componentInChildren = (LimitedShopBuyList)mBuyItem.GetComponentInChildren <LimitedShopBuyList>();
                componentInChildren.limitedShopItem = data1;
                DataSource.Bind <LimitedShopItem>(mBuyItem, data1);
                componentInChildren.amount.SetActive(!data1.IsSet);
                if (data1.IsArtifact)
                {
                    ArtifactParam artifactParam = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(data1.iname);

                    DataSource.Bind <ArtifactParam>(mBuyItem, artifactParam);
                }
                else if (data1.IsConceptCard)
                {
                    ConceptCardData cardDataForDisplay = ConceptCardData.CreateConceptCardDataForDisplay(data1.iname);
                    componentInChildren.SetupConceptCard(cardDataForDisplay);
                }
                else if (data1.IsItem || data1.IsSet)
                {
                    ItemData data2 = new ItemData();
                    data2.Setup(0L, data1.iname, data1.num);
                    DataSource.Bind <ItemData>(mBuyItem, data2);
                    DataSource.Bind <ItemParam>(mBuyItem, MonoSingleton <GameManager> .Instance.GetItemParam(data1.iname));
                }
                else
                {
                    DebugUtility.LogError(string.Format("不明な商品タイプが設定されています (shopitem.iname({0}) => {1})", (object)data1.iname, (object)data1.ShopItemType));
                }
                ListItemEvents component1 = (ListItemEvents)mBuyItem.GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    component1.OnSelect = new ListItemEvents.ListItemEvent(this.OnSelect);
                }
                Button component2 = (Button)mBuyItem.GetComponent <Button>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component2, (UnityEngine.Object)null))
                {
                    ((Selectable)component2).set_interactable(!data1.is_soldout);
                }
                mBuyItem.SetActive(true);
            }
            this.ShowAndSaveTimeOutItem(nearbyTimeout);
            GameParameter.UpdateAll(((Component)this).get_gameObject());
        }
コード例 #25
0
        public override void OnActivate(int pinID)
        {
            if (pinID != 1)
            {
                return;
            }
            PlayerData player = MonoSingleton <GameManager> .Instance.Player;

            ((Behaviour)this).set_enabled(false);
            ShopData shopData = player.GetShopData(GlobalVars.ShopType);

            if (shopData == null)
            {
                this.ActivateOutputLinks(104);
            }
            else
            {
                ShopItem shopitem = shopData.items.FirstOrDefault <ShopItem>((Func <ShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));
                if (shopitem.is_soldout)
                {
                    this.ActivateOutputLinks(105);
                }
                else
                {
                    int       buy       = 0;
                    ItemParam itemParam = (ItemParam)null;
                    if (shopitem.IsArtifact)
                    {
                        buy = MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shopitem.iname).GetBuyNum(shopitem.saleType);
                    }
                    else if (shopitem.IsConceptCard)
                    {
                        if (!MonoSingleton <GameManager> .Instance.Player.CheckConceptCardCapacity(shopitem.num * GlobalVars.ShopBuyAmount))
                        {
                            ConceptCardParam conceptCardParam = MonoSingleton <GameManager> .Instance.MasterParam.GetConceptCardParam(shopitem.iname);

                            if (conceptCardParam != null && conceptCardParam.type == eCardType.Equipment)
                            {
                                this.ActivateOutputLinks(106);
                                return;
                            }
                        }
                    }
                    else
                    {
                        itemParam = MonoSingleton <GameManager> .Instance.GetItemParam(shopitem.iname);

                        if (!shopitem.IsSet && !player.CheckItemCapacity(itemParam, shopitem.num * GlobalVars.ShopBuyAmount))
                        {
                            this.ActivateOutputLinks(106);
                            return;
                        }
                        buy = itemParam.GetBuyNum(shopitem.saleType);
                    }
                    switch (shopitem.saleType)
                    {
                    case ESaleType.Gold:
                        if (!this.CheckCanBuy(shopitem, buy, player.Gold, 107))
                        {
                            return;
                        }
                        break;

                    case ESaleType.Coin:
                        if (!this.CheckCanBuy(shopitem, buy, player.Coin, 108))
                        {
                            return;
                        }
                        break;

                    case ESaleType.TourCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.TourCoin, 109))
                        {
                            return;
                        }
                        break;

                    case ESaleType.ArenaCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.ArenaCoin, 110))
                        {
                            return;
                        }
                        break;

                    case ESaleType.PiecePoint:
                        if (!this.CheckCanBuy(shopitem, buy, player.PiecePoint, 111))
                        {
                            return;
                        }
                        break;

                    case ESaleType.MultiCoin:
                        if (!this.CheckCanBuy(shopitem, buy, player.MultiCoin, 112))
                        {
                            return;
                        }
                        break;

                    case ESaleType.EventCoin:
                        DebugUtility.Assert("There is no common price in the event coin.");
                        this.ActivateOutputLinks(113);
                        return;

                    case ESaleType.Coin_P:
                        if (!this.CheckCanBuy(shopitem, buy, player.PaidCoin, 114))
                        {
                            return;
                        }
                        break;
                    }
                    this.mShopType = GlobalVars.ShopType;
                    int shopBuyIndex = GlobalVars.ShopBuyIndex;
                    if (Network.Mode == Network.EConnectMode.Offline)
                    {
                        if (itemParam == null)
                        {
                            return;
                        }
                        player.DEBUG_BUY_ITEM(this.mShopType, shopBuyIndex);
                        ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                        player.OnBuyAtShop(shopParam.iname, itemParam.iname, shopitem.num);
                        this.Success();
                    }
                    else
                    {
                        if (this.mShopType == EShopType.Guerrilla)
                        {
                            this.ExecRequest((WebAPI) new ReqItemGuerrillaShopBuypaid(shopBuyIndex, GlobalVars.ShopBuyAmount, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        }
                        else
                        {
                            this.ExecRequest((WebAPI) new ReqItemShopBuypaid(this.mShopType.ToString(), shopBuyIndex, GlobalVars.ShopBuyAmount, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                        }
                        ((Behaviour)this).set_enabled(true);
                    }
                }
            }
        }
コード例 #26
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopSoldOut:
                case Network.EErrCode.ShopBuyCostShort:
                case Network.EErrCode.ShopBuyLvShort:
                case Network.EErrCode.ShopBuyNotFound:
                case Network.EErrCode.ShopBuyItemNotFound:
                    this.OnBack();
                    break;

                case Network.EErrCode.ShopRefreshItemList:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(121)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                case Network.EErrCode.ShopBuyOutofItemPeriod:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(120)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                case Network.EErrCode.ShopBuyOutofPeriod:
                    UIUtility.SystemMessage((string)null, Network.ErrMsg, (UIUtility.DialogResultEvent)(go => this.ActivateOutputLinks(122)), (GameObject)null, false, -1);
                    ((Behaviour)this).set_enabled(false);
                    Network.RemoveAPI();
                    Network.ResetError();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopBuyResponse> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                if (jsonObject.body == null)
                {
                    this.OnRetry();
                }
                else
                {
                    Network.RemoveAPI();
                    ShopData shop = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                    }
                    else
                    {
                        MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop);

                        if (jsonObject.body.cards != null && jsonObject.body.cards.Length > 0)
                        {
                            GlobalVars.IsDirtyConceptCardData.Set(true);
                            Json_ShopBuyConceptCard[] cards = jsonObject.body.cards;
                            for (int index = 0; index < cards.Length; ++index)
                            {
                                if (cards[index] != null && cards[index].IsGetConceptCardUnit)
                                {
                                    FlowNode_ConceptCardGetUnit.AddConceptCardData(ConceptCardData.CreateConceptCardDataForDisplay(cards[index].iname));
                                }
                            }
                        }
                        ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                        if (shopParam != null)
                        {
                            PlayerData player   = MonoSingleton <GameManager> .Instance.Player;
                            ShopItem   shopItem = shop.items.FirstOrDefault <ShopItem>((Func <ShopItem, bool>)(item => item.id == GlobalVars.ShopBuyIndex));
                            string     iname    = shopItem.iname;
                            if (shopItem.isSetSaleValue)
                            {
                                MyMetaps.TrackSpendShop(shopItem.saleType, this.mShopType, shopItem.saleValue);
                            }
                            else
                            {
                                int num = !shopItem.IsArtifact ? (!shopItem.IsConceptCard ? MonoSingleton <GameManager> .Instance.GetItemParam(shopItem.iname).GetBuyNum(shopItem.saleType) * shopItem.num : shopItem.saleValue) : MonoSingleton <GameManager> .Instance.MasterParam.GetArtifactParam(shopItem.iname).GetBuyNum(shopItem.saleType) * shopItem.num;

                                if (num > 0)
                                {
                                    MyMetaps.TrackSpendShop(shopItem.saleType, this.mShopType, num);
                                }
                            }
                            player.OnBuyAtShop(shopParam.iname, iname, shopItem.num);
                        }
                        this.Success();
                    }
                }
            }
        }
コード例 #27
0
        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();
            }
        }
コード例 #28
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.ShopRefreshCostShort:
                case Network.EErrCode.ShopRefreshLvSort:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                if (GlobalVars.ShopType != EShopType.Event)
                {
                    WebAPI.JSON_BodyResponse <Json_ShopUpdateResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_ShopUpdateResponse> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnRetry();
                        return;
                    }
                    Network.RemoveAPI();
                    ShopData shop = MonoSingleton <GameManager> .Instance.Player.GetShopData(this.mShopType) ?? new ShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                        return;
                    }
                    MonoSingleton <GameManager> .Instance.Player.SetShopData(this.mShopType, shop);
                }
                else
                {
                    WebAPI.JSON_BodyResponse <Json_EventShopUpdateResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_EventShopUpdateResponse> >(www.text);
                    DebugUtility.Assert(jsonObject != null, "res == null");
                    if (jsonObject.body == null)
                    {
                        this.OnRetry();
                        return;
                    }
                    List <JSON_EventShopItemListSet> eventShopItemListSetList = new List <JSON_EventShopItemListSet>((IEnumerable <JSON_EventShopItemListSet>)jsonObject.body.shopitems);
                    jsonObject.body.shopitems = eventShopItemListSetList.ToArray();
                    Network.RemoveAPI();
                    EventShopData shop = MonoSingleton <GameManager> .Instance.Player.GetEventShopData() ?? new EventShopData();

                    if (!shop.Deserialize(jsonObject.body))
                    {
                        this.OnFailed();
                        return;
                    }
                    MonoSingleton <GameManager> .Instance.Player.SetEventShopData(shop);
                }
                ShopParam shopParam = MonoSingleton <GameManager> .Instance.MasterParam.GetShopParam(this.mShopType);

                if (shopParam != null)
                {
                    PlayerData player = MonoSingleton <GameManager> .Instance.Player;
                    AnalyticsManager.TrackSpendShopUpdate(shopParam.UpdateCostType, this.mShopType, player.GetShopUpdateCost(this.mShopType, true));
                }
                this.Success();
            }
        }
コード例 #29
0
ファイル: BetterQueue.cs プロジェクト: mengtest/RewriteFrame
 void IEnumerator.Reset()
 {
     DebugUtility.Assert(m_StartVersion == m_Queue.m_Version, LOG_TAG, "m_StartVersion == m_Queue.m_Version");
     m_Index          = -1;
     m_CurrentElement = default;
 }
コード例 #30
0
ファイル: BetterQueue.cs プロジェクト: mengtest/RewriteFrame
 public void SetElement(int index, T value)
 {
     DebugUtility.Assert(index >= 0 && index < m_Size, LOG_TAG, "index >= 0 && index < m_Size");
     m_Array[(m_Head + index) % m_Array.Length] = value;
     m_Version++;
 }