using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using AX.InputSystem;
//Author:quyuyun
//CreatTime:12/27/2017
///
/// UI组件ScrollRect的记录脚本基类
///
[RequireComponent(typeof(BaseGameObjInfo))]
[RequireComponent(typeof(CreateStaticObjID))]
public abstract class BaseScrollRect : MonoBehaviour
{
public virtual void OnEnable()
{
GetComponent().onValueChanged.AddListener(OnValueChanged);
}
public virtual void OnDisable()
{
GetComponent().onValueChanged.RemoveListener(OnValueChanged);
}
public virtual void OnDestroy()
{
GetComponent().onValueChanged.RemoveListener(OnValueChanged);
}
public void OnValueChanged(Vector2 vec)
{
var arg = new UIScrollRectCmdArgs();
arg.vctr = vec;
arg.currentCursorPos = Input.mousePosition;
RegisterUIInputEvent.RegisterUIInputHistory(gameObject, this.GetType().Name, "ValueChanged", arg);
RespondFun(vec);
}
public void ValueChanged(CmdArgs arg)
{
if (GameSettings.othersSettings.isReplayMode)
{
if (!GameSettings.othersSettings.isReplayPause && !GameSettings.othersSettings.isReplayOver)
{
CursorManager.GetInstance.SetClick(arg);
}
}
GetComponent().normalizedPosition= ((UIScrollRectCmdArgs)arg).vctr;
}
public abstract void RespondFun(Vector2 value);
}