fCraft.MineField.GetInstance C# (CSharp) Méthode

GetInstance() public static méthode

public static GetInstance ( ) : MineField
Résultat MineField
        public static MineField GetInstance()
        {
            if ( instance == null ) {
                instance = new MineField();
                Failed = new List<Player>();
                Mines = new ConcurrentDictionary<string, Vector3I>();
                Player.Moving += new EventHandler<PlayerMovingEventArgs>( PlayerMoving );
                Player.PlacingBlock += new EventHandler<PlayerPlacingBlockEventArgs>( PlayerPlacing );
                _rand = new Random();
                _stopped = false;
            }
            return instance;
        }

Usage Example

Exemple #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;
            }
        }
All Usage Examples Of fCraft.MineField::GetInstance