GetInstance() public static method

public static GetInstance ( ) : MineField
return MineField
Esempio n. 1
0
        private static void GameHandler(Player player, Command cmd)
        {
            string GameMode = cmd.Next();
            string Option   = cmd.Next();
            World  world    = player.World;

            /*if (world == WorldManager.MainWorld){
             *  player.Message("/Game cannot be used on the main world");
             *  return;
             * }*/

            if (GameMode.ToLower() == "zombie")
            {
                if (Option.ToLower() == "start")
                {
                    ZombieGame game = new ZombieGame(player.World);   //move to world
                    game.Start();
                    return;
                }
                else
                {
                    CdGame.PrintUsage(player);
                    return;
                }
            }
            if (GameMode.ToLower() == "minefield")
            {
                if (Option.ToLower() == "start")
                {
                    if (WorldManager.FindWorldExact("Minefield") != null)
                    {
                        player.Message("&WA game of Minefield is currently running and must first be stopped");
                        return;
                    }
                    MineField.GetInstance();
                    MineField.Start(player);
                    return;
                }
                else if (Option.ToLower() == "stop")
                {
                    if (WorldManager.FindWorldExact("Minefield") == null)
                    {
                        player.Message("&WA game of Minefield is currently not running");
                        return;
                    }
                    MineField.Stop(player, false);
                    return;
                }
                else
                {
                    CdGame.PrintUsage(player);
                    return;
                }
            }
            else
            {
                CdGame.PrintUsage(player);
                return;
            }
        }
Esempio n. 2
0
        private static void GameHandler(Player player, Command cmd)
        {
            string GameMode = cmd.Next();
            string Option   = cmd.Next();
            World  world    = player.World;

            if (PropHunt.StartMode != Game.StartMode.None)
            {
                player.Message("&cThere is already a game running!");
                return;
            }

            if (GameMode == null)
            {
                CdGame.PrintUsage(player);
                return;
            }
            if (GameMode.ToLower() == "zombie")
            {
                if (Option.ToLower() == "start")
                {
                    ZombieSurvival game = new ZombieSurvival(player.World); //move to world
                    game.Start();
                    return;
                }
                else if (Option.ToLower() == "stop")
                {
                    ZombieSurvival.Stop(player);
                    Server.Message("{0} &cended the game of zombie survival in the world {1}", player.ClassyName,
                                   world.ClassyName);
                    return;
                }
            }
            if (GameMode.ToLower() == "minefield")
            {
                if (Option == null)
                {
                    player.Message("&cYou must choose an option! &astart/stop");
                    return;
                }
                else if (Option.ToLower() == "start")
                {
                    if (WorldManager.FindWorldExact("Minefield") != null)
                    {
                        player.Message("&WA game of Minefield is currently running and must first be stopped");
                        return;
                    }
                    else
                    {
                        MineField.GetInstance();
                        MineField.Start(player);
                        return;
                    }
                }
                else if (Option.ToLower() == "stop")
                {
                    if (WorldManager.FindWorldExact("Minefield") == null)
                    {
                        player.Message("&WA game of Minefield is currently not running");
                        return;
                    }
                    MineField.Stop(player, false);
                    return;
                }
            }
            if (GameMode.ToLower() == "prophunt")
            {
                if (Option == null)
                {
                    player.Message("&cYou must choose an option! &astart/stop");
                    return;
                }
                if (Option.ToLower() == "start")
                {
                    PropHunt game = new PropHunt(player.World); //move to world
                    game.Start();
                }
            }
            else
            {
                CdGame.PrintUsage(player);
                return;
            }
        }