public ClassiCubeServersScreen( LauncherWindow game )
     : base(game, true)
 {
     tableFont = new Font( game.FontName, 11, FontStyle.Regular );
     enterIndex = 3;
     widgets = new LauncherWidget[7];
 }
 public DirectConnectScreen( LauncherWindow game )
     : base(game, true)
 {
     booleanFont = new Font( game.FontName, 22, FontStyle.Regular );
     enterIndex = 3;
     widgets = new LauncherWidget[8];
 }
 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}";
     SetStatus( String.Format( format, resumeIp, resumePort, resumeUser ) );
 }
Example #4
0
 public MainScreen(LauncherWindow game) : base(game, true)
 {
     buttonFont = new Font(game.FontName, 16, FontStyle.Bold);
     updateFont = new Font(game.FontName, 12, FontStyle.Italic);
     enterIndex = 2;
     widgets    = new LauncherWidget[16];
     LoadResumeInfo();
 }
Example #5
0
 protected override void SelectWidget(LauncherWidget widget)
 {
     base.SelectWidget(widget);
     if (widget is LauncherInputWidget)
     {
         widgetOpenTime = DateTime.UtcNow;
         lastCaretFlash = false;
     }
 }
 public MainScreen( LauncherWindow game )
     : base(game, true)
 {
     buttonFont = new Font( game.FontName, 16, FontStyle.Bold );
     updateFont = new Font( game.FontName, 12, FontStyle.Italic );
     enterIndex = 2;
     widgets = new LauncherWidget[16];
     LoadResumeInfo();
 }
Example #7
0
 protected override void UnselectWidget(LauncherWidget widget)
 {
     base.UnselectWidget(widget);
     if (signingIn || !resumeValid || widget != widgets[4])
     {
         return;
     }
     SetStatus("");
 }
        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(game.FontName, 16, FontStyle.Bold);
            infoFont   = new Font(game.FontName, 14, FontStyle.Regular);
            buttonFont = titleFont;
            widgets    = new LauncherWidget[13];
        }
        public ChooseModeScreen( LauncherWindow game )
            : base(game)
        {
            game.Window.Mouse.Move += MouseMove;
            game.Window.Mouse.ButtonDown += MouseButtonDown;

            titleFont = new Font( game.FontName, 16, FontStyle.Bold );
            infoFont = new Font( game.FontName, 14, FontStyle.Regular );
            buttonFont = titleFont;
            widgets = new LauncherWidget[14];
        }
Example #11
0
        public ResourcesScreen(LauncherWindow game) : base(game)
        {
            game.Window.Mouse.Move       += MouseMove;
            game.Window.Mouse.ButtonDown += MouseButtonDown;

            textFont   = new Font(game.FontName, 16, FontStyle.Bold);
            infoFont   = new Font(game.FontName, 14, FontStyle.Regular);
            statusFont = new Font(game.FontName, 13, FontStyle.Italic);
            buttonFont = textFont;
            widgets    = new LauncherWidget[4];
        }
Example #12
0
        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}";

            SetStatus(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( game.FontName, 16, FontStyle.Bold );
            infoFont = new Font( game.FontName, 14, FontStyle.Regular );
            statusFont = new Font( game.FontName, 13, FontStyle.Italic );
            buttonFont = textFont;
            widgets = new LauncherWidget[4];
        }
Example #14
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);
                        ((LauncherInputWidget)widgets[i]).CaretPos = -1;
                    }
                    break;
                }
            }
        }
Example #15
0
        /// <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.RedrawBackground();
                using ( drawer ) {
                    drawer.SetBitmap(game.Framebuffer);
                    button.Redraw(drawer);
                }
                Dirty = true;
            }
        }
 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);
         }
     }
 }
Example #17
0
        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 = null;
            Dirty     = true;
        }
Example #18
0
        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;
        }
Example #19
0
        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;
                    }

                    if (selectedWidget != null)
                    {
                        UnselectWidget(selectedWidget);
                    }
                    SelectWidget(widget);
                    selectedWidget = widget;
                    return;
                }
            }

            if (selectedWidget == null)
            {
                return;
            }
            UnselectWidget(selectedWidget);
            selectedWidget = null;
        }
 protected override void UnselectWidget( LauncherWidget widget )
 {
     base.UnselectWidget( widget );
     if( signingIn || !resumeValid || widget != widgets[4] ) return;
     SetStatus( "" );
 }
Example #21
0
        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();
            }
        }
Example #22
0
 protected virtual void WidgetUnclicked(LauncherWidget widget)
 {
 }
Example #23
0
        protected string Get(int index)
        {
            LauncherWidget widget = widgets[index];

            return(widget == null ? "" : widget.Text);
        }
 public ClassiCubeServersScreen(LauncherWindow game) : base(game, true)
 {
     tableFont  = new Font(game.FontName, 11, FontStyle.Regular);
     enterIndex = 3;
     widgets    = new LauncherWidget[7];
 }
Example #25
0
 public DirectConnectScreen(LauncherWindow game) : base(game, true)
 {
     booleanFont = new Font(game.FontName, 22, FontStyle.Regular);
     enterIndex  = 3;
     widgets     = new LauncherWidget[8];
 }
 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 = null;
     Dirty = true;
 }
 protected override void SelectWidget( LauncherWidget widget )
 {
     base.SelectWidget( widget );
     if( widget is LauncherInputWidget ) {
         widgetOpenTime = DateTime.UtcNow;
         lastCaretFlash = false;
     }
 }
 public ColoursScreen( LauncherWindow game )
     : base(game, true)
 {
     enterIndex = 6;
     widgets = new LauncherWidget[25];
 }
        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 );
                        ((LauncherInputWidget)widgets[i]).CaretPos = -1;
                    }
                    break;
                }
            }
        }
 protected virtual void WidgetUnclicked( LauncherWidget widget )
 {
 }
 /// <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.RedrawBackground();
         using( drawer ) {
             drawer.SetBitmap( game.Framebuffer );
             button.Redraw( drawer );
         }
         Dirty = true;
     }
 }
        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;

                    if( selectedWidget != null )
                        UnselectWidget( selectedWidget );
                    SelectWidget( widget );
                    selectedWidget = widget;
                    return;
                }
            }

            if( selectedWidget == null ) return;
            UnselectWidget( selectedWidget );
            selectedWidget = null;
        }
        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;
        }
 public ColoursScreen(LauncherWindow game) : base(game, true)
 {
     enterIndex = 6;
     widgets    = new LauncherWidget[25];
 }