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.
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using AX.InputSystem;
|
|
|
|
|
//Author:quyuyun
|
|
|
|
|
//CreatTime:12/27/2017
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// UI<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ScrollRect<EFBFBD>ļ<EFBFBD>¼<EFBFBD>ű<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RequireComponent(typeof(BaseGameObjInfo))]
|
|
|
|
|
[RequireComponent(typeof(CreateStaticObjID))]
|
|
|
|
|
public abstract class BaseScrollRect : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public virtual void OnEnable()
|
|
|
|
|
{
|
|
|
|
|
GetComponent<ScrollRect>().onValueChanged.AddListener(OnValueChanged);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnDisable()
|
|
|
|
|
{
|
|
|
|
|
GetComponent<ScrollRect>().onValueChanged.RemoveListener(OnValueChanged);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnDestroy()
|
|
|
|
|
{
|
|
|
|
|
GetComponent<ScrollRect>().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<ScrollRect>().normalizedPosition= ((UIScrollRectCmdArgs)arg).vctr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public abstract void RespondFun(Vector2 value);
|
|
|
|
|
}
|