Exemplo n.º 1
0
        private void UpdateSlots(int slodID)
        {
            DataManager dataManager = ServiceFactory.Instance.Resolve <DataManager>();

            TestExpandItemButton[] buttons = inventoryExpand.GetComponentsInChildren <TestExpandItemButton>();

            // Ignore the 0 position because it is the active slot item
            for (int i = 1; i < 10; i++)
            {
                string upgradeItemID = dataManager.gameData.ShipSlot[slodID, i];

                if (!string.IsNullOrEmpty(upgradeItemID))
                {
                    List <UpgradeItem> upgradeItemList = dataManager.upgradeItemList.itemList;
                    UpgradeItem        upgradeItem     = upgradeItemList.Find(item => item.ItemID == upgradeItemID);
                    Debug.Log(upgradeItem.ItemBonus.ToString());

                    //GameObject upgrade = Instantiate(upgradeItem.ItemPrefab) as GameObject;
                    //buttons[i - 1].gameObject.transform.SetParent(transform.parent, false);
                    //upgrade.GetComponentInChildren<Text>().text = upgradeItem.GetName();
                    buttons[i - 1].GetComponentInChildren <Text>().text = upgradeItem.GetName();
                }
                else
                {
                    buttons[i - 1].GetComponentInChildren <Text>().text = string.Empty;
                }
            }
        }
Exemplo n.º 2
0
        void Start()
        {
            DataManager dataManager   = ServiceFactory.Instance.Resolve <DataManager>();
            string      upgradeItemID = dataManager.gameData.ShipSlot[slodID, 0];

            if (!string.IsNullOrEmpty(upgradeItemID))
            {
                List <UpgradeItem> upgradeItemList = dataManager.upgradeItemList.itemList;
                UpgradeItem        upgradeItem     = upgradeItemList.Find(i => i.ItemID == upgradeItemID);

                GameObject item = Instantiate(upgradeItem.ItemPrefab) as GameObject;
                item.transform.SetParent(transform.parent, false);
                item.GetComponentInChildren <Text>().text = upgradeItem.GetName();
            }
        }