Exemple #1
0
 public TeacherMatchBoard(ServiceReference.Player player, int idGame, int idSelectedCharacter)
 {
     playerInstance = new InstanceContext(this);
     playerClient   = new ServiceReference.PlayerManagerClient();
     gameClient     = new ServiceReference.GameManagerClient();
     chatClient     = new ServiceReference.ChatManagerClient(playerInstance);
     music          = new SoundPlayer();
     InitializeComponent();
     playerThis  = player;
     this.idGame = idGame;
     this.idSelectedCharacter = idSelectedCharacter;
     InitializeMusic();
     chatClient.ConnectToChat(playerThis.UserName);
     ShowSelectedCharacter();
     chatClient.InitializeGameChat(idGame, playerThis.UserName);
     label_Message.Content    = playerThis.UserName;
     label_Message_EE.Content = "EE: " + playerClient.GetScore(playerThis.UserName);
 }
Exemple #2
0
        private void Button_Exit_Click(object sender, RoutedEventArgs e)
        {
            chatClient = new ServiceReference.ChatManagerClient(playerInstance);
            MessageBoxResult message = MessageBox.Show(Properties.Resources.message_Exit, Properties.Resources.message_Wait, MessageBoxButton.YesNo, MessageBoxImage.Question);

            try {
                if (message == MessageBoxResult.Yes)
                {
                    if (playerThis.UserName == gameClient.GetUserNamePlayerOne(idGame))
                    {
                        chatClient.WinGamePlayerTwo(idGame, playerThis.UserName);
                    }
                    else
                    {
                        if (playerThis.UserName == gameClient.GetUserNamePlayerTwo(idGame))
                        {
                            chatClient.WinGamePlayerOne(idGame, playerThis.UserName);
                        }
                    }
                }
            } catch (Exception ex) {
                Console.WriteLine(ex);
            }
        }