Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
[AddComponentMenu("NGUI/Interaction/Center Scroll View on Click")]
|
|
public class UICenterOnClick : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Transform _otherCenteringTarget;
|
|
|
|
private void OnClick()
|
|
{
|
|
UICenterOnChild uICenterOnChild = NGUITools.FindInParents<UICenterOnChild>(base.gameObject);
|
|
UIPanel uIPanel = NGUITools.FindInParents<UIPanel>(base.gameObject);
|
|
if (uICenterOnChild != null)
|
|
{
|
|
if (uICenterOnChild.enabled)
|
|
{
|
|
if (_otherCenteringTarget != null)
|
|
{
|
|
uICenterOnChild.CenterOn(_otherCenteringTarget);
|
|
}
|
|
else
|
|
{
|
|
uICenterOnChild.CenterOn(base.transform);
|
|
}
|
|
}
|
|
}
|
|
else if (uIPanel != null && uIPanel.clipping != UIDrawCall.Clipping.None)
|
|
{
|
|
UIScrollView component = uIPanel.GetComponent<UIScrollView>();
|
|
Vector3 pos = -uIPanel.cachedTransform.InverseTransformPoint(base.transform.position);
|
|
if (!component.canMoveHorizontally)
|
|
{
|
|
pos.x = uIPanel.cachedTransform.localPosition.x;
|
|
}
|
|
if (!component.canMoveVertically)
|
|
{
|
|
pos.y = uIPanel.cachedTransform.localPosition.y;
|
|
}
|
|
SpringPanel.Begin(uIPanel.cachedGameObject, pos, 6f);
|
|
}
|
|
}
|
|
}
|