public void UseButton(ButtonUI button) { ButtonType buttonType = button.GetButtonType(); switch (buttonType) { case ButtonType.Close: case ButtonType.Combine: case ButtonType.unknown: case ButtonType.Back: case ButtonType.Next: WindowUI window = button.GetWindow(); int windowId = window.GetWindowId(); int npcId = window.GetNPCId(); int unknown = window.GetUnknownId(); int unknown2 = window.GetUnknown2Id(); m_gameManager.SendWindowButtonClicked(buttonType, windowId, npcId, unknown, unknown2); if (buttonType.Equals(ButtonType.Close) || buttonType.Equals(ButtonType.Back) || buttonType.Equals(ButtonType.Next)) { m_gameManager.RemoveWindow(windowId); } break; case ButtonType.TradeAccept: m_gameManager.SendTradeAccept(); break; case ButtonType.TradeCancel: m_gameManager.SendTradeCancel(); break; case ButtonType.PickUp: m_gameManager.SendPickUp(); break; case ButtonType.ChatText: m_state.ToggleChatWindow(); break; case ButtonType.Help: m_gameManager.SendHelp(); break; case ButtonType.CombineBag: m_gameManager.SendOpenCombineBag(); break; case ButtonType.Inventory: m_state.ToggleInventory(); break; case ButtonType.ToggleTrade: m_gameManager.SendToggleTrade(); break; case ButtonType.Spellbook: m_state.ToggleSpellsWindow(); break; case ButtonType.Exit: m_gameManager.Disconnect(); break; } }