public MainScreen(LauncherWindow game) : base(game, true) { buttonFont = new Font("Arial", 16, FontStyle.Bold); enterIndex = 2; widgets = new LauncherWidget[13]; LoadResumeInfo(); }
protected override void UnselectWidget( LauncherWidget widget ) { LauncherButtonWidget button = widget as LauncherButtonWidget; button.Active = false; button.Redraw( drawer, button.Text, textFont ); Dirty = true; }
protected void HandleTab() { int index = lastClicked == null ? -1 : Array.IndexOf<LauncherWidget>( widgets, lastClicked ); if( tabDown ) return; tabDown = true; for( int i = 0; i < widgets.Length * 2; i++ ) { index = (index + 1) % widgets.Length; if( widgets[index] is LauncherInputWidget || widgets[index] is LauncherButtonWidget ) { LauncherWidget widget = widgets[index]; moveArgs.X = widget.X + widget.Width / 2; moveArgs.Y = widget.Y + widget.Height / 2; pressArgs.Button = MouseButton.Left; pressArgs.IsPressed = true; pressArgs.X = moveArgs.X; pressArgs.Y = moveArgs.Y; MouseMove( null, moveArgs ); Point p = game.Window.PointToScreen( Point.Empty ); p.Offset( moveArgs.X, moveArgs.Y ); game.Window.DesktopCursorPos = p; lastClicked = widget; if( widgets[index] is LauncherInputWidget ) MouseButtonDown( null, pressArgs ); break; } } }
public DirectConnectScreen( LauncherWindow game ) : base(game) { titleFont = new Font( "Arial", 15, FontStyle.Bold ); inputFont = new Font( "Arial", 14, FontStyle.Regular ); enterIndex = 6; widgets = new LauncherWidget[9]; }
public ClassiCubeScreen( LauncherWindow game ) : base(game) { titleFont = new Font( "Arial", 15, FontStyle.Bold ); inputFont = new Font( "Arial", 15, FontStyle.Regular ); enterIndex = 4; widgets = new LauncherWidget[8]; }
protected override void UnselectWidget(LauncherWidget widget) { base.UnselectWidget(widget); if (signingIn || !resumeValid || widget != widgets[4]) { return; } SetStatusNoLock(""); }
protected override void SelectWidget( LauncherWidget widget ) { LauncherButtonWidget button = widget as LauncherButtonWidget; if( button != null ) { button.Active = true; button.Redraw( drawer, button.Text, textFont ); Dirty = true; } }
protected override void SelectWidget(LauncherWidget widget) { base.SelectWidget(widget); if (widget is LauncherInputWidget) { widgetOpenTime = DateTime.UtcNow; lastCaretFlash = false; } }
string GetCol(byte col, bool force) { if (force) { return(col.ToString()); } LauncherWidget widget = widgets[widgetIndex]; return(widget == null?col.ToString() : widget.Text); }
public UpdatesScreen(LauncherWindow game) : base(game) { game.Window.Mouse.Move += MouseMove; game.Window.Mouse.ButtonDown += MouseButtonDown; titleFont = new Font("Arial", 16, FontStyle.Bold); infoFont = new Font("Arial", 14, FontStyle.Regular); buttonFont = titleFont; widgets = new LauncherWidget[20]; }
public UpdatesScreen( LauncherWindow game ) : base(game) { game.Window.Mouse.Move += MouseMove; game.Window.Mouse.ButtonDown += MouseButtonDown; titleFont = new Font( "Arial", 16, FontStyle.Bold ); infoFont = new Font( "Arial", 14, FontStyle.Regular ); buttonFont = titleFont; widgets = new LauncherWidget[16]; }
protected override void SelectWidget(LauncherWidget widget) { base.SelectWidget(widget); if (signingIn || !resumeValid || widget != widgets[4]) { return; } const string format = "&eResume to {0}:{1}, as {2}"; SetStatusNoLock(String.Format(format, resumeIp, resumePort, resumeUser)); }
public ResourcesScreen(LauncherWindow game) : base(game) { game.Window.Mouse.Move += MouseMove; game.Window.Mouse.ButtonDown += MouseButtonDown; textFont = new Font("Arial", 16, FontStyle.Bold); infoFont = new Font("Arial", 14, FontStyle.Regular); statusFont = new Font("Arial", 13, FontStyle.Italic); buttonFont = textFont; widgets = new LauncherWidget[4]; }
/// <summary> Called when user has moved their mouse over a given widget. </summary> protected virtual void SelectWidget(LauncherWidget widget) { LauncherButtonWidget button = widget as LauncherButtonWidget; if (button != null) { button.Active = true; button.Redraw(drawer, button.Text, buttonFont); Dirty = true; } }
public ResourcesScreen( LauncherWindow game ) : base(game) { game.Window.Mouse.Move += MouseMove; game.Window.Mouse.ButtonDown += MouseButtonDown; textFont = new Font( "Arial", 16, FontStyle.Bold ); infoFont = new Font( "Arial", 14, FontStyle.Regular ); statusFont = new Font( "Arial", 13, FontStyle.Italic ); widgets = new LauncherWidget[4]; }
void KeyDown(object sender, KeyboardKeyEventArgs e) { if (e.Key == Key.Tab) { HandleTab(); } else if (e.Key == Key.Enter) { LauncherWidget widget = selectedWidget; if (widget != null && widget.OnClick != null) { widget.OnClick(0, 0); } } }
protected void HandleTab() { if (tabDown) { return; } tabDown = true; int index = lastClicked == null ? -1 : Array.IndexOf <LauncherWidget>(widgets, lastClicked); int dir = (game.Window.Keyboard[Key.ShiftLeft] || game.Window.Keyboard[Key.ShiftRight]) ? -1 : 1; index += dir; Utils.Clamp(ref index, 0, widgets.Length - 1); for (int j = 0; j < widgets.Length * 2; j++) { int i = (j * dir + index) % widgets.Length; if (i < 0) { i += widgets.Length; } if (widgets[i] is LauncherInputWidget || widgets[i] is LauncherButtonWidget) { LauncherWidget widget = widgets[i]; moveArgs.X = widget.X + widget.Width / 2; moveArgs.Y = widget.Y + widget.Height / 2; pressArgs.Button = MouseButton.Left; pressArgs.IsPressed = true; pressArgs.X = moveArgs.X; pressArgs.Y = moveArgs.Y; MouseMove(null, moveArgs); Point p = game.Window.PointToScreen(Point.Empty); p.Offset(moveArgs.X, moveArgs.Y); game.Window.DesktopCursorPos = p; lastClicked = widget; if (widgets[i] is LauncherInputWidget) { MouseButtonDown(null, pressArgs); } break; } } }
protected override void WidgetUnclicked(LauncherWidget widget) { LauncherInputWidget input = widget as LauncherInputWidget; if (input == null) { return; } using ( drawer ) { drawer.SetBitmap(game.Framebuffer); input.Active = false; input.Redraw(drawer, lastInput.Text, inputFont, inputHintFont); } lastInput = null; Dirty = true; }
protected void MouseButtonDown(object sender, MouseButtonEventArgs e) { if (e.Button != MouseButton.Left) { return; } if (lastClicked != null && lastClicked != selectedWidget) { WidgetUnclicked(lastClicked); } if (selectedWidget != null && selectedWidget.OnClick != null) { selectedWidget.OnClick(e.X, e.Y); } lastClicked = selectedWidget; }
protected virtual void MouseMove(object sender, MouseMoveEventArgs e) { if (supressMove) { supressMove = false; return; } mouseMoved = true; for (int i = 0; i < widgets.Length; i++) { LauncherWidget widget = widgets[i]; if (widget == null) { continue; } if (e.X >= widget.X && e.Y >= widget.Y && e.X < widget.X + widget.Width && e.Y < widget.Y + widget.Height) { if (selectedWidget == widget) { return; } using ( drawer ) { drawer.SetBitmap(game.Framebuffer); if (selectedWidget != null) { UnselectWidget(selectedWidget); } SelectWidget(widget); } selectedWidget = widget; return; } } if (selectedWidget == null) { return; } using ( drawer ) { drawer.SetBitmap(game.Framebuffer); UnselectWidget(selectedWidget); } selectedWidget = null; }
public ClassiCubeServersScreen(LauncherWindow game) : base(game, true) { tableFont = new Font("Arial", 11, FontStyle.Regular); enterIndex = 3; widgets = new LauncherWidget[7]; }
public DirectConnectScreen(LauncherWindow game) : base(game, true) { booleanFont = new Font("Arial", 22, FontStyle.Regular); enterIndex = 3; widgets = new LauncherWidget[8]; }
/// <summary> Called when the user has moved their mouse away from a previously selected widget. </summary> protected virtual void UnselectWidget( LauncherWidget widget ) { LauncherButtonWidget button = widget as LauncherButtonWidget; if( button != null ) { button.Active = false; button.Redraw( drawer, button.Text, buttonFont ); Dirty = true; } }
protected virtual void MouseMove( object sender, MouseMoveEventArgs e ) { for( int i = 0; i < widgets.Length; i++ ) { LauncherWidget widget = widgets[i]; if( widget == null ) continue; if( e.X >= widget.X && e.Y >= widget.Y && e.X < widget.X + widget.Width && e.Y < widget.Y + widget.Height ) { if( selectedWidget == widget ) return; using( drawer ) { drawer.SetBitmap( game.Framebuffer ); if( selectedWidget != null ) UnselectWidget( selectedWidget ); SelectWidget( widget ); } selectedWidget = widget; return; } } if( selectedWidget == null ) return; using( drawer ) { drawer.SetBitmap( game.Framebuffer ); UnselectWidget( selectedWidget ); } selectedWidget = null; }
protected void MouseButtonDown( object sender, MouseButtonEventArgs e ) { if( e.Button != MouseButton.Left || selectedWidget == null ) return; if( selectedWidget.OnClick != null ) selectedWidget.OnClick( e.X, e.Y ); lastClicked = selectedWidget; }
public MainScreen( LauncherWindow game ) : base(game) { textFont = new Font( "Arial", 16, FontStyle.Bold ); widgets = new LauncherWidget[4]; }
protected virtual void WidgetUnclicked(LauncherWidget widget) { }
protected string Get(int index) { LauncherWidget widget = widgets[index]; return(widget == null ? "" : widget.Text); }
protected virtual void KeyDown(object sender, KeyboardKeyEventArgs e) { if (e.Key == Key.Enter && enterIndex >= 0) { LauncherWidget widget = (selectedWidget != null && mouseMoved) ? selectedWidget : widgets[enterIndex]; if (widget.OnClick != null) { widget.OnClick(0, 0); } } else if (e.Key == Key.Tab) { HandleTab(); } if (lastInput == null) { if (e.Key == Key.Escape) { game.SetScreen(new MainScreen(game)); } return; } if (e.Key == Key.BackSpace && lastInput.BackspaceChar()) { RedrawLastInput(); OnRemovedChar(); } else if (e.Key == Key.Delete && lastInput.DeleteChar()) { RedrawLastInput(); OnRemovedChar(); } else if (e.Key == Key.C && ControlDown) { lastInput.CopyToClipboard(); } else if (e.Key == Key.V && ControlDown) { if (lastInput.CopyFromClipboard()) { RedrawLastInput(); } } else if (e.Key == Key.Escape) { if (lastInput.ClearText()) { RedrawLastInput(); } } else if (e.Key == Key.Left) { lastInput.AdvanceCursorPos(-1); RedrawLastInput(); } else if (e.Key == Key.Right) { lastInput.AdvanceCursorPos(+1); RedrawLastInput(); } }
public ColoursScreen(LauncherWindow game) : base(game, true) { enterIndex = 6; widgets = new LauncherWidget[25]; }
/// <summary> Called when the user has moved their mouse away from a previously selected widget. </summary> protected virtual void UnselectWidget( LauncherWidget widget ) { }