Files
taptap2024_GJ_chidouren/Assets/Scripts/Views/EndAboutPanel.cs
2024-10-27 20:33:42 +08:00

79 lines
2.6 KiB
C#

using System.Collections.Generic;
using System.StateSystem;
using Framework.Audio;
using Framework.UI;
using Game.Component;
using UnityEngine;
using UnityEngine.UI;
using IcecreamView;
using StateSystem;
using UnityEngine.Playables;
namespace Views
{
public class EndAboutPanel : IcecreamView.IC_AbstractModule
{
[SerializeField] private PlayableDirector table1;
[SerializeField] private PlayableDirector table2;
[SerializeField] private PlayableDirector table3;
[SerializeField] private GameObject table4;
[SerializeField] private Button _closeBtn;
[SerializeField] private string BGM;
private AnimatorStateUpdate _animatorStateUpdate;
public override void OnInitView ()
{
this._closeBtn.gameObject.SetActive (false);
this._closeBtn.onClick.AddListener (() =>
{
UIManager.Instance.OpenLoading (() => { GameStateManager.Instance.OpenState (GameGlobalState.GameHome); });
this.ViewConnector.CloseView ();
});
}
public override void OnOpenView (IC_ViewData parameters)
{
AudioManager.Instance.PlayBGM (BGM , 1 , 0.6f);
string key = "CompleteCount";
if (!PlayerPrefs.HasKey (key))
{
PlayerPrefs.SetInt (key , 0);
}
PlayerPrefs.SetInt (key , PlayerPrefs.GetInt (key) + 1);
this._animatorStateUpdate = Transform.FindObjectOfType<AnimatorStateUpdate> ();
table1.stopped += OnTable2;
table2.stopped += OnTable3;
table3.stopped += OnTable4;
this.table1.gameObject.SetActive (true);
}
private void OnTable4 (PlayableDirector obj)
{
this._animatorStateUpdate.state = 7;
this.table3.gameObject.SetActive (false);
this.table4.gameObject.SetActive (true);
this._closeBtn.gameObject.SetActive (true);
}
private void OnTable3 (PlayableDirector obj)
{
this._animatorStateUpdate.state = 6;
this.table2.gameObject.SetActive (false);
this.table3.gameObject.SetActive (true);
}
private void OnTable2 (PlayableDirector obj)
{
this._animatorStateUpdate.state = 5;
this.table1.gameObject.SetActive (false);
this.table2.gameObject.SetActive (true);
}
public override void OnCloseView ()
{
}
}
}