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); } }
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); }
void RemoveOverwrite(Widget widget, string defaultText) { ButtonWidget button = (ButtonWidget)widget; if (button.OptName == null) { return; } button.OptName = null; button.Set(defaultText, titleFont); }
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); }
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; }
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); }
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); } }
protected virtual void UpdateEntry(ButtonWidget widget, string text) { widget.Set(text, font); }