private void BtnSave_Click(object sender, RoutedEventArgs e) { PageController.Route(Pages.Game, levelEditor.grid, true); //string levelName = Message.InputMessage("Test message met input"); //if (!string.IsNullOrWhiteSpace(levelName)) //{ // WebApi.AddNewLevel(levelName, GridConverter.Serialize(levelEditor.grid)); // //Message.Warning("Level successfully uploaded"); // //PageController.Route(Pages.Menu); // //string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), string.Format(@"PuzzleGame\{0}.json", tbSaveName.Text)); // //string root = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"PuzzleGame\"); // //if (!Directory.Exists(root)) // //{ // // Directory.CreateDirectory(root); // //} // //// Delete the file if it exists. // //if (File.Exists(path)) // //{ // // //File.Delete(path); // // MessageBox.Show("Naam is al bezet kies een ander."); // //} // //else // //{ // // //Create the file. // // File.WriteAllText(path, grid.Serialize()); // //} //} }
public MainWindow() { AutoUpdater.RunUpdateAsAdmin = false; AutoUpdater.AppTitle = "Puzzle game"; AutoUpdater.Start("http://puzzle.runotrack.com/autoupdater/autoupdater.xml"); InitializeComponent(); DataContext = PageController.Instance; PageController.Route(Pages.Menu); gameObjectList.Clear(); //Maakt de listview leeg XmlDocument xmlDoc = new XmlDocument(); //xmlDoc.Load(@"D:\Development\PuzzleGame-master\old\Images\sokoban_spritesheet.xml"); //laad xmlbestand in xmlDoc //XmlNodeList imageNodes = xmlDoc.SelectNodes("//TextureAtlas/SubTexture"); //Zoek nodes //foreach (XmlNode image in imageNodes) //{ // GameObject imageEntity = new GameObject() { name = image.Attributes["name"].Value, x = int.Parse(image.Attributes["x"].Value), y = int.Parse(image.Attributes["y"].Value), height = int.Parse(image.Attributes["width"].Value), width = int.Parse(image.Attributes["height"].Value) }; // gameObjectList.Add(imageEntity); //} foreach (GameObject gameObject in gameObjectList) { //lvAllItems.Items.Add(new DisplayClass { name = gameObject.name, image = getImageFromSprite(gameObject.name.ToEnum<GameObjects>()), x = gameObject.x, y = gameObject.y, height = gameObject.height, width = gameObject.width }); } }
public void Close() { if (!inEditorMode && Message.SelectionMessage("Are you sure you want to quit the level?", "Leave!", "Cancel")) { PageController.Route(Pages.LevelSelector); } else if (inEditorMode && Message.SelectionMessage("Are you sure you want to go back to the editor?", "Go back", "Cancel")) { PageController.Route(Pages.LevelEditor, game.originalGrid); } }
private void GameCompleted() { if (!inEditorMode) { timer.Stop(); Message.Warning("YOU FINISHED THE GAME WOOP WOOP"); PageController.Route(Pages.LevelSelector); } else { timer.Stop(); Message.Warning("You're level has been aproved"); PageController.Route(Pages.LevelEditor, game.originalGrid, true); } }
private void Button_Click_3(object sender, RoutedEventArgs e) { PageController.Route(Pages.NewUser); }
private void startLevel(object sender, RoutedEventArgs e) { Button btn = (Button)sender; PageController.Route(Pages.Game, btn.Content.ToString()); }
private void BtnEditLevel_Click(object sender, RoutedEventArgs e) { PageController.Route(Pages.LevelEditor, new Pos(int.Parse(tbRangeX.Text), int.Parse(tbRangeY.Text))); }
private void BtnStartGame_Click(object sender, RoutedEventArgs e) { PageController.Route(Pages.LevelSelector); }