41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
|
|
//=======================================================
|
||
|
|
// 作者:王则昆
|
||
|
|
// 描述:
|
||
|
|
//=======================================================
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Stary.Evo.InformationSave
|
||
|
|
{
|
||
|
|
public static class AnchoredPositionExtension
|
||
|
|
{
|
||
|
|
public static AnchoredPosition.Information GetAnchoredPositionInformation(this RectTransform tf, string desc)
|
||
|
|
{
|
||
|
|
return tf.GetComponent<AnchoredPosition>()._list.Find(n => n.desc == desc);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static Vector3 GetAnchoredPosition(this RectTransform tf, string desc)
|
||
|
|
{
|
||
|
|
return GetAnchoredPositionInformation(tf, desc).anchoredPosition.SetVector2Data();
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void SetAnchoredPosition(this RectTransform tf, string desc)
|
||
|
|
{
|
||
|
|
tf.GetComponent<AnchoredPosition>().Set(desc);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static AnchoredPosition.Information GetAnchoredPositionInformation(this Transform tf, string desc)
|
||
|
|
{
|
||
|
|
return tf.GetComponent<AnchoredPosition>()._list.Find(n => n.desc == desc);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static Vector3 GetAnchoredPosition(this Transform tf, string desc)
|
||
|
|
{
|
||
|
|
return GetAnchoredPositionInformation(tf, desc).anchoredPosition.SetVector2Data();
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void SetAnchoredPosition(this Transform tf, string desc)
|
||
|
|
{
|
||
|
|
tf.GetComponent<AnchoredPosition>().Set(desc);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|