海淀天下城电子沙盘单机版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
4.0 KiB

4 years ago
using AX.MessageSystem;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BottomUITabPageManager : MonoBehaviour
{
private Toggle Toggle_Cars;
private Toggle Toggle_Tools;
private Toggle Toggle_Disasters;
//private Toggle Toggle_Other;
private Toggle Toggle_EnsuringCommunications;
private Toggle Toggle_Person;
private GameObject GameObject_Cars;
private GameObject GameObject_Tools;
private GameObject GameObject_Disasters;
//private GameObject GameObject_Other;
private GameObject GameObject_EnsuringCommunications;
private GameObject GameObject_Person;
private Color selectColor;
private Button CarPropertiesBtn;
private void Awake()
{
Init();
}
void Init()
{
CarPropertiesBtn = transform.Find("CarProperties").GetComponent<Button>();
CarPropertiesBtn.onClick.AddListener(CarProperties);
Toggle_Cars = transform.Find("ButtonGrid/Cars").GetComponent<Toggle>();
Toggle_Tools = transform.Find("ButtonGrid/Tools").GetComponent<Toggle>();
Toggle_Disasters = transform.Find("ButtonGrid/Disasters").GetComponent<Toggle>();
//Toggle_Other = transform.Find("ButtonGrid/Other").GetComponent<Toggle>();
Toggle_EnsuringCommunications = transform.Find("ButtonGrid/EnsuringCommunications").GetComponent<Toggle>();
Toggle_Person = transform.Find("ButtonGrid/Person").GetComponent<Toggle>();
GameObject_Cars = transform.Find("CarDetails").gameObject;
GameObject_Tools = transform.Find("ToolDetails").gameObject;
GameObject_Disasters = transform.Find("DisasterDetails").gameObject;
//GameObject_Other = transform.Find("OtherDetails").gameObject;
GameObject_EnsuringCommunications = transform.Find("EnsuringCommunicationsDetails").gameObject;
GameObject_Person = transform.Find("PersonDetails").gameObject;
Toggle_Cars.onValueChanged.AddListener(Toggle_CarsValueChanged);
Toggle_Tools.onValueChanged.AddListener(Toggle_ToolsValueChanged);
Toggle_Disasters.onValueChanged.AddListener(Toggle_DisastersValueChanged);
//Toggle_Other.onValueChanged.AddListener(Toggle_OtherValueChanged);
Toggle_EnsuringCommunications.onValueChanged.AddListener(Toggle_EnsuringCommunicationsValueChanged);
Toggle_Person.onValueChanged.AddListener(Toggle_PersonValueChanged);
selectColor = Toggle_Cars.transform.Find("Label").GetComponent<Text>().color;
}
private void OnDisable()
{
if (InputManager.cloneObjType != CloneObjType.None)//取消克隆类型选中
InputManager.cloneObjType = CloneObjType.None;
}
private void CarProperties()
{
CarAttributePanle.GetInstance.gameObject.SetActive(true);
}
private void ChangeColor(Toggle t)
{
Text lable = t.transform.Find("Label").GetComponent<Text>();
if (t.isOn)
{
lable.color = selectColor;
}
else
{
lable.color = Color.white;
}
}
private void Toggle_PersonValueChanged(bool IsOn)
{
ChangeColor(Toggle_Person);
GameObject_Person.SetActive(IsOn);
}
private void Toggle_EnsuringCommunicationsValueChanged(bool IsOn)
{
ChangeColor(Toggle_EnsuringCommunications);
GameObject_EnsuringCommunications.SetActive(IsOn);
}
//private void Toggle_OtherValueChanged(bool IsOn)
//{
// ChangeColor(Toggle_Other);
// GameObject_Other.SetActive(IsOn);
//}
private void Toggle_DisastersValueChanged(bool IsOn)
{
ChangeColor(Toggle_Disasters);
GameObject_Disasters.SetActive(IsOn);
}
private void Toggle_ToolsValueChanged(bool IsOn)
{
ChangeColor(Toggle_Tools);
GameObject_Tools.SetActive(IsOn);
}
private void Toggle_CarsValueChanged(bool IsOn)
{
ChangeColor(Toggle_Cars);
GameObject_Cars.SetActive(IsOn);
}
}