public virtual void HandleTileButtonClick(GumpImageTileButton button) { var now = DateTime.UtcNow; var lbc = LastTileButtonClicked; var lbt = LastButtonClick + DClickInterval; DoubleClicked = lbc != null && now <= lbt && (lbc == button || lbc.ButtonID == button.ButtonID || (lbc.Parent == button.Parent && lbc.X == button.X && lbc.Y == button.Y && lbc.Type == button.Type && lbc.Param == button.Param)); LastTileButtonClicked = button; LastButtonClick = now; OnClick(); OnClick(button); if (DoubleClicked) { OnDoubleClick(button); } if (TileButtonHandler != null) { TileButtonHandler(button); } else if (TileButtons[button] != null) { TileButtons[button](button); } }
public virtual void HandleTileButtonClick(GumpImageTileButton button) { DateTime now = DateTime.UtcNow; DoubleClicked = LastTileButtonClicked != null && now < LastButtonClick + DClickInterval && (LastTileButtonClicked == button || LastTileButtonClicked.ButtonID == button.ButtonID || (LastTileButtonClicked.Parent == button.Parent && LastTileButtonClicked.X == button.X && LastTileButtonClicked.Y == button.Y && LastTileButtonClicked.Type == button.Type && LastTileButtonClicked.Param == button.Param)); LastTileButtonClicked = button; LastButtonClick = now; OnClick(button); if (DoubleClicked) { OnDoubleClick(button); } if (TileButtonHandler != null) { TileButtonHandler(button); } else if (TileButtons[button] != null) { TileButtons[button](button); } }
protected virtual void Clear() { NextButtonID = 1; NextSwitchID = 0; NextTextInputID = 0; Buttons.Clear(); TileButtons.Clear(); Switches.Clear(); Radios.Clear(); TextInputs.Clear(); LimitedTextInputs.Clear(); Entries.Clear(); Entries.TrimExcess(); if (Layout == null) { Layout = new SuperGumpLayout(); } else { Layout.Clear(); } }
public void Dispose() { if (IsDisposed) { return; } IsDisposed = true; //Console.WriteLine("SuperGump Disposing: {0} (0x{1:X})", GetType(), Serial); //GC.SuppressFinalize(this); VitaNexCore.TryCatch(OnDispose); VitaNexCore.TryCatch(UnregisterInstance); NextButtonID = 1; NextSwitchID = 0; NextTextInputID = 0; if (InstancePoller != null) { VitaNexCore.TryCatch(InstancePoller.Dispose); InstancePoller = null; } VitaNexCore.TryCatch( () => { Buttons.Clear(); TileButtons.Clear(); Switches.Clear(); Radios.Clear(); TextInputs.Clear(); LimitedTextInputs.Clear(); Entries.Clear(); Entries.TrimExcess(); Layout.Clear(); }); VitaNexCore.TryCatch(() => Linked.AsEnumerable().ForEach(Unlink)); VitaNexCore.TryCatch(() => Children.AsEnumerable().ForEach(RemoveChild)); IsOpen = false; Hidden = false; Parent = null; User = null; VitaNexCore.TryCatch(OnDisposed); }
protected void AddImageTiledButton(GumpImageTileButton entry, Action <GumpImageTileButton> handler) { if (entry == null || !CanDisplay(entry)) { return; } if (!TileButtons.ContainsKey(entry)) { TileButtons.Add(entry, handler); } else { TileButtons[entry] = handler; } Add(entry); }
public void Dispose() { if (IsDisposed) { return; } //Console.WriteLine("SuperGump Disposing: {0} (0x{1:X})", GetType(), Serial); //GC.SuppressFinalize(this); IsDisposed = true; IsOpen = Hidden = false; VitaNexCore.TryCatch(OnDispose); VitaNexCore.TryCatch(UnregisterInstance); VitaNexCore.TryCatch( () => { if (Linked != null) { Linked.ForEachReverse(Unlink); Linked.Free(true); } }); VitaNexCore.TryCatch( () => { if (Children != null) { Children.ForEachReverse(RemoveChild); Children.Free(true); } }); VitaNexCore.TryCatch( () => { if (InstancePoller != null) { InstancePoller.Dispose(); } }); VitaNexCore.TryCatch( () => { if (Entries != null) { Entries.ForEachReverse( e => { if (e is IDisposable) { VitaNexCore.TryCatch(((IDisposable)e).Dispose); } }); } }); VitaNexCore.TryCatch(OnDisposed); VitaNexCore.TryCatch( () => { if (Buttons != null) { Buttons.Clear(); } if (TileButtons != null) { TileButtons.Clear(); } if (Switches != null) { Switches.Clear(); } if (Radios != null) { Radios.Clear(); } if (TextInputs != null) { TextInputs.Clear(); } if (LimitedTextInputs != null) { LimitedTextInputs.Clear(); } if (Entries != null) { Entries.Free(true); } if (Layout != null) { Layout.Clear(); } }); NextButtonID = 1; NextSwitchID = 0; NextTextInputID = 0; OnActionSend = null; OnActionClose = null; OnActionHide = null; OnActionRefresh = null; OnActionDispose = null; OnActionClick = null; OnActionDoubleClick = null; LastButtonClicked = null; Buttons = null; ButtonHandler = null; TileButtons = null; TileButtonHandler = null; Switches = null; SwitchHandler = null; Radios = null; RadioHandler = null; TextInputs = null; TextInputHandler = null; LimitedTextInputs = null; LimitedTextInputHandler = null; Layout = null; Linked = null; Children = null; Parent = null; User = null; InstancePoller = null; }