コード例 #1
0
        public void Fkt_Test(object obj)
        {
            //if (obj is object[])
            //{
            //    var param = obj as object[];
            //    FieldContent[4] = param[0].ToString();
            //    OnNotifyPropertyChanged("FieldContent");
            //    TextContent = param[1].ToString();
            //    OnNotifyPropertyChanged("TextContent");
            //}
            //else
            //{
            //    string input = obj as String;
            //    char[] seperator = { '|' };
            //    string[] param = input.Split(seperator);
            //    FieldContent[4] = param[0].ToString();
            //    OnNotifyPropertyChanged("FieldContent");
            //    TextContent = param[1].ToString();
            //    OnNotifyPropertyChanged("TextContent");
            //}

            TextContent = CanExecute.ToString() + " " + GameInProgress.ToString();
            OnNotifyPropertyChanged("TextContent");
            OnNotifyPropertyChanged("FieldContent");
        }
コード例 #2
0
 public static void Join(GamePlayer player)
 {
     GameInProgress currentGame = LookForAvailableGame();
       if (currentGame != null)
       {
     currentGame.Join(player);
       }
       else
       {
     currentGame = new GameInProgress();
     currentGame.GameOver += (game) => { lock (games) games.Remove(game); };
     currentGame.Join(player);
     lock( games )
       games.Add(currentGame);
       }
 }
コード例 #3
0
        private void MakeMove()
        {
            // int sticksToTake = 0;
            if (GameInProgress != null)
            {
                var sticksToTake = GameInProgress.Invoke(this, players[(int)Current]);

                TakeSticks(sticksToTake);
                if (sticksToTake != 0)
                {
                    SticksTaken?.Invoke(players[(int)Current], sticksToTake);
                }
            }
            else
            {
                throw new InvalidOperationException("At least one instance GameInProgress handler should be defined.");
            }
        }
コード例 #4
0
ファイル: GamePlayer.cs プロジェクト: PeterHimschoot/Beers2U
 public void Joins(GameInProgress game)
 {
   Game = game;
 }