コード例 #1
0
        public static void ExportGame(ShootEmUpGame game)
        {
            //Create game folder
            String ExportPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            ExportPath += "\\ShootEmUpMaker\\";
            String GameFolderPath = ExportPath + game._name;
            String GameFilePath   = GameFolderPath + "\\" + game._name + ".xml";

            Directory.CreateDirectory(GameFolderPath);

            //Copy ressources to game folder
            try
            {
                Serialization.copyRessources(game);
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.ToString());
            }

            //Create xml file in game folder
            XmlSerializer xs = new XmlSerializer(typeof(ShootEmUpGame));

            using (StreamWriter wr = new StreamWriter(GameFilePath))
            {
                xs.Serialize(wr, game);
            }
        }
コード例 #2
0
        public static void ExportGame(ShootEmUpGame game)
        {
            //Create game folder
            String ExportPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            ExportPath += "\\ShootEmUpMaker\\";
            String GameFolderPath = ExportPath + game._name;
            String GameFilePath = GameFolderPath + "\\" + game._name + ".xml";
            Directory.CreateDirectory(GameFolderPath);

            //Copy ressources to game folder
            try
            {
                Serialization.copyRessources(game);
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.ToString());
            }

            //Create xml file in game folder
            XmlSerializer xs = new XmlSerializer(typeof(ShootEmUpGame));
            using (StreamWriter wr = new StreamWriter(GameFilePath))
            {
                xs.Serialize(wr, game);
            }
        }
コード例 #3
0
        public MakerWindow(ShootEmUpGame _game = null)
        {
            // Inits
            InitializeComponent();

            // Default actions
            this.game = _game != null ? _game : new ShootEmUpGame();
            this.LoadGameObject();

            // Init events
            this.gameNameTextBox.TextChanged += gameNameTextBoxTextChanged;
            this.GeneralSettingsTextBlock.MouseDown += GeneralSettingsTextBlockMouseDown;
            this.MenuAndPlayerTextBlock.MouseDown += MenuAndPlayerPanelMouseDown;
            this.CreateNewLevelButton.MouseDown += CreateNewLevel;
        }
コード例 #4
0
        public MakerWindow(ShootEmUpGame _game = null)
        {
            // Inits
            InitializeComponent();

            // Default actions
            this.game = _game != null ? _game : new ShootEmUpGame();
            this.LoadGameObject();

            // Init events
            this.gameNameTextBox.TextChanged        += gameNameTextBoxTextChanged;
            this.GeneralSettingsTextBlock.MouseDown += GeneralSettingsTextBlockMouseDown;
            this.MenuAndPlayerTextBlock.MouseDown   += MenuAndPlayerPanelMouseDown;
            this.CreateNewLevelButton.MouseDown     += CreateNewLevel;
        }
コード例 #5
0
        public static void copyRessources(ShootEmUpGame myGame)
        {
            String UserDocumentPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ShootEmUpMaker\\";
            String CreatedGamePath  = UserDocumentPath + myGame._name + "\\res";

            //Creating ressource folder
            Directory.CreateDirectory(CreatedGamePath);
            Directory.CreateDirectory(CreatedGamePath + "\\general");
            Directory.CreateDirectory(CreatedGamePath + "\\player");
            Directory.CreateDirectory(CreatedGamePath + "\\enemy");

            ////Copying ressources to folder
            foreach (Level x in myGame._levels)
            {
                //General
                string wallName  = Path.GetFileName(x._wallpaper);
                string musicName = Path.GetFileName(x._music);
                //File.Copy(x._wallpaper, CreatedGamePath + "\\general\\" + wallName);
                //    File.Copy(x._music, CreatedGamePath + "\\general\\" + musicName);
                x._wallpaper = wallName;
                x._music     = musicName;

                //    //Enemy
                foreach (EnemyShip z in x._enemy)
                {
                    string EshipSprite   = Path.GetFileName(z._shipSprite);
                    string EweaponSprite = Path.GetFileName(z._weaponSprite);
                    //   File.Copy(z._shipSprite, CreatedGamePath + "\\enemy\\" + EshipSprite);
                    //   File.Copy(z._weaponSprite, CreatedGamePath + "\\enemy\\" + EweaponSprite);
                    z._shipSprite   = EshipSprite;
                    z._weaponSprite = EweaponSprite;
                }
            }

            ////Player
            string UshipSprite   = Path.GetFileName(myGame._player._shipSprite);
            string UweaponSprite = Path.GetFileName(myGame._player._weaponSprite);

            //File.Copy(myGame._player._shipSprite, CreatedGamePath + "\\player\\" + UshipSprite);
            //File.Copy(myGame._player._weaponSprite, CreatedGamePath + "\\player\\" + UweaponSprite);
            myGame._player._shipSprite   = UshipSprite;
            myGame._player._weaponSprite = UweaponSprite;

            string thumbName = Path.GetFileName(myGame._wallpaper);

            File.Copy(myGame._wallpaper, CreatedGamePath + "\\general\\" + thumbName);
            myGame._wallpaper = thumbName;
        }
コード例 #6
0
 public static ShootEmUpGame ImportGame(string path)
 {
     ShootEmUpGame myGame = new ShootEmUpGame();
     XmlSerializer xs = new XmlSerializer(typeof(ShootEmUpGame));
     using (StreamReader tr = new StreamReader(path))
     {
         try
         {
             myGame = (ShootEmUpGame)xs.Deserialize(tr);
         }
         catch (Exception e)
         {
             System.Windows.MessageBox.Show(e.ToString());
         }
     }
     return myGame;
 }
コード例 #7
0
        public static void ExportGame(ShootEmUpGame myGame)
        {
            //Create game folder
            string docPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            Directory.CreateDirectory(docPath + "\\ShootEmUpMaker\\" + myGame._name);

            //Create xml file in game folder
            XmlSerializer xs = new XmlSerializer(typeof(ShootEmUpGame));
            using (StreamWriter wr = new StreamWriter(docPath +
                "\\ShootEmUpMaker\\" +
                myGame._name +
                "\\" +
                myGame._name + ".xml"))
            {
                xs.Serialize(wr, myGame);
            }
        }
コード例 #8
0
        public static void copyRessources(ShootEmUpGame myGame)
        {
            String UserDocumentPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ShootEmUpMaker\\";
            String CreatedGamePath = UserDocumentPath + myGame._name + "\\res";

            //Creating ressource folder
            Directory.CreateDirectory(CreatedGamePath);
            Directory.CreateDirectory(CreatedGamePath + "\\general");
            Directory.CreateDirectory(CreatedGamePath + "\\player");
            Directory.CreateDirectory(CreatedGamePath + "\\enemy");

            ////Copying ressources to folder
            foreach (Level x in myGame._levels)
            {
                //General
                string wallName = Path.GetFileName(x._wallpaper);
                string musicName = Path.GetFileName(x._music);
                //File.Copy(x._wallpaper, CreatedGamePath + "\\general\\" + wallName);
                //    File.Copy(x._music, CreatedGamePath + "\\general\\" + musicName);
                x._wallpaper = wallName;
                x._music = musicName;

            //    //Enemy
                foreach (EnemyShip z in x._enemy)
                {
                    string EshipSprite = Path.GetFileName(z._shipSprite);
                    string EweaponSprite = Path.GetFileName(z._weaponSprite);
                 //   File.Copy(z._shipSprite, CreatedGamePath + "\\enemy\\" + EshipSprite);
                 //   File.Copy(z._weaponSprite, CreatedGamePath + "\\enemy\\" + EweaponSprite);
                    z._shipSprite = EshipSprite;
                    z._weaponSprite = EweaponSprite;
                }
            }

            ////Player
            string UshipSprite = Path.GetFileName(myGame._player._shipSprite);
            string UweaponSprite = Path.GetFileName(myGame._player._weaponSprite);
            //File.Copy(myGame._player._shipSprite, CreatedGamePath + "\\player\\" + UshipSprite);
            //File.Copy(myGame._player._weaponSprite, CreatedGamePath + "\\player\\" + UweaponSprite);
            myGame._player._shipSprite = UshipSprite;
            myGame._player._weaponSprite = UweaponSprite;

            string thumbName = Path.GetFileName(myGame._wallpaper);
            File.Copy(myGame._wallpaper, CreatedGamePath + "\\general\\" + thumbName);
            myGame._wallpaper = thumbName;
        }
コード例 #9
0
        public static ShootEmUpGame ImportGame(string path)
        {
            ShootEmUpGame myGame = new ShootEmUpGame();
            XmlSerializer xs     = new XmlSerializer(typeof(ShootEmUpGame));

            using (StreamReader tr = new StreamReader(path))
            {
                try
                {
                    myGame = (ShootEmUpGame)xs.Deserialize(tr);
                }
                catch (Exception e)
                {
                    System.Windows.MessageBox.Show(e.ToString());
                }
            }
            return(myGame);
        }
コード例 #10
0
        public static void ExportGame(ShootEmUpGame myGame)
        {
            //Create game folder
            string docPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            Directory.CreateDirectory(docPath + "\\ShootEmUpMaker\\" + myGame._name);

            //Create xml file in game folder
            XmlSerializer xs = new XmlSerializer(typeof(ShootEmUpGame));

            using (StreamWriter wr = new StreamWriter(docPath +
                                                      "\\ShootEmUpMaker\\" +
                                                      myGame._name +
                                                      "\\" +
                                                      myGame._name + ".xml"))
            {
                xs.Serialize(wr, myGame);
            }
        }
コード例 #11
0
        private Brush getGameBackground(string gamePath)
        {
            Brush         ret  = null;
            ShootEmUpGame game = Serialization.ImportGame(gamePath);

            if (game != null && File.Exists(game._wallpaper))
            {
                try {
                    new Uri(game._wallpaper, UriKind.Relative);
                    ret = new ImageBrush(new BitmapImage());
                }
                catch (Exception e) {
                    Console.WriteLine(e.ToString());
                }
            }
            else
            {
                ret = new SolidColorBrush(Color.FromRgb(194, 32, 38));
            }
            return(ret);
        }