Пример #1
0
        public object Start(string level)
        {
            LocalNode node = new LocalNode(Assembly.GetExecutingAssembly());
            node.Join();

            try
            {
                FileInfo levelInfo = new FileInfo(level);
                if (levelInfo.Directory.Name != "Resources")
                    return "Level is not in a resources directory.";

                DirectoryInfo directoryInfo = levelInfo.Directory.Parent;
                World.BaseDirectory = directoryInfo.FullName;
                World.RuntimeDirectory = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;

                using (RuntimeGame game = new RuntimeGame(levelInfo.Name.Substring(0, levelInfo.Name.Length - levelInfo.Extension.Length)))
                {
                    game.Run();
                }
            }
            finally
            {
                node.Leave();
            }

            return null;
        }
Пример #2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (RuntimeGame game = new RuntimeGame())
     {
         game.Run();
     }
 }
Пример #3
0
        public object Start(string level)
        {
            LocalNode node = new LocalNode(Assembly.GetExecutingAssembly());

            node.Join();

            try
            {
                FileInfo levelInfo = new FileInfo(level);
                if (levelInfo.Directory.Name != "Resources")
                {
                    return("Level is not in a resources directory.");
                }

                DirectoryInfo directoryInfo = levelInfo.Directory.Parent;
                World.BaseDirectory    = directoryInfo.FullName;
                World.RuntimeDirectory = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName;

                using (RuntimeGame game = new RuntimeGame(levelInfo.Name.Substring(0, levelInfo.Name.Length - levelInfo.Extension.Length)))
                {
                    game.Run();
                }
            }
            finally
            {
                node.Leave();
            }

            return(null);
        }
Пример #4
0
        public List <Player> ListPlayers(Guid gameId)
        {
            if (!Games.gameIds.Contains(gameId))
            {
                throw new Exception("game does not exist");
            }

            RuntimeGame game = Games.games.Where(g => g.gameId == gameId).FirstOrDefault();

            return(game.players);
        }
Пример #5
0
        public string Pick(Guid gameId, Guid playerId)
        {
            if (!Games.gameIds.Contains(gameId))
            {
                throw new Exception("game does not exist");
            }

            RuntimeGame game = Games.games.Where(g => g.gameId == gameId).FirstOrDefault();

            return(game.Pick(playerId));
        }
Пример #6
0
        public Player JoinGame(Guid gameId, string displayName)
        {
            if (!Games.gameIds.Contains(gameId))
            {
                throw new Exception("game does not exist");
            }
            Guid   playerId = Guid.NewGuid();
            Player player   = new Player
            {
                DisplayName = displayName,
                PlayerId    = playerId
            };
            RuntimeGame game = Games.games.Where(g => g.gameId == gameId).FirstOrDefault();

            game.Join(player);

            return(player);
        }
Пример #7
0
 public OgmoState(RuntimeGame game)
 {
     this.m_Game = game;
 }
Пример #8
0
 public OgmoState(RuntimeGame game)
 {
     this.m_Game = game;
 }