コード例 #1
0
        public void call(string args)
        {
            var request = BridgeRequest.Deserialize(args);

            if (request == null)
            {
                DebugUtility.LogError(LoggerTags.Module, "平台调用 -> 异常args:{0}", args);
                return;
            }
            DebugUtility.Log(LoggerTags.Module, "平台调用 -> 传入args:{0}", args);
            var response     = BridgeResponse.CreateDefaultResponse(request.id, request.callbackMethod);
            var invokeMethod = request.invokeMethod.ToEnum(CallUnityMethod.Unknown);
            var method       = caller.PullListener(invokeMethod);

            if (method != null)
            {
                try
                {
                    method(request, response);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    response.SetFailureResult(BridgeCode.Failure);
                    caller.DefaultCallBackPlatform(response);
                }
            }
            else
            {
                DebugUtility.LogError(LoggerTags.Module, "平台调用 -> 方法未监听!method:{0}, id:{1}", request.invokeMethod, request.id);
                response.SetFailureResult(BridgeCode.NorFunc);
                caller.DefaultCallBackPlatform(response);
            }
        }
コード例 #2
0
        public static BridgeRequest Deserialize(string jsonString)
        {
            if (string.IsNullOrEmpty(jsonString))
            {
                return(null);
            }
            try
            {
                var ret  = new BridgeRequest();
                var json = JsonMapper.ToObject(jsonString);
                var keys = json.Keys;

                var id             = (int)json["id"];
                var invokeMethod   = (string)json["func"];
                var args           = keys.Contains("args") ? json["args"] : string.Empty;
                var callbackMethod = keys.Contains("callback") ? (string)json["callback"] : string.Empty;

                ret.id             = id;
                ret.invokeMethod   = invokeMethod;
                ret.args           = args;
                ret.callbackMethod = callbackMethod;
                return(ret);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return(null);
            }
        }
コード例 #3
0
        public static BridgeResponse Deserialize(string jsonString)
        {
            if (string.IsNullOrEmpty(jsonString))
            {
                return(null);
            }
            try
            {
                var ret = new BridgeResponse();

                var json           = JsonMapper.ToObject(jsonString);
                var id             = (int)json["id"];
                var complete       = (int)json["complete"];
                var code           = (int)json["code"];
                var keys           = json.Keys;
                var msg            = keys.Contains("msg") ? (string)json["msg"] : string.Empty;
                var callbackMethod = keys.Contains("callback") ? (string)json["callback"] : string.Empty;
                var data           = keys.Contains("data") ? json["data"] : BridgeUtility.EmptyObject;

                ret.id             = id;
                ret.complete       = complete;
                ret.code           = code;
                ret.msg            = msg;
                ret.callbackMethod = callbackMethod;
                ret.data           = data;
                return(ret);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return(null);
            }
        }
コード例 #4
0
        public static Component DeserializeFromJson(RobotComponentDataModel componentDataModel)
        {
            var component = componentDataModel.component;

            if (component == null)
            {
                return(null);
            }

            var targetType = component.GetType();

            if (!msJsonToComponent.TryGetValue(targetType, out var convert))
            {
                foreach (var kv in msJsonToComponent)
                {
                    if (targetType.IsCompatibleWith(kv.Key))
                    {
                        convert = kv.Value;
                        break;
                    }
                }
            }
            if (convert != null)
            {
                try
                {
                    convert(componentDataModel, component);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                }
            }
            return(component);
        }
コード例 #5
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");
                Network.RemoveAPI();
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

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

                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.items);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    return;
                }
                GameParameter.UpdateValuesOfType(GameParameter.ParameterTypes.GLOBAL_PLAYER_GOLD);
                ((Behaviour)this).set_enabled(false);
            }
        }
コード例 #6
0
    public static bool Setup(string path)
    {
        path = !string.IsNullOrEmpty(path) ? path : "Data/Localnotification";
        string src = AssetManager.LoadTextData(path);

        if (string.IsNullOrEmpty(src))
        {
            return(false);
        }
        try
        {
            JSON_LocalNotificationInfo[] jsonArray = JSONParser.parseJSONArray <JSON_LocalNotificationInfo>(src);
            if (jsonArray == null)
            {
                throw new InvalidJSONException();
            }
            MyLocalNotification.mLocalNotifications.Clear();
            foreach (JSON_LocalNotificationInfo json in jsonArray)
            {
                LocalNotificationInfo notificationInfo = new LocalNotificationInfo();
                if (notificationInfo.Deserialize(GameUtility.Config_Language, json))
                {
                    MyLocalNotification.mLocalNotifications.Add(notificationInfo);
                }
            }
        }
        catch (Exception ex)
        {
            DebugUtility.LogException(ex);
            return(false);
        }
        return(true);
    }
コード例 #7
0
        private static bool DoOpen(Window win, object param)
        {
            try
            {
                if (win == null || win.HasDestroyed())
                {
                    return(false);
                }
                DebugUtility.Log(LoggerTags.UI, "DoOpen : {0}", win.name);

                if (win.used)
                {
                    msUsedWindows.Remove(win);
                }
                else
                {
                    msUnusedWindows.Remove(win);
                }

                msUsedWindows.Add(win);
                DebugUtility.Log(LoggerTags.UI, "Before SortUsedWindows : {0}", win.name);
                SortUsedWindows();
                DebugUtility.Log(LoggerTags.UI, "After SortUsedWindows : {0}", win.name);
                win.Open(param);
                DebugUtility.Log(LoggerTags.UI, "After Open : {0}", win.name);
                Misc.SafeInvoke(onOpenWindow, win);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return(false);
            }
            return(true);
        }
コード例 #8
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCardFavorite.Json_ConceptCardFavorite> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCardFavorite.Json_ConceptCardFavorite> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         try
         {
             MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.concept_card);
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             return;
         }
         this.ActivateOutputLinks(this.mOutPutPinId);
         ((Behaviour)this).set_enabled(false);
     }
 }
コード例 #9
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         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();
         GameManager instance = MonoSingleton <GameManager> .Instance;
         try
         {
             instance.Deserialize(jsonObject.body.friends, FriendStates.Follwer);
             this.Success();
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             return;
         }
         if (!Object.op_Inequality((Object)this, (Object)null))
         {
             return;
         }
         ((Behaviour)this).set_enabled(false);
     }
 }
コード例 #10
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");
                Network.RemoveAPI();
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

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

                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.items);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    return;
                }
                ((Behaviour)this).set_enabled(false);
                MonoSingleton <GameManager> .Instance.Player.OnOpenTobiraTrophy((long)GlobalVars.SelectedUnitUniqueID);
            }
        }
コード例 #11
0
ファイル: EventShopData.cs プロジェクト: zunaalabaya/TAC-BOT
 public bool Deserialize(Json_EventShopUpdateResponse response)
 {
     if (response.currencies == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.currencies);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     if (response.items == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.items);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     if (response.shopitems == null || !this.Deserialize(response.shopitems))
     {
         return(false);
     }
     this.UpdateCount = response.relcnt;
     return(true);
 }
コード例 #12
0
        public override void OnSuccess(WWWResult www)
        {
            if (TowerErrorHandle.Error((FlowNode_Network)this))
            {
                return;
            }
            WebAPI.JSON_BodyResponse <FlowNode_ReqTowerRecover.JSON_ReqTowerRecoverResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqTowerRecover.JSON_ReqTowerRecoverResponse> >(www.text);
            DebugUtility.Assert(jsonObject != null, "res == null");
            Network.RemoveAPI();
            GameManager instance = MonoSingleton <GameManager> .Instance;

            try
            {
                instance.Deserialize(jsonObject.body.player);
                instance.TowerResuponse.Deserialize(jsonObject.body.pdeck);
                instance.TowerResuponse.rtime       = (long)jsonObject.body.rtime;
                instance.TowerResuponse.recover_num = jsonObject.body.rcv_num;
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return;
            }
            this.Success();
        }
コード例 #13
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                this.OnRetry();
            }
            else
            {
                WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCard.Json_ConceptCardList> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCard.Json_ConceptCardList> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                Network.RemoveAPI();
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.cards, this.mIsDataOverride);

                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.materials, this.mIsDataOverride);

                    GlobalVars.IsDirtyConceptCardData.Set(false);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    return;
                }
                this.StartCoroutine(this.DownloadAssetsAndOutputPin());
            }
        }
コード例 #14
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         if (Network.ErrCode == Network.EErrCode.CountLimitForPlayer)
         {
             Network.RemoveAPI();
             Network.ResetError();
             this.Success();
         }
         else
         {
             this.OnBack();
         }
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_GoogleReview> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GoogleReview> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         try
         {
             MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body);
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             this.Failure();
             return;
         }
         this.Success();
     }
 }
コード例 #15
0
        private void OnRequestResult(WWWResult www)
        {
            if (Network.IsError)
            {
                if (Network.ErrCode == Network.EErrCode.AbilityCoinShort)
                {
                    FlowNode_Network.Back();
                }
                else
                {
                    FlowNode_Network.Retry();
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

                    Network.RemoveAPI();
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    FlowNode_Network.Retry();
                    return;
                }
                AnalyticsManager.TrackOriginalCurrencyUse(ESaleType.Coin, (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.AbilityRankUpCountCoin, "AbilityPoint");
                this.UpdateValue();
                this.Success();
            }
        }
コード例 #16
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                this.OnRetry();
            }
            else
            {
                WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCardSell.Json_ConceptCardSell> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCardSell.Json_ConceptCardSell> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                Network.RemoveAPI();
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

                    MonoSingleton <GameManager> .Instance.Player.RemoveConceptCardData(jsonObject.body.sell_ids);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    return;
                }
                MonoSingleton <GameManager> .Instance.Player.OnGoldChange(this.totalSellZeny);

                this.ActivateOutputLinks(100);
                ((Behaviour)this).set_enabled(false);
            }
        }
コード例 #17
0
 public bool Deserialize(Json_LimitedShopBuyResponse response)
 {
     if (response.currencies == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.currencies);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     if (response.items != null)
     {
         try
         {
             MonoSingleton <GameManager> .Instance.Player.Deserialize(response.items);
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             return(false);
         }
     }
     if (response.shopitems == null)
     {
         return(false);
     }
     JSON_LimitedShopItemListSet[] shopitems = response.shopitems;
     for (int index = 0; index < shopitems.Length; ++index)
     {
         LimitedShopItem limitedShopItem = this.items[index];
         if (limitedShopItem == null)
         {
             limitedShopItem = new LimitedShopItem();
             this.items.Add(limitedShopItem);
         }
         if (!limitedShopItem.Deserialize(shopitems[index]))
         {
             return(false);
         }
     }
     if (response.mail_info == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.mail_info);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     return(true);
 }
コード例 #18
0
        public bool Deserialize(JsonData json)
        {
            try
            {
                m_KeyToUnit[msLP_LTBU.source]      = msLP_LTBU;
                m_KeyToUnit[msGroup.source]        = msGroup;
                m_KeyToUnit[msBone_M87_BLK.source] = msBone_M87_BLK;

                var content = json;
                for (int i = 0; i < content.Count; i++)
                {
                    var item   = content[i];
                    var unit   = new PartUnit();
                    var source = (string)item["Source"];
                    unit.source         = source;
                    unit.id             = (string)item["Id"];
                    unit.type           = ((string)item["Type"]).ToEnum(PartType.Normal);
                    m_KeyToUnit[source] = unit;
#if UNITY_EDITOR
                    unitIcons.Add(source);
#endif
                }
                return(true);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return(false);
            }
        }
コード例 #19
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");
                Network.RemoveAPI();
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

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

                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)UnitEnhanceV3.Instance, (UnityEngine.Object)null))
                    {
                        UnitEnhanceV3.Instance.OnEquipConceptCardSelect();
                    }
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    return;
                }
                ((Behaviour)this).set_enabled(false);
            }
        }
コード例 #20
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");
         if (jsonObject.body == null)
         {
             this.OnFailed();
         }
         else
         {
             try
             {
                 MonoSingleton <GameManager> .Instance.Player.Deserialize(jsonObject.body.player);
             }
             catch (Exception ex)
             {
                 DebugUtility.LogException(ex);
                 this.OnFailed();
                 return;
             }
             Network.RemoveAPI();
             AnalyticsManager.TrackSpendCoin(this.ResetType.ToString(), this.getRequiredCoin());
             this.Success();
         }
     }
 }
コード例 #21
0
        private bool LoadJson(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }
            string src = AssetManager.LoadTextData(path);

            if (string.IsNullOrEmpty(src))
            {
                return(false);
            }
            try
            {
                JSON_QuestDropParam jsonObject = JSONParser.parseJSONObject <JSON_QuestDropParam>(src);
                if (jsonObject == null)
                {
                    throw new InvalidJSONException();
                }
                this.Deserialize(jsonObject);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
                return(false);
            }
            return(true);
        }
コード例 #22
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         Network.EErrCode errCode = Network.ErrCode;
         this.OnFailed();
     }
     else
     {
         WebAPI.JSON_BodyResponse <Json_QuestList> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_QuestList> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         try
         {
             MonoSingleton <GameManager> .Instance.Deserialize(GameUtility.Config_Language, jsonObject.body);
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             this.Failure();
             return;
         }
         this.Success();
     }
 }
コード例 #23
0
        public IEnumerator PostInitialize()
        {
            mPostInited = true;
            try
            {
                if (mRobots.Count > 0)
                {
                    ActiveRobot(mRobots[0].gameObject.name);
                    WindowManager.CloseAll();
                    WindowManager.Open <SimulationWindow>();
                }

                //Reconnect();
                //var hostRef = NetworkManager.GetOrAlloc().hostSettingRef;
                //if (hostRef.connType == EHostConnType.Deploy)
                //{
                //	var conn = netMgr.ConnectToScratch();
                //	mAcitivedConn = new RobotConnection() { host = netMgr.hostSettingRef.GetHost(), conn = conn };
                //	return;
                //}

                ////var wconn = new RobotConnection() { conn = windmill, host = hostRef.scratchWindmillSIMHost };
                ////var rconn = new RobotConnection() { conn = roboticArm, host = hostRef.scratchRoboticArmSIMHost };

                //var windmill = NetworkManager.GetOrAlloc().ConnectToScratch(hostRef.scratchWindmillSIMHost, true);
                //var roboticArm = NetworkManager.GetOrAlloc().ConnectToScratch(hostRef.scratchRoboticArmSIMHost, true);
            }
            catch (Exception ex)
            {
                DebugUtility.LogException(ex);
            }

            yield break;
        }
コード例 #24
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.NoMail:
                    this.OnBack();
                    break;

                case Network.EErrCode.MailReadable:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            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.items);

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

                        if (!MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.mails))
                        {
                            this.OnRetry();
                            return;
                        }
                        if (jsonObject.body.artifacts != null)
                        {
                            MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.artifacts, false);
                        }
                    }
                    catch (Exception ex)
                    {
                        DebugUtility.LogException(ex);
                        this.OnRetry();
                        return;
                    }
                    Network.RemoveAPI();
                    ((Behaviour)this).set_enabled(false);
                    this.Success();
                }
            }
        }
コード例 #25
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.FindNoFriend:
                    Network.RemoveAPI();
                    Network.ResetError();
                    this.Failure();
                    break;

                case Network.EErrCode.FindIsMine:
                    ((Behaviour)this).set_enabled(false);
                    this.OnBack();
                    break;

                case Network.EErrCode.StringTooShort:
                    ((Behaviour)this).set_enabled(false);
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                DebugMenu.Log("API", "find/friend:" + www.text);
                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
                {
                    Network.RemoveAPI();
                    try
                    {
                        if (jsonObject.body.friends == null || jsonObject.body.friends.Length < 1)
                        {
                            throw new InvalidJSONException();
                        }
                        FriendData friendData = new FriendData();
                        friendData.Deserialize(jsonObject.body.friends[0]);
                        GlobalVars.FoundFriend = friendData;
                        this.Success();
                    }
                    catch (Exception ex)
                    {
                        DebugUtility.LogException(ex);
                        this.Failure();
                    }
                }
            }
        }
コード例 #26
0
ファイル: ShopData.cs プロジェクト: zunaalabaya/TAC-BOT
 public bool Deserialize(Json_ShopBuyResponse response)
 {
     if (response.currencies == null)
     {
         return(false);
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.currencies);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     if (response.items != null)
     {
         try
         {
             MonoSingleton <GameManager> .Instance.Player.Deserialize(response.items);
         }
         catch (Exception ex)
         {
             DebugUtility.LogException(ex);
             return(false);
         }
     }
     if (response.shopitems == null)
     {
         return(false);
     }
     Json_ShopItem[] shopitems = response.shopitems;
     for (int index = 0; index < shopitems.Length; ++index)
     {
         ShopItem shopItem = this.items[index];
         if (shopItem == null)
         {
             shopItem = new ShopItem();
             this.items.Add(shopItem);
         }
         if (!shopItem.Deserialize(shopitems[index]))
         {
             return(false);
         }
     }
     try
     {
         MonoSingleton <GameManager> .Instance.Player.Deserialize(response.units);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
         return(false);
     }
     GlobalVars.ConceptCardNum.Set(response.concept_count);
     return(true);
 }
コード例 #27
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                switch (Network.ErrCode)
                {
                case Network.EErrCode.NoJobLvUpEquip:
                    this.OnFailed();
                    break;

                case Network.EErrCode.EquipNotComp:
                    this.OnBack();
                    break;

                default:
                    this.OnRetry();
                    break;
                }
            }
            else
            {
                WebAPI.JSON_BodyResponse <Json_PlayerDataAll> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PlayerDataAll> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                try
                {
                    if (jsonObject.body == null)
                    {
                        throw new InvalidJSONException();
                    }
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

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

                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.items);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    this.OnRetry();
                    return;
                }
                Network.RemoveAPI();
                MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedUnitUniqueID).SetJobIndex((int)GlobalVars.SelectedUnitJobIndex);

                if ((GlobalVars.JobRankUpTypes)GlobalVars.JobRankUpType == GlobalVars.JobRankUpTypes.Unlock)
                {
                    this.mSuccessPinID = 2;
                }
                else if ((GlobalVars.JobRankUpTypes)GlobalVars.JobRankUpType == GlobalVars.JobRankUpTypes.ClassChange)
                {
                    this.mSuccessPinID = 3;
                }
                this.Success();
            }
        }
コード例 #28
0
 public void LoadRobot(string jsonData, Action <IRobot> onCompleted)
 {
     try
     {
         LoadRobot(JsonMapper.ToObject(jsonData), onCompleted);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
     }
 }
コード例 #29
0
 protected override void CallBackPlatform(string result)
 {
     try
     {
         Callback(result);
     }
     catch (Exception ex)
     {
         DebugUtility.LogException(ex);
     }
 }
コード例 #30
0
        public override void OnSuccess(WWWResult www)
        {
            if (Network.IsError)
            {
                Network.EErrCode errCode = Network.ErrCode;
                this.OnRetry();
            }
            else
            {
                WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCardMix.Json_ConceptCardMix> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqConceptCardMix.Json_ConceptCardMix> >(www.text);
                DebugUtility.Assert(jsonObject != null, "res == null");
                Network.RemoveAPI();
                long iid              = -1;
                int  beforeLevel      = -1;
                int  beforeAwakeCount = -1;
                int  beforeTrust      = -1;
                if (jsonObject.body.concept_card != null)
                {
                    iid = jsonObject.body.concept_card.iid;
                    ConceptCardData conceptCardByUniqueId = MonoSingleton <GameManager> .Instance.Player.FindConceptCardByUniqueID(iid);

                    if (conceptCardByUniqueId != null)
                    {
                        beforeLevel      = (int)conceptCardByUniqueId.Lv;
                        beforeAwakeCount = (int)conceptCardByUniqueId.AwakeCount;
                        beforeTrust      = (int)conceptCardByUniqueId.Trust;
                    }
                }
                try
                {
                    MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body.player);

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

                    MonoSingleton <GameManager> .Instance.Player.RemoveConceptCardData(jsonObject.body.mix_ids);
                }
                catch (Exception ex)
                {
                    DebugUtility.LogException(ex);
                    return;
                }
                MonoSingleton <GameManager> .Instance.Player.OnGoldChange(this.totalMixZeny);

                MonoSingleton <GameManager> .Instance.ServerSyncTrophyExecEnd(www);

                ConceptCardData conceptCardByUniqueId1 = MonoSingleton <GameManager> .Instance.Player.FindConceptCardByUniqueID(iid);

                MonoSingleton <GameManager> .Instance.Player.OnMixedConceptCard(conceptCardByUniqueId1.Param.iname, beforeLevel, (int)conceptCardByUniqueId1.Lv, beforeAwakeCount, (int)conceptCardByUniqueId1.AwakeCount, beforeTrust, (int)conceptCardByUniqueId1.Trust);

                this.ActivateOutputLinks(1000);
                ((Behaviour)this).set_enabled(false);
            }
        }