Ejemplo n.º 1
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="mainVM">Referenz auf das MainVM Objekt, dass mit der SurfaceWindow1 View verknuepft ist.</param>
 public GameVM( MainVM mainVM)
 {
     _sourceItemsP1 = new ObservableCollection<Statement>();
     _targetItemsP1 = new ObservableCollection<Statement>();
     _sourceItemsP2 = new ObservableCollection<Statement>();
     _targetItemsP2 = new ObservableCollection<Statement>();
     _p1Fin = false;
     _p2Fin = false;
     _p1LoadingVisible = "Hidden";
     _p2LoadingVisible = "Hidden";
     _waiting = Config.WAITING_Player;
     _game = new Game();
     _mainVM = mainVM;
     initSourceItems();
     initTargetItems();
     _p1Time = "00:00";
     _p2Time = "00:00";
     _gameTimer = new DispatcherTimer();
     _gameTimer.Interval = new TimeSpan(0, 0, 1);
     _gameTimer.Tick += gameTimeEvent;
     _gameTimer.Start();
     _loadingTimer = new DispatcherTimer();
     _loadingTimer.Interval = new TimeSpan(0, 0, 1);
     _loadingTimer.Tick += loadingTimeEvent;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Konstruktor
 /// </summary>
 /// <param name="gameVM">Referenz auf das auszuwertende Spiel</param>
 public ResultVM(GameVM gameVM)
 {
     _p1TargetItems = gameVM.TargetItemsP1;
     _p2TargetItems = gameVM.TargetItemsP2;
     _game = gameVM.Game;
     _game.evaluate();
     _p1StatCol = new ObservableCollection<Tuple<int, string, string, string, int>>(_game.P1.PointList);
     _p2StatCol = new ObservableCollection<Tuple<int, string, string, string, int>>(_game.P2.PointList);
     _p1Points = _game.P1.Points;
     _p2Points = _game.P2.Points;
     _p1Time = "Benötigte Zeit: " + string.Format("{0:00}:{1:00}", _game.P1.Time / 60, _game.P1.Time % 60);
     _p2Time = "Benötigte Zeit: " + string.Format("{0:00}:{1:00}", _game.P2.Time / 60, _game.P2.Time % 60);
     if (_game.FastestPlayer == _game.P1)
     {
         _p1Time += " schnellster Spieler +1 Bonuspunkt!";
     }
     else if (_game.FastestPlayer == _game.P2)
     {
         _p2Time += " schnellster Spieler +1 Bonuspunkt!";
     }
     _p1Animation = new AnimationVM(_game.P1.Programm);
     _p2Animation = new AnimationVM(_game.P2.Programm);
     if (_game.Winner == _game.P1)
     {
         _p1Status = "Gewonnen";
         _p2Status = "Verloren";
     }
     else if (_game.Winner == _game.P2)
     {
         _p2Status = "Gewonnen";
         _p1Status = "Verloren";
     }
     else
     {
         _p1Status = "Unentschieden";
         _p2Status = "Unentschieden";
     }
 }