protected void DoGameRequestReceived(GeniusTetrisPlayer player, string message)
 {
     if (OnGameRequestReceived != null)
     {
         OnGameRequestReceived(player, message);
     }
 }
 protected void DoStartGameNow(GeniusTetrisPlayer player)
 {
     if (OnStartGameNow != null)
     {
         OnStartGameNow(player);
     }
 }
 protected void DoGameRequestAccepted(GeniusTetrisPlayer player)
 {
     if (OnGameRequestAccepted != null)
     {
         OnGameRequestAccepted(player);
     }
 }
 protected void DoEndGameEnd(GeniusTetrisPlayer player, string message)
 {
     if (OnEndGameEnd != null)
     {
         OnEndGameEnd(player, message);
     }
 }
 protected void DoHideBoard(GeniusTetrisPlayer player, bool hide)
 {
     if (OnHideBoard != null)
     {
         OnHideBoard(player, hide);
     }
 }
 protected void DoOptionArrived(GeniusTetrisPlayer from, GeniusTetrisPlayer to, byte option)
 {
     if (OnOptionArrived != null)
     {
         OnOptionArrived(from, to, option);
     }
 }
 protected void DoSendScore(GeniusTetrisPlayer player, int score)
 {
     if (OnSendScore != null)
     {
         OnSendScore(player, score);
     }
 }
 protected void DoTimerChanged(GeniusTetrisPlayer player, double value)
 {
     if (OnTimerChanged != null)
     {
         OnTimerChanged(player, value);
     }
 }
 protected void DoGameOver(GeniusTetrisPlayer player, string message)
 {
     if (OnGameOver != null)
     {
         OnGameOver(player, message);
     }
 }
 protected void DoSendBoard(GeniusTetrisPlayer player, byte[,] board)
 {
     if (OnSendBoard != null)
     {
         OnSendBoard(player, board);
     }
 }
 public TetrisMultiplayerApplicationBase(ITimer timer)
 {
     this.Dispatcher               = System.Windows.Threading.Dispatcher.CurrentDispatcher;
     CurrentGame                   = new GeniusTetris.Core.Game(timer);
     CurrentGame.OnGameOver       += new EventHandler(_Game_OnGameOver);
     CurrentGame.OnOptionsChanged += new EventHandler(_Game_OnOptionsChanged);
     CurrentGame.Board.OnDropped  += new EventHandler <BoardChangedEventArgs>(Board_OnDropped);
     CurrentGame.OnBoardChanged   += new EventHandler(_Game_OnBoardChanged);
     CurrentGame.OnHideMyBoard    += new EventHandler(_Game_OnHideMyBoard);
     PlayersInMeshList             = new System.Collections.ObjectModel.ObservableCollection <GeniusTetrisPlayer>();
     GameMembersList               = new System.Collections.ObjectModel.ObservableCollection <GeniusTetrisPlayer>();
     Options     = new ObservableCollection <byte>();
     GameOptions = GameOptions.Instance.Value;
     GameOptions.OnOptionsChanged += new EventHandler(GameOptions_OnOptionsChanged);
     CurrentPlayer = new GeniusTetrisPlayer()
     {
         ID       = Guid.NewGuid(),
         NickName = GameOptions.Member
     };
 }
Exemple #12
0
        void app_OnGameRequestAccepted(GeniusTetris.Multiplayer.GeniusTetrisPlayer player)
        {
            //Assign player to a board
            int ieme = _PlayersBoard.Count + 1;

            GeniusTetris.BoardUC b;
            //find ieme board, last me be 8, after exception will throw
            b = this.FindName(string.Format("board{0}", ieme)) as GeniusTetris.BoardUC;
            //change the player name at the top of board
            b.Player = player;
            //adds link between playerId and his local board to a dictionnary
            _PlayersBoard.Add(player.ID, b);
            //hide player
            b.GameOver     = Visibility.Collapsed;
            b.Invisibility = Visibility.Collapsed;
            b.OffLine      = Visibility.Collapsed;
            //TODO: hide all not used board
            //add a link between a key "2" -> "8" to a playerId
            _PlayersKey.Add((ieme + 1).ToString(), player);
        }
 public abstract void SendOption(GeniusTetrisPlayer toplayer, byte option);
 public override void SendOption(GeniusTetrisPlayer toplayer, byte option)
 {
     throw new NotImplementedException();
 }