public SyncManager(IVisualDynamicEntityManager dynamicEntityManager, ServerComponent server, IWorldChunks chunks, ChatComponent chat) { _dynamicEntityManager = dynamicEntityManager; _server = server; _chunks = chunks; _chat = chat; _server.MessageError += _server_MessageError; _server.MessageEntityData += server_MessageEntityData; }
/// <summary> /// Creates new instance of ItemMessageTranslator. /// </summary> /// <param name="server"></param> public ItemMessageTranslator(ServerComponent server) { if (server == null) { throw new ArgumentNullException("server"); } _server = server; _server.MessageEntityLockResult += ServerMessageEntityLockResult; _server.MessageItemTransfer += _server_MessageItemTransfer; Enabled = true; }
/// <summary> /// Creates new instance of EntityMessageTranslator /// </summary> public EntityMessageTranslator( ServerComponent server, PlayerEntityManager playerEntityManager, IVisualDynamicEntityManager dynamicEntityManager, IChunkEntityImpactManager landscapeManager, SyncManager syncManager) { _server = server; //Handle Entity received Message from Server _server.MessageEntityIn += ServerMessageEntityIn; _server.MessageEntityOut += ServerMessageEntityOut; _server.MessagePosition += ServerMessagePosition; _server.MessageDirection += ServerMessageDirection; _server.MessageEntityLock += ServerMessageEntityLock; _server.MessageEntityUse += _server_MessageEntityUse; _server.MessageEntityEquipment += _server_MessageEntityEquipment; _server.MessageUseFeedback += _server_MessageUseFeedback; _server.MessageItemTransfer += _server_MessageItemTransfer; _server.MessageEntityVoxelModel += ServerOnMessageEntityVoxelModel; _server.MessageEntityHealth += _server_MessageEntityHealth; _server.MessageEntityHealthState += _server_MessageEntityHealthState; _server.MessageEntityAfflictionState += _server_MessageEntityAfflictionState; if (dynamicEntityManager == null) { throw new ArgumentNullException("dynamicEntityManager"); } if (landscapeManager == null) { throw new ArgumentNullException("landscapeManager"); } if (syncManager == null) { throw new ArgumentNullException("syncManager"); } if (playerEntityManager == null) { throw new ArgumentNullException("playerEntityManager"); } _dynamicEntityManager = dynamicEntityManager; _landscapeManager = landscapeManager; _syncManager = syncManager; PlayerEntity = playerEntityManager.PlayerCharacter; playerEntityManager.PlayerEntityChanged += (sender, args) => { PlayerEntity = args.PlayerCharacter; }; }