/// <summary> /// Gets the slot with the specified ID and Group. /// </summary> /// <returns>The slot.</returns> /// <param name="ID">The slot ID.</param> /// <param name="group">The slot Group.</param> public static UIItemSlot GetSlot(int ID, UIItemSlot_Group group) { UIItemSlot[] sl = Resources.FindObjectsOfTypeAll<UIItemSlot>(); foreach (UIItemSlot s in sl) { // Check if the slow is active in the hierarchy if (s.gameObject.activeInHierarchy && s.ID == ID && s.slotGroup == group) return s; } return null; }
/// <summary> /// Gets all the item slots in the specified group. /// </summary> /// <returns>The slots.</returns> /// <param name="group">The item slot group.</param> public static List<UIItemSlot> GetSlotsInGroup(UIItemSlot_Group group) { List<UIItemSlot> slots = new List<UIItemSlot>(); UIItemSlot[] sl = Resources.FindObjectsOfTypeAll<UIItemSlot>(); foreach (UIItemSlot s in sl) { // Check if the slow is active in the hierarchy if (s.gameObject.activeInHierarchy && s.slotGroup == group) slots.Add(s); } return slots; }
/// <summary> /// Gets all the item slots in the specified group. /// </summary> /// <returns>The slots.</returns> /// <param name="group">The item slot group.</param> public static List <UIItemSlot> GetSlotsInGroup(UIItemSlot_Group group) { List <UIItemSlot> slots = new List <UIItemSlot>(); UIItemSlot[] sl = Resources.FindObjectsOfTypeAll <UIItemSlot>(); foreach (UIItemSlot s in sl) { // Check if the slow is active in the hierarchy if (s.gameObject.activeInHierarchy && s.slotGroup == group) { slots.Add(s); } } // Sort the slots by id slots.Sort(delegate(UIItemSlot a, UIItemSlot b) { return(a.ID.CompareTo(b.ID)); }); return(slots); }