示例#1
0
    void OnEntitlementsRefreshed()
    {
        foreach (string id in pendingEntitlementIds)
        {
            //notify user of new inventory
            Entitlement ent        = collectionCore.GetEntitlementById(id);
            Asset       info       = collectionCore.GetAssetInfoByName(ent.AssetName);
            string      prefabName = (string)info.GetCustom("prefabName", "");
            string      descript   = (string)info.Description;
            popupPrefab.SetPrefab(prefabName, descript);

            RecipeController ctrler = (RecipeController)AppController.Instance.GetController(Controller.RECIPE);

            //check recipes for completion
            string outcome = ctrler.OnNewInventory((string)info.Name);

            if (!String.IsNullOrEmpty(outcome))
            {
                foreach (Image fuse in fusions)
                {
                    if (fuse.gameObject.name == "icon_fus_" + outcome)
                    {
                        fuse.color = Color.white;
                        break;
                    }
                }
            }

            foreach (Image image in images)
            {
                if (image.gameObject.name == "icon_" + ent.AssetName)
                {
                    image.color = Color.white;

                    foreach (Image fuse in fusions)
                    {
                        if (fuse.gameObject.name == "icon_fus_" + ent.AssetName)
                        {
                            fuse.enabled = false;
                            break;
                        }
                    }

                    break;
                }
            }
        }

        pendingEntitlementIds.Clear();
    }