/* ******************************************************************************** *Copyright(C),coolae.net *Author: wangkaiyuan *Version: 2.0 *Date: 2017-01-09 *Description: 拖动滑动一页,比如可以用在关卡地图页面,绑定lua *Others: *History: ********************************************************************************* */ using UnityEngine; using System.Collections; namespace Coolape { public class UIDragPageContents : UIDragScrollView { Transform tr; public Transform transform { get { if (tr == null) { tr = gameObject.transform; } return tr; } } public UIGridPage _gridPage; public UIGridPage gridPage { get { if (_gridPage == null) { _gridPage = transform.parent.GetComponent (); } return _gridPage; } } public void OnPress (bool isPressed) { if (!enabled || !NGUITools.GetActive(this)) return; if (isPressed) { base.OnPress (isPressed); } gridPage.onPress (isPressed); } public void OnDrag (Vector2 delta) { if (!enabled || !NGUITools.GetActive(this)) return; base.OnDrag (delta); gridPage.onDrag (delta); } /// /// Init the specified obj.初始化页面数据 /// /// Object. public virtual void init (object obj, int index){} /// /// Refreshs the current.初始化当前页面数据 /// /// Page index. /// Object. public virtual void refreshCurrent (int pageIndex, object obj){} } }