예제 #1
0
 private void StartGame(GameType gameType, ReconnectType reconnectType, BattleNet.GameServerInfo serverInfo)
 {
     this.m_savedStartGameParams.GameType      = gameType;
     this.m_savedStartGameParams.ReconnectType = reconnectType;
     this.m_savedStartGameParams.ServerInfo    = serverInfo;
     this.StartGame();
 }
예제 #2
0
    public bool ReconnectFromLogin()
    {
        NetCache.ProfileNoticeDisconnectedGame dCGameNotice = this.GetDCGameNotice();
        if (dCGameNotice == null)
        {
            return(false);
        }
        if (!this.IsReconnectEnabled())
        {
            return(false);
        }
        if (dCGameNotice.GameResult != ProfileNoticeDisconnectedGameResult.GameResult.GR_PLAYING)
        {
            this.OnGameResult(dCGameNotice);
            return(false);
        }
        if (dCGameNotice.GameType == GameType.GT_UNKNOWN)
        {
            return(false);
        }
        this.m_pendingReconnectNotice = dCGameNotice;
        ReconnectType lOGIN = ReconnectType.LOGIN;

        this.StartReconnecting(lOGIN);
        NetCache.Get().RegisterReconnectMgr(new NetCache.NetCacheCallback(this.OnNetCacheReady));
        return(true);
    }
예제 #3
0
    private void StartReconnecting(ReconnectType reconnectType)
    {
        float realtimeSinceStartup = UnityEngine.Time.realtimeSinceStartup;

        this.m_reconnectType           = reconnectType;
        this.m_reconnectStartTimestamp = realtimeSinceStartup;
        this.m_retryStartTimestamp     = realtimeSinceStartup;
        this.ShowReconnectingDialog();
    }
예제 #4
0
 private IReconnectManager GetManager(ReconnectType connType)
 {
     if (!this.reconnectFactories.ContainsKey(connType))
     {
         LogManager.Error(string.Format(" Don't have a ReconnectType :{0}", connType));
         return(null);
     }
     return(this.reconnectFactories[connType]);
 }
예제 #5
0
 void InitSocketClientType()
 {
     if ("SocketClient_User" == ClaName)
     {
         mReconnectType    = ReconnectType.Reexteral;
         mSocketClientType = SocketClientType.Socket_User;
     }
     else if ("SocketClient_Game" == ClaName)
     {
         mReconnectType    = ReconnectType.Reexteral;
         mSocketClientType = SocketClientType.Socket_Game;
     }
 }
예제 #6
0
        private bool TryReconnect(ReconnectType type)
        {
            if (closed)
            {
                return(false);
            }

            if (lastReconnect != type)
            {
                reconnectCounter = 0;
            }
            lastReconnect = type;

            TimeSpan?delay;

            switch (type)
            {
            case ReconnectType.Timeout: delay = config.Reconnect.OnTimeout.GetValueAsTime(reconnectCounter); break;

            case ReconnectType.Kick: delay = config.Reconnect.OnKick.GetValueAsTime(reconnectCounter); break;

            case ReconnectType.Ban: delay = config.Reconnect.OnBan.GetValueAsTime(reconnectCounter); break;

            case ReconnectType.ServerShutdown: delay = config.Reconnect.OnShutdown.GetValueAsTime(reconnectCounter); break;

            case ReconnectType.Error: delay = config.Reconnect.OnError.GetValueAsTime(reconnectCounter); break;

            case ReconnectType.None:
                return(false);

            default: throw Util.UnhandledDefault(type);
            }
            reconnectCounter++;

            if (delay == null)
            {
                Log.Info("Reconnect strategy for '{0}' has reached the end. Closing instance.", type);
                return(false);
            }

            Log.Info("Trying to reconnect because of {0}. Delaying reconnect for {1:0} seconds", type, delay.Value.TotalSeconds);
            reconnectTick = TickPool.RegisterTickOnce(() => ConnectClient(), delay);
            return(true);
        }
예제 #7
0
    private void OnNetCacheReady()
    {
        GameType gameType = this.m_pendingReconnectNotice.GameType;

        if (gameType != GameType.GT_UNKNOWN)
        {
            NetCache.Get().UnregisterNetCacheHandler(new NetCache.NetCacheCallback(this.OnNetCacheReady));
            ReconnectType lOGIN = ReconnectType.LOGIN;
            NetCache.NetCacheDisconnectedGame netObject = NetCache.Get().GetNetObject <NetCache.NetCacheDisconnectedGame>();
            if ((netObject == null) || (netObject.ServerInfo == null))
            {
                this.OnReconnectTimeout();
            }
            else
            {
                this.StartGame(gameType, lOGIN, netObject.ServerInfo);
            }
        }
    }
예제 #8
0
    public bool ReconnectFromGameplay()
    {
        if (!this.IsReconnectEnabled())
        {
            return(false);
        }
        BattleNet.GameServerInfo lastGameServerJoined = Network.Get().GetLastGameServerJoined();
        if (lastGameServerJoined == null)
        {
            Debug.LogError("serverInfo in ReconnectMgr.ReconnectFromGameplay is null and should not be!");
            return(false);
        }
        if (!lastGameServerJoined.Resumable)
        {
            return(false);
        }
        this.HideDialog();
        GameType      gameType = GameMgr.Get().GetGameType();
        ReconnectType gAMEPLAY = ReconnectType.GAMEPLAY;

        this.StartReconnecting(gAMEPLAY);
        this.StartGame(gameType, gAMEPLAY, lastGameServerJoined);
        return(true);
    }
예제 #9
0
 public void StartReconnecting(ReconnectType reconnectType)
 {
     object[] objArray1 = new object[] { reconnectType };
     base.method_8("StartReconnecting", objArray1);
 }
예제 #10
0
 private void ClearReconnectData()
 {
     this.m_reconnectType           = ReconnectType.INVALID;
     this.m_reconnectStartTimestamp = 0f;
     this.m_retryStartTimestamp     = 0f;
 }