コード例 #1
0
 private void Matchmaking_LobbyChatUpdate(IMyLobby lobby, ulong changedUser, ulong makingChangeUser, MyChatMemberStateChangeEnum stateChange)
 {
     if (lobby.LobbyId == this.Lobby.LobbyId)
     {
         if (stateChange != MyChatMemberStateChangeEnum.Entered)
         {
             if ((Sync.Clients == null) || Sync.Clients.HasClient(changedUser))
             {
                 base.RaiseClientLeft(changedUser, stateChange);
             }
             if (changedUser == base.ServerId)
             {
                 base.RaiseHostLeft();
                 MySessionLoader.UnloadAndExitToMenu();
                 MyGuiScreenServerReconnector.ReconnectToLastSession();
             }
             else if (MySandboxGame.IsGameReady)
             {
                 MyHudNotification notification = new MyHudNotification(MyCommonTexts.NotificationClientDisconnected, 0x1388, "Blue", MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, 0, MyNotificationLevel.Important);
                 object[]          arguments    = new object[] { MyGameService.GetPersonaName(changedUser) };
                 notification.SetTextFormatArguments(arguments);
                 MyHud.Notifications.Add(notification);
             }
         }
         else
         {
             object[] objArray1 = new object[] { "Player entered: ", MyGameService.GetPersonaName(changedUser), " (", changedUser, ")" };
             MySandboxGame.Log.WriteLineAndConsole(string.Concat(objArray1));
             MyGameService.Peer2Peer.AcceptSession(changedUser);
             if ((Sync.Clients == null) || !Sync.Clients.HasClient(changedUser))
             {
                 base.RaiseClientJoined(changedUser);
             }
             if (MySandboxGame.IsGameReady && (changedUser != base.ServerId))
             {
                 MyHudNotification notification = new MyHudNotification(MyCommonTexts.NotificationClientConnected, 0x1388, "Blue", MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER, 0, MyNotificationLevel.Important);
                 object[]          arguments    = new object[] { MyGameService.GetPersonaName(changedUser) };
                 notification.SetTextFormatArguments(arguments);
                 MyHud.Notifications.Add(notification);
             }
         }
     }
 }
コード例 #2
0
 private void MyMultiplayerClient_HostLeft()
 {
     this.CloseSession();
     MySessionLoader.UnloadAndExitToMenu();
     MyGuiScreenServerReconnector.ReconnectToLastSession();
 }