Пример #1
0
 public MainGame(Player.levelenum level)
 {
     //BitmapImage bmi = new BitmapImage();
     //bmi = HelperClasses.BitmapConverter.BitmapToImageSource(currentlvl.image);
     //this.Background = new ImageBrush(bmi);
     InitializeComponent();
 }
Пример #2
0
 public MainViewModel()
 {
     XML xml = new XML();
     player = xml.Player;
     players.Add(player);
     highScores = new ObservableCollection<Model.HighScores>();
     highScores.Add(xml.HighScores);
     highScores[0].players = players;
     mc = new MovementController(players, highScores);
     mc.Win += mc_Win;
     NewHighScoreCommand = new RelayCommand(NewHighScore);
     KeyDownCommand = new RelayCommand<KeyEventArgs>(KeyDown);
     KeyUpCommand = new RelayCommand<KeyEventArgs>(KeyUp);
     NewGameCommand = new RelayCommand(NewGame);
     ContinueCommand = new RelayCommand(Continue);
     HighScoreCommand = new RelayCommand(HighScore);
     ExitCommand = new RelayCommand(Exit);
     SaveHighScoreCommand = new RelayCommand<String>(SaveHighScore);
     MainMenuCommand = new RelayCommand(MainMenuC);
     SavePlayerCommand = new RelayCommand(SavePlayer);
     NewPlayerCommandLVL1 = new RelayCommand(NewPlayerLVL1);
     NewPlayerCommandLVL2 = new RelayCommand(NewPlayerLVL2);
     DeathCommand = new RelayCommand(Death);
     WinCommand = new RelayCommand(Win);
     LevelSelectCommand = new RelayCommand(LevelSelectC);
 }
Пример #3
0
        public void TestPlayerXML()
        {
            HighScores high = new HighScores();
            Player player = new Player();
            XML xml = new XML();
            player.alive = false;
            player.onWallRight = true;
            xml.Player = player;

            Assert.Equals(xml.Player.alive, player.alive);
            Assert.Equals(xml.Player.onWallRight, player.onWallRight);
        }
Пример #4
0
        public void TestHighScoreXML()
        {
            HighScores high = new HighScores();
            Player player = new Player();
            XML xml= new XML();

            high.Name1 = "PLayer 1";
            high.Name2 = "PLayer 2";

            high.Score1 = long.MaxValue;
            high.Score2 = long.MinValue;

            xml.HighScores = high;
            Assert.AreEqual(xml.HighScores.Name1, high.Name1);
            Assert.AreEqual(xml.HighScores.Name2, high.Name2);
            Assert.AreEqual(xml.HighScores.Score1, high.Score1);
            Assert.AreEqual(xml.HighScores.Score2, high.Score2);

            Assert.AreEqual(xml.HighScores.Name, high.Name);
            Assert.AreEqual(xml.HighScores.Score, high.Score);

            Assert.AreEqual(xml.HighScores.nice1, high.nice1);
            Assert.AreEqual(xml.HighScores.nice2, high.nice2);
        }
Пример #5
0
 private void SerializeP(Player value)
 {
     TextWriter writer = new StreamWriter(Directory.GetCurrentDirectory().ToString() + "\\Player.xml");
     serP.Serialize(writer, value);
     writer.Close();
 }