private void LoadGame(TextAdventureGame game, Engine.Objects.World world) { CloseGame(); Text = world.Title + " - Text Adventure"; _game = game; _game.Run(); xnaControl.DrawBackground = false; }
public ActionResult Create([Bind(Include = "UserID,Published,Name,Description,GameData")] TextAdventureGame textAdventureGame) { if (ModelState.IsValid) { db.TextAdventureGame.Add(textAdventureGame); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(textAdventureGame)); }
private void CloseGame() { if (!GameRunning) { return; } _game.Dispose(); _game = null; _multimediaPlayer.Reset(); xnaControl.DrawBackground = true; xnaControl.Refresh(); }
// GET: TextAdventure/Home/Details/5 public ActionResult Play(int?id) { if (id == 0) { return(View()); } TextAdventureGame textAdventureGame = db.TextAdventureGame.Find(id); if (textAdventureGame == null) { return(HttpNotFound()); } return(View(textAdventureGame)); }
// GET: TextAdventure/Home/Create?id=0 public ActionResult Create(int?id) { if (id == 0) { TextAdventureGame newGame = new TextAdventureGame() { ID = 0, UserID = 0, //TODO get user ID Published = 0, Name = "New Game", Description = "Give this game a description", GameData = "NEW" }; return(View(newGame)); } TextAdventureGame textAdventureGame = db.TextAdventureGame.Find(id); if (textAdventureGame == null) { return(HttpNotFound());//TODO Redirect to index view. Maybe with a message? } return(View(textAdventureGame)); }