Пример #1
0
        void Set(int index)
        {
            string       text   = Get(index + currentIndex);
            ButtonWidget button = buttons[index];

            button.SetText(text);
            button.Metadata = default(Hotkey);
            if (text != "-----")
            {
                button.Metadata = hotkeys.Hotkeys[index];
            }
        }
Пример #2
0
        void UpdateReconnectState()
        {
            ButtonWidget btn     = (ButtonWidget)widgets[2];
            double       elapsed = (DateTime.UtcNow - initTime).TotalSeconds;
            int          scsLeft = Math.Max(0, (int)(delay - elapsed));

            if (lastSecsLeft != scsLeft)
            {
                string suffix = scsLeft == 0 ? "" : ".. " + scsLeft;
                btn.SetText("Try to reconnect" + suffix);
            }
            btn.Disabled = scsLeft != 0;
        }
Пример #3
0
 public static ButtonWidget Create( Game game, int x, int y, int width, int height, string text, Anchor horizontal,
     Anchor vertical, Font font, Action<Game, Widget> onClick)
 {
     ButtonWidget widget = new ButtonWidget( game, font );
     widget.Init();
     widget.HorizontalAnchor = horizontal;
     widget.VerticalAnchor = vertical;
     widget.XOffset = x; widget.YOffset = y;
     widget.DesiredMaxWidth = width; widget.DesiredMaxHeight = height;
     widget.SetText( text );
     widget.OnClick = onClick;
     return widget;
 }
Пример #4
0
        public static ButtonWidget Create(Game game, int x, int y, int width, int height, string text, Anchor horizontal,
                                          Anchor vertical, Font font, ClickHandler onClick)
        {
            ButtonWidget widget = new ButtonWidget(game, font);

            widget.Init();
            widget.HorizontalAnchor = horizontal;
            widget.VerticalAnchor   = vertical;
            widget.XOffset          = x; widget.YOffset = y;
            widget.DesiredMaxWidth  = width; widget.DesiredMaxHeight = height;
            widget.SetText(text);
            widget.OnClick = onClick;
            return(widget);
        }
Пример #5
0
 void ModifiersClick( Game game, Widget widget )
 {
     focusWidget = buttons[9];
     focusWidget.SetText( "Modifiers: press a key.." );
     supressNextPress = true;
 }
Пример #6
0
 void BaseKeyClick( Game game, Widget widget )
 {
     focusWidget = buttons[8];
     focusWidget.SetText( "Key: press a key.." );
     supressNextPress = true;
 }
Пример #7
0
 void ModifiersClick(Game game, Widget widget)
 {
     focusWidget = buttons[9];
     focusWidget.SetText("Modifiers: press a key..");
     supressNextPress = true;
 }
Пример #8
0
 void BaseKeyClick(Game game, Widget widget)
 {
     focusWidget = buttons[8];
     focusWidget.SetText("Key: press a key..");
     supressNextPress = true;
 }