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; }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (RuntimeGame game = new RuntimeGame()) { game.Run(); } }
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); }
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); }
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)); }
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); }
public OgmoState(RuntimeGame game) { this.m_Game = game; }