Esempio n. 1
0
 private void LoadTitleData(GetTitleDataResult result)
 {
     if (result != null)
     {
         ExpPerLevel = Int32.Parse(result.Data ["ExpPerLevel"]);
     }
 }
Esempio n. 2
0
 void Respond(GetTitleDataResult result, PlayFabError error)
 {
     if (OnResponse != null)
     {
         OnResponse(this, error);
     }
 }
Esempio n. 3
0
 private void OnGetTitleData(GetTitleDataResult result)
 {
     _androidPushSenderId = result.Data["AndroidPushSenderId"];
     Debug.Log("PlayFab: Sender id: " + _androidPushSenderId);
     PlayFabAndroidPushPlugin.Setup(_androidPushSenderId);
     PlayFabAndroidPushPlugin.TriggerManualRegistration();
 }
Esempio n. 4
0
    private static void OnGetTitleDataSuccess(GetTitleDataResult result)
    {
        ExtractJsonTitleData(result.Data, "Achievements", ref Achievements);
//        ExtractJsonTitleData(result.Data, "ActiveEventKeys", ref ActiveEventKeys);
        ExtractJsonTitleData(result.Data, "CharacterLevelRamp", ref CharacterLevelRamp);
        ExtractJsonTitleData(result.Data, "Classes", ref Classes);
//        ExtractJsonTitleData(result.Data, "Events", ref Events);
        ExtractJsonTitleData(result.Data, "Levels", ref Levels);
        ExtractJsonTitleData(result.Data, "MinimumInterstitialWait", ref MinimumInterstitialWait);
        ExtractJsonTitleData(result.Data, "Spells", ref Spells);
        ExtractJsonTitleData(result.Data, "StandardStores", ref StandardStores);
        ExtractJsonTitleData(result.Data, "StartingCharacterSlots", ref StartingCharacterSlots);
        ExtractJsonTitleData(result.Data, "UseCDN", ref UseCDN);
//        DoExtraEventProcessing();

        AndroidPushSenderId = GlobalStrings.DEFAULT_ANDROID_PUSH_SENDER_ID;
        if (result.Data.ContainsKey("AndroidPushSenderId"))
        {
            AndroidPushSenderId = result.Data["AndroidPushSenderId"];
        }
        Debug.Log("AccountStatusController: Set AndroidPushSenderId from titleData: \"" + AndroidPushSenderId + "\"");
        if (result.Data.ContainsKey("CommunityWebsite"))
        {
            CommunityWebsite = result.Data["CommunityWebsite"];
        }

        PF_Bridge.RaiseCallbackSuccess("Title Data Loaded", PlayFabAPIMethods.GetTitleData_General, MessageDisplayStyle.none);
    }
Esempio n. 5
0
 protected override void succesfullTitleDataQuerry(GetTitleDataResult result)
 {
     foreach (var entry in result.Data)
     {
         deckList.Add(JsonUtility.FromJson <StoreDeck>(entry.Value));
     }
 }
Esempio n. 6
0
 protected virtual void succesfullTitleDataQuerry(GetTitleDataResult result)
 {
     Debug.Log("Got the following titleData:");
     foreach (var entry in result.Data)
     {
         Debug.Log(entry.Key + ": " + entry.Value);
     }
 }
Esempio n. 7
0
 public void GetTitleDataServerStatus_Completed(GetTitleDataResult obj)
 {
     if (!Running)
     {
         return;
     }
     this.metaLoopGameManager.ReadTitleData(obj);
 }
Esempio n. 8
0
    private void OnSeedFetched(GetTitleDataResult result)
    {
        int newSeed;

        if (result != null && result.Data != null && result.Data.ContainsKey("kings_favorite_random_seed") && int.TryParse(result.Data["kings_favorite_random_seed"], out newSeed))
        {
            this.UpdateRandomPart(newSeed);
        }
        this.isFetchingSeed = false;
    }
Esempio n. 9
0
    private void OnVersionResult(GetTitleDataResult obj)
    {
        Debug.Log("Getting Version");

        version = JsonUtility.FromJson <Version>(obj.Data["Version"]);

        CompareVersion();

        Debug.Log("Game Version : " + version.LiveVersion);
    }
Esempio n. 10
0
    private void OnCircleParametersResult(GetTitleDataResult obj)
    {
        Debug.Log("Getting Circle Parameters");

        circleProperties = JsonUtility.FromJson <CircleProperties>(obj.Data["CircleParameters"]);

        SetCircleParametersPlayerPrefs();
        //Debug.Log("circleProperties Time : " + circleProperties.InitialTime + " " + circleProperties.MinimumTime +" " + circleProperties.TimeReduceAmount);
        //Debug.Log("circleProperties Scale : " + circleProperties.MaxScaleTollerance + " " + circleProperties.MinScaleTollerance +" " + circleProperties.PerfectScaleMaximum + " " + circleProperties.PerfectScaleMinimum);
    }
Esempio n. 11
0
 private void LoadTitleData(GetTitleDataResult result)
 {
     if (result != null)
     {
         ExpPerLevel = Int32.Parse(result.Data ["ExpPerLevel"]);
         ExpForWin   = Int32.Parse(result.Data ["ExpForWin"]);
         ExpForLoose = Int32.Parse(result.Data ["ExpForLoose"]);
     }
     TitleDataLoaded = true;
 }
    private void OnGetTitleData(NetworkConnection connection, GetTitleDataResult result)
    {
        //Do something cool with title data and Return back to the client.
        var output = string.Format("Recieved {0} Title Data Keys", result.Data.Keys.Count);

        Logger.Dispatch(LoggerTypes.Info, output);
        connection.Send(1002, new StringMessage()
        {
            value = string.Format(output)
        });
    }
Esempio n. 13
0
 private void OnLoginSuccess(GetTitleDataResult result)
 {
     if (result.Data.ContainsKey(tag))
     {
         onSucceed?.Invoke($"{tag} : {result.Data[tag]}");
     }
     else
     {
         onSucceed?.Invoke($"Can't find {tag}");
     }
 }
Esempio n. 14
0
 void DebugLogTitleData(GetTitleDataResult result)
 {
     if (result.Data != null)
     {
         var stringBuilder = new StringBuilder();
         foreach (var item in result.Data)
         {
             stringBuilder.AppendFormat("{0}:{1}\n", item.Key, item.Value);
         }
         Debug.Log(stringBuilder);
     }
 }
        private void OnSucces(GetTitleDataResult result)
        {
            string value = null;

            if (result.Data != null)
            {
                if (result.Data.TryGetValue(key.Value, out value))
                {
                    data.Value = value;
                }
            }

            Fsm.Event(successEvent);
        }
Esempio n. 16
0
        protected virtual void DownloadTitleData_Completed(GetTitleDataResult result)
        {
            Debug.Log("MetaLoopGameManager Downloading TitleData Completed...");
            if (result != null)
            {
                if (!ReadTitleData(result, false))
                {
                    return;
                }
            }
            else
            {
                ShowUnavailableMessage(GameUnavailableMessageType.HOST_UNREACHABLE);
                return;
            }

            AssetManifest assetManifest;

            if (result.Data.ContainsKey(MetaStateSettings._TitleDataKey_CdnManifest))
            {
                assetManifest = JsonConvert.DeserializeObject <AssetManifest>(result.Data[MetaStateSettings._TitleDataKey_CdnManifest]);
                RemoteAssetsManager.Init(assetManifest);
            }


            if (result.Data.ContainsKey(MetaStateSettings._TitleDataKey_RemoteConfig))
            {
                RemoteConfigData.Load(result.Data[MetaStateSettings._TitleDataKey_RemoteConfig]);
            }
            else
            {
                RemoteConfigData.Load(null);
            }


            EventManagerState eventManagerState;

            if (result.Data.ContainsKey(MetaStateSettings._TitleDataKey_EventManager))
            {
                eventManagerState = JsonConvert.DeserializeObject <EventManagerState>(result.Data[MetaStateSettings._TitleDataKey_EventManager]);
            }
            else
            {
                eventManagerState = new EventManagerState();
            }

            Debug.Log("MetaLoopGameManager Downloading User Data...");

            DownloadUserData();
        }
    public UniTask <GetTitleDataResult> TryGetDataAsync()
    {
        var source = new UniTaskCompletionSource <GetTitleDataResult>();
        Action <GetTitleDataResult> resultCallback = (_result) =>
        {
            result = _result;
            Debug.Log(Dump());
            source.TrySetResult(_result);
        };
        Action <PlayFabError> errorCallback = (_error) => source.TrySetException(new Exception(_error.GenerateErrorReport()));

        PlayFabClientAPI.GetTitleData(new GetTitleDataRequest(), resultCallback, errorCallback);
        return(source.Task);
    }
Esempio n. 18
0
    public static void StoreItemsFromJson(GetTitleDataResult res)
    {
        Items.Clear();
        var allRewardsJson = JSON.Parse(res.Data["fm_rewards"]);

        for (int i = 0; i < allRewardsJson.Count; i++)
        {
            var          reward  = allRewardsJson[i];
            FMRewardType type    = reward["item_key"] == null ? FMRewardType.Currency : FMRewardType.Item;
            int          amount  = type == FMRewardType.Currency ? reward["amount"].AsInt : 0;
            string       itemKey = type == FMRewardType.Item ? reward["item_key"].Value : "";
            var          ri      = new FMRewardItem(reward["key"], reward["reward_type"], amount, itemKey, type);
            Items.Add(ri);
        }
    }
Esempio n. 19
0
        void RetrieveCallback(GetTitleDataResult result)
        {
            Value = result.Data;

            if (OnRetrieved != null)
            {
                OnRetrieved(this);
            }

            Respond(result, null);

            if (IsOnline)
            {
                Save(result, FileName);
            }
        }
Esempio n. 20
0
    public static void OnGetTitleDataSuccess(GetTitleDataResult result)
    {
        Debug.Log("OnGetTitleDataSuccess");

        Debug.Log("OnGetTitleDataSuccess -- Spells");
        if (result.Data.ContainsKey("Spells"))
        {
            Spells = PlayFabSimpleJson.DeserializeObject <Dictionary <string, FG_SpellDetail> >(result.Data["Spells"]);
            Debug.Log(string.Format("{0} Spell count found", Spells.Count));
        }

        Debug.Log("OnGetTitleDataSuccess -- Classes");
        if (result.Data.ContainsKey("Classes"))
        {
            Classes = PlayFabSimpleJson.DeserializeObject <Dictionary <string, FG_ClassDetail> >(result.Data["Classes"]);
            Debug.Log(string.Format("{0} Classes count found", Classes.Count));
        }

        Debug.Log("OnGetTitleDataSuccess -- Levels");
        if (result.Data.ContainsKey("Levels"))
        {
            Levels = PlayFabSimpleJson.DeserializeObject <Dictionary <string, FG_LevelData> >(result.Data["Levels"]);
            Debug.Log(Levels.Count + " sbdaibdaiubdiabba");
        }

        Debug.Log("OnGetTitleDataSuccess -- MinimumInterstitialWait");
        if (result.Data.ContainsKey("MinimumInterstitialWait"))
        {
            MinimumInterstitialWait = float.Parse(result.Data["MinimumInterstitialWait"]);
        }

        Debug.Log("OnGetTitleDataSuccess -- CharacterLevelRamp");
        if (result.Data.ContainsKey("CharacterLevelRamp"))
        {
            CharacterLevelRamp = PlayFabSimpleJson.DeserializeObject <Dictionary <string, int> >(result.Data["CharacterLevelRamp"]);
        }

        if (result.Data.ContainsKey("StandardStores"))
        {
            //StandardStores = PlayFabSimpleJson.DeserializeObject<List<string>>(result.Data["StandardStores"]);
            Debug.Log("Standard Stores Retrieved");
        }

        PF_Bridge.RaiseCallbackSuccess("Title Data Loaded", PlayFabAPIMethods.GetTitleData, MessageDisplayStyle.none);
    }
        private void parseConfig(string configProperty, PlatformConfig platformConfig,
                                 GetTitleDataResult result, Action <PlatformConfig> successHandler, Action failureHandler)
        {
            string configValue;

            if (!result.Data.TryGetValue(configProperty, out configValue))
            {
                throw new Exception("Couldn't find Title Data property : " + configProperty);
            }

            RawConfigSet configSet = JsonUtility.FromJson <RawConfigSet>(configValue);
            RawConfig    rawConfig = configSet.GetRawConfigByPlatform(platformConfig.PlatformType);

            platformConfig.CatalogID           = rawConfig.CatalogID;
            platformConfig.StoreID             = rawConfig.StoreID;
            platformConfig.AssetBundleBasePath = rawConfig.AssetBundleBasePath;

            successHandler(platformConfig);
        }
Esempio n. 22
0
    /// <summary>
    /// get title achievements
    /// </summary>
    /// <param name="res"></param>
    public void StoreItemsFromJson(GetTitleDataResult res)
    {
        Items.Clear();
        var titleAchievements = JSON.Parse(res.Data["fm_achievements"]);

        for (int i = 0; i < titleAchievements.Count; i++)
        {
            var item = new FMAchievementItem();
            item.Key   = titleAchievements[i]["key"].Value;
            item.Title = titleAchievements[i]["title"].Value;

            item.AmountRequired = new int[titleAchievements[i]["count"].AsArray.Count];
            item.RewardKeys     = new string[titleAchievements[i]["reward_keys"].Count];
            for (int j = 0; j < titleAchievements[i]["reward_keys"].Count; j++)
            {
                item.RewardKeys[j]     = titleAchievements[i]["reward_keys"][j].Value;
                item.AmountRequired[j] = titleAchievements[i]["count"][j].AsInt;
            }
            item.Statistic = titleAchievements[i]["statistic_name"].Value;
            item.iconName  = titleAchievements[i]["icon"].Value;

            Items.Add(item);
        }
    }
Esempio n. 23
0
 //游戏数据接收成功后调用
 void OnGetTitleData(GetTitleDataResult result)
 {
     //在GameInfo中保存游戏数据
     GameInfo.titleData = result.Data;
     OnMessageResponse();    //PlayFab的数据是否接收完毕
 }
Esempio n. 24
0
 /// <summary>
 /// Event called when title data load completes.
 /// </summary>
 /// <param name="result">Title data.</param>
 private void OnTitleDataLoadSuccess(GetTitleDataResult result)
 {
     titleData = result.Data;
 }
Esempio n. 25
0
        public bool ReadTitleData(GetTitleDataResult obj, bool fromRoutineTaskManager = true)
        {
            ServerInfo serverInfo;

            if (obj != null && obj.Data.ContainsKey(MetaStateSettings._TitleDataKey_ServerInfo))
            {
                serverInfo = JsonConvert.DeserializeObject <ServerInfo>(obj.Data[MetaStateSettings._TitleDataKey_ServerInfo]);

                if ((serverInfo.CacheVersion < lastServerInfoCacheVersion) && IsGameAvailable)
                {
                    return(true);                                                                           //ignore this manifest.
                }
                lastServerInfoCacheVersion = serverInfo.CacheVersion;

                if (serverInfo.ServerStatus != ServerStatus.Online)
                {
                    GameUnavailableMessageType gameUnavailableMessageType = GameUnavailableMessageType.MAINTENANCE;

                    if (!string.IsNullOrEmpty(serverInfo.MaintenanceMessage))
                    {
                        try
                        {
                            gameUnavailableMessageType = (GameUnavailableMessageType)Enum.Parse(typeof(GameUnavailableMessageType), serverInfo.MaintenanceMessage);
                        }
                        catch { }
                    }

                    ShowUnavailableMessage(gameUnavailableMessageType);

                    return(false);
                }
                else if (serverInfo.ServerStatus == ServerStatus.Online)
                {
                    //"0.1" is wildcard for dev/staging env
                    if (serverInfo.AppVersion == MetaStateSettings.GetMajorVersion() || serverInfo.AppVersion == "0.10" || serverInfo.AppVersion == "0.1")
                    {
                        IsGameAvailable = true;

                        if (fromRoutineTaskManager && DataLayer.Instance.Connection != null)
                        {
                            if (obj != null && obj.Data.ContainsKey(MetaStateSettings._TitleDataKey_EventManager))
                            {
                                EventManagerState eventManagerState = JsonConvert.DeserializeObject <EventManagerState>(obj.Data[MetaStateSettings._TitleDataKey_EventManager]);
                                GameData.Current.EventManagerState = eventManagerState;
                                GameData.Current.EventManagerState.SyncState(EventData.GetAllEvents());
                            }
                        }
                    }
                    else
                    {
                        ShowUnavailableMessage(GameUnavailableMessageType.VERSION_MISMATCH);
                    }
                }
            }
            else
            {
                if (CheckInternetConnection())
                {
                    ShowUnavailableMessage(GameUnavailableMessageType.HOST_UNREACHABLE);
                }
                else
                {
                    ShowUnavailableMessage(GameUnavailableMessageType.INTERNET_ERROR);
                }

                return(false);
            }

            return(true);
        }
Esempio n. 26
0
 private void OnTitleData(GetTitleDataResult result)
 {
     Data = result.Data;
     PlayFabTitleDataLoaded = true;
 }
Esempio n. 27
0
    private static void OnGetTitleDataSuccess(GetTitleDataResult result)
    {
        Debug.Log("OnGetTitleDataSuccess");

        Debug.Log("OnGetTitleDataSuccess -- Classes");
        if (result.Data.ContainsKey("Classes"))
        {
            Spells = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_SpellDetail> >(result.Data["Spells"]);
        }

        Debug.Log("OnGetTitleDataSuccess -- Spells");
        if (result.Data.ContainsKey("Spells"))
        {
            Classes = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_ClassDetail> >(result.Data["Classes"]);
        }

        Debug.Log("OnGetTitleDataSuccess -- StartingCharacterSlots");
        if (result.Data.ContainsKey("StartingCharacterSlots"))
        {
            StartingCharacterSlots = Int32.Parse(result.Data["StartingCharacterSlots"]);
        }

        Debug.Log("OnGetTitleDataSuccess -- MinimumInterstitialWait");
        if (result.Data.ContainsKey("MinimumInterstitialWait"))
        {
            MinimumInterstitialWait = float.Parse(result.Data["MinimumInterstitialWait"]);
        }

        Debug.Log("OnGetTitleDataSuccess -- CharacterLevelRamp");
        if (result.Data.ContainsKey("CharacterLevelRamp"))
        {
            CharacterLevelRamp = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, int> >(result.Data["CharacterLevelRamp"]);
        }

        Debug.Log("OnGetTitleDataSuccess -- Levels");
        if (result.Data.ContainsKey("Levels"))
        {
            Levels = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_LevelData> >(result.Data["Levels"]);
        }

        if (result.Data.ContainsKey("Achievements"))
        {
            Achievements = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_Achievement> >(result.Data["Achievements"]);
        }

        if (result.Data.ContainsKey("Sales"))
        {
            Sales = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_SaleData> >(result.Data["Sales"], PlayFab.Internal.PlayFabUtil.ApiSerializerStrategy);
            Debug.Log("Sale Data Retrieved");

            if (Sales.Count > 0)
            {
                DetermineSalesPromotionalTypes();
            }
        }

        if (result.Data.ContainsKey("Events"))
        {
            Events = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_EventData> >(result.Data["Events"], PlayFab.Internal.PlayFabUtil.ApiSerializerStrategy);
            Debug.Log("Event Data Retrieved");
            if (Events.Count > 0)
            {
                DetermineEventPromotionalTypes();
            }
        }

        if (result.Data.ContainsKey("Offers"))
        {
            Offers = PlayFab.Json.JsonWrapper.DeserializeObject <Dictionary <string, UB_OfferData> >(result.Data["Offers"], PlayFab.Internal.PlayFabUtil.ApiSerializerStrategy);
            Debug.Log("Offer Data Retrieved");
        }

        if (result.Data.ContainsKey("CommunityWebsite"))
        {
            CommunityWebsite = result.Data["CommunityWebsite"];
            Debug.Log("Community Website URL Retrieved");
        }
        if (result.Data.ContainsKey("StandardStores"))
        {
            StandardStores = PlayFab.Json.JsonWrapper.DeserializeObject <List <string> >(result.Data["StandardStores"]);
            Debug.Log("Standard Stores Retrieved");
        }

        Debug.Log("OnGetTitleDataSuccess -- AndroidPushSenderId");
        if (result.Data.ContainsKey("AndroidPushSenderId"))
        {
            AndroidPushSenderId = result.Data["AndroidPushSenderId"];
        }
        else
        {
            AndroidPushSenderId = GlobalStrings.DEFAULT_ANDROID_PUSH_SENDER_ID;
        }



        BuildCDNRequests();
        PF_Bridge.RaiseCallbackSuccess("Title Data Loaded", PlayFabAPIMethods.GetTitleData, MessageDisplayStyle.none);
    }