//========================================================== // // Copyright (c) Guangzhou Shixiang Technology Co.,Ltd. // All rights reserved. // //========================================================== using UnityEngine; using UnityEngine.UI; public class UIInteractionHandle : MonoBehaviour { [SerializeField] private Button _buttonAdd; [SerializeField] private Button _buttonSub; [SerializeField] private Button _buttonChangeColor; [SerializeField] private Button _buttonRotate; [SerializeField] private Slider _sliderScale; [SerializeField] private Toggle _toggleLockColor; [SerializeField] private Dropdown _Dropdown; void Start() { if (_buttonAdd != null) { _buttonAdd.onClick.AddListener(Add); } if (_buttonSub != null) { _buttonSub.onClick.AddListener(Sub); } if (_buttonChangeColor != null) { _buttonChangeColor.onClick.AddListener(ChangeColor); } if (_buttonRotate != null) { _buttonRotate.onClick.AddListener(Rotate); } if (_sliderScale != null) { _sliderScale.onValueChanged.AddListener(delegate { SliderValueChanged(); }); } _toggleLockColor.isOn = false; if (_toggleLockColor != null) { _toggleLockColor.onValueChanged.AddListener(delegate { ToggleValueChanged(); }); } } private void Add() { InteractionObjManager.Instance.AddAll(); } private void Sub() { InteractionObjManager.Instance.SubAll(); } private void ChangeColor() { InteractionObjManager.Instance.ChangeColorAll(); } private void Rotate() { InteractionObjManager.Instance.RotateAll(); } private void SliderValueChanged() { float value = _sliderScale.value; InteractionObjManager.Instance.ScaleAll(value); } private void ToggleValueChanged() { bool isLock = _toggleLockColor.isOn; InteractionObjManager.Instance.LockColorAll(isLock); } }