Пример #1
0
        public override void Initialize(IServer server)
        {
            base.Initialize(server);

            Logger.LogLevel = LogLevel;

            // Get dependencies
            SpawnersModule = server.GetModule <SpawnersModule>();
            RoomsModule    = server.GetModule <RoomsModule>();

            Factories = Factories ?? new Dictionary <string, ILobbyFactory>();
            Lobbies   = Lobbies ?? new Dictionary <int, ILobby>();

            server.SetHandler((short)MsfOpCodes.CreateLobby, HandleCreateLobby);
            server.SetHandler((short)MsfOpCodes.JoinLobby, HandleJoinLobby);
            server.SetHandler((short)MsfOpCodes.LeaveLobby, HandleLeaveLobby);
            server.SetHandler((short)MsfOpCodes.SetLobbyProperties, HandleSetLobbyProperties);
            server.SetHandler((short)MsfOpCodes.SetMyLobbyProperties, HandleSetMyProperties);
            server.SetHandler((short)MsfOpCodes.JoinLobbyTeam, HandleJoinTeam);
            server.SetHandler((short)MsfOpCodes.LobbySendChatMessage, HandleSendChatMessage);
            server.SetHandler((short)MsfOpCodes.LobbySetReady, HandleSetReadyStatus);
            server.SetHandler((short)MsfOpCodes.LobbyStartGame, HandleStartGame);
            server.SetHandler((short)MsfOpCodes.GetLobbyRoomAccess, HandleGetLobbyRoomAccess);

            server.SetHandler((short)MsfOpCodes.GetLobbyMemberData, HandleGetLobbyMemberData);
            server.SetHandler((short)MsfOpCodes.GetLobbyInfo, HandleGetLobbyInfo);
        }
Пример #2
0
        public override void Initialize(IServer server)
        {
            base.Initialize(server);
            singleton = this;

            Spawners   = new Dictionary <string, RegisteredSpawner>();
            SpawnTasks = new Dictionary <string, SpawnTask>();

            // Add handlers
            server.SetHandler((short)MsfOpCodes.RegisterSpawner, HandlerRegisterSpawner);
            server.SetHandler((short)MsfOpCodes.ClientsSpawnRequest, HandleClientsSpawnRequest);
            server.SetHandler((short)MsfOpCodes.RegisterSpawnedProcess, HandleRegisterSpawnedProcess);
            server.SetHandler((short)MsfOpCodes.CompleteSpawnProcess, HandleCompleteSpawnProcess);
            server.SetHandler((short)MsfOpCodes.ProcessStarted, HandleProcessStarted);
            server.SetHandler((short)MsfOpCodes.ProcessKilled, HandleProcessKilled);
            server.SetHandler((short)MsfOpCodes.AbortSpawnRequest, HandleAbortSpawnRequest);
            server.SetHandler((short)MsfOpCodes.GetSpawnFinalizationData, HandleGetCompletionData);
            server.SetHandler((short)MsfOpCodes.UpdateSpawnerProcessesCount, HandleSpawnedProcessesCount);

            // Coroutines
            StartCoroutine(StartQueueUpdater());
        }