public MyGameExtendedInfo(MyGameInfo gameInfo)
 {
     GameInfo   = gameInfo;
     Ping       = MyMwcUtils.GetRandomInt(10, 20);
     SectorType = MySectorType.Official;
     GameType   = gameInfo.GameType;
 }
        public void JoinGame(MyGameInfo gameInfo, string password, GameJoinedHandler onGameJoined, Action onGameEnterDisallowed, Action onDownloadingSector)
        {
            MyMultiplayerPeers.Static.Restart();
            m_introductionTimer.Dispose();
            m_hostTimer.Dispose();

            MyMultiplayerPeers.Static.HostUserId = -1;
            m_game = gameInfo;

            m_gameJoinedAction          = onGameJoined;
            m_gameDownloadingSector     = onDownloadingSector;
            m_gameEnterDisallowedAction = onGameEnterDisallowed;
            MyMultiplayerPeers.Static.NetworkClient.ClearCallbacks();
            MyMultiplayerPeers.Static.DisconnectExceptServer();

            MyMultiplayerPeers.Static.Players.Clear();

            MyEventJoinGame joinRequest = new MyEventJoinGame();

            joinRequest.GameId   = gameInfo.GameId;
            joinRequest.Password = password;

            SetCallback <MyEventJoinGameResponse>(OnJoinGameResponse);
            MyMultiplayerPeers.Static.NetworkClient.RegisterCallback <MyEventLoginResponse>(OnLoginResponse);

            MyMultiplayerPeers.Static.NetworkClient.NatIntroductionSuccess = NetworkClient_NatIntroductionSuccess;

            m_natIntroduction = new MyNatIntroduction(MyMultiplayerPeers.Static.NetworkClient);
            MyMultiplayerPeers.Static.NetworkClient.PeerConnected += new Action <NetConnection>(NetworkClient_PeerConnected);
            MyMultiplayerPeers.Static.SendServer(ref joinRequest);

            MyMultiplayerGameplay.Log("JOIN 1. - Join game");
        }
 private MyTexture2D GetSectorIcon(MyGameInfo gameInfo)
 {
     switch (0)
     {
     default:
         return(null);
     }
 }
        private StringBuilder GetGameType(MyGameInfo gameInfo)
        {
            switch (gameInfo.GameType)
            {
            case MyGameTypes.Story:
                return(new StringBuilder(MyTextsWrapper.Get(MyTextsWrapperEnum.Story) + " (" + MyTextsWrapper.Get(MyGameplayConstants.GetGameplayDifficultyProfile(gameInfo.Difficulty).DifficultyName) + ")"));

                break;

            case MyGameTypes.Deathmatch:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.Deathmatch));

                break;

            default:
                return(MyTextsWrapper.Get(MyTextsWrapperEnum.UNKNOWN));

                break;
            }
        }
        void OnGameJoined(MyGameInfo game, MyResultCodeEnum resultCode, MyMwcObjectBuilder_Checkpoint checkpointBuilder)
        {
            Debug.Assert(m_waitingScreen != null);
            m_waitingScreen.CloseScreen();

            if (resultCode == MyResultCodeEnum.OK)
            {
                var loadingScreen = MySession.StartJoinMultiplayerSession(game.GameType, game.Difficulty, checkpointBuilder);
                loadingScreen.Closed += new MyGuiScreenBase.ScreenHandler(OnLoadFinished);
            }
            else if (resultCode == MyResultCodeEnum.GAME_NOT_EXISTS)
            {
                MyGuiManager.AddModalScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.MP_GameHasEnded, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null), null);
                GetDataFromServer(true);
            }
            else
            {
                MyGuiManager.AddModalScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.ErrorCreatingNetworkConnection, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null), null);
                GetDataFromServer(true);
            }
        }