2929// Official Documentation: https://gameframex.doc.alianblank.com/
3030// ==========================================================================================
3131
32- using GameFrameX . StartUp ;
33-
34- namespace GameFrameX . Hotfix . StartUp ;
35-
36- internal partial class AppStartUpHotfixGame : AppStartUpBase , IHotfixBridge
37- {
38- protected override bool IsRegisterToDiscoveryCenter { get ; set ; } = true ;
39-
40- public async Task < bool > OnLoadSuccess ( AppSetting setting , bool reload )
41- {
42- if ( reload )
43- {
44- ActorManager . ClearAgent ( ) ;
45- return true ;
46- }
47-
48- Init ( setting . ServerType , setting ) ;
49- await RunServer ( ) ;
50- // 启动定时器
51- GlobalTimer . Start ( ) ;
52- await ComponentRegister . ActiveGlobalComponents ( ) ;
53- return true ;
54- }
55-
56- public async Task Stop ( string message = "" )
57- {
58- await StopAsync ( message ) ;
59- }
32+ using GameFrameX . Hotfix . Logic . DiscoveryCenter ;
33+ using GameFrameX . StartUp ;
34+
35+ namespace GameFrameX . Hotfix . StartUp ;
36+
37+ internal partial class AppStartUpHotfixGame : AppStartUpBase , IHotfixBridge
38+ {
39+ protected override bool IsRegisterToDiscoveryCenter { get ; set ; } = true ;
40+
41+ public async Task < bool > OnLoadSuccess ( AppSetting setting , bool reload )
42+ {
43+ if ( reload )
44+ {
45+ ActorManager . ClearAgent ( ) ;
46+ return true ;
47+ }
48+
49+ Init ( setting . ServerType , setting ) ;
50+ await RunServer ( ) ;
51+ // 启动定时器
52+ GlobalTimer . Start ( ) ;
53+ await ComponentRegister . ActiveGlobalComponents ( ) ;
54+ var discoveryCenterComponentAgent = await ActorManager . GetComponentAgent < DiscoveryCenterComponentAgent > ( ) ;
55+ if ( discoveryCenterComponentAgent . IsNotNull ( ) )
56+ {
57+ discoveryCenterComponentAgent . SetAppStartUp ( this ) ;
58+ }
59+
60+ return true ;
61+ }
62+
63+ public async Task Stop ( string message = "" )
64+ {
65+ await StopAsync ( message ) ;
66+ }
6067}
0 commit comments