ChangDaoZhanGuan/ChangDaoPro/Assets/Scripts/IconMgr.cs

259 lines
7.6 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
public class IconMgr : MonoBehaviour
{
private static IconMgr instance;
public static IconMgr Instance
{
get
{
if (instance == null)
{
GameObject obj = new GameObject("IconMgr");
instance = obj.AddComponent<IconMgr>();
DontDestroyOnLoad(obj);
}
return instance;
}
}
///// <summary>
///// 地点
///// </summary>
//public GameObject location_tip;
///// <summary>
///// 空调
///// </summary>
//public GameObject cooler_tip;
///// <summary>
///// 照明
///// </summary>
//public GameObject lighting_tip;
///// <summary>
///// 排水
///// </summary>
//public GameObject drainage_tip;
private void Awake()
{
//location_tip = GameObject.Find("地点名称tip");
//cooler_tip = GameObject.Find("空调tip");
//lighting_tip = GameObject.Find("照明tip");
//drainage_tip = GameObject.Find("排水tip");
}
public void PerformOperation(int operationType)
{
switch (operationType)
{
case 1:
Operation1();
break;
case 2:
Operation2();
break;
case 3:
Operation3();
break;
case 4:
Operation4();
break;
case 5:
Operation5();
break;
case 6:
Operation6();
break;
case 7:
Operation7();
break;
case 8:
Operation8();
break;
default:
Debug.LogError("Invalid operation type");
break;
}
}
/// <summary>
/// 地点名称
/// </summary>
private void Operation1()
{
Debug.Log("Performing Operation 1");
//location_tip.SetActive(true);
//cooler_tip.SetActive(false);
//lighting_tip.SetActive(false);
//drainage_tip.SetActive(false);
Resetting();
Config.Instance.location_tip.SetActive(true);
Config.Instance.cooler_tip.SetActive(false);
Config.Instance.lighting_tip.SetActive(false);
Config.Instance.drainage_tip.SetActive(false);
}
/// <summary>
/// 空调
/// </summary>
private void Operation2()
{
Debug.Log("Performing Operation 2");
//location_tip.SetActive(true);
//cooler_tip.SetActive(true);
//lighting_tip.SetActive(false);
//drainage_tip.SetActive(false);
Resetting();
Config.Instance.location_tip.SetActive(true);
Config.Instance.cooler_tip.SetActive(true);
Config.Instance.lighting_tip.SetActive(false);
Config.Instance.drainage_tip.SetActive(false);
}
/// <summary>
/// 照明
/// </summary>
private void Operation3()
{
Debug.Log("Performing Operation 3");
//location_tip.SetActive(true);
//cooler_tip.SetActive(false);
//lighting_tip.SetActive(true);
//drainage_tip.SetActive(false);
Resetting();
Config.Instance.location_tip.SetActive(false);
Config.Instance.cooler_tip.SetActive(false);
Config.Instance.lighting_tip.SetActive(true);
Config.Instance.drainage_tip.SetActive(false);
Config.Instance.lighting_b1f.SetActive(false);
Config.Instance.lighting_a1.SetActive(true);
Config.Instance.lighting_a2.SetActive(false);
Config.Instance.lighting_a3.SetActive(false);
}
/// <summary>
/// 排水
/// </summary>
private void Operation4()
{
Debug.Log("Performing Operation 4");
//location_tip.SetActive(true);
//cooler_tip.SetActive(false);
//lighting_tip.SetActive(false);
//drainage_tip.SetActive(true);
Resetting();
Config.Instance.location_tip.SetActive(true);
Config.Instance.cooler_tip.SetActive(false);
Config.Instance.lighting_tip.SetActive(false);
Config.Instance.drainage_tip.SetActive(true);
}
/// <summary>
/// 照明负一楼
/// </summary>
private void Operation5()
{
Debug.Log("Performing Operation 5");
//location_tip.SetActive(true);
//cooler_tip.SetActive(false);
//lighting_tip.SetActive(false);
//drainage_tip.SetActive(true);
Config.Instance.location_tip.SetActive(false);
Config.Instance.cooler_tip.SetActive(false);
Config.Instance.lighting_tip.SetActive(true);
Config.Instance.drainage_tip.SetActive(false);
Config.Instance.lighting_b1f.SetActive(true);
Config.Instance.lighting_a1.SetActive(false);
Config.Instance.lighting_a2.SetActive(false);
Config.Instance.lighting_a3.SetActive(false);
}
/// <summary>
/// 照明一楼
/// </summary>
private void Operation6()
{
Debug.Log("Performing Operation 6");
//location_tip.SetActive(true);
//cooler_tip.SetActive(false);
//lighting_tip.SetActive(false);
//drainage_tip.SetActive(true);
Config.Instance.location_tip.SetActive(false);
Config.Instance.cooler_tip.SetActive(false);
Config.Instance.lighting_tip.SetActive(true);
Config.Instance.drainage_tip.SetActive(false);
Config.Instance.lighting_b1f.SetActive(false);
Config.Instance.lighting_a1.SetActive(true);
Config.Instance.lighting_a2.SetActive(false);
Config.Instance.lighting_a3.SetActive(false);
}
/// <summary>
/// 照明二楼
/// </summary>
private void Operation7()
{
Debug.Log("Performing Operation 7");
//location_tip.SetActive(true);
//cooler_tip.SetActive(false);
//lighting_tip.SetActive(false);
//drainage_tip.SetActive(true);
Config.Instance.location_tip.SetActive(false);
Config.Instance.cooler_tip.SetActive(false);
Config.Instance.lighting_tip.SetActive(true);
Config.Instance.drainage_tip.SetActive(false);
Config.Instance.lighting_b1f.SetActive(false);
Config.Instance.lighting_a1.SetActive(false);
Config.Instance.lighting_a2.SetActive(true);
Config.Instance.lighting_a3.SetActive(false);
}
/// <summary>
/// 照明三楼
/// </summary>
private void Operation8()
{
Debug.Log("Performing Operation 8");
//location_tip.SetActive(true);
//cooler_tip.SetActive(false);
//lighting_tip.SetActive(false);
//drainage_tip.SetActive(true);
Config.Instance.location_tip.SetActive(false);
Config.Instance.cooler_tip.SetActive(false);
Config.Instance.lighting_tip.SetActive(true);
Config.Instance.drainage_tip.SetActive(false);
Config.Instance.lighting_b1f.SetActive(false);
Config.Instance.lighting_a1.SetActive(false);
Config.Instance.lighting_a2.SetActive(false);
Config.Instance.lighting_a3.SetActive(true);
}
/// <summary>
/// 初始状态
/// </summary>
private void Resetting()
{
foreach (Transform child in Config.Instance.location_tip.transform)
{
child.gameObject.SetActive(false);
}
foreach (Transform child in Config.Instance.cooler_tip.transform)
{
child.gameObject.SetActive(false);
}
Config.Instance.drainage_Pop.SetActive(false);
Config.Instance.lighting_Pop.SetActive(false);
}
}