public static void AddInvoker_Battle_InvSelect(BattleInvPanel panelScript) { invokers_Battle_InvSelect.Add(panelScript); //if (listener_Battle_InvSelect != null) foreach (UnityAction <int?, string> listener in listeners_Battle_InvSelect) { panelScript.AddListener_Battle_InvSelect(listener); } }
/// <summary> /// Populates the usable inventory /// </summary> void PopulateGrid() { // Create a grid item GameObject newPanel; GameObject prefabPanel = Resources.Load <GameObject>(@"MenuPrefabs\prefabBattleInvPanel"); foreach (InvItem item in partyStash.Contents) { // Only populate potions if (item.Type == InvType.Potion) { // Create instances of the prefab, with the Content panel as its parent newPanel = GameObject.Instantiate(prefabPanel, gridContent.transform); BattleInvPanel battleInvPanel = newPanel.GetComponent <BattleInvPanel>(); // Load item into the panel battleInvPanel.SetIndex(partyStash.IndexOfItem(item.Name), item.FullName, item.Description, item.Sprite, item.Quantity); } } }