Пример #1
0
        static void Main(string[] args)
        {
            DashCMD.Start();
            DashCMD.Title = "Ace Of Spades Server";
            DashCMD.WriteLine("Game Version: {0}", ConsoleColor.Magenta, GameVersion.Current);

            SimulatedGame game = null;

            ProgramExceptionHandler.RunMainWithHandler(
                () => // tryAction
            {
                LoadServerConfig();

                game = new ServerGame();
                game.Start("AOSServer Game Thread");

                DashCMD.Listen(false);
            },
                () => // finallAyction
            {
                DashCMD.Stop();
            },
                () => // shutdownAction
            {
                if (game.IsRunning)
                {
                    game.Stop();
                }

                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            });
        }
Пример #2
0
        public MatchScreen(ServerGame game)
            : base(game, "Match")
        {
            gamemodes = new Dictionary <GamemodeType, NetworkedGamemode>()
            {
                { GamemodeType.TDM, new TDMGamemode(this) },
                { GamemodeType.CTF, new CTFGamemode(this) }
            };

            // Setup default multiplayer cvars
            DashCMD.SetCVar("ch_infammo", false);
            DashCMD.SetCVar("ch_infhealth", false);
            DashCMD.SetCVar("mp_friendlyfire", false);

            DashCMD.SetCVar("sv_impacts", false);
            DashCMD.SetCVar("sv_hitboxes", false);

            DashCMD.SetCVar("rp_rollback_constant", false);
            DashCMD.SetCVar("rp_rollback_factor", 0.5f);
            DashCMD.SetCVar("rp_rollback_offset", 0);
            DashCMD.SetCVar("rp_usetargetping", false);

            DashCMD.SetCVar("gm_neverend", false);

            DashCMD.AddCommand("world", "Changes the world", "world [filename | *]",
                               (args) =>
            {
                if (args.Length != 1)
                {
                    DashCMD.WriteImportant("Current World: {0}", World.CurrentWorldName);
                }
                else
                {
                    string worldFile = args[0];
                    ChangeWorld(worldFile);
                }
            });

            DashCMD.AddCommand("worlds", "Lists all worlds", "worlds",
                               (args) =>
            {
                string[] worlds = Directory.GetFiles("Content/Worlds");
                DashCMD.WriteImportant("Available Worlds ({0}):", worlds.Length);
                for (int i = 0; i < worlds.Length; i++)
                {
                    DashCMD.WriteStandard("  {0}", Path.GetFileNameWithoutExtension(worlds[i]));
                }
            });

            DashCMD.AddCommand("gamemode", "Changes the gamemode", "gamemode [mode]",
                               (args) =>
            {
                if (args.Length != 1)
                {
                    DashCMD.WriteImportant("Current Gamemode: {0}",
                                           currentGamemode != null ? currentGamemode.Type.ToString() : "None");
                }
                else
                {
                    GamemodeType type;
                    if (Enum.TryParse(args[0], true, out type))
                    {
                        ChangeWorld(World.CurrentWorldName, type);
                    }
                    else
                    {
                        DashCMD.WriteError("Gamemode '{0}' does not exist!", type);
                    }
                }
            });

            DashCMD.AddCommand("say", "Announces a global message", "say <message>",
                               (args) =>
            {
                if (args.Length == 0)
                {
                    DashCMD.ShowSyntax("say");
                }
                else
                {
                    Announce(DashCMD.CombineArgs(args), 5);
                }
            });

            DashCMD.AddCommand("chat", "Sends a chat message from the user 'SERVER'", "chat <message>",
                               (args) =>
            {
                if (args.Length == 0)
                {
                    DashCMD.ShowSyntax("chat");
                }
                else
                {
                    Chat(DashCMD.CombineArgs(args));
                }
            });
        }
Пример #3
0
 public GameScreen(ServerGame game, string name)
 {
     Game = game;
     Name = name;
 }