public bool OnResponse(NetState ns, RelayInfo info) { if (_Handler == null || Desktop == null || Desktop.Viewed == null || Desktop.Viewed.NetState == null || Desktop.Viewed.NetState.Gumps == null) { return(false); } var buttonID = info.ButtonID; if (!ButtonMap.ContainsKey(buttonID)) { return(false); } buttonID = ButtonMap[buttonID]; var switches = info.Switches.Where(SwitchMap.ContainsKey).Select(SwitchMap.GetValue).ToArray(); var texts = info.TextEntries.Where(tr => TextMap.ContainsKey(tr.EntryID)) .Select(tr => new TextRelay(TextMap[tr.EntryID], tr.Text)) .ToArray(); Desktop.Viewed.NetState.Gumps.RemoveAll(g => g.TypeID == _TypeID); Desktop.Viewed.NetState.Send(new CloseGump(_TypeID, 0)); _Handler(Desktop.Viewed.NetState, new RelayInfo(buttonID, switches, texts)); return(true); }
public static Button GetButtonFromMoreName(string buttonName) { return(ButtonMap.ContainsKey(buttonName) ? ButtonMap[buttonName] : null); }