71 lines
2.2 KiB
C#
71 lines
2.2 KiB
C#
using DG.Tweening;
|
||
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
public class UI_ComputerSystemBasePanel : BasePanel
|
||
{
|
||
protected Button backObj;
|
||
protected Button closeObj;
|
||
protected List<ImageTips> tipList;
|
||
protected Tween tween;
|
||
|
||
public override void ShowMe()
|
||
{
|
||
base.ShowMe();
|
||
|
||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)//学习模式下隐藏关闭和回退按钮
|
||
{
|
||
backObj = GetControl<Button>("backBtn");
|
||
if (backObj != null) backObj.gameObject.SetActive(false);
|
||
|
||
closeObj = GetControl<Button>("closeBtn");
|
||
if (closeObj != null) closeObj.gameObject.SetActive(false);
|
||
|
||
tipList = ToolFuncManager.FindChildrenWithComponent<ImageTips>(this.transform);
|
||
|
||
foreach (var item in tipList)
|
||
{
|
||
if (item.gameObject.name == "ImageTips_1")
|
||
{
|
||
ActiveEmbededTip(item.gameObject);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
backObj = GetControl<Button>("backBtn");
|
||
if (backObj != null) backObj.gameObject.SetActive(true);
|
||
|
||
closeObj = GetControl<Button>("closeBtn");
|
||
if (closeObj != null) closeObj.gameObject.SetActive(true);
|
||
}
|
||
}
|
||
|
||
public override void HideMe()
|
||
{
|
||
if (tween != null)
|
||
tween.Kill(true);
|
||
if (GameManager.RunModelMgr.ModeType == E_ModeType.Study)//学习模式下隐藏关闭和回退按钮
|
||
if (tipList != null)
|
||
foreach (var item in tipList)
|
||
item.gameObject.SetActive(false);
|
||
}
|
||
|
||
public void ActiveEmbededTip(GameObject tip, Tween tween = null)
|
||
{
|
||
if (tween != null)
|
||
tween.Kill(true);
|
||
tip.gameObject.SetActive(true);
|
||
Image image = tip.GetComponent<Image>();
|
||
image.enabled = true;
|
||
if (tween == null) tween = this.tween;
|
||
tween = DOVirtual.Float(1, 0.3f, 0.5f, t =>
|
||
{
|
||
Color finalColor = image.color;
|
||
finalColor.a = t;
|
||
image.color = finalColor;
|
||
}).SetLoops(-1, LoopType.Yoyo);//HQB 原始数值:1,0.
|
||
}
|
||
}
|