Example #1
0
        public static void CheckIfAnyInvalidRef(GameKitConfig config)
        {
            foreach (var item in config.LifeTimeItems)
            {
                for (int i = 0; i < item.PurchaseInfo.Count; i++)
                {
                    CheckPurchase("Life-time item", item.ID, item.PurchaseInfo[i], i);
                }
                for (int i = 0; i < item.Upgrades.Count; i++)
                {
                    UpgradeItem upgrade = item.Upgrades[i];
                    for (int j = 0; j < upgrade.PurchaseInfo.Count; j++)
                    {
                        CheckPurchase(item.ID + " upgrade", upgrade.ID, upgrade.PurchaseInfo[j], j);
                    }
                }
            }
            foreach (var item in config.SingleUseItems)
            {
                for (int i = 0; i < item.PurchaseInfo.Count; i++)
                {
                    CheckPurchase("Single use item", item.ID, item.PurchaseInfo[i], i);
                }
                for (int i = 0; i < item.Upgrades.Count; i++)
                {
                    UpgradeItem upgrade = item.Upgrades[i];
                    for (int j = 0; j < upgrade.PurchaseInfo.Count; j++)
                    {
                        CheckPurchase(item.ID + " upgrade", upgrade.ID, upgrade.PurchaseInfo[j], j);
                    }
                }
            }
            foreach (var pack in config.ItemPacks)
            {
                for (int i = 0; i < pack.PackElements.Count; i++)
                {
                    PackElement element = pack.PackElements[i];

                    if (element.Item == null)
                    {
                        Debug.LogError("Pack [" + pack.ID + "]'s [" + (i + 1) + "] element item is null.");
                    }
                }
                for (int i = 0; i < pack.PurchaseInfo.Count; i++)
                {
                    CheckPurchase("Pack", pack.ID, pack.PurchaseInfo[i], i);
                }
            }
            foreach (var category in config.Categories)
            {
                List <VirtualItem> items = category.GetItems(true);
                for (int i = 0; i < items.Count; i++)
                {
                    if (items[i] == null)
                    {
                        Debug.LogError("Category [" + category.ID + "]'s [" + (i + 1) + "] item is null.");
                    }
                }
            }
        }
Example #2
0
        private static GameKitConfig GetConfigAndCreateIfNonExist()
        {
            string        configFilePath     = GameKit.DefaultConfigDataPath + "/GameKitConfig.asset";
            GameKitConfig virtualItemsConfig = AssetDatabase.LoadAssetAtPath(configFilePath, typeof(GameKitConfig)) as GameKitConfig;

            if (virtualItemsConfig == null)
            {
                virtualItemsConfig = CreateAsset <GameKitConfig>(configFilePath);
            }
            return(virtualItemsConfig);
        }
Example #3
0
        public override void OnInspectorGUI()
        {
            GameKitConfig config = target as GameKitConfig;

            if (config != null)
            {
                DrawDefaultInspector();
                GUILayout.Label("Please Edit in GameKit Window.");

                if (GUILayout.Button("Check References"))
                {
                    config.UpdateMapsAndTree();
                    CheckIfAnyInvalidRef(config);
                }
            }
        }
Example #4
0
        public static Dictionary <string, MarketProduct> CreateProductListFromVirtualItemsConfig(GameKitConfig config)
        {
            Dictionary <string, MarketProduct> list = new Dictionary <string, MarketProduct>();

            foreach (var item in config.VirtualItems)
            {
                MarketProduct product = TryCreateMarketProductFromVirtualItem(item);
                if (product != null)
                {
                    list.Add(product.ProductIdentifier, product);
                }
            }

            return(list);
        }