_xiaofang/xiaofang/Assets/Script/UI/ZZZZZZ/LayoutCompooment.cs

28 lines
763 B
C#
Raw Normal View History

2024-12-23 19:12:48 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LayoutCompooment : MonoBehaviour
{
public RectTransform rectTransform;
public GameObject secondMenu;//<2F><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>ĸ<EFBFBD><C4B8><EFBFBD>
public Toggle firstToggle;//һ<><D2BB><EFBFBD>˵<EFBFBD>
private void Start()
{
firstToggle.onValueChanged.AddListener((canOpen) =>OpenSecondMenu(canOpen));
}
public void OpenSecondMenu(bool canOpen)
{
secondMenu.gameObject.SetActive(canOpen);
StartCoroutine(UpdateLayout(rectTransform));
}
//дһ<D0B4><D2BB><EFBFBD><EFBFBD>Я<EFBFBD><D0AF><EFBFBD><EFBFBD>UIʵʱˢ<CAB1><CBA2>
IEnumerator UpdateLayout(RectTransform rect){
LayoutRebuilder.ForceRebuildLayoutImmediate(rect);
yield return new WaitForEndOfFrame();
}
}