51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using XFrame.Core.UIs;
|
|
using XFrame.Core.Tool;
|
|
using DG.Tweening;
|
|
public class IntroducePanels : XUIPanels
|
|
{
|
|
public Image 光伏板, 充电路面, 公交站台, 智慧路灯;
|
|
|
|
private RectTransform bg;
|
|
public IntroducePanels() : base(UIType.PopUp, UIMode.HideOther, UICollider.None)
|
|
{
|
|
uiPath = "UI/IntroducePanel/Prefabs/IntroducePanel";
|
|
}
|
|
|
|
public override void Awake(GameObject go)
|
|
{
|
|
AutoAssign.InitObject(this, transform);
|
|
bg = transform.Find("bg/bg").GetComponent<RectTransform>();
|
|
}
|
|
public override void Active()
|
|
{
|
|
base.Active();
|
|
int No = (int)Data;
|
|
HideImage(No);
|
|
}
|
|
|
|
Tween t;
|
|
void HideImage(int No)
|
|
{
|
|
t.Kill();
|
|
if (No == -1)
|
|
{
|
|
t = bg.DOAnchorPos(new Vector2(295.6f, bg.anchoredPosition.y), 1.5f);
|
|
return;
|
|
}
|
|
|
|
for (int i = 0; i < bg.childCount; i++)
|
|
{
|
|
if (i != No)
|
|
bg.GetChild(i).gameObject.SetActive(false);
|
|
else
|
|
{
|
|
bg.GetChild(i).gameObject.SetActive(true);
|
|
bg.anchoredPosition = new Vector2(295.6f, bg.anchoredPosition.y);
|
|
t = bg.DOAnchorPos(new Vector2(-295.2f, bg.anchoredPosition.y), 1.5f);
|
|
}
|
|
}
|
|
}
|
|
}
|