Make InputFieldRef helper, InteractiveString and IOUtility

This commit is contained in:
Sinai
2021-05-07 17:06:56 +10:00
parent 4931117b1e
commit d8f532d913
20 changed files with 405 additions and 206 deletions

View File

@ -18,7 +18,7 @@ namespace UnityExplorer.UI.CacheObject.Views
public LayoutElement KeyGroupLayout;
public Text KeyLabel;
public ButtonRef KeyInspectButton;
public InputField KeyInputField;
public InputFieldRef KeyInputField;
public Text KeyInputTypeLabel;
public static Color EvenColor = new Color(0.07f, 0.07f, 0.07f);
@ -75,10 +75,10 @@ namespace UnityExplorer.UI.CacheObject.Views
// input field
var keyInputObj = UIFactory.CreateInputField(keyGroup, "KeyInput", "empty", out KeyInputField);
UIFactory.SetLayoutElement(keyInputObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 0, preferredWidth: 200);
KeyInputField = UIFactory.CreateInputField(keyGroup, "KeyInput", "empty");
UIFactory.SetLayoutElement(KeyInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 0, preferredWidth: 200);
//KeyInputField.lineType = InputField.LineType.MultiLineNewline;
KeyInputField.readOnly = true;
KeyInputField.InputField.readOnly = true;
return root;
}

View File

@ -50,7 +50,7 @@ namespace UnityExplorer.UI.CacheObject.Views
public Text ValueLabel;
public Toggle Toggle;
public Text ToggleText;
public InputField InputField;
public InputFieldRef InputField;
public ButtonRef InspectButton;
public ButtonRef SubContentButton;
@ -152,8 +152,8 @@ namespace UnityExplorer.UI.CacheObject.Views
ToggleText.color = SignatureHighlighter.KeywordBlue;
Toggle.onValueChanged.AddListener(ToggleClicked);
var inputObj = UIFactory.CreateInputField(rightHoriGroup, "InputField", "...", out InputField);
UIFactory.SetLayoutElement(inputObj, minWidth: 150, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0);
InputField = UIFactory.CreateInputField(rightHoriGroup, "InputField", "...");
UIFactory.SetLayoutElement(InputField.UIRoot, minWidth: 150, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0);
// Inspect and apply buttons

View File

@ -33,7 +33,7 @@ namespace UnityExplorer.UI.CacheObject.Views
private readonly List<Text> genericArgLabels = new List<Text>();
private readonly List<TypeCompleter> genericAutocompleters = new List<TypeCompleter>();
private readonly List<InputField> inputFieldCache = new List<InputField>();
private readonly List<InputFieldRef> inputFieldCache = new List<InputFieldRef>();
public void OnBorrowedFromPool(CacheMember owner)
{
@ -53,7 +53,7 @@ namespace UnityExplorer.UI.CacheObject.Views
public void OnReturnToPool()
{
foreach (var input in inputFieldCache)
input.text = "";
input.Text = "";
this.Owner = null;
}
@ -223,11 +223,11 @@ namespace UnityExplorer.UI.CacheObject.Views
labelList.Add(label);
label.horizontalOverflow = HorizontalWrapMode.Wrap;
var inputObj = UIFactory.CreateInputField(horiGroup, "InputField", "...", out InputField inputField);
UIFactory.SetLayoutElement(inputObj, minHeight: 25, flexibleHeight: 50, minWidth: 100, flexibleWidth: 1000);
inputField.lineType = InputField.LineType.MultiLineNewline;
inputObj.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
inputField.onValueChanged.AddListener((string val) => { inputArray[index] = val; });
var inputField = UIFactory.CreateInputField(horiGroup, "InputField", "...");
UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25, flexibleHeight: 50, minWidth: 100, flexibleWidth: 1000);
inputField.InputField.lineType = InputField.LineType.MultiLineNewline;
inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
inputField.OnValueChanged += (string val) => { inputArray[index] = val; };
inputFieldCache.Add(inputField);
if (autocomplete)