2025-09-08 14:51:28 +08:00
|
|
|
|
using ZXKFramework;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using System.Collections;
|
2025-09-08 17:37:12 +08:00
|
|
|
|
using DongWuYiXue.Main;
|
|
|
|
|
|
namespace DongWuYiXue.DaoNiaoShu
|
2025-09-08 14:51:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class GameManager : MonoSingleton<GameManager>
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public InteractionManager interactionManager;
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public TimelineClipManager timelineManager;
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public FSMManager fsm;
|
|
|
|
|
|
//<2F><><EFBFBD>ҹ<EFBFBD><D2B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public PlayerManager playerManager;
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public HighLightManager highLightManager;
|
|
|
|
|
|
//<2F><>ʱģ<CAB1><C4A3>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public TimeCounterManager timeCounterManager;
|
|
|
|
|
|
//<2F>ɼ<EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public KaoHeManager kaoheManager;
|
|
|
|
|
|
//UIģ<49><C4A3>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public IUIManager uiManager = new UIManager();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public VirtualCameraManager virtualCameraManager;
|
|
|
|
|
|
public bool test;
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public SceneDataHandler sceneDataHandler;
|
|
|
|
|
|
IEnumerator Start()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (test)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><><EFBFBD>ݳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
MVC.RegisterModel(new Main.GameModel());
|
|
|
|
|
|
yield return MVC.GetModel<Main.GameModel>().Init();
|
|
|
|
|
|
MVC.GetModel<Main.GameModel>().modeType = ModeType.KaoHe;
|
|
|
|
|
|
MVC.GetModel<Main.GameModel>().mainData = MVC.GetModel<Main.GameModel>().excelData.GetMainData(2);
|
|
|
|
|
|
}
|
|
|
|
|
|
MVC.RegisterModel(new GameModel());
|
|
|
|
|
|
yield return MVC.GetModel<GameModel>().Init();
|
|
|
|
|
|
Game.Instance.eventManager.AddListener<PlayTrueOrFalseEvent>(PlayTrueOrFalseSound);
|
|
|
|
|
|
Game.Instance.eventManager.AddListener<PlaySoundEvent>(PlaySound);
|
|
|
|
|
|
sceneDataHandler = transform.FindFirst<SceneDataHandler>("SceneDataHandler");
|
|
|
|
|
|
interactionManager = transform.FindFirst<InteractionManager>("InteractionManager");
|
|
|
|
|
|
virtualCameraManager = transform.FindFirst<VirtualCameraManager>("VirtualCameraManager");
|
|
|
|
|
|
fsm = transform.FindFirst<FSMManager>("FSMManager");
|
|
|
|
|
|
timelineManager = transform.FindFirst<TimelineClipManager>("TimelineManager");
|
|
|
|
|
|
highLightManager = transform.FindFirst<HighLightManager>("HighLightManager");
|
|
|
|
|
|
timeCounterManager = transform.FindFirst<TimeCounterManager>("TimeCounterManager");
|
|
|
|
|
|
kaoheManager = transform.FindFirst<KaoHeManager>("KaoHeManager");
|
|
|
|
|
|
playerManager = transform.FindFirst<PlayerManager>("PlayerManager");
|
|
|
|
|
|
//aiManager = transform.FindFirst<AIManager>("AIManager");
|
|
|
|
|
|
//<2F>洢<EFBFBD><E6B4A2><EFBFBD>ݳ<EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
sceneDataHandler.Init();
|
|
|
|
|
|
Game.Instance.fsm.ChangeState<GamePlayingState>();
|
|
|
|
|
|
uiManager.ShowUI<HomePanel>();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
virtualCameraManager.Init();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
highLightManager.Init();
|
|
|
|
|
|
//״̬<D7B4><CCAC><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
fsm.Init();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
timelineManager.Init();
|
|
|
|
|
|
//<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
|
timeCounterManager.Init();
|
|
|
|
|
|
|
|
|
|
|
|
if(MVC.GetModel<Main.GameModel>().modeType == ModeType.ShiXun )
|
|
|
|
|
|
{
|
|
|
|
|
|
uiManager.ShowUI<TreeViewPanel>();
|
|
|
|
|
|
uiManager.GetUI<TreeViewPanel>().BuildButton(MVC.GetModel<GameModel>().GetTreeViewData());
|
|
|
|
|
|
uiManager.ShowUI<TimePanel>();
|
|
|
|
|
|
uiManager.ShowUI<ScorePanel>();
|
|
|
|
|
|
}
|
|
|
|
|
|
if ( MVC.GetModel<Main.GameModel>().modeType == ModeType.KaoHe)
|
|
|
|
|
|
{
|
|
|
|
|
|
uiManager.ShowUI<TimePanel>();
|
|
|
|
|
|
uiManager.ShowUI<ScorePanel>();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void PlaySound(PlaySoundEvent e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Game.Instance.sound.PlayBGM(e.path, false, clip => {
|
|
|
|
|
|
e.callBack?.Invoke(clip.length);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void PlayTrueOrFalseSound(PlayTrueOrFalseEvent e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.isTrue)
|
|
|
|
|
|
{
|
|
|
|
|
|
Game.Instance.sound.PlayMS(MVC.GetModel<Main.GameModel>().mainData.folder + "/Sounds/right");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Game.Instance.sound.PlayMS(MVC.GetModel<Main.GameModel>().mainData.folder + "/Sounds/false");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void OnDestroy()
|
|
|
|
|
|
{
|
|
|
|
|
|
Game.Instance.eventManager.RemoveListener<PlayTrueOrFalseEvent>(PlayTrueOrFalseSound);
|
|
|
|
|
|
Game.Instance.eventManager.RemoveListener<PlaySoundEvent>(PlaySound);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|