Files
PrinceOfGlory/Assets/Scripts/Help/UIPanelControll.cs
2026-02-27 11:59:40 +08:00

105 lines
2.4 KiB
C#

using BigSpace.Logic;
using BigSpace.XRCore.Base;
using BigSpace.XRCore.Event;
using BigSpace.XRCore.Video;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
public class UIPanelControll : MonoSingleton<UIPanelControll>
{
public List<Image> ListUiImg;
//计时相关
bool isRun = false;
bool isRun2 = false;
float waitTime = 5f;
float waitTime2 = 3f;
float runTime = 0;
int nowIndex = 0; //当前下标
//是否是特殊版本
bool isSpecialVersion = false;
void Start()
{
GlobalEventMgr.Listen<int>(GameEvent.EventShowUI, GameDataManage_EventShowUI);
}
private void Update()
{
if (isSpecialVersion)
{
}
else
{
if (isRun)
{
runTime += Time.deltaTime;
if (runTime >= waitTime)
{
isRun = false;
runTime = 0;
ListUiImg[nowIndex].gameObject.SetActive(false);
}
}
if (isRun2)
{
runTime += Time.deltaTime;
if (runTime >= waitTime2)
{
isRun2 = false;
isRun = true;
runTime = 0;
ListUiImg[0].gameObject.SetActive(true);
ListUiImg[8].gameObject.SetActive(false);
GlobalEventMgr.Dispatch(GameEvent.EventPlayTimeline);
}
}
}
}
void GameDataManage_EventShowUI(int index)
{
if (isSpecialVersion)
{
}
else
{
if (index == 0 || index == 7)
{
nowIndex = index;
if (index == 0)
{
isRun2 = true;
ListUiImg[8].gameObject.SetActive(true);
}
else
{
ListUiImg[nowIndex].gameObject.SetActive(true);
}
if (index != 7 && index != 0)
isRun = true;
else
{
if (index == 7)
{
waitTime = 5;
isRun = true;
}
}
}
}
}
}