747 lines
29 KiB
C#
747 lines
29 KiB
C#
using System;
|
||
using UnityEngine;
|
||
using System.Collections;
|
||
using Thousandto.Core.Base;
|
||
using Thousandto.Plugins.Common;
|
||
using Thousandto.Core.Framework;
|
||
using Thousandto.Code.Logic;
|
||
|
||
using Thousandto.Core.Asset;
|
||
using Thousandto.Code.Logic.Network;
|
||
|
||
using Thousandto.Code.Global;
|
||
using Thousandto.Core.Support;
|
||
using Thousandto.Core.PostEffect;
|
||
using XLua;
|
||
using System.Collections.Generic;
|
||
using EventManager = UnityEngine.Gonbest.MagicCube.EventManager;
|
||
using EventSystemHandler = UnityEngine.Gonbest.MagicCube.EventSystemHandler;
|
||
using PreLoadEventDefine = UnityEngine.Gonbest.MagicCube.PreLoadEventDefine;
|
||
using PathUtils = UnityEngine.Gonbest.MagicCube.PathUtils;
|
||
using CoroutinePool = UnityEngine.Gonbest.MagicCube.CoroutinePool;
|
||
using StringUtils = UnityEngine.Gonbest.MagicCube.StringUtils;
|
||
using FLogger = UnityEngine.Gonbest.MagicCube.FLogger;
|
||
using FLogManager = UnityEngine.Gonbest.MagicCube.FLogManager;
|
||
using FThreadPool = UnityEngine.Gonbest.MagicCube.FThreadPool;
|
||
|
||
namespace Thousandto.Code.Center
|
||
{
|
||
/// <summary>
|
||
/// 把游戏中所用到的系统实例,在此做一个静态定义
|
||
/// </summary>
|
||
[Hotfix]
|
||
public static class GameCenter
|
||
{
|
||
#region//私有变量
|
||
//是否已经初始化完毕
|
||
private static bool _isInitialized = false;
|
||
public static bool IsInitialized { get { return _isInitialized; } }
|
||
//是否挂起
|
||
public static bool IsFocused { get; set; }
|
||
#endregion
|
||
|
||
|
||
|
||
#region//游戏中内核逻辑管理器
|
||
//事件管理器
|
||
public static EventManager EventManager = null;
|
||
//网络管理器
|
||
public static Networker Networker = null;
|
||
//Prefab实例工厂容器
|
||
public static SpawnPoolManager SpawnPoolManager = null;
|
||
//Shader管理器
|
||
public static ShaderManager ShaderManager = null;
|
||
//材质的管理器
|
||
public static MaterialManager MaterialManager = null;
|
||
//动画管理者
|
||
public static AnimationClipManager AnimManager = null;
|
||
//音乐管理者
|
||
public static AudioClipManager AudioManager = null;
|
||
//自动清理者管理器
|
||
public static AutoCleanerManager CleanerManager = null;
|
||
//纹理管理者
|
||
public static TextureManager TextureManager = null;
|
||
//视频管理者
|
||
public static VideoManager VideoManager = null;
|
||
//Prefab管理器
|
||
public static PrefabAssetManager PrefabManager = null;
|
||
//新游戏状态管理类
|
||
public static GameStateSystem GameStateSystem = null;
|
||
//游戏场景系统
|
||
public static GameSceneSystem GameSceneSystem = null;
|
||
//常规SDK 管理系统
|
||
public static SDKSystem SDKSystem = null;
|
||
// 跨地图寻路数据管理器
|
||
public static PathFinderSystem PathFinderSystem = null;
|
||
//技能可视数据配置管理器
|
||
public static SkillVisualManager SkillVisualManager = null;
|
||
//摄像机管理器
|
||
public static CameraControlUtil CameraControlUtil = null;
|
||
//警示圈管理器
|
||
public static WarningFiledManager WarningFiledManager = null;
|
||
|
||
//寻路系统
|
||
public static PathSearchSystem PathSearchSystem = null;
|
||
//技能选择地面表现系统
|
||
public static SkillSelectFiledManager SkillSelectFiledManager = null;
|
||
//地图逻辑开关
|
||
public static MapLogicSwitch MapLogicSwitch = null;
|
||
//Lua管理系统
|
||
private static LuaSystem _luaSystem = null;
|
||
public static LuaSystem LuaSystem
|
||
{
|
||
get
|
||
{
|
||
#if UNITY_EDITOR
|
||
if (_luaSystem == null&&!Application.isPlaying)
|
||
{
|
||
_luaSystem = new LuaSystem();
|
||
_luaSystem.LuaEnv.AddLoader(_luaSystem.LuaLoader);
|
||
_luaSystem.LuaEnv.DoString("DataConfig = require('Config.DataConfig')");
|
||
}
|
||
#endif
|
||
return _luaSystem;
|
||
}
|
||
set
|
||
{
|
||
_luaSystem = value;
|
||
}
|
||
}
|
||
// Timeline系统
|
||
public static TimelineSystem TimelineSystem = null;
|
||
|
||
#endregion
|
||
|
||
#region //游戏逻辑管理器
|
||
//窗体状态系统
|
||
public static FormStateSystem FormStateSystem = null;
|
||
//登录系统
|
||
//public static LoginSystem LoginSystem = null;
|
||
//服务器列表选择系统
|
||
//public static ServerListSystem ServerListSystem = null;
|
||
//创建角色系统
|
||
//public static PlayerRoleListSystem PlayerRoleListSystem = null;
|
||
//玩家主聊天框
|
||
public static ChatSystem ChatSystem = null;
|
||
//聊天插入面板
|
||
public static ChatInsertSystem ChatInsertSystem = null;
|
||
//玩家私聊聊天框
|
||
public static ChatPrivateSystem ChatPrivateSystem = null;
|
||
//心跳消息
|
||
public static HeartSystem HeartSystem = null;
|
||
//输入系统
|
||
public static InputSystem InputSystem = null;
|
||
//世界地图数据管理器
|
||
public static WorldMapInfoManager WorldMapInfoManager = null;
|
||
//主功能入口
|
||
public static MainFunctionSystem MainFunctionSystem = null;
|
||
//客户端GM系统
|
||
public static ClientGMSystem ClientGMSystem = null;
|
||
//动态阻挡管理器
|
||
public static DynamicBlockerManager DynamicBlockerManager = new DynamicBlockerManager();
|
||
//触发器管理器
|
||
public static TriggerManager TriggerManager = new TriggerManager();
|
||
//资源预加载
|
||
public static PreloadAssetsSystem PreloadAssetsSystem = null;
|
||
//固定资源的系统
|
||
public static ImmortalResSystem ImmortalResSystem;
|
||
//游戏设置系统
|
||
public static GameSetting GameSetting = null;
|
||
//消息提示系统
|
||
public static MsgPromptSystem MsgPromptSystem = null;
|
||
//物品管理系统
|
||
public static ItemContianerSystem ItemContianerSystem = null;
|
||
//装备管理系统
|
||
public static EquipmentSystem EquipmentSystem = null;
|
||
//buff管理系统
|
||
public static BuffSystem BuffSystem = null;
|
||
//阻断性提示系统
|
||
public static IBlockingUpPromptSystem BlockingUpPromptSystem = null;
|
||
//任务系统
|
||
public static ITaskManager TaskManager = null;
|
||
public static ITaskController TaskController = null;
|
||
//更新系统
|
||
public static UpdateSystem UpdateSystem = null;
|
||
//引导系统
|
||
public static IGuideSystem GuideSystem = null;
|
||
//红点系统
|
||
public static RedPointSystem RedPointSystem = null;
|
||
//断线重连系统
|
||
public static ReconnectSystem ReconnectSystem = null;
|
||
//掉落归属系统
|
||
public static DropAscriptionSystem DropAscriptionSystem = null;
|
||
//采集UI提示
|
||
public static GatherTishiSystem GatherTishiSystem = null;
|
||
//语言转换的类
|
||
public static LanguageConvertSystem LanguageConvertSystem = null;
|
||
//实时语音系统
|
||
public static RealTimeVoiceSystem RealTimeVoiceSystem = null;
|
||
//场景数据资源还原系统类
|
||
public static SceneRestoreSystem SceneRestoreSystem = null;
|
||
//计时器
|
||
public static TimerEventSystem TimerEventSystem = null;
|
||
//窗体预加载处理
|
||
public static PreLoadFormRoot PreLoadFormRoot = null;
|
||
//场景遮挡剔除系统类
|
||
public static SceneOcSystem SceneOcSystem = null;
|
||
//聊天屏蔽字监控系统
|
||
public static ChatMonitorSystem ChatMonitorSystem = null;
|
||
//场景缓存系统
|
||
public static CacheSceneSystem CacheSceneSystem = null;
|
||
//打点系统
|
||
public static BISystem BISystem = null;
|
||
//场景后台下载
|
||
public static SceneBackLoadSystem SceneBackLoadSystem = null;
|
||
//google翻译
|
||
public static GoogleTranslateSystem GoogleTranslateSystem = null;
|
||
#endregion
|
||
|
||
#region //初始化以及卸载处理
|
||
//静态构造函数
|
||
public static void CreateSystem()
|
||
{
|
||
//开启异步消息的处理
|
||
EventManager.SharedInstance.EnableAsynMsg = true;
|
||
EventManager.SharedInstance.PushFixEvent(PreLoadEventDefine.EID_STEP_START, 2);
|
||
FLogger.LogTime("GameCenter Start Create!");
|
||
//调试这个事件
|
||
//EventManager.DebugEventID = (int)UIEventDefine.UIMESSAGEBOX_CLOSE;
|
||
AppData.AppIsRunning = true;
|
||
//ResourcesEx.DebugUIModel = true;
|
||
//Debug.unityLogger.logEnabled = false;
|
||
Application.backgroundLoadingPriority = ThreadPriority.Low;
|
||
//资源配置初始化
|
||
AssetsCacheManager.Initialize();
|
||
//设置应用的目标频率
|
||
Application.targetFrameRate = GameDefine.DefaultTargetFrameRate;
|
||
//禁止休眠黑屏
|
||
Screen.sleepTimeout = SleepTimeout.NeverSleep;
|
||
//日志初始化
|
||
FLogManager.Instance.Initialize();
|
||
|
||
//增加两个线程,用于异步处理
|
||
FThreadPool.AddThread();
|
||
FThreadPool.AddThread();
|
||
|
||
//协程缓存池初始化
|
||
CoroutinePool.Initialize();
|
||
//内核和逻辑系统的创建
|
||
NewCoreSystem();
|
||
NewLogicSystem(true);
|
||
FLogger.LogTime("GameCenter Create Finished!!");
|
||
}
|
||
|
||
//游戏中心进行初始化处理
|
||
public static void Initialize()
|
||
{
|
||
_isInitialized = false;
|
||
FLogger.LogTime("GameCenter Start Initialize!");
|
||
//启动网络消息预序列化线程
|
||
//HandleMsg.StartPreSerializeThread();
|
||
|
||
CoroutinePool.AddTask(CoreInitialize(() =>
|
||
{
|
||
LogicInitialize(true);
|
||
FLogger.LogTime("GameCenter Initialize Finished!");
|
||
_isInitialized = true;
|
||
}));
|
||
}
|
||
//卸载
|
||
public static void Uninitialize()
|
||
{
|
||
LogicUninitialize(true);
|
||
CoreUninitialize();
|
||
}
|
||
|
||
//清理处理
|
||
public static void ResetLogicSystem(bool clearLoginData)
|
||
{
|
||
LogicUninitialize(clearLoginData);
|
||
NewLogicSystem(clearLoginData);
|
||
LogicInitialize(clearLoginData);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region//心跳处理
|
||
public static void Update(float deltaTime)
|
||
{
|
||
if (!_isInitialized) return;
|
||
|
||
UnityEngine.Profiling.Profiler.BeginSample("HeartSystem.Update");
|
||
HeartSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
UnityEngine.Profiling.Profiler.BeginSample("ResourcesEx.Update");
|
||
ResourcesEx.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
UnityEngine.Profiling.Profiler.BeginSample("FGameObjectVFXRoot.Update");
|
||
FGameObjectVFXRoot.Update();
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//游戏状态更新
|
||
//GameCaseSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.BeginSample("GameStateSystem.Update");
|
||
GameStateSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//输入系统更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("InputSystem.Update");
|
||
InputSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//UI预加载系统更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("PreLoadFormRoot.Update");
|
||
PreLoadFormRoot.Update();
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//省电模式
|
||
//PowerSaveModelSysytem.Update(deltaTime);
|
||
|
||
//UnityEngine.Profiling.Profiler.BeginSample("LoginSystem.Update");
|
||
//LoginSystem.Update(deltaTime);
|
||
//UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//声音系统更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("AudioPlayer.Update");
|
||
AudioPlayer.Update();
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//物品系统更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("ItemContianerSystem.Update");
|
||
ItemContianerSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//装备系统更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("EquipmentSystem.Update");
|
||
EquipmentSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//警示圈更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("WarningFiledManager.Update");
|
||
WarningFiledManager.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//buff系统更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("BuffSystem.Update");
|
||
BuffSystem.Update();
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
if (UpdateSystem != null)
|
||
{
|
||
UnityEngine.Profiling.Profiler.BeginSample("UpdateSystem.Update");
|
||
UpdateSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
}
|
||
|
||
UnityEngine.Profiling.Profiler.BeginSample("ReconnectSystem.Update");
|
||
ReconnectSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
UnityEngine.Profiling.Profiler.BeginSample("Networker.Update");
|
||
Networker.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
UnityEngine.Profiling.Profiler.BeginSample("TimelineSystem.Update");
|
||
TimelineSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//红点系统更新
|
||
UnityEngine.Profiling.Profiler.BeginSample("RedPointSystem.Update");
|
||
RedPointSystem.Update();
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
UnityEngine.Profiling.Profiler.BeginSample("DynamicBoneSystem.Update");
|
||
DynamicBoneSystem.SharedInstance.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//聊天系统
|
||
UnityEngine.Profiling.Profiler.BeginSample("ChatSystem.Update");
|
||
ChatSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
//Bi系统
|
||
UnityEngine.Profiling.Profiler.BeginSample("BISystem.Update");
|
||
BISystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
|
||
if (GameSetting.GetSetting(GameSettingKeyCode.TPLuaUpdate) != 1)
|
||
{
|
||
UnityEngine.Profiling.Profiler.BeginSample("LuaSystem.Update");
|
||
LuaSystem.Update(deltaTime);
|
||
UnityEngine.Profiling.Profiler.EndSample();
|
||
}
|
||
|
||
}
|
||
|
||
public static void LateUpdate(float deltaTime)
|
||
{
|
||
if (!_isInitialized) return;
|
||
//自动清理者更新
|
||
CleanerManager.Update(deltaTime);
|
||
//监控器更新
|
||
FrameMonitor.Update(deltaTime);
|
||
//
|
||
PostEffectManager.Instance.Update(deltaTime);
|
||
//红点系统更新
|
||
RedPointSystem.LateUpdate();
|
||
|
||
DynamicBoneSystem.SharedInstance.LateUpdate(deltaTime);
|
||
}
|
||
|
||
public static void FixedUpdate(float deltaTime)
|
||
{
|
||
if (!_isInitialized) return;
|
||
Networker.FixedUpdate(deltaTime);
|
||
}
|
||
#endregion
|
||
|
||
#region//应用程序退出操作
|
||
public static void ApplicationQuit()
|
||
{
|
||
AppData.AppIsRunning = false;
|
||
Shader.globalMaximumLOD = 310;
|
||
FThreadPool.ShutDown();
|
||
_isInitialized = false;
|
||
Debug.LogError("Application Quit!");
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region//私有函数处理
|
||
|
||
#region//Core系统的方法
|
||
//工具逻辑系统
|
||
private static void NewCoreSystem()
|
||
{
|
||
CleanerManager = AutoCleanerManager.SharedInstance;
|
||
EventManager = EventManager.SharedInstance;
|
||
Networker = Networker.Instance;
|
||
|
||
ShaderManager = ShaderManager.SharedInstance;
|
||
SpawnPoolManager = SpawnPoolManager.ShareInstance;
|
||
AnimManager = AnimationClipManager.SharedInstance;
|
||
TextureManager = TextureManager.SharedInstance;
|
||
VideoManager = VideoManager.SharedInstance;
|
||
AudioManager = AudioClipManager.SharedInstance;
|
||
PrefabManager = PrefabAssetManager.SharedInstance;
|
||
MaterialManager = MaterialManager.SharedInstance;
|
||
|
||
GameStateSystem = new GameStateSystem();
|
||
GameSceneSystem = new GameSceneSystem();
|
||
|
||
SkillVisualManager = new SkillVisualManager();
|
||
CameraControlUtil = new CameraControlUtil();
|
||
|
||
PathFinderSystem = new PathFinderSystem();
|
||
|
||
ItemContianerSystem = new ItemContianerSystem();
|
||
EquipmentSystem = new EquipmentSystem();
|
||
WarningFiledManager = new WarningFiledManager();
|
||
SkillSelectFiledManager = new SkillSelectFiledManager();
|
||
|
||
GameSetting = new GameSetting();
|
||
MapLogicSwitch = new MapLogicSwitch();
|
||
TimelineSystem = new TimelineSystem();
|
||
|
||
|
||
SDKSystem = new SDKSystem();
|
||
FormStateSystem = new FormStateSystem();
|
||
LuaSystem = new LuaSystem();
|
||
|
||
#if UNITY_EDITOR
|
||
EventManager.CheckEventDefineIsValid(typeof(LogicEventDefine));
|
||
#endif
|
||
Debug.Log("NewCoreSystem Finished!!");
|
||
}
|
||
//游戏中心进行初始化处理
|
||
private static IEnumerator CoreInitialize(MyAction onCoreInitFinished)
|
||
{
|
||
yield return LuaSystem.CoreInitialize();
|
||
//启动GameCfgData的加载线程
|
||
GameCfgDataSystem.Initialize();
|
||
//FLogger.LogTime(" LuaSystem.Adaptor.CoreInitialize() ok!");
|
||
SpawnPoolManager.Initialize();
|
||
//FLogger.LogTime("SpawnPoolManager.Initialize() ok!");
|
||
yield return null;
|
||
ShaderManager.Initialize();
|
||
//FLogger.LogTime("ShaderManager.Initialize() ok!");
|
||
yield return null;
|
||
MaterialManager.Initialize();
|
||
//FLogger.LogTime("MaterialManager.Initialize() ok!");
|
||
yield return null;
|
||
TextureManager.Initialize();
|
||
//FLogger.LogTime("TextureManager.Initialize() ok!");
|
||
yield return null;
|
||
VideoManager.Initialize();
|
||
//FLogger.LogTime("VideoManager.Initialize() ok!");
|
||
yield return null;
|
||
FGameObjectVFXRoot.Initialize();
|
||
//FLogger.LogTime("FGameObjectVFXRoot.Initialize() ok!");
|
||
yield return null;
|
||
RegisterMsgCallback.Register();
|
||
//FLogger.LogTime("RegisterMsgCallback.Register() ok!");
|
||
yield return null;
|
||
Networker.Initialize();
|
||
//FLogger.LogTime("Networker.Initialize() ok!");
|
||
yield return null;
|
||
//HandleMsg.Initailize();
|
||
//FLogger.LogTime("HandleMsg.Initialize() ok!");
|
||
//yield return null;
|
||
//GameCaseSystem.Initialize();
|
||
//FLogger.LogTime("GameCaseSystem.Initialize() ok!");
|
||
GameStateSystem.Initialize();
|
||
//FLogger.LogTime("GameStateManager.Initialize() ok!");
|
||
yield return null;
|
||
GameSceneSystem.Initialize();
|
||
//FLogger.LogTime("GameSceneSystem.Initialize() ok!");
|
||
yield return null;
|
||
FrameMonitor.Initialize();
|
||
//FLogger.LogTime("MonitorManager.Install(MonitorType.Frame) ok!");
|
||
yield return null;
|
||
SDKSystem.Initalize();
|
||
//FLogger.LogTime("SDKSystem.Initalize() ok!");
|
||
yield return null;
|
||
ItemContianerSystem.Initialize();
|
||
//FLogger.LogTime("ItemContianerSystem.Initalize() ok!");
|
||
yield return null;
|
||
SkillVisualManager.Load();
|
||
//FLogger.LogTime("SkillVisualManager.Initalize() ok!");
|
||
yield return null;
|
||
WarningFiledManager.Initialize();
|
||
//FLogger.LogTime("WarningFiledManager.Initialize() ok!");
|
||
yield return null;
|
||
|
||
SkillSelectFiledManager.Initialize();
|
||
//FLogger.LogTime("SkillSelectFiledManager.Initialize() ok!");
|
||
yield return null;
|
||
|
||
PathFinderSystem.Initialize();
|
||
//FLogger.LogTime("PathFinderSystem.Initialize() ok!");
|
||
yield return null;
|
||
|
||
GameSetting.Initialize();
|
||
//FLogger.LogTime("GameSetting.Initialize() ok!");
|
||
yield return null;
|
||
DynamicBoneSystem.SharedInstance.Initialize();
|
||
|
||
TimelineSystem.Initialize();
|
||
yield return null;
|
||
//FLogger.LogTime( "TimelineSystem.Initialize() ok!" );
|
||
|
||
|
||
onCoreInitFinished();
|
||
yield return null;
|
||
}
|
||
//卸载
|
||
private static void CoreUninitialize()
|
||
{
|
||
LuaSystem.CoreUnInitialize();
|
||
|
||
FGameObjectVFXRoot.UnInitialize();
|
||
//工具逻辑系统
|
||
AnimManager.Sweep();
|
||
|
||
MaterialManager.UnInitialize();
|
||
|
||
TextureManager.Sweep();
|
||
|
||
VideoManager.Sweep();
|
||
//清除者
|
||
CleanerManager.Clear();
|
||
|
||
GameSceneSystem.Uninitialize();
|
||
|
||
FrameMonitor.Uninitialize();
|
||
|
||
SDKSystem.Unitialize();
|
||
|
||
PathFinderSystem.Uninitialize();
|
||
|
||
WarningFiledManager.Uninitialize();
|
||
|
||
SkillSelectFiledManager.Uninitialize();
|
||
SpawnPoolManager.Uninitialize();
|
||
|
||
GameSetting.Uninitialize();
|
||
|
||
TimelineSystem.Uninitialize();
|
||
ItemContianerSystem.Uninitialize();
|
||
|
||
DynamicBoneSystem.SharedInstance.Uninitialize();
|
||
|
||
FPlayerAnimRelation.ClearAnims();
|
||
}
|
||
#endregion
|
||
|
||
#region //游戏逻辑的处理
|
||
//游戏逻辑系统
|
||
private static void NewLogicSystem(bool clearLoginData)
|
||
{
|
||
//判断是否清理登陆数据
|
||
if (clearLoginData)
|
||
{
|
||
//LoginSystem = new LoginSystem();
|
||
//ServerListSystem = new ServerListSystem();
|
||
//PlayerRoleListSystem = new PlayerRoleListSystem();
|
||
HeartSystem = new HeartSystem();
|
||
}
|
||
|
||
//将sdk从CoreSystem移到LogicSystem中,避免一些数据在返回登录后没有清理掉
|
||
TimerEventSystem = new TimerEventSystem();
|
||
ChatSystem = new ChatSystem();
|
||
ChatInsertSystem = new ChatInsertSystem();
|
||
ChatPrivateSystem = new ChatPrivateSystem();
|
||
InputSystem = new InputSystem();
|
||
WorldMapInfoManager = new WorldMapInfoManager();
|
||
MsgPromptSystem = new MsgPromptSystem();
|
||
MainFunctionSystem = new MainFunctionSystem();
|
||
ClientGMSystem = new ClientGMSystem();
|
||
PreloadAssetsSystem = new PreloadAssetsSystem();
|
||
ImmortalResSystem = new ImmortalResSystem();
|
||
BuffSystem = new BuffSystem();
|
||
UpdateSystem = new UpdateSystem();
|
||
RedPointSystem = new RedPointSystem();
|
||
ReconnectSystem = new ReconnectSystem();
|
||
PathSearchSystem = new PathSearchSystem();
|
||
DropAscriptionSystem = new DropAscriptionSystem();
|
||
GatherTishiSystem = new GatherTishiSystem();
|
||
LanguageConvertSystem = new LanguageConvertSystem();
|
||
RealTimeVoiceSystem = new RealTimeVoiceSystem();
|
||
SceneRestoreSystem = new SceneRestoreSystem();
|
||
PreLoadFormRoot = new PreLoadFormRoot();
|
||
SceneOcSystem = new SceneOcSystem();
|
||
ChatMonitorSystem = new ChatMonitorSystem();
|
||
CacheSceneSystem = new CacheSceneSystem();
|
||
BISystem = new BISystem();
|
||
SceneBackLoadSystem = new SceneBackLoadSystem();
|
||
GoogleTranslateSystem = new GoogleTranslateSystem();
|
||
|
||
PushFixEvent(LogicEventDefine.EID_GAMECENTER_LOGIC_NEW);
|
||
Debug.Log("NeLogicSystem Finished!!");
|
||
}
|
||
//游戏中心进行初始化处理
|
||
private static void LogicInitialize(bool clearLoginData)
|
||
{
|
||
|
||
PushFixEvent(LogicEventDefine.EID_GAMECENTER_LOGIC_START_INITIALIZE, InputSystem);
|
||
|
||
if (clearLoginData)
|
||
{
|
||
Networker.AddThreadHandleFunc(HeartSystem.OnNetworkThreadTick);
|
||
}
|
||
TimerEventSystem.Initialize();
|
||
RedPointSystem.Initialize();
|
||
MainFunctionSystem.Initialize();
|
||
InputSystem.Initialize();
|
||
WorldMapInfoManager.Initialize();
|
||
PreloadAssetsSystem.Initialize();
|
||
BISystem.Initialize();
|
||
//游戏逻辑
|
||
LuaSystem.LogicInitialize(clearLoginData);
|
||
GameObjectLimit.Initialize();
|
||
//LoginSystem.Initialize();
|
||
//ServerListSystem.Initialize();
|
||
BuffSystem.Initialize();
|
||
MsgPromptSystem.Initialize();
|
||
ReconnectSystem.Initialize();
|
||
EquipmentSystem.Initialize();
|
||
RealTimeVoiceSystem.Initialize();
|
||
SceneRestoreSystem.Initialize();
|
||
GameSetting.ApplySetting();
|
||
UpdateSystem.Initialize();
|
||
FormStateSystem.Initialize();
|
||
ChatMonitorSystem.Initialize();
|
||
CacheSceneSystem.Initialize();
|
||
SceneBackLoadSystem.Initialize();
|
||
ChatSystem.Initialize();
|
||
ChatPrivateSystem.Initialize();
|
||
}
|
||
|
||
|
||
//卸载
|
||
private static void LogicUninitialize(bool clearLoginData)
|
||
{
|
||
//游戏逻辑系统卸载
|
||
LuaSystem.LogicUnInitialize(clearLoginData);
|
||
|
||
if (clearLoginData)
|
||
{
|
||
HeartSystem.Uninitialize();
|
||
Networker.Uninitialize();
|
||
}
|
||
//LoginSystem.Uninitialize();
|
||
InputSystem.Uninitialize();
|
||
MainFunctionSystem.Uninitialize();
|
||
ChatSystem.Destroy();
|
||
ChatInsertSystem.Destroy();
|
||
GameObjectLimit.UnInitialize();
|
||
PreloadAssetsSystem.Unitialize();
|
||
BuffSystem.Uninitialize();
|
||
UpdateSystem.Uninitialize();
|
||
RedPointSystem.UnInitialize();
|
||
GameSetting.SaveSetting();
|
||
EquipmentSystem.UnInitialize();
|
||
RealTimeVoiceSystem.Uninitialize();
|
||
TimerEventSystem.Uninitialize();
|
||
FormStateSystem.UnInitialize();
|
||
ChatMonitorSystem.UnInitialize();
|
||
CacheSceneSystem.UnInitialize();
|
||
SceneBackLoadSystem.Uninitialize();
|
||
BISystem.Uninitialize();
|
||
MsgPromptSystem.Uninitialize();
|
||
PushFixEvent(LogicEventDefine.EID_GAMECENTER_LOGIC_UNINITIALIZED);
|
||
}
|
||
#endregion
|
||
|
||
#endregion
|
||
|
||
#region //静态函数--事件处理
|
||
public static void PushFixEvent(LogicEventDefine eventID, object obj = null, object sender = null)
|
||
{
|
||
EventManager.PushFixEvent((int)eventID, obj, sender);
|
||
}
|
||
|
||
public static void PushFixEvent(UIEventDefine eventID, object obj = null, object sender = null)
|
||
{
|
||
EventManager.PushFixEvent((int)eventID, obj, sender);
|
||
}
|
||
|
||
public static void PushFixEvent(int eventID, object obj = null, object sender = null)
|
||
{
|
||
EventManager.PushFixEvent(eventID, obj, sender);
|
||
}
|
||
|
||
public static EventSystemHandler RegFixEventHandle(LogicEventDefine eventType, EventSystemHandler eventHandler)
|
||
{
|
||
return EventManager.RegFixEventHandle((int)eventType, eventHandler);
|
||
}
|
||
public static EventSystemHandler RegFixEventHandle(UIEventDefine eventType, EventSystemHandler eventHandler)
|
||
{
|
||
return EventManager.RegFixEventHandle((int)eventType, eventHandler);
|
||
}
|
||
public static EventSystemHandler RegFixEventHandle(int eventType, EventSystemHandler eventHandler)
|
||
{
|
||
return EventManager.RegFixEventHandle(eventType, eventHandler);
|
||
}
|
||
|
||
public static void UnRegFixEventHandle(LogicEventDefine eventType, EventSystemHandler eventHandler)
|
||
{
|
||
EventManager.UnRegFixEventHandle((int)eventType, eventHandler);
|
||
}
|
||
public static void UnRegFixEventHandle(UIEventDefine eventType, EventSystemHandler eventHandler)
|
||
{
|
||
EventManager.UnRegFixEventHandle((int)eventType, eventHandler);
|
||
}
|
||
public static void UnRegFixEventHandle(int eventType, EventSystemHandler eventHandler)
|
||
{
|
||
EventManager.UnRegFixEventHandle(eventType, eventHandler);
|
||
}
|
||
|
||
#endregion
|
||
|
||
}
|
||
|
||
}
|