Ejemplo n.º 1
0
 protected override void UpdateEntry(ButtonWidget widget, string text)
 {
     try {
         using (Font tmp = new Font(text, font.Size)) {
             widget.Set(text, tmp);
         }
     } catch {
         widget.Set(empty, font);
     }
 }
Ejemplo n.º 2
0
        void SetButtonValue(int index, string text)
        {
            ButtonWidget btn = (ButtonWidget)widgets[index];

            btn.SetValue(game, text);

            // need to get btn again here (e.g. changing FPS invalidates all widgets)
            btn = (ButtonWidget)widgets[index];
            btn.Set(btn.OptName + ": " + btn.GetValue(game), titleFont);
        }
Ejemplo n.º 3
0
        void RemoveOverwrite(Widget widget, string defaultText)
        {
            ButtonWidget button = (ButtonWidget)widget;

            if (button.OptName == null)
            {
                return;
            }

            button.OptName = null;
            button.Set(defaultText, titleFont);
        }
Ejemplo n.º 4
0
        void OnBindingClick(Game game, Widget widget)
        {
            if (curI >= 0)
            {
                ButtonWidget curButton = (ButtonWidget)widgets[curI];
                curButton.Set(ButtonText(curI), titleFont);
            }

            curI = IndexWidget(widget);
            string text = ButtonText(curI);

            ((ButtonWidget)widget).Set("> " + text + " <", titleFont);
        }
Ejemplo n.º 5
0
        void UpdateDelayLeft(double delta)
        {
            double elapsed  = (DateTime.UtcNow - initTime).TotalSeconds;
            int    secsLeft = Math.Max(0, (int)(delay - elapsed));

            if (lastSecsLeft == secsLeft && reconnect.Active == lastActive)
            {
                return;
            }

            reconnect.Set(ReconnectMessage(), titleFont);
            reconnect.Disabled = secsLeft != 0;

            lastSecsLeft = secsLeft;
            lastActive   = reconnect.Active;
        }
Ejemplo n.º 6
0
        public override bool HandlesKeyDown(Key key)
        {
            if (curI == -1)
            {
                return(base.HandlesKeyDown(key));
            }
            KeyBind bind = binds[curI];

            if (key == Key.Escape)
            {
                key = game.Input.Keys.GetDefault(bind);
            }
            game.Input.Keys[bind] = key;

            ButtonWidget curButton = (ButtonWidget)widgets[curI];

            curButton.Set(ButtonText(curI), titleFont);
            curI = -1;
            return(true);
        }
Ejemplo n.º 7
0
        void DoSave(Widget widget, string ext)
        {
            string file = input.Text.ToString();

            if (file.Length == 0)
            {
                MakeDescWidget("&ePlease enter a filename"); return;
            }

            string       path = Path.Combine("maps", file + ext);
            ButtonWidget btn  = (ButtonWidget)widget;

            if (Platform.FileExists(path) && btn.OptName == null)
            {
                btn.Set("&cOverwrite existing?", titleFont);
                btn.OptName = "O";
            }
            else
            {
                RemoveOverwrites();
                SaveMap(path);
            }
        }
Ejemplo n.º 8
0
 protected virtual void UpdateEntry(ButtonWidget widget, string text)
 {
     widget.Set(text, font);
 }