Net_Ease_Dome/Assets/Scripts/Manage/GUIManager.cs

85 lines
1.7 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GUIManager : MonoBehaviour {
public static GUIManager Instance;
[SerializeField]
private bool godMode;
[SerializeField]
private bool renderered;
[SerializeField]
private bool autoWalk;
public NewButton B_上帝模式;
public NewButton B_相机渲染;
public NewButton B_自动行走;
public static bool Renderered { get => Instance.renderered; }
void Awake()
{
Instance = this;
}
// Use this for initialization
void Start() {
Init();
if (Application.isMobilePlatform)
{
B_上帝模式.gameObject.SetActive(false);
}
B_上帝模式.m_onClick.AddListener((ison) =>
{
SetGod(ison);
});
B_相机渲染.m_onClick.AddListener((ison) =>
{
SetRenderer(ison);
});
B_自动行走.m_onClick.AddListener((ison) =>
{
SetAutoWalk(ison);
});
}
void SetGod(bool ison)
{
GameManager.Instance.God();
B_上帝模式.m_Text.text = ison ? "上帝模式: ON" : "上帝模式: OFF";
godMode = ison;
}
void SetRenderer(bool ison)
{
GameManager.Instance.MainCamera.enabled = ison;
GameManager.Instance.EnvirCamera.enabled = ison;
B_相机渲染.m_Text.text = ison ? "开启渲染" : "关闭渲染";
renderered = ison;
}
void SetAutoWalk(bool ison)
{
if (GameManager.GodMode) return;
GameManager.AutoWalk = ison;
B_自动行走.m_Text.text = ison ? "自动行走" : "手动行走";
autoWalk = ison;
}
private void Init()
{
SetGod(godMode);
B_上帝模式.m_IsOn = godMode;
SetRenderer(renderered);
B_相机渲染.m_IsOn = renderered;
SetAutoWalk(autoWalk);
B_自动行走.m_IsOn = autoWalk;
}
}