Files
taptap2024_GJ_chidouren/Assets/Scripts/Views/HomePanel.cs
2024-10-26 01:38:30 +08:00

104 lines
3.3 KiB
C#

using System.Collections.Generic;
using System.StateSystem;
using Framework.UI;
using Game;
using Game.Component;
using UnityEngine;
using UnityEngine.UI;
using IcecreamView;
using MintAnimation.Runtime.Components.MintAnimation;
using Script.Core.Utils.Extend;
using StateSystem;
using UnityEngine.Playables;
namespace Views{
public class HomePanel : IcecreamView.IC_AbstractModule
{
public Button _toGame;
public Button _settingGame;
public Button _aboutGame;
public MintAnimBase _MintAnim;
private PlayableDirector _playableDirector;
public override void OnOpenView(IC_ViewData parameters)
{
this._playableDirector = parameters.GetValue<PlayableDirector>();
MapContent.Instance.Pathfinder.Scan ();
MapContent.Instance.IsActiveGame = true;
}
public override void OnCloseView()
{
}
public override void OnInitView ()
{
this._toGame.onClick.AddListener (OnClickToGame , SeAudio.Btn_Click);
this._aboutGame.onClick.AddListener(OnClickAboutGame , SeAudio.Btn_Click);
this._settingGame.onClick.AddListener(OnClickSettingGame , SeAudio.Btn_Click);
// this._achiveGame.onClick.AddListener(OnClickAchiveGame , SeAudio.Btn_Click);
// this._changlleGame.onClick.AddListener(OnClickChanglleGame , SeAudio.Btn_Click);
}
private void OnClickChanglleGame()
{
UIManager.Instance.OpenPropTip("前面的区域,以后再来探索吧!");
}
private void OnClickAchiveGame()
{
UIManager.Instance.OpenPropTip("成就".ToColorString("red")+"暂未开放!敬请期待!");
}
public override void OnFocusActive()
{
this._aboutGame.gameObject.SetActive(true);
this._settingGame.gameObject.SetActive(true);
this._toGame.gameObject.SetActive(true);
}
public override void OnFocusInactive()
{
this._toGame.gameObject.SetActive(false);
this._aboutGame.gameObject.SetActive(false);
this._settingGame.gameObject.SetActive(false);
}
private void OnClickToGame()
{
this._toGame.gameObject.SetActive(false);
this._aboutGame.gameObject.SetActive(false);
this._settingGame.gameObject.SetActive(false);
var mintPlayerBase = this._MintAnim.MintAnimation ();
mintPlayerBase.TweenOptions.IsFlip = true;
this._MintAnim.StartAnim();
this._playableDirector.stopped += ToGaming;
this._playableDirector.initialTime = 0;
this._playableDirector.Play ();
}
private void ToGaming (PlayableDirector playableDirector)
{
UIManager.Instance.OpenLoading (() =>
{
this.ViewConnector.CloseView ();
GameStateManager.Instance.OpenState (GameGlobalState.GameRoom);
});
}
private void OnClickSettingGame()
{
UIManager.Instance.OpenView (UIPanel.SettingPanel);
}
private void OnClickAboutGame()
{
UIManager.Instance.OpenView (UIPanel.AboutPanel);
}
}
}