Localize options menu.

This commit is contained in:
Pieter-Jan Briers
2021-02-25 21:08:06 +01:00
parent 1fa26c1634
commit 454465694a
5 changed files with 248 additions and 120 deletions

View File

@@ -56,39 +56,40 @@ namespace Content.Client.UserInterface
Children = Children =
{ {
new Control {MinSize = (4, 0)}, new Control {MinSize = (4, 0)},
new Label {Text = Loc.GetString("Master Volume:")}, new Label {Text = Loc.GetString("ui-options-master-volume")},
new Control {MinSize = (8, 0)}, new Control {MinSize = (8, 0)},
MasterVolumeSlider, MasterVolumeSlider,
new Control {MinSize = (8, 0)}, new Control {MinSize = (8, 0)},
MasterVolumeLabel, MasterVolumeLabel,
new Control { MinSize = (4, 0) }, new Control {MinSize = (4, 0)},
} }
}); });
// sets up ambience checkbox. i am sorry for not fixing the rest of this code. // sets up ambience checkbox. i am sorry for not fixing the rest of this code.
AmbienceCheckBox = new CheckBox { Text = Loc.GetString("Ambient Hum") }; AmbienceCheckBox = new CheckBox {Text = Loc.GetString("ui-options-ambient-hum")};
contents.AddChild(AmbienceCheckBox); contents.AddChild(AmbienceCheckBox);
AmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.AmbienceBasicEnabled); AmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.AmbienceBasicEnabled);
ApplyButton = new Button ApplyButton = new Button
{ {
Text = Loc.GetString("Apply"), TextAlign = Label.AlignMode.Center, Text = Loc.GetString("ui-options-apply"), TextAlign = Label.AlignMode.Center,
HorizontalAlignment = HAlignment.Right HorizontalAlignment = HAlignment.Right
}; };
vBox.AddChild(new Label vBox.AddChild(new Label
{ {
Text = Loc.GetString("Volume Sliders"), Text = Loc.GetString("ui-options-volume-sliders"),
FontColorOverride = StyleNano.NanoGold, FontColorOverride = StyleNano.NanoGold,
StyleClasses = { StyleNano.StyleClassLabelKeyText } StyleClasses = {StyleNano.StyleClassLabelKeyText}
}); });
vBox.AddChild(contents); vBox.AddChild(contents);
ResetButton = new Button ResetButton = new Button
{ {
Text = Loc.GetString("Reset all"), Text = Loc.GetString("ui-options-reset-all"),
StyleClasses = { StyleBase.ButtonCaution }, StyleClasses = {StyleBase.ButtonCaution},
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Right HorizontalAlignment = HAlignment.Right
}; };
@@ -106,23 +107,21 @@ namespace Content.Client.UserInterface
Children = Children =
{ {
ResetButton, ResetButton,
new Control { MinSize = (2, 0) }, new Control {MinSize = (2, 0)},
ApplyButton ApplyButton
} }
} }
} }
}); });
MasterVolumeSlider.Value = _cfg.GetCVar(CVars.AudioMasterVolume) * 100.0f;
MasterVolumeLabel.Text = string.Format(Loc.GetString("{0:0}%"), MasterVolumeSlider.Value);
ApplyButton.OnPressed += OnApplyButtonPressed; ApplyButton.OnPressed += OnApplyButtonPressed;
ResetButton.OnPressed += OnResetButtonPressed; ResetButton.OnPressed += OnResetButtonPressed;
MasterVolumeSlider.OnValueChanged += OnMasterVolumeSliderChanged; MasterVolumeSlider.OnValueChanged += OnMasterVolumeSliderChanged;
AmbienceCheckBox.OnToggled += OnAmbienceCheckToggled; AmbienceCheckBox.OnToggled += OnAmbienceCheckToggled;
AddChild(vBox); AddChild(vBox);
UpdateChanges();
Reset();
} }
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
@@ -136,8 +135,9 @@ namespace Content.Client.UserInterface
private void OnMasterVolumeSliderChanged(Range range) private void OnMasterVolumeSliderChanged(Range range)
{ {
MasterVolumeLabel.Text = string.Format(Loc.GetString("{0:0}%"), MasterVolumeSlider.Value); MasterVolumeLabel.Text =
_clydeAudio.SetMasterVolume(MasterVolumeSlider.Value / 100.0f); Loc.GetString("ui-options-volume-percent", ("volume", MasterVolumeSlider.Value / 100));
_clydeAudio.SetMasterVolume(MasterVolumeSlider.Value / 100);
UpdateChanges(); UpdateChanges();
} }
@@ -148,7 +148,7 @@ namespace Content.Client.UserInterface
private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args) private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
{ {
_cfg.SetCVar(CVars.AudioMasterVolume, MasterVolumeSlider.Value / 100.0f); _cfg.SetCVar(CVars.AudioMasterVolume, MasterVolumeSlider.Value / 100);
_cfg.SetCVar(CCVars.AmbienceBasicEnabled, AmbienceCheckBox.Pressed); _cfg.SetCVar(CCVars.AmbienceBasicEnabled, AmbienceCheckBox.Pressed);
_cfg.SaveToFile(); _cfg.SaveToFile();
UpdateChanges(); UpdateChanges();
@@ -156,15 +156,22 @@ namespace Content.Client.UserInterface
private void OnResetButtonPressed(BaseButton.ButtonEventArgs args) private void OnResetButtonPressed(BaseButton.ButtonEventArgs args)
{ {
MasterVolumeSlider.Value = _cfg.GetCVar(CVars.AudioMasterVolume) * 100.0f; Reset();
MasterVolumeLabel.Text = string.Format(Loc.GetString("{0:0}%"), MasterVolumeSlider.Value); }
private void Reset()
{
MasterVolumeSlider.Value = _cfg.GetCVar(CVars.AudioMasterVolume) * 100;
MasterVolumeLabel.Text =
Loc.GetString("ui-options-volume-percent", ("volume", MasterVolumeSlider.Value / 100));
AmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.AmbienceBasicEnabled); AmbienceCheckBox.Pressed = _cfg.GetCVar(CCVars.AmbienceBasicEnabled);
UpdateChanges(); UpdateChanges();
} }
private void UpdateChanges() private void UpdateChanges()
{ {
var isMasterVolumeSame = System.Math.Abs(MasterVolumeSlider.Value - _cfg.GetCVar(CVars.AudioMasterVolume) * 100.0f) < 0.01f; var isMasterVolumeSame =
System.Math.Abs(MasterVolumeSlider.Value - _cfg.GetCVar(CVars.AudioMasterVolume) * 100) < 0.01f;
var isAmbienceSame = AmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.AmbienceBasicEnabled); var isAmbienceSame = AmbienceCheckBox.Pressed == _cfg.GetCVar(CCVars.AmbienceBasicEnabled);
var isEverythingSame = isMasterVolumeSame && isAmbienceSame; var isEverythingSame = isMasterVolumeSame && isAmbienceSame;
ApplyButton.Disabled = isEverythingSame; ApplyButton.Disabled = isEverythingSame;

View File

@@ -44,26 +44,26 @@ namespace Content.Client.UserInterface
VerticalExpand = true, VerticalExpand = true,
}; };
VSyncCheckBox = new CheckBox {Text = Loc.GetString("VSync")}; VSyncCheckBox = new CheckBox {Text = Loc.GetString("ui-options-vsync")};
contents.AddChild(VSyncCheckBox); contents.AddChild(VSyncCheckBox);
VSyncCheckBox.OnToggled += OnCheckBoxToggled; VSyncCheckBox.OnToggled += OnCheckBoxToggled;
FullscreenCheckBox = new CheckBox {Text = Loc.GetString("Fullscreen")}; FullscreenCheckBox = new CheckBox {Text = Loc.GetString("ui-options-fullscreen")};
contents.AddChild(FullscreenCheckBox); contents.AddChild(FullscreenCheckBox);
FullscreenCheckBox.OnToggled += OnCheckBoxToggled; FullscreenCheckBox.OnToggled += OnCheckBoxToggled;
LightingPresetOption = new OptionButton {MinSize = (100, 0)}; LightingPresetOption = new OptionButton {MinSize = (100, 0)};
LightingPresetOption.AddItem(Loc.GetString("Very Low")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-very-low"));
LightingPresetOption.AddItem(Loc.GetString("Low")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-low"));
LightingPresetOption.AddItem(Loc.GetString("Medium")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-medium"));
LightingPresetOption.AddItem(Loc.GetString("High")); LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-high"));
LightingPresetOption.OnItemSelected += OnLightingQualityChanged; LightingPresetOption.OnItemSelected += OnLightingQualityChanged;
contents.AddChild(new HBoxContainer contents.AddChild(new HBoxContainer
{ {
Children = Children =
{ {
new Label {Text = Loc.GetString("Lighting Quality:")}, new Label {Text = Loc.GetString("ui-options-lighting-label")},
new Control {MinSize = (4, 0)}, new Control {MinSize = (4, 0)},
LightingPresetOption LightingPresetOption
} }
@@ -71,27 +71,27 @@ namespace Content.Client.UserInterface
ApplyButton = new Button ApplyButton = new Button
{ {
Text = Loc.GetString("Apply"), TextAlign = Label.AlignMode.Center, Text = Loc.GetString("ui-options-apply"), TextAlign = Label.AlignMode.Center,
HorizontalAlignment = HAlignment.Right HorizontalAlignment = HAlignment.Right
}; };
var resourceCache = IoCManager.Resolve<IResourceCache>(); var resourceCache = IoCManager.Resolve<IResourceCache>();
_uiScaleOption = new OptionButton(); _uiScaleOption = new OptionButton();
_uiScaleOption.AddItem(Loc.GetString("Automatic ({0}%)", UserInterfaceManager.DefaultUIScale * 100)); _uiScaleOption.AddItem(Loc.GetString("ui-options-scale-auto", ("scale", UserInterfaceManager.DefaultUIScale)));
_uiScaleOption.AddItem(Loc.GetString("75%")); _uiScaleOption.AddItem(Loc.GetString("ui-options-scale-75"));
_uiScaleOption.AddItem(Loc.GetString("100%")); _uiScaleOption.AddItem(Loc.GetString("ui-options-scale-100"));
_uiScaleOption.AddItem(Loc.GetString("125%")); _uiScaleOption.AddItem(Loc.GetString("ui-options-scale-125"));
_uiScaleOption.AddItem(Loc.GetString("150%")); _uiScaleOption.AddItem(Loc.GetString("ui-options-scale-150"));
_uiScaleOption.AddItem(Loc.GetString("175%")); _uiScaleOption.AddItem(Loc.GetString("ui-options-scale-175"));
_uiScaleOption.AddItem(Loc.GetString("200%")); _uiScaleOption.AddItem(Loc.GetString("ui-options-scale-200"));
_uiScaleOption.OnItemSelected += OnUIScaleChanged; _uiScaleOption.OnItemSelected += OnUIScaleChanged;
contents.AddChild(new HBoxContainer contents.AddChild(new HBoxContainer
{ {
Children = Children =
{ {
new Label {Text = Loc.GetString("UI Scale:")}, new Label {Text = Loc.GetString("ui-options-scale-label")},
new Control {MinSize = (4, 0)}, new Control {MinSize = (4, 0)},
_uiScaleOption _uiScaleOption
} }
@@ -100,7 +100,7 @@ namespace Content.Client.UserInterface
contents.AddChild(new Placeholder(resourceCache) contents.AddChild(new Placeholder(resourceCache)
{ {
VerticalExpand = true, VerticalExpand = true,
PlaceholderText = "Viewport settings" PlaceholderText = Loc.GetString("ui-options-placeholder-viewport")
}); });
vBox.AddChild(contents); vBox.AddChild(contents);

View File

@@ -65,11 +65,11 @@ namespace Content.Client.UserInterface
new Label new Label
{ {
StyleClasses = {StyleBase.StyleClassLabelSubText}, StyleClasses = {StyleBase.StyleClassLabelSubText},
Text = "Click to change binding, right-click to clear" Text = Loc.GetString("ui-options-binds-explanation")
}, },
(resetAllButton = new Button (resetAllButton = new Button
{ {
Text = "Reset ALL keybinds", Text = Loc.GetString("ui-options-binds-reset-all"),
StyleClasses = {StyleBase.ButtonCaution}, StyleClasses = {StyleBase.ButtonCaution},
HorizontalAlignment = HAlignment.Right HorizontalAlignment = HAlignment.Right
}) })
@@ -101,96 +101,96 @@ namespace Content.Client.UserInterface
first = false; first = false;
vBox.AddChild(new Label vBox.AddChild(new Label
{ {
Text = headerContents, Text = Loc.GetString(headerContents),
FontColorOverride = StyleNano.NanoGold, FontColorOverride = StyleNano.NanoGold,
StyleClasses = {StyleNano.StyleClassLabelKeyText} StyleClasses = {StyleNano.StyleClassLabelKeyText}
}); });
} }
void AddButton(BoundKeyFunction function, string name) void AddButton(BoundKeyFunction function)
{ {
var control = new KeyControl(this, name, function); var control = new KeyControl(this, function);
vBox.AddChild(control); vBox.AddChild(control);
_keyControls.Add(function, control); _keyControls.Add(function, control);
} }
AddHeader("Movement"); AddHeader("ui-options-header-movement");
AddButton(EngineKeyFunctions.MoveUp, "Move up"); AddButton(EngineKeyFunctions.MoveUp);
AddButton(EngineKeyFunctions.MoveLeft, "Move left"); AddButton(EngineKeyFunctions.MoveLeft);
AddButton(EngineKeyFunctions.MoveDown, "Move down"); AddButton(EngineKeyFunctions.MoveDown);
AddButton(EngineKeyFunctions.MoveRight, "Move right"); AddButton(EngineKeyFunctions.MoveRight);
AddButton(EngineKeyFunctions.Walk, "Walk"); AddButton(EngineKeyFunctions.Walk);
AddHeader("Basic Interaction"); AddHeader("ui-options-header-interaction-basic");
AddButton(EngineKeyFunctions.Use, "Use"); AddButton(EngineKeyFunctions.Use);
AddButton(ContentKeyFunctions.WideAttack, "Wide attack"); AddButton(ContentKeyFunctions.WideAttack);
AddButton(ContentKeyFunctions.ActivateItemInHand, "Activate item in hand"); AddButton(ContentKeyFunctions.ActivateItemInHand);
AddButton(ContentKeyFunctions.ActivateItemInWorld, "Activate item in world"); AddButton(ContentKeyFunctions.ActivateItemInWorld);
AddButton(ContentKeyFunctions.Drop, "Drop item"); AddButton(ContentKeyFunctions.Drop);
AddButton(ContentKeyFunctions.ExamineEntity, "Examine"); AddButton(ContentKeyFunctions.ExamineEntity);
AddButton(ContentKeyFunctions.SwapHands, "Swap hands"); AddButton(ContentKeyFunctions.SwapHands);
AddButton(ContentKeyFunctions.ToggleCombatMode, "Toggle combat mode"); AddButton(ContentKeyFunctions.ToggleCombatMode);
AddHeader("Advanced Interaction"); AddHeader("ui-options-header-interaction-adv");
AddButton(ContentKeyFunctions.SmartEquipBackpack, "Smart-equip to backpack"); AddButton(ContentKeyFunctions.SmartEquipBackpack);
AddButton(ContentKeyFunctions.SmartEquipBelt, "Smart-equip to belt"); AddButton(ContentKeyFunctions.SmartEquipBelt);
AddButton(ContentKeyFunctions.ThrowItemInHand, "Throw item"); AddButton(ContentKeyFunctions.ThrowItemInHand);
AddButton(ContentKeyFunctions.TryPullObject, "Pull object"); AddButton(ContentKeyFunctions.TryPullObject);
AddButton(ContentKeyFunctions.MovePulledObject, "Move pulled object"); AddButton(ContentKeyFunctions.MovePulledObject);
AddButton(ContentKeyFunctions.ReleasePulledObject, "Release pulled object"); AddButton(ContentKeyFunctions.ReleasePulledObject);
AddButton(ContentKeyFunctions.Point, "Point at location"); AddButton(ContentKeyFunctions.Point);
AddHeader("User Interface"); AddHeader("ui-options-header-ui");
AddButton(ContentKeyFunctions.FocusChat, "Focus chat"); AddButton(ContentKeyFunctions.FocusChat);
AddButton(ContentKeyFunctions.FocusOOC, "Focus chat (OOC)"); AddButton(ContentKeyFunctions.FocusOOC);
AddButton(ContentKeyFunctions.FocusAdminChat, "Focus chat (admin)"); AddButton(ContentKeyFunctions.FocusAdminChat);
AddButton(ContentKeyFunctions.OpenCharacterMenu, "Open character menu"); AddButton(ContentKeyFunctions.OpenCharacterMenu);
AddButton(ContentKeyFunctions.OpenContextMenu, "Open context menu"); AddButton(ContentKeyFunctions.OpenContextMenu);
AddButton(ContentKeyFunctions.OpenCraftingMenu, "Open crafting menu"); AddButton(ContentKeyFunctions.OpenCraftingMenu);
AddButton(ContentKeyFunctions.OpenInventoryMenu, "Open inventory"); AddButton(ContentKeyFunctions.OpenInventoryMenu);
AddButton(ContentKeyFunctions.OpenTutorial, "Open tutorial"); AddButton(ContentKeyFunctions.OpenTutorial);
AddButton(ContentKeyFunctions.OpenActionsMenu, "Open action menu"); AddButton(ContentKeyFunctions.OpenActionsMenu);
AddButton(ContentKeyFunctions.OpenEntitySpawnWindow, "Open entity spawn menu"); AddButton(ContentKeyFunctions.OpenEntitySpawnWindow);
AddButton(ContentKeyFunctions.OpenSandboxWindow, "Open sandbox menu"); AddButton(ContentKeyFunctions.OpenSandboxWindow);
AddButton(ContentKeyFunctions.OpenTileSpawnWindow, "Open tile spawn menu"); AddButton(ContentKeyFunctions.OpenTileSpawnWindow);
AddButton(ContentKeyFunctions.OpenAdminMenu, "Open admin menu"); AddButton(ContentKeyFunctions.OpenAdminMenu);
AddHeader("Miscellaneous"); AddHeader("ui-options-header-misc");
AddButton(ContentKeyFunctions.TakeScreenshot, "Take screenshot"); AddButton(ContentKeyFunctions.TakeScreenshot);
AddButton(ContentKeyFunctions.TakeScreenshotNoUI, "Take screenshot (without UI)"); AddButton(ContentKeyFunctions.TakeScreenshotNoUI);
AddHeader("Hotbar"); AddHeader("ui-options-header-hotbar");
AddButton(ContentKeyFunctions.Hotbar1, "Hotbar slot 1"); AddButton(ContentKeyFunctions.Hotbar1);
AddButton(ContentKeyFunctions.Hotbar2, "Hotbar slot 2"); AddButton(ContentKeyFunctions.Hotbar2);
AddButton(ContentKeyFunctions.Hotbar3, "Hotbar slot 3"); AddButton(ContentKeyFunctions.Hotbar3);
AddButton(ContentKeyFunctions.Hotbar4, "Hotbar slot 4"); AddButton(ContentKeyFunctions.Hotbar4);
AddButton(ContentKeyFunctions.Hotbar5, "Hotbar slot 5"); AddButton(ContentKeyFunctions.Hotbar5);
AddButton(ContentKeyFunctions.Hotbar6, "Hotbar slot 6"); AddButton(ContentKeyFunctions.Hotbar6);
AddButton(ContentKeyFunctions.Hotbar7, "Hotbar slot 7"); AddButton(ContentKeyFunctions.Hotbar7);
AddButton(ContentKeyFunctions.Hotbar8, "Hotbar slot 8"); AddButton(ContentKeyFunctions.Hotbar8);
AddButton(ContentKeyFunctions.Hotbar9, "Hotbar slot 9"); AddButton(ContentKeyFunctions.Hotbar9);
AddButton(ContentKeyFunctions.Hotbar0, "Hotbar slot 0"); AddButton(ContentKeyFunctions.Hotbar0);
AddButton(ContentKeyFunctions.Loadout1, "Hotbar Loadout 1"); AddButton(ContentKeyFunctions.Loadout1);
AddButton(ContentKeyFunctions.Loadout2, "Hotbar Loadout 2"); AddButton(ContentKeyFunctions.Loadout2);
AddButton(ContentKeyFunctions.Loadout3, "Hotbar Loadout 3"); AddButton(ContentKeyFunctions.Loadout3);
AddButton(ContentKeyFunctions.Loadout4, "Hotbar Loadout 4"); AddButton(ContentKeyFunctions.Loadout4);
AddButton(ContentKeyFunctions.Loadout5, "Hotbar Loadout 5"); AddButton(ContentKeyFunctions.Loadout5);
AddButton(ContentKeyFunctions.Loadout6, "Hotbar Loadout 6"); AddButton(ContentKeyFunctions.Loadout6);
AddButton(ContentKeyFunctions.Loadout7, "Hotbar Loadout 7"); AddButton(ContentKeyFunctions.Loadout7);
AddButton(ContentKeyFunctions.Loadout8, "Hotbar Loadout 8"); AddButton(ContentKeyFunctions.Loadout8);
AddButton(ContentKeyFunctions.Loadout9, "Hotbar Loadout 9"); AddButton(ContentKeyFunctions.Loadout9);
AddHeader("Map Editor"); AddHeader("ui-options-header-map-editor");
AddButton(EngineKeyFunctions.EditorPlaceObject, "Place object"); AddButton(EngineKeyFunctions.EditorPlaceObject);
AddButton(EngineKeyFunctions.EditorCancelPlace, "Cancel placement"); AddButton(EngineKeyFunctions.EditorCancelPlace);
AddButton(EngineKeyFunctions.EditorGridPlace, "Place in grid"); AddButton(EngineKeyFunctions.EditorGridPlace);
AddButton(EngineKeyFunctions.EditorLinePlace, "Place line"); AddButton(EngineKeyFunctions.EditorLinePlace);
AddButton(EngineKeyFunctions.EditorRotateObject, "Rotate"); AddButton(EngineKeyFunctions.EditorRotateObject);
AddHeader("Development"); AddHeader("ui-options-header-dev");
AddButton(EngineKeyFunctions.ShowDebugConsole, "Open Console"); AddButton(EngineKeyFunctions.ShowDebugConsole);
AddButton(EngineKeyFunctions.ShowDebugMonitors, "Show Debug Monitors"); AddButton(EngineKeyFunctions.ShowDebugMonitors);
AddButton(EngineKeyFunctions.HideUI, "Hide UI"); AddButton(EngineKeyFunctions.HideUI);
foreach (var control in _keyControls.Values) foreach (var control in _keyControls.Values)
{ {
@@ -357,7 +357,7 @@ namespace Content.Client.UserInterface
} }
_currentlyRebinding = button; _currentlyRebinding = button;
_currentlyRebinding.Button.Text = Loc.GetString("Press a key..."); _currentlyRebinding.Button.Text = Loc.GetString("ui-options-key-prompt");
if (button.Binding != null) if (button.Binding != null)
{ {
@@ -394,19 +394,20 @@ namespace Content.Client.UserInterface
public readonly BindButton BindButton2; public readonly BindButton BindButton2;
public readonly Button ResetButton; public readonly Button ResetButton;
public KeyControl(KeyRebindControl parent, string niceName, BoundKeyFunction function) public KeyControl(KeyRebindControl parent, BoundKeyFunction function)
{ {
Function = function; Function = function;
var name = new Label var name = new Label
{ {
Text = Loc.GetString(niceName), Text = Loc.GetString(
$"ui-options-function-{CaseConversion.PascalToKebab(function.FunctionName)}"),
HorizontalExpand = true, HorizontalExpand = true,
HorizontalAlignment = HAlignment.Left HorizontalAlignment = HAlignment.Left
}; };
BindButton1 = new BindButton(parent, this, StyleBase.ButtonOpenRight); BindButton1 = new BindButton(parent, this, StyleBase.ButtonOpenRight);
BindButton2 = new BindButton(parent, this, StyleBase.ButtonOpenLeft); BindButton2 = new BindButton(parent, this, StyleBase.ButtonOpenLeft);
ResetButton = new Button {Text = Loc.GetString("Reset"), StyleClasses = {StyleBase.ButtonCaution}}; ResetButton = new Button {Text = Loc.GetString("ui-options-bind-reset"), StyleClasses = {StyleBase.ButtonCaution}};
var hBox = new HBoxContainer var hBox = new HBoxContainer
{ {
@@ -478,7 +479,7 @@ namespace Content.Client.UserInterface
public void UpdateText() public void UpdateText()
{ {
Button.Text = Binding?.GetKeyString() ?? "Unbound"; Button.Text = Binding?.GetKeyString() ?? Loc.GetString("ui-options-unbound");
} }
} }
} }

View File

@@ -20,7 +20,7 @@ namespace Content.Client.UserInterface
SetSize = MinSize = (800, 450); SetSize = MinSize = (800, 450);
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
Title = Loc.GetString("Game Options"); Title = Loc.GetString("ui-options-title");
GraphicsControl graphicsControl; GraphicsControl graphicsControl;
KeyRebindControl rebindControl; KeyRebindControl rebindControl;
@@ -36,9 +36,9 @@ namespace Content.Client.UserInterface
} }
}; };
TabContainer.SetTabTitle(graphicsControl, Loc.GetString("Graphics")); TabContainer.SetTabTitle(graphicsControl, Loc.GetString("ui-options-tab-graphics"));
TabContainer.SetTabTitle(rebindControl, Loc.GetString("Controls")); TabContainer.SetTabTitle(rebindControl, Loc.GetString("ui-options-tab-controls"));
TabContainer.SetTabTitle(audioControl, Loc.GetString("Audio")); TabContainer.SetTabTitle(audioControl, Loc.GetString("ui-options-tab-audio"));
Contents.AddChild(tabs); Contents.AddChild(tabs);
} }

View File

@@ -0,0 +1,120 @@
### Options menu stuff.
## General stuff
ui-options-title = Game Options
ui-options-tab-graphics = Graphics
ui-options-tab-controls = Controls
ui-options-tab-audio = Audio
ui-options-apply = Apply
ui-options-reset-all = Reset All
## Audio menu
ui-options-master-volume = Master Volume:
ui-options-ambient-hum = Ambient Hum
ui-options-volume-sliders = Volume Sliders
ui-options-volume-percent = { TOSTRING($volume, "P0") }
## Graphics menu
ui-options-vsync = VSync
ui-options-fullscreen = Fullscreen
ui-options-lighting-label = Lighting Quality:
ui-options-lighting-very-low = Very Low
ui-options-lighting-low = Low
ui-options-lighting-medium = Medium
ui-options-lighting-high = High
ui-options-scale-label = UI Scale:
ui-options-scale-auto = Automatic ({ TOSTRING($scale, "P0") })
ui-options-scale-75 = 75%
ui-options-scale-100 = 100%
ui-options-scale-125 = 125%
ui-options-scale-150 = 150%
ui-options-scale-175 = 175%
ui-options-scale-200 = 200%
ui-options-placeholder-viewport = Viewport settings
## Controls menu
ui-options-binds-reset-all = Reset ALL keybinds
ui-options-binds-explanation = Click to change binding, right-click to clear
ui-options-unbound = Unbound
ui-options-bind-reset = Reset
ui-options-key-prompt = Press a key...
ui-options-header-movement = Movement
ui-options-header-interaction-basic = Basic Interaction
ui-options-header-interaction-adv = Advanced Interaction
ui-options-header-ui = User Interface
ui-options-header-misc = Miscellaneous
ui-options-header-hotbar = Hotbar
ui-options-header-map-editor = Map Editor
ui-options-header-dev = Development
ui-options-function-move-up = Move Up
ui-options-function-move-left = Move Left
ui-options-function-move-down = Move Down
ui-options-function-move-right = Move Right
ui-options-function-walk = Walk
ui-options-function-use = Use
ui-options-function-wide-attack = Wide attack
ui-options-function-activate-item-in-hand = Activate item in hand
ui-options-function-activate-item-in-world = Activate item in world
ui-options-function-drop = Drop item
ui-options-function-examine-entity = Examine
ui-options-function-swap-hands = Swap hands
ui-options-function-toggle-combat-mode = Toggle combat mode
ui-options-function-smart-equip-backpack = Smart-equip to backpack
ui-options-function-smart-equip-belt = Smart-equip to belt
ui-options-function-throw-item-in-hand = Throw item
ui-options-function-try-pull-object = Pull object
ui-options-function-move-pulled-object = Move pulled object
ui-options-function-release-pulled-object = Release pulled object
ui-options-function-point = Point at location
ui-options-function-focus-chat-window = Focus chat
ui-options-function-focus-ooc-window = Focus chat (OOC)
ui-options-function-focus-admin-chat-window = Focus chat (admin)
ui-options-function-open-character-menu = Open character menu
ui-options-function-open-context-menu = Open context menu
ui-options-function-open-crafting-menu = Open crafting menu
ui-options-function-open-inventory-menu = Open inventory
ui-options-function-open-tutorial = Open tutorial
ui-options-function-open-abilities-menu = Open action menu
ui-options-function-open-entity-spawn-window = Open entity spawn menu
ui-options-function-open-sandbox-window = Open sandbox menu
ui-options-function-open-tile-spawn-window = Open tile spawn menu
ui-options-function-open-admin-menu = Open admin menu
ui-options-function-take-screenshot = Take screenshot
ui-options-function-take-screenshot-no-ui = Take screenshot (without UI)
ui-options-function-hotbar1 = Hotbar slot 1
ui-options-function-hotbar2 = Hotbar slot 2
ui-options-function-hotbar3 = Hotbar slot 3
ui-options-function-hotbar4 = Hotbar slot 4
ui-options-function-hotbar5 = Hotbar slot 5
ui-options-function-hotbar6 = Hotbar slot 6
ui-options-function-hotbar7 = Hotbar slot 7
ui-options-function-hotbar8 = Hotbar slot 8
ui-options-function-hotbar9 = Hotbar slot 9
ui-options-function-hotbar0 = Hotbar slot 0
ui-options-function-loadout1 = Hotbar Loadout 1
ui-options-function-loadout2 = Hotbar Loadout 2
ui-options-function-loadout3 = Hotbar Loadout 3
ui-options-function-loadout4 = Hotbar Loadout 4
ui-options-function-loadout5 = Hotbar Loadout 5
ui-options-function-loadout6 = Hotbar Loadout 6
ui-options-function-loadout7 = Hotbar Loadout 7
ui-options-function-loadout8 = Hotbar Loadout 8
ui-options-function-loadout9 = Hotbar Loadout 9
ui-options-function-editor-place-object = Place object
ui-options-function-editor-cancel-place = Cancel placement
ui-options-function-editor-grid-place = Place in grid
ui-options-function-editor-line-place = Place line
ui-options-function-editor-rotate-object = Rotate
ui-options-function-show-debug-console = Open Console
ui-options-function-show-debug-monitors = Show Debug Monitors
ui-options-function-hide-ui = Hide UI