LMQT/Assets/Scripts/UIManager.cs
2024-12-10 09:03:45 +08:00

99 lines
1.9 KiB
C#
Raw 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.Mathematics;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class UIManager : MonoBehaviour
{
public GameObject buildingName;
public Image icon;
public Sprite ON;
public Sprite OFF;
public GameObject camCtrl;
public GameObject camCenter;
public Vector3 camCenterX;
bool bName = false;
bool dis = true;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.Q))
{
Debug.Log(´ÏÂq");
}
}
public void disName()
{
if (bName == false)
{
buildingName.SetActive(true);
bName = true;
icon.sprite = OFF;
}
else
{
buildingName.SetActive(false);
bName = false;
icon.sprite = ON;
}
}
public void qie(GameObject imageUI)
{
if (dis == false)
{
dis = true;
imageUI.SetActive(true);
icon.sprite = OFF;
}
else
{
dis = false;
imageUI.SetActive(false);
icon.sprite = ON;
}
}
public void qieAll(GameObject imageUI)
{
dis = true;
imageUI.SetActive(true);
icon.sprite = OFF;
}
public void toSecen()
{
SceneManager.LoadScene("SampleScene");
}
public void dingWeiX(float cx)
{
camCtrl.GetComponent<MouseFollowRotation>().x = cx;
//camCtrl.GetComponent<MouseFollowRotation>().y = cy;
}
public void dingWeiY(float cy)
{
camCtrl.GetComponent<MouseFollowRotation>().y = cy;
}
public void centerX()
{
camCenter.transform.position = camCenterX;
}
}