海淀天下城电子沙盘单机版
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.

48 lines
1.4 KiB

4 years ago
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<RectTransform>();
trans.sizeDelta = new Vector2(trans.sizeDelta.x, height);
trans.anchoredPosition = new Vector2(trans.anchoredPosition.x, (height - 551) / 2 - 79);
var filter = gameObject.AddComponent<ContentSizeFitter>();
}
private void OnDisable()
{
foreach (Transform item in transform)
{
if (item.GetComponent<Toggle>() && item.GetComponent<Toggle>().isOn)
{
if (item.name != "ShowNameToggle")
item.GetComponent<Toggle>().isOn = false;
}
}
}
}