// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖 

using UnityEngine;
using FairyGUI;
using NBC;

namespace NBF
{
    public partial class CommonInput : GComponent
    {
        public EventListener onChanged => Input.onChanged;

        public override string text
        {
            get => Input.text;
            set => Input.text = value;
        }

        public string title
        {
            get => text;
            set => text = value;
        }

        public string promptText
        {
            get => Input.promptText;
            set => Input.promptText = value;
        }
        
        private void OnInited()
        {
            onFocusIn.Add(OnInputFocusIn);
            onFocusOut.Add(OnInputFocusOut);
        }

        private void OnInputFocusIn()
        {
            FocusState.selectedIndex = 1;
        }

        private void OnInputFocusOut()
        {
            FocusState.selectedIndex = 0;
        }
    }
}