コード例 #1
0
    public void OnUpdateUserInventory(GetUserInventoryResult result)
    {
        inventory = result.Inventory;

        if (inventory.Count == 0)
        {
            Debug.Log("GrantItemAtInventory");
            GrantItems();
        }

        for (int i = 0; i < inventory.Count; i++)
        {
            ItemInstance itemInstance = inventory[i];

            if (itemInstance.ItemClass == "Skin" && !PlayFabGameBridge.Instance.boughtSkins.ContainsKey(itemInstance.ItemId))
            {
                PlayFabGameBridge.Instance.boughtSkins.Add(itemInstance.ItemId, itemInstance);
            }
            else if (itemInstance.ItemClass == "Missile" && !PlayFabGameBridge.Instance.boughtMissiles.ContainsKey(itemInstance.ItemId))
            {
                PlayFabGameBridge.Instance.boughtMissiles.Add(itemInstance.ItemId, itemInstance);
            }
        }

        if (inventory.Count == (PlayFabGameBridge.Instance.boughtSkins.Count + PlayFabGameBridge.Instance.boughtMissiles.Count))
        {
            InventoryLoaded = true;
            PurchaseDone();
        }

        if (InventoryLoaded)
        {
            InitializationEventManager.OnNextInitialization();
        }
    }
コード例 #2
0
    void AssignStoreItems()
    {
        indexCatalog       = 0;
        indexSkinSprite    = 0;
        indexMissileSprite = 0;

        List <CatalogItem> items = CatalogScript.Instance.items;

        skinContentPanel    = GameObject.Find("SkinContentPanel");
        missileContentPanel = GameObject.Find("MissileContentPanel");
        itemImages          = new Dictionary <string, Image>();
        itemContentHolders  = new Dictionary <string, ContentHolder>();

        foreach (Missile missile in PlayFabGameBridge.Instance.missiles.Values)
        {
            Initialize(missile.price, items[indexCatalog]);
            indexCatalog++;
        }

        foreach (Skin skin in PlayFabGameBridge.Instance.skins.Values)
        {
            Initialize(skin.price, items[indexCatalog]);
            indexCatalog++;
        }
        InitializeDone();
        InitializationEventManager.TriggerNextInitialization();
    }