Files
2026-05-08 15:34:53 +08:00

63 lines
1.5 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
//public enum UILayer { HUD,Main,Popup}
public class UIManager : BaseMgr<UIManager>
{
//这里面要维护很多数据,基本上所有的覆盖全屏 UI 的对象都要覆盖,涉及到 UI 外面的也会有一些全部使用 public目前还没有检测空的办法
public GameObject mainCamera;
public GameObject worker;
public GameObject PopUpCanvas;
public Transform WorldIcons;
protected override void Awake()
{
base.Awake();
}
public void Start()
{
}
private void Update()
{
}
public void ConvertToWorkerView()
{
mainCamera.SetActive(false);
worker.SetActive(true);
for (int i = 0; i < WorldIcons.childCount; i++)
{
WorldIcons.GetChild(i).transform.localScale = Vector3.one * 0.5f;//工人视角下重置大小
}
}
public void ConvertToFreeView()
{
mainCamera.SetActive(true);
worker.SetActive(false);
}
public void DisplayData(string targetName)
{
if (PopUpCanvas.transform.Find(targetName) != null)
{
PopUpCanvas.transform.Find(targetName).gameObject.SetActive(true);
}
}
public void HideData()
{
for(int i = 0; i < PopUpCanvas.transform.childCount; i++)
{
PopUpCanvas.transform.GetChild(i).gameObject.SetActive(false);
}
}
}