예제 #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.");
                    }
                }
            }
        }
예제 #2
0
        private void DrawVirtualItem(Rect position, PackElement packElement, int index)
        {
            ItemPopupDrawer drawer = index < _itemPopupDrawers.Count ? _itemPopupDrawers[index] : null;

            if (drawer != null)
            {
                packElement.ItemID = drawer.Draw(new Rect(position.x, position.y, position.width * 0.5f - 1, position.height),
                                                 packElement.ItemID, GUIContent.none);
            }
        }
예제 #3
0
        private void DrawAmount(Rect position, PackElement packElement)
        {
            Rect rect = new Rect(position.x + position.width * 0.5f,
                                 position.y, position.width * 0.5f - 1, position.height);

            if (packElement.Item is LifeTimeItem)
            {
                packElement.Amount = 1;
                EditorGUI.LabelField(rect, packElement.Amount.ToString());
            }
            else
            {
                packElement.Amount = EditorGUI.IntField(rect, packElement.Amount);
            }
        }
예제 #4
0
 public PackElement DrawPackElement(Rect position, PackElement element, int index)
 {
     DrawVirtualItem(position, element, index);
     DrawAmount(position, element);
     return(element);
 }