123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- //==========================================================
- //
- // 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);
- }
- }
|