protected ItemSlotManager CreateManager(ItemSlot slot) { ItemSlotManager clone = Instantiate(SlotPrefab, slotHolder); clone.transform.localRotation = Quaternion.identity; clone.transform.localScale = Vector3.one; clone.GetComponent <RectTransform> ().anchoredPosition3D = Vector3.zero; clone.Setup(slot); managers.Add(clone); OnSlotAdd(clone); return(clone); }
public void FireSetup() { if (!setup) { manager.Setup(character.equipment.Items[EquipmentSlot.Index]); if (selector != null) { manager.onMainAction += () => { /*selector.DisplaySelector (manager.slot, (ItemSlot returnedSlot) => * { * manager.slot.Swap (returnedSlot); * });*/ }; } setup = true; } }
public override void Setup(Inventory inventory) { if (current != null) { return; } current = inventory; managers = new List <ItemSlotManager> (current.Size); for (int i = 0; i < current.Items.Count; i++) { ItemSlot slot = current.Items[i]; ItemSlotManager manager = Slots[i]; manager.Setup(slot); OnSlotAdd(manager); } }
public void FireSetup() { if (!setup) { #pragma warning disable var entry = EquipmentInformationDatabase.Instance.EquipmentInfos[EquipmentSlot]; #pragma warning restore manager.Setup(character.equipment.Items[EquipmentSlot.entryIndex]); if (selector != null) { manager.onMainAction += () => { /*selector.DisplaySelector (manager.slot, (ItemSlot returnedSlot) => * { * manager.slot.Swap (returnedSlot); * });*/ }; } setup = true; } }
public void Filter(SortingMode mode, ItemCondition[] Filters) { lastSorting = mode; LastFilters = Filters; sorted = new List <ItemSlot> (); for (int i = 0; i < current.Items.Count; i++) { ItemSlot slot = current.Items[i]; if (HideEmpty && slot.Item == null) { continue; } if (Filters == null) { sorted.Add(slot); continue; } if (Filters.IsValid(slot.Item)) { sorted.Add(slot); } } if (mode == SortingMode.Name) { sorted.Sort(NameComparison); } else if (mode == SortingMode.Type) { sorted.Sort(TypeComparison); } for (int i = 0; i < managers.Count; i++) { ItemSlotManager manager = managers[i]; if (EventSystem.current.currentSelectedGameObject == manager.gameObject) { EventSystem.current.SetSelectedGameObject(null); } manager.Detatch(); manager.gameObject.SetActive(false); } for (int i = 0; i < sorted.Count; i++) { ItemSlotManager manager = managers[i]; manager.gameObject.SetActive(true); manager.Setup(sorted[i]); /*if (i == 0) * { * EventSystem.current.SetSelectedGameObject(manager.gameObject); * var pointer = new PointerEventData(EventSystem.current); * //ExecuteEvents.Execute(manager.gameObject, pointer, ExecuteEvents.pointerEnterHandler); * //ExecuteEvents.Execute(manager.gameObject, pointer, ExecuteEvents.selectHandler); * }*/ } filterDirty = false; }