64 lines
1.4 KiB
C#
64 lines
1.4 KiB
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using WI;
|
|
|
|
namespace CHN
|
|
{
|
|
public class UI_InputOrFind : UIBase
|
|
{
|
|
TextMeshProUGUI Text_Path;
|
|
Button Button_Find;
|
|
Image Image_State;
|
|
TextMeshProUGUI ErrorMessage;
|
|
|
|
public Action onClickFind;
|
|
|
|
public enum State
|
|
{
|
|
None,
|
|
Good,
|
|
Error,
|
|
Warning,
|
|
}
|
|
|
|
public void SetState(State s)
|
|
{
|
|
switch (s)
|
|
{
|
|
case State.None:
|
|
Image_State.color = Color.gray;
|
|
break;
|
|
case State.Good:
|
|
Image_State.color = Color.green;
|
|
break;
|
|
case State.Error:
|
|
Image_State.color = Color.red;
|
|
break;
|
|
case State.Warning:
|
|
Image_State.color = Color.yellow;
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void SetPathText(string str)
|
|
{
|
|
Text_Path.SetText(str);
|
|
}
|
|
public void SetErrorMessageText(string error)
|
|
{
|
|
ErrorMessage.SetText(error);
|
|
}
|
|
|
|
public override void AfterAwake()
|
|
{
|
|
Button_Find.onClick.AddListener(OnClickFindButton);
|
|
}
|
|
|
|
private void OnClickFindButton()
|
|
{
|
|
onClickFind?.Invoke();
|
|
}
|
|
}
|
|
} |