Rename some members to avoid confusion

This commit is contained in:
Sinai
2021-05-11 19:18:27 +10:00
parent ec215a0006
commit 7241247d05
24 changed files with 115 additions and 113 deletions

View File

@ -26,12 +26,12 @@ namespace UnityExplorer.UI.IValues
{
base.OnBorrowed(owner);
m_applyButton.Button.gameObject.SetActive(owner.CanWrite);
m_applyButton.Component.gameObject.SetActive(owner.CanWrite);
foreach (var slider in m_sliders)
slider.interactable = owner.CanWrite;
foreach (var input in m_inputs)
input.InputField.readOnly = !owner.CanWrite;
input.Component.readOnly = !owner.CanWrite;
}
// owner setting value to this
@ -158,7 +158,7 @@ namespace UnityExplorer.UI.IValues
// apply button
m_applyButton = UIFactory.CreateButton(horiGroup, "ApplyButton", "Apply", new Color(0.2f, 0.26f, 0.2f));
UIFactory.SetLayoutElement(m_applyButton.Button.gameObject, minHeight: 25, minWidth: 90);
UIFactory.SetLayoutElement(m_applyButton.Component.gameObject, minHeight: 25, minWidth: 90);
m_applyButton.OnClick += SetValueToOwner;
// sliders / inputs

View File

@ -191,7 +191,7 @@ namespace UnityExplorer.UI.IValues
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(hori, false, false, true, true, 2);
var applyButton = UIFactory.CreateButton(hori, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
UIFactory.SetLayoutElement(applyButton.Button.gameObject, minHeight: 25, minWidth: 100);
UIFactory.SetLayoutElement(applyButton.Component.gameObject, minHeight: 25, minWidth: 100);
applyButton.OnClick += OnApplyClicked;
var dropdownObj = UIFactory.CreateDropdown(hori, out enumDropdown, "not set", 14, null);

View File

@ -26,8 +26,8 @@ namespace UnityExplorer.UI.IValues
{
base.OnBorrowed(owner);
inputField.InputField.readOnly = !owner.CanWrite;
ApplyButton.Button.gameObject.SetActive(owner.CanWrite);
inputField.Component.readOnly = !owner.CanWrite;
ApplyButton.Component.gameObject.SetActive(owner.CanWrite);
SaveFilePath.Text = Path.Combine(ConfigManager.Default_Output_Path.Value, "untitled.txt");
}
@ -65,11 +65,7 @@ namespace UnityExplorer.UI.IValues
private void OnInputChanged(string input)
{
EditedValue = input;
if (IsStringTooLong(EditedValue))
{
ExplorerCore.LogWarning("InputField length has reached maximum character count!");
}
SaveFileRow.SetActive(IsStringTooLong(EditedValue));
}
private void OnSaveFileClicked()
@ -109,7 +105,7 @@ namespace UnityExplorer.UI.IValues
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horizRow, false, false, true, true, 4);
var saveButton = UIFactory.CreateButton(horizRow, "SaveButton", "Save file");
UIFactory.SetLayoutElement(saveButton.Button.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
UIFactory.SetLayoutElement(saveButton.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
saveButton.OnClick += OnSaveFileClicked;
SaveFilePath = UIFactory.CreateInputField(horizRow, "SaveInput", "...");
@ -118,13 +114,13 @@ namespace UnityExplorer.UI.IValues
// Main Input / apply
ApplyButton = UIFactory.CreateButton(UIRoot, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
UIFactory.SetLayoutElement(ApplyButton.Button.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
UIFactory.SetLayoutElement(ApplyButton.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
ApplyButton.OnClick += OnApplyClicked;
inputField = UIFactory.CreateInputField(UIRoot, "InputField", "empty");
inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25, flexibleHeight: 500, flexibleWidth: 9999);
inputField.InputField.lineType = InputField.LineType.MultiLineNewline;
inputField.Component.lineType = InputField.LineType.MultiLineNewline;
inputField.OnValueChanged += OnInputChanged;
return UIRoot;

View File

@ -104,7 +104,7 @@ namespace UnityExplorer.UI.IValues
{
base.OnBorrowed(owner);
applyButton.Button.gameObject.SetActive(owner.CanWrite);
applyButton.Component.gameObject.SetActive(owner.CanWrite);
}
// Setting value from owner to this
@ -190,7 +190,7 @@ namespace UnityExplorer.UI.IValues
var fitter = input.UIRoot.AddComponent<ContentSizeFitter>();
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
input.InputField.lineType = InputField.LineType.MultiLineNewline;
input.Component.lineType = InputField.LineType.MultiLineNewline;
inputFields.Add(input);
}
@ -203,7 +203,7 @@ namespace UnityExplorer.UI.IValues
UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleWidth: 9999);
applyButton = UIFactory.CreateButton(UIRoot, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
UIFactory.SetLayoutElement(applyButton.Button.gameObject, minHeight: 25, minWidth: 175);
UIFactory.SetLayoutElement(applyButton.Component.gameObject, minHeight: 25, minWidth: 175);
applyButton.OnClick += OnApplyClicked;
return UIRoot;