Ejemplo n.º 1
0
        internal void AccountLogin(string accountKey, int opcode, int channelId, string data, int login_server_id, string client_game_version, string client_login_ip, string unique_identifier, string system, string game_channel_id, string nodeName)
        {
            ServerBridgeThread bridgeThread = LobbyServer.Instance.ServerBridgeThread;

            if (bridgeThread.CurActionNum < 30000)
            {
                LogSys.Log(LOG_TYPE.INFO, "Account connected: {0}, Login type: AccountLogin", accountKey);
            }
            /// Normlog
            LogSys.NormLog("serverevent", LobbyConfig.AppKeyStr, LobbyConfig.LogNormVersionStr, system, game_channel_id,
                           unique_identifier, "null", (int)ServerEventCode.VerifyToken, client_game_version);
            //账号登录模式下,首先向Billing服务器验证账号,获取accountId
            //注意这里的回调执行线程是在ServerBridgeThread线程。
            VerifyAccount(accountKey, opcode, channelId, data, (BillingClient.VerifyAccountCB)((a, ret, accountId) =>
            {
                if (ret == true)
                {
                    if (m_KickedUsers.ContainsKey(accountId))
                    {
                        LogSys.Log(LOG_TYPE.WARN, ConsoleColor.Green, "Account verify success but user is a kicked user. account:{0}, id:{1}", accountKey, accountId);

                        JsonMessageAccountLoginResult replyMsg = new JsonMessageAccountLoginResult();
                        replyMsg.m_Account   = accountKey;
                        replyMsg.m_AccountId = "";
                        replyMsg.m_Result    = (int)AccountLoginResult.Error;
                        JsonMessageDispatcher.SendDcoreMessage(nodeName, replyMsg);
                    }
                    else
                    {
                        LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Green, "Account verify success. account:{0}, id:{1}", accountKey, accountId);

                        DataProcessScheduler dataProcess = LobbyServer.Instance.DataProcessScheduler;
                        dataProcess.DispatchAction(dataProcess.DoAccountLogin, accountKey, accountId, login_server_id, client_game_version, client_login_ip, unique_identifier, system, game_channel_id, nodeName);
                    }
                }
                else
                {
                    LogSys.Log(LOG_TYPE.INFO, ConsoleColor.Yellow, "Account verify failed. account:{0}", accountKey);
                    JsonMessageAccountLoginResult replyMsg = new JsonMessageAccountLoginResult();
                    replyMsg.m_Account   = accountKey;
                    replyMsg.m_AccountId = "";
                    replyMsg.m_Result    = (int)AccountLoginResult.Error;
                    JsonMessageDispatcher.SendDcoreMessage(nodeName, replyMsg);
                }
                /// norm log
                LogSys.NormLog("serverevent", LobbyConfig.AppKeyStr, LobbyConfig.LogNormVersionStr, system, game_channel_id,
                               unique_identifier, accountId, (int)ServerEventCode.VerifyResult, client_game_version);
            }));
        }
Ejemplo n.º 2
0
        internal void DirectLogin(string accountKey, int loginServerId, string nodeName)
        {
            LogSys.Log(LOG_TYPE.INFO, "Account connected: {0}, Login type: DirectLogin", accountKey);
            //直接登录模式下默认accountId与设备标识accountKey相同
            //TO DO:不同设备的设备标识会不会有重复?会不会与Billing返回的accountId重复?
            string accountId = accountKey;

            if (m_KickedUsers.ContainsKey(accountId))
            {
                JsonMessageAccountLoginResult replyMsg = new JsonMessageAccountLoginResult();
                replyMsg.m_Account   = accountKey;
                replyMsg.m_AccountId = "";
                replyMsg.m_Result    = (int)AccountLoginResult.Error;
                JsonMessageDispatcher.SendDcoreMessage(nodeName, replyMsg);
            }
            else
            {
                DataProcessScheduler dataProcess = LobbyServer.Instance.DataProcessScheduler;
                dataProcess.DispatchAction(dataProcess.DoAccountLogin, accountKey, accountId, loginServerId, "", "", "", "", "", nodeName);
            }
        }