You've already forked taptap2024_GJ_chidouren
69 lines
2.1 KiB
C#
69 lines
2.1 KiB
C#
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<AnimatorStateUpdate> ();
|
|
this._clickBtn.onClick.AddListener (OnClickTouch);
|
|
GameUpdateMgr.Instance.AddUpdater (DoUpdate);
|
|
}
|
|
|
|
private void OnClickTouch ()
|
|
{
|
|
this._time += 0.1f;
|
|
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);
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
} |