Files
taptap2024_GJ_chidouren/Assets/Scripts/System/StateSystem/State/StateHome.cs

55 lines
1.5 KiB
C#
Raw Normal View History

2024-10-16 00:03:41 +08:00
using System;
using System.StateSystem;
2024-10-24 22:16:39 +08:00
using Framework.Asset;
2024-10-16 00:03:41 +08:00
using Framework.Audio;
using Framework.FSMLite;
using Framework.Timer;
using Framework.UI;
2024-10-24 22:16:39 +08:00
using IcecreamView;
2024-10-16 00:03:41 +08:00
using StateSystem.Loader;
using UnityEngine;
2024-10-24 22:16:39 +08:00
using UnityEngine.Playables;
2024-10-16 00:03:41 +08:00
using UnityEngine.SceneManagement;
using Views;
using AudioType = Framework.Audio.AudioType;
2024-10-24 22:16:39 +08:00
using Object = UnityEngine.Object;
2024-10-16 00:03:41 +08:00
namespace StateSystem.State
{
public class StateHome : StateMachine<GameGlobalState>
{
private SceneLoader _loader;
2024-10-24 22:16:39 +08:00
public int _lastCatLevel = -1; //记录上一次的猫的等级,用于判断是否升级
private GameObject homeScene;
2024-10-16 00:03:41 +08:00
protected override async void OnEnter (params object[] args)
{
2024-10-25 16:51:34 +08:00
2024-10-16 00:03:41 +08:00
AudioManager.Instance.PlayBGM (BgmAudio.LobbyBgm);
GameUpdateMgr.Instance.AddUpdater (DoUpdate);
2024-10-21 22:29:53 +08:00
OnActived ();
2024-10-16 00:03:41 +08:00
}
private void OnActived ()
{
2024-10-24 22:16:39 +08:00
var homePart = AssetManager.Instance.LoadAlwaysAsset<GameObject> ("HomeScene.prefab");
homeScene = Object.Instantiate (homePart);
UIManager.Instance.OpenView (UIPanel.HomePanel , new IC_ViewData (this.homeScene.GetComponent<PlayableDirector> ()));
2024-10-16 00:03:41 +08:00
UIManager.Instance.CloseLoading (null);
}
protected override void OnExit ()
{
2024-10-24 22:16:39 +08:00
GameObject.Destroy (this.homeScene.gameObject);
2024-10-16 00:03:41 +08:00
GameUpdateMgr.Instance.RemoveUpdater (DoUpdate);
2024-10-21 22:29:53 +08:00
// this._loader.Kill ();
2024-10-16 00:03:41 +08:00
}
private void DoUpdate ()
{
}
}
}