예제 #1
0
    private static void OnGetUserAccountInfoSuccess(GetPlayerCombinedInfoResult result)
    {
        playerInventory.Clear();
        foreach (var eachItem in result.InfoResultPayload.UserInventory)
        {
            playerInventory.Add(eachItem);
        }
        accountInfo = result.InfoResultPayload.AccountInfo;

        if (result.InfoResultPayload.UserData.ContainsKey("IsRegisteredForPush"))
        {
            isRegisteredForPush = result.InfoResultPayload.UserData["IsRegisteredForPush"].Value == "1";
        }
        else
        {
            isRegisteredForPush = false;
        }

        if (result.InfoResultPayload.UserData.ContainsKey("ShowAccountOptionsOnLogin") && result.InfoResultPayload.UserData["ShowAccountOptionsOnLogin"].Value == "0")
        {
            showAccountOptionsOnLogin = false;
        }
        else //if (PF_Authentication.hasLoggedInOnce == false)
        {
            //PF_Authentication.hasLoggedInOnce = true;
            DialogCanvasController.RequestAccountSettings();
        }

        inventoryByCategory.Clear();
        if (PF_GameData.catalogItems.Count > 0)
        {
            foreach (var item in playerInventory)
            {
                if (inventoryByCategory.ContainsKey(item.ItemId))
                {
                    continue;
                }

                var catalogItem = PF_GameData.GetCatalogItemById(item.ItemId);
                if (catalogItem == null)
                {
                    continue;
                }

                var items      = new List <ItemInstance>(playerInventory.FindAll((x) => { return(x.ItemId.Equals(item.ItemId)); }));
                var customIcon = PF_GameData.GetIconByItemById(catalogItem.ItemId);
                var icon       = GameController.Instance.iconManager.GetIconById(customIcon, IconManager.IconTypes.Item);
                inventoryByCategory.Add(item.ItemId, new InventoryCategory(item.ItemId, catalogItem, items, icon));
            }
        }

        if (PF_Authentication.GetDeviceId(true))
        {
            Debug.Log("Mobile Device ID Found!");

            var deviceId = string.IsNullOrEmpty(PF_Authentication.android_id) ? PF_Authentication.ios_id : PF_Authentication.android_id;
            PlayerPrefs.SetString("LastDeviceIdUsed", deviceId);
        }
        else
        {
            Debug.Log("Custom Device ID Found!");

            if (string.IsNullOrEmpty(PF_Authentication.custom_id))
            {
                PlayerPrefs.SetString("LastDeviceIdUsed", PF_Authentication.custom_id);
            }
        }

        virtualCurrency.Clear();
        foreach (var eachPair in result.InfoResultPayload.UserVirtualCurrency)
        {
            virtualCurrency.Add(eachPair.Key, eachPair.Value);
        }

        PF_Bridge.RaiseCallbackSuccess("Player Account Info Loaded", PlayFabAPIMethods.GetAccountInfo, MessageDisplayStyle.none);
    }
예제 #2
0
 public void ShowAccountSettings()
 {
     DialogCanvasController.RequestAccountSettings();
 }