void MouseButtonUp(object sender, MouseButtonEventArgs e) { LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; table.DraggingColumn = -1; table.DraggingScrollbar = false; }
protected override void KeyDown(object sender, KeyboardKeyEventArgs e) { LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; if (e.Key == Key.Enter) { if (table.Count == 1 && String.IsNullOrEmpty(Get(hashIndex))) { widgets[hashIndex].Text = table.usedEntries[0].Hash; ConnectToServer(0, 0); } else { base.KeyDown(sender, e); } } else if (e.Key == Key.Up) { table.SetSelected(table.SelectedIndex - 1); table.NeedRedraw(); } else if (e.Key == Key.Down) { table.SetSelected(table.SelectedIndex + 1); table.NeedRedraw(); } else { base.KeyDown(sender, e); } }
void MakeTableWidget() { int tableHeight = Math.Max(game.Height - tableY - 50, 1); FastColour col = LauncherTableWidget.backGridCol; drawer.Clear(col, tableX, tableY, game.Width - tableX, tableHeight); if (widgets[tableIndex] != null) { LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; table.Height = tableHeight; table.Redraw(drawer, tableFont, inputFont, inputFont); return; } LauncherTableWidget widget = new LauncherTableWidget(game); widget.CurrentIndex = 0; widget.SetEntries(game.Session.Servers); widget.Height = tableHeight; widget.DrawAt(drawer, tableFont, inputFont, inputFont, Anchor.LeftOrTop, Anchor.LeftOrTop, tableX, tableY); widget.NeedRedraw = Resize; widget.SelectedChanged = SelectedChanged; widgets[widgetIndex++] = widget; }
protected override void MouseWheelChanged(object sender, MouseWheelEventArgs e) { LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; table.CurrentIndex -= e.Delta; table.ClampIndex(); Resize(); }
protected override void MouseMove(object sender, MouseMoveEventArgs e) { base.MouseMove(sender, e); if (selectedWidget != null && selectedWidget == widgets[tableIndex]) { LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; table.MouseMove(e.X, e.Y, e.XDelta, e.YDelta); } }
public override void Tick() { base.Tick(); LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; if (!game.Window.Mouse[MouseButton.Left]) { table.DraggingColumn = -1; table.DraggingScrollbar = false; } }
protected override void RedrawLastInput() { base.RedrawLastInput(); if (lastInput != widgets[hashIndex]) { return; } LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; table.SetSelected(widgets[hashIndex].Text); Resize(); }
void FilterList() { if (lastInput != widgets[searchIndex]) { return; } LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; table.FilterEntries(lastInput.Text); table.ClampIndex(); Resize(); }
public override void Dispose() { base.Dispose(); tableFont.Dispose(); LauncherTableWidget table = widgets[tableIndex] as LauncherTableWidget; if (table != null) { table.DraggingColumn = -1; table.DraggingScrollbar = false; } }
public override void Resize() { using ( drawer ) { drawer.SetBitmap(game.Framebuffer); game.ClearArea(0, 0, game.Width, tableY); LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; if (table != null) { table.ClampIndex(); } Draw(); } Dirty = true; }
void ConnectToServer(int mouseX, int mouseY) { LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; game.ConnectToServer(table.servers, Get(hashIndex)); }
void MakeTableWidget() { if( widgets[tableIndex] != null ) { LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex]; table.Redraw( drawer, inputFont, titleFont, boldInputFont ); return; } LauncherTableWidget widget = new LauncherTableWidget( game ); widget.CurrentIndex = 0; widget.SetEntries( game.Session.Servers ); widget.DrawAt( drawer, inputFont, titleFont, boldInputFont, Anchor.LeftOrTop, Anchor.LeftOrTop, 0, 100 ); widget.NeedRedraw = Resize; widget.SelectedChanged = SelectedChanged; widgets[widgetIndex++] = widget; }