Files
PrinceOfGlory/Assets/Scripts/Help/UIPanelControll.cs
kridoo ac041525cc 1
2026-01-12 09:39:28 +08:00

89 lines
2.1 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; //µ±Ç°Ï±ê
void Start()
{
GlobalEventMgr.Listen<int>(GameEvent.EventShowUI, GameDataManage_EventShowUI);
}
private void Update()
{
if (isRun)
{
runTime += Time.deltaTime;
if (runTime >= waitTime)
{
isRun = false;
runTime = 0;
ListUiImg[nowIndex].gameObject.SetActive(false);
if (nowIndex==0)
{
}
}
}
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 (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;
}
}
}
}
}