static private void ChangeSorting(Players.Data player) { // Cache Transform stashPanelHolder = GetStashPanel(player.UI); InventoryContentDisplay inventory = GetPlayerStashInventoryPanel(stashPanelHolder).GetComponent <InventoryContentDisplay>(); ContainerDisplay chestDisplay = GetChestStashInventoryPanel(stashPanelHolder).GetComponent <ContainerDisplay>(); // Sort ItemListDisplay.SortingType nextSorting = default; switch (chestDisplay.m_lastSortingType) { case ItemListDisplay.SortingType.ByList: nextSorting = ItemListDisplay.SortingType.ByWeight; break; case ItemListDisplay.SortingType.ByWeight: nextSorting = ItemListDisplay.SortingType.ByDurability; break; case ItemListDisplay.SortingType.ByDurability: nextSorting = ItemListDisplay.SortingType.ByList; break; } foreach (var containerDisplay in new[] { inventory.m_pouchDisplay, inventory.m_bagDisplay, chestDisplay }) { containerDisplay.SortBy(nextSorting); } UpdateStashName(player); // Select first GameObject selectedObject = EventSystem.current.GetCurrentSelectedGameObject(player.ID); if (selectedObject != null && selectedObject.TryGetComponent(out ItemDisplay currentItem) && currentItem.ParentItemListDisplay != null) { currentItem.ParentItemListDisplay.m_assignedDisplays.First().OnSelect(); } }
void Awake() { if (myContainerDisplay == null) { myContainerDisplay = gameObject.GetComponentInChildren<ContainerDisplay>(); } if (myContainerDisplay == null) { myContainerDisplay = gameObject.GetComponent<ContainerDisplay>(); } startPos = this.transform.localPosition; UpdatePos(); if (myContainerDisplay != null) { if (myContainerDisplay.IsWindowActive()) this.transform.localPosition = inPos; else this.transform.localPosition = outPos; } if (tween == null) { tween = this.GetComponent<TweenPosition>(); tween.enabled = false; } }
static private void SwitchToStash(Players.Data player) { if (EventSystem.current.GetCurrentSelectedGameObject(player.ID).TryGetComponent(out ItemDisplay currentItem) && currentItem.m_refItem == null) { return; } // Cache ContainerDisplay chest = GetChestStashInventoryPanel(GetStashPanel(player.UI)).GetComponent <ContainerDisplay>(); List <ItemDisplay> chestItems = chest.m_assignedDisplays; int currentID = chestItems.IndexOf(currentItem); // Execute if (currentID >= chestItems.Count - 1) { chestItems.First().OnSelect(); } else if (currentID >= 0) { int nextID = currentID + chestItems.Count / 2; if (chestItems.IsIndexValid(nextID)) { chestItems[nextID].OnSelect(); } else { chestItems.Last().OnSelect(); } } else if (chestItems.IsNotEmpty()) { chestItems.First().OnSelect(); } }
void Awake() { if (myContainerDisplay == null) { myContainerDisplay = gameObject.GetComponentInChildren <ContainerDisplay>(); } if (myContainerDisplay == null) { myContainerDisplay = gameObject.GetComponent <ContainerDisplay>(); } startPos = this.transform.localPosition; UpdatePos(); if (myContainerDisplay != null) { if (myContainerDisplay.IsWindowActive()) { this.transform.localPosition = inPos; } else { this.transform.localPosition = outPos; } } if (tween == null) { tween = this.GetComponent <TweenPosition>(); tween.enabled = false; } }
public void TestContainerDisplay() { Serial serial = 0x1000; ushort gumpId = 100; var expected = new ContainerDisplay(serial, gumpId).Compile(); using var ns = PacketTestUtilities.CreateTestNetState(); ns.SendDisplayContainer(serial, gumpId); var result = ns.SendPipe.Reader.TryRead(); AssertThat.Equal(result.Buffer[0].AsSpan(0), expected); }
public void TestContainerDisplay() { Serial serial = 0x1000; ushort gumpId = 100; var data = new ContainerDisplay(serial, gumpId).Compile(); Span <byte> expectedData = stackalloc byte[7]; var pos = 0; expectedData.Write(ref pos, (byte)0x24); // Packet ID expectedData.Write(ref pos, serial); expectedData.Write(ref pos, gumpId); AssertThat.Equal(data, expectedData); }
static private void UpdateStashName(Players.Data player) { // Cache Transform stashPanelHolder = GetStashPanel(player.UI); ContainerDisplay chestDisplay = GetChestStashInventoryPanel(stashPanelHolder).GetComponent <ContainerDisplay>(); Text stashTitle = GetChestStashTitle(stashPanelHolder).GetComponent <Text>(); // Execute stashTitle.text = "Stash"; switch (chestDisplay.m_lastSortingType) { case ItemListDisplay.SortingType.ByList: break; case ItemListDisplay.SortingType.ByWeight: stashTitle.text += "<color=lime> (sorted by Weight)</color>"; break; case ItemListDisplay.SortingType.ByDurability: stashTitle.text += "<color=orange> (sorted by Durability)</color>"; break; } }
void Awake() { containerDisplay = gameObject.GetComponent <ContainerDisplay>(); Debug.Log(containerDisplay); }
void Awake() { myContainer = GetComponent<ContainerDisplay>(); }
void Awake() { myContainer = GetComponent <ContainerDisplay>(); }
void Awake() { containerDisplay = gameObject.GetComponent<ContainerDisplay>(); Debug.Log(containerDisplay); }