/////////////////////////////////////////// public GameNetworkClient(bool entitySystemServiceEnabled) { if (instance != null) { Log.Fatal("GameNetworkClient.GameNetworkClient: instance != null."); } instance = this; //register network services //register user management service userManagementService = new UserManagementClientNetworkService(); RegisterService(userManagementService); //register custom messages service customMessagesService = new CustomMessagesClientNetworkService(); RegisterService(customMessagesService); //register chat service chatService = new ChatClientNetworkService(userManagementService); RegisterService(chatService); //register entity system service if (entitySystemServiceEnabled) { entitySystemService = new EntitySystemClientNetworkService(userManagementService); RegisterService(entitySystemService); } }
/////////////////////////////////////////// public GameNetworkClient( bool entitySystemServiceEnabled ) { if( instance != null ) Log.Fatal( "GameNetworkClient.GameNetworkClient: instance != null." ); instance = this; //register network services //register user management service userManagementService = new UserManagementClientNetworkService(); RegisterService( userManagementService ); //register custom messages service customMessagesService = new CustomMessagesClientNetworkService(); RegisterService( customMessagesService ); //register chat service chatService = new ChatClientNetworkService( userManagementService ); RegisterService( chatService ); //register entity system service if( entitySystemServiceEnabled ) { entitySystemService = new EntitySystemClientNetworkService( userManagementService ); RegisterService( entitySystemService ); } }
// public ClientEntitySystemNetworkingInterface( EntitySystemClientNetworkService service ) { this.service = service; }
// public ClientEntitySystemNetworkingInterface(EntitySystemClientNetworkService service) { this.service = service; }
void Client_EntitySystemService_WorldDestroy( EntitySystemClientNetworkService sender, bool newMapWillBeLoaded) { WinFormsAppWorld.WorldDestroy(); }
void Client_EntitySystemService_WorldCreateEnd( EntitySystemClientNetworkService sender ) { }
void Client_EntitySystemService_WorldCreateBegin( EntitySystemClientNetworkService sender, WorldType worldType, string mapVirtualFileName) { MapSystemWorld.MapDestroy(); if( !EntitySystemWorld.Instance.WorldCreate( WorldSimulationTypes.ClientOnly, worldType, sender.NetworkingInterface ) ) { Log.Fatal( "GameEngineApp: Client_EntitySystemService_WorldCreateBegin: " + "EntitySystemWorld.WorldCreate failed." ); } }
void Client_EntitySystemService_WorldCreateEnd( EntitySystemClientNetworkService sender ) { //dynamic created map example if( string.IsNullOrEmpty( Map.Instance.VirtualFileName ) ) DynamicCreatedMapExample.Client_CreateEntities(); //play music if( GameMap.Instance != null ) GameMusic.MusicPlay("Sounds//Music//Ants.ogg", true); //GameMusic.MusicPlay( GameMap.Instance.GameMusic, true ); CreateGameWindowForMap(); }
void Client_EntitySystemService_WorldCreateBegin( EntitySystemClientNetworkService sender, WorldType worldType, string mapVirtualFileName) { //show map loading window EControl mapLoadingWindow = ControlDeclarationManager.Instance.CreateControl( "Gui\\MapLoadingWindow.gui" ); if( mapLoadingWindow != null ) { mapLoadingWindow.Text = mapVirtualFileName; controlManager.Controls.Add( mapLoadingWindow ); } RenderScene(); DeleteAllGameWindows(); MapSystemWorld.MapDestroy(); if( !EntitySystemWorld.Instance.WorldCreate( WorldSimulationTypes.ClientOnly, worldType, sender.NetworkingInterface ) ) { Log.Fatal( "GameEngineApp: Client_EntitySystemService_WorldCreateBegin: " + "EntitySystemWorld.WorldCreate failed." ); } }
void Client_EntitySystemService_WorldDestroy( EntitySystemClientNetworkService sender, bool newMapWillBeLoaded) { MapSystemWorld.MapDestroy(); if( EntitySystemWorld.Instance != null ) EntitySystemWorld.Instance.WorldDestroy(); //close all windows foreach( Control control in GameEngineApp.Instance.ControlManager.Controls ) control.SetShouldDetach(); if( !newMapWillBeLoaded ) { //create lobby window MultiplayerLobbyWindow lobbyWindow = new MultiplayerLobbyWindow(); GameEngineApp.Instance.ControlManager.Controls.Add( lobbyWindow ); } }
void Client_EntitySystemService_WorldCreateBegin( EntitySystemClientNetworkService sender, WorldType worldType, string mapVirtualFileName) { //close all windows foreach( Control control in controlManager.Controls ) control.SetShouldDetach(); //show map loading window { string mapDirectory = Path.GetDirectoryName( mapVirtualFileName ); string guiPath = Path.Combine( mapDirectory, "Description\\MapLoadingWindow.gui" ); if( !VirtualFile.Exists( guiPath ) ) guiPath = "Gui\\MapLoadingWindow.gui"; Control mapLoadingWindow = ControlDeclarationManager.Instance.CreateControl( guiPath ); if( mapLoadingWindow != null ) { mapLoadingWindow.Text = mapVirtualFileName; controlManager.Controls.Add( mapLoadingWindow ); } client_mapLoadingWindow = mapLoadingWindow; } RenderScene(); DeleteAllGameWindows(); MapSystemWorld.MapDestroy(); //unload all reloadable textures TextureManager.Instance.UnloadAll( true, false ); if( !EntitySystemWorld.Instance.WorldCreate( WorldSimulationTypes.ClientOnly, worldType, sender.NetworkingInterface ) ) { Log.Fatal( "GameEngineApp: Client_EntitySystemService_WorldCreateBegin: " + "EntitySystemWorld.WorldCreate failed." ); } }