コード例 #1
0
ファイル: ServerManager.cs プロジェクト: HarmHoog/CustomGames
        public void OnPlayerSpawn(IPlayerSpawnedEvent e)
        {
            if (!_roleManager.IsActive() && !_gameModeManager.IsActive())
            {
                return;
            }

            Task.Factory.StartNew(() =>
            {
                Task.Delay(1500).Wait();
                var active   = "<align=\"center\"><size=150%><#0000FF>Roles & GameModes:<#000000><size=100%>";
                var commands = "<#000000><align=\"center\"><b>Commands:</b>";

                if (_gameModeManager.IsActive())
                {
                    active   += "\n" + _gameModeManager.GetStatus(e.Game);
                    commands += "\n" + _gameModeManager.GetCommands();
                }

                if (_roleManager.IsActive())
                {
                    active   += "\n\n" + _roleManager.GetStatus(e.Game);
                    commands += "\n" + _roleManager.GetCommands();
                }


                e.PlayerControl.SendChatToPlayerAsync(active);
                e.PlayerControl.SendChatToPlayerAsync(commands);
            });
        }