using System; using System.Collections.Generic; using Framework.Timer; using Game; using Game.Component; using UnityEngine; using UnityEngine.UI; using IcecreamView; using Unity.Mathematics; namespace Views { public class BossTouchPanel : IcecreamView.IC_AbstractModule { [SerializeField] private Button _clickBtn; [SerializeField] private GameObject _text; private AnimatorStateUpdate _animatorStateUpdate; private float _time = 0; public override void OnOpenView (IC_ViewData parameters) { this._clickBtn.gameObject.SetActive (false); this._animatorStateUpdate = RoomManager.Instance._BossSceneDirector.transform.GetComponentInChildren (); this._clickBtn.onClick.AddListener (OnClickTouch); GameUpdateMgr.Instance.AddUpdater (DoUpdate); } private void OnClickTouch () { this._time += 0.25f; if (this._time > 1) { this._time = 1; } #if !UNITY_EDITOR VibratorImp.Instance.Vibrator_Normal (0.2f , (int)(math.clamp (this._time , 0 , 1) * 50)); #endif // GameManager.Instance.Vibrator (VibratorScale.Small); CameraImpulseUtils.Instance.UniformImpulseCamera (0.5f , math.clamp (this._time , 0 , 2)); } private void DoUpdate () { if (_animatorStateUpdate.state == 2) { if (!this._clickBtn.gameObject.activeSelf) { this._clickBtn.gameObject.SetActive (true); } if (this._time > 0) { this._text.SetActive (false); this._time -= Time.deltaTime; } if (this._time <= 0 && !this._text.activeSelf) { this._text.SetActive (true); } } else if(_animatorStateUpdate.state == 3) { this.ViewConnector.CloseView (); } else { if (this._clickBtn.gameObject.activeSelf) { this._clickBtn.gameObject.SetActive (false); } } } public override void OnCloseView () { GameUpdateMgr.Instance.RemoveUpdater (DoUpdate); } } }