-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,975 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"Toggle": { | ||
"type": "toggle", | ||
"title": "exampleconfig.toggle.title", | ||
"tooltip": "exampleconfig.toggle.tooltip", | ||
"value": true | ||
}, | ||
"Text": { | ||
"type": "text", | ||
"title": "exampleconfig.text.title", | ||
"tooltip": "exampleconfig.text.tooltip", | ||
"value": "Hello" | ||
}, | ||
"Integer": { | ||
"type": "integer", | ||
"title": "exampleconfig.integer.title", | ||
"tooltip": "exampleconfig.integer.tooltip", | ||
"value": 22 | ||
}, | ||
"Decimal": { | ||
"type": "decimal", | ||
"title": "exampleconfig.decimal.title", | ||
"tooltip": "exampleconfig.decimal.tooltip", | ||
"value": 1.01 | ||
}, | ||
"Slider": { | ||
"type": "slider", | ||
"title": "exampleconfig.slider.title", | ||
"tooltip": "exampleconfig.slider.tooltip", | ||
"min": 10, | ||
"max": 20, | ||
"value": 15 | ||
}, | ||
"Dropdown": { | ||
"type": "dropdown", | ||
"title": "exampleconfig.dropdown.title", | ||
"tooltip": "exampleconfig.dropdown.tooltip", | ||
"options": [ | ||
"exampleconfig.dropdown.option.one", | ||
"exampleconfig.dropdown.option.two", | ||
"exampleconfig.dropdown.option.three" | ||
], | ||
"value": "exampleconfig.dropdown.option.two" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"menu.mods": "Mods", | ||
"popup.confirm-restore-mod-default-settings": "Are you sure you want to restore this mod's settings back to default values?\n\nThis action cannot be undone.", | ||
"settings.tab.mods": "Mods", | ||
"settings.mods.footer.list": "List", | ||
"settings.mods.footer.options": "Options", | ||
"winch.name": "Winch", | ||
"winch.writelogstofile.title": "Write logs to file", | ||
"winch.writelogstofile.tooltip": "Whether to write logs to a file.\n\nREQUIRES RESTART TO TAKE EFFECT.", | ||
"winch.writelogstoconsole.title": "Write logs to console", | ||
"winch.writelogstoconsole.tooltip": "Whether to open the console program.\n\nREQUIRES RESTART TO TAKE EFFECT.", | ||
"winch.loglevel.title": "Minimum Log Level", | ||
"winch.loglevel.tooltip": "The minimum log level that can pushed to file and console.", | ||
"winch.logsfolder.title": "Logs Folder", | ||
"winch.logsfolder.tooltip": "The path to the logs folder. Can be relative to the game folder or absolute.\n\nREQUIRES RESTART TO TAKE EFFECT.", | ||
"winch.detailedlogsources.title": "Detailed Log Sources", | ||
"winch.detailedlogsources.tooltip": "Whether to show the class and method the log came from instead of just the assembly name.", | ||
"winch.enabledeveloperconsole.title": "Enable Developer Console", | ||
"winch.enabledeveloperconsole.tooltip": "Whether to enable the terminal that can opened with the ` key.", | ||
"winch.maxlogfiles.title": "Max Log Files", | ||
"winch.maxlogfiles.tooltip": "The maximum amount of logs that can be in the log folder.\n\nREQUIRES RESTART TO TAKE EFFECT.", | ||
"winch.exportyarnprogram.title": "Export Yarn Program", | ||
"winch.exportyarnprogram.tooltip": "Whether to extract the game's Yarn dialogue program to 'YarnProgramVanilla.txt' and 'YarnProgramModded.txt' in the game folder.\n\nREQUIRES RESTART TO TAKE EFFECT." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using TMPro; | ||
using UnityEngine; | ||
using UnityEngine.Localization; | ||
using UnityEngine.Localization.Settings; | ||
using UnityEngine.UI; | ||
using Winch.Util; | ||
|
||
namespace Winch.Components | ||
{ | ||
public class ColorDropdownInput : DropdownInput | ||
{ | ||
[SerializeField] | ||
internal TextMeshProUGUI textField; | ||
|
||
[SerializeField] | ||
private LocalizedString labelLocalizedString = LocalizationUtil.CreateReference("Strings", "settings.dropdown.color"); | ||
|
||
[SerializeField] | ||
internal int columns; | ||
|
||
protected override void Awake() | ||
{ | ||
populateOptions = true; | ||
retrieveSelectedIndex = true; | ||
scrollToSelectedItem = false; | ||
optionStrings = GameManager.Instance.GameConfigData.Colors.Select(color => labelLocalizedString).ToList(); | ||
base.Awake(); | ||
initialized = true; | ||
} | ||
|
||
protected override void OnLocaleChanged(Locale l) | ||
{ | ||
RefreshDropdown(); | ||
} | ||
|
||
protected override void RefreshDropdown() | ||
{ | ||
base.RefreshDropdown(); | ||
RefreshLabelsColor(); | ||
} | ||
|
||
private void RefreshLabelsColor() | ||
{ | ||
textField.color = GameManager.Instance.GameConfigData.Colors[CurrentIndex]; | ||
} | ||
|
||
protected override void RetrieveSelectedIndex() | ||
{ | ||
base.RetrieveSelectedIndex(); | ||
} | ||
|
||
protected override void OnValueChanged(int value) | ||
{ | ||
base.OnValueChanged(value); | ||
RefreshLabelsColor(); | ||
} | ||
|
||
protected override void OnComponentSubmitted() | ||
{ | ||
List<DropdownItem> items = transform.GetComponentsInChildren<DropdownItem>().ToList<DropdownItem>(); | ||
for (int i = 0; i < items.Count; i++) | ||
{ | ||
var item = items[i]; | ||
item.background.color = GameManager.Instance.GameConfigData.Colors[i]; | ||
Selectable toggle = item.toggle; | ||
Navigation navigation = toggle.navigation; | ||
var floatedColumns = (float)columns; | ||
if (i <= Mathf.Ceil((items.Count / floatedColumns) * floatedColumns) && i + columns < items.Count) | ||
{ | ||
Selectable toggle2 = items[i + columns].toggle; | ||
navigation.selectOnDown = toggle2; | ||
} | ||
if (i >= columns && i - columns >= 0) | ||
{ | ||
Selectable toggle3 = items[i - columns].toggle; | ||
navigation.selectOnUp = toggle3; | ||
} | ||
toggle.navigation = navigation; | ||
} | ||
} | ||
|
||
protected override void ChangeValue(int index) | ||
{ | ||
SetConfigValue<Color>(GameManager.Instance.GameConfigData.Colors[index]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
| ||
using Winch.Core; | ||
|
||
namespace Winch.Components | ||
{ | ||
public class DecimalFieldInput : FieldInput | ||
{ | ||
protected override void Awake() | ||
{ | ||
base.Awake(); | ||
inputField.characterValidation = TMPro.TMP_InputField.CharacterValidation.Decimal; | ||
} | ||
|
||
protected override bool ValidateInput(string input) | ||
{ | ||
return double.TryParse(input, out _); | ||
} | ||
|
||
protected override void ChangeValue(string value) | ||
{ | ||
if (string.IsNullOrWhiteSpace(value)) | ||
{ | ||
ResetConfigValueToDefault(); | ||
return; | ||
} | ||
|
||
if (double.TryParse(value, out double floatingValue)) | ||
SetConfigValue(floatingValue); | ||
else | ||
{ | ||
ResetConfigValueToDefault(); | ||
WinchCore.Log.Error($"Invalid decimal \"{value}\" for setting {key}"); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.