Example #1
0
 void app_OnHideBoard(GeniusTetrisPlayer player, bool hide)
 {
     if (_PlayersBoard.ContainsKey(player.ID))
     {
         GeniusTetris.BoardUC b = _PlayersBoard[player.ID];
         b.Invisibility = hide ? Visibility.Visible : Visibility.Collapsed;
     }
 }
Example #2
0
 void app_OnOptionArrived(GeniusTetrisPlayer from, GeniusTetrisPlayer to, byte option)
 {
     if (_PlayersBoard.ContainsKey(from.ID))
     {
         GeniusTetris.BoardUC b = _PlayersBoard[from.ID];
         app.CurrentGame.ExecuteOption(option, new ProxyGame(app, from.ID, b.Board));
     }
 }
Example #3
0
 void app_OnSendBoard(GeniusTetrisPlayer player, byte[,] data)
 {
     //throw new NotImplementedException();
     if (_PlayersBoard.ContainsKey(player.ID))
     {
         GeniusTetris.BoardUC b = _PlayersBoard[player.ID];
         if (b.Board == null)
         {
             b.Board = new Board(12, 22, null);
         }
         b.Board.SetData(data);
     }
 }
Example #4
0
        /// <summary>
        /// Retreie a receiver for option, only "1" is authorized when a player plays alone
        /// </summary>
        /// <param name="key"></param>
        /// <returns>a local playe on "1" key, and a proxy player on others</returns>
        private IGame GetReceiver(string key)
        {
            if (key == "1")
            {
                return(app.CurrentGame);
            }
            if (!app.InMultiplayer)
            {
                return(null);
            }
            GeniusTetrisPlayer player = FindPlayerKey(key);

            if (player != null && !player.IsGameOver)
            {
                GeniusTetris.BoardUC b = _PlayersBoard[player.ID];
                return(new ProxyGame(this.app, player.ID, b.Board));
            }
            return(null);
        }