using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ToolsMovePanelManager : MonoBehaviour { public GameObject tools; public GameObject clearAll; public GameObject save; public GameObject teamName; public GameObject setting; public void Init() { if (DisasterManager.model == PlayModel.view) { tools.SetActive(false); clearAll.SetActive(false); save.SetActive(false); teamName.SetActive(false); setting.SetActive(false); } float height = 0; foreach (Transform item in transform) { if (item.gameObject.activeSelf) { height += 79; } } var trans = GetComponent(); trans.sizeDelta = new Vector2(trans.sizeDelta.x, height); trans.anchoredPosition = new Vector2(trans.anchoredPosition.x, (height - 551) / 2 - 79); var filter = gameObject.AddComponent(); } private void OnDisable() { foreach (Transform item in transform) { if (item.GetComponent() && item.GetComponent().isOn) { if (item.name != "ShowNameToggle") item.GetComponent().isOn = false; } } } }