This commit is contained in:
CortexCore
2024-03-31 23:31:00 +08:00
parent e179d2eb53
commit b7b89ee71a
641 changed files with 31286 additions and 22134 deletions

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
namespace BITKit.UX
{
public class UXPhotoMode : MonoBehaviour
{
[SerializeField] private UIDocument document;
[UXBindPath("photo-mode-toggle")]
private Toggle _photoModeToggle;
private VisualElement[] _visualElements=Array.Empty<VisualElement>();
private void Start()
{
UXUtils.Inject(this);
_photoModeToggle.RegisterValueChangedCallback(OnValueChanged);
OnValueChanged(ChangeEvent<bool>.GetPooled(false,_photoModeToggle.value));
_visualElements = document.rootVisualElement.Query<VisualElement>(className:"photo-mode").ToList().ToArray();
}
private void OnValueChanged(ChangeEvent<bool> evt)
{
foreach (var x in _visualElements)
{
x.style.visibility=!evt.newValue?Visibility.Visible:Visibility.Hidden;
}
}
}
}