上海苏宁宝丽嘉酒店,2020.11.17 15:30改为单机版本,以后合成单机版本可以以此版本为模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

63 lines
1.9 KiB

using AX.InputSystem;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System;
[RequireComponent(typeof(BaseGameObjInfo))]
[RequireComponent(typeof(CreateStaticObjID))]
public abstract class BaseInputField : MonoBehaviour,ISelectHandler
{
public virtual void OnEnable()
{
GetComponent<InputField>().onValueChanged.AddListener(OnValueChanged);
GetComponent<InputField>().onEndEdit.AddListener(onEndEdit);
}
public virtual void OnDisable()
{
GetComponent<InputField>().onValueChanged.RemoveListener(OnValueChanged);
GetComponent<InputField>().onEndEdit.RemoveListener(onEndEdit);
}
public virtual void OnDestroy()
{
GetComponent<InputField>().onValueChanged.RemoveListener(OnValueChanged);
GetComponent<InputField>().onEndEdit.RemoveListener(onEndEdit);
}
public void OnValueChanged(string value)
{
var arg = new UIInputFieldArgs();
arg.msg = value;
arg.currentCursorPos = Input.mousePosition;
RegisterUIInputEvent.RegisterUIInputHistory(gameObject, this.GetType().Name, "ValueChanged", arg);
//ValueChanged(arg);
RespondFun(value);
//InputManager.OccupyKeyboard = true;
}
public void ValueChanged(CmdArgs arg)
{
if (GameSettings.othersSettings.isReplayMode)
{
if (!GameSettings.othersSettings.isReplayPause && !GameSettings.othersSettings.isReplayOver)
{
CursorManager.GetInstance.SetClick(arg);
}
}
GetComponent<InputField>().text = ((UIInputFieldArgs)arg).msg;
}
public void onEndEdit(string value)
{
InputManager.OccupyKeyboard = false;
}
public abstract void RespondFun(string value);
public void OnSelect(BaseEventData eventData)
{
InputManager.OccupyKeyboard = true;
}
}