Exemple #1
0
        public static void OnLogin2(Session session, FunMessage message)
        {
            LobbyLoginRequest request = new LobbyLoginRequest();

            if (!message.TryGetExtension_lobby_login_req(
                    out request))
            {
                Log.Error("OnLogin2: Wrong message.");
                return;
            }

            string account_id = request.id;
            string type       = request.type;

            if (account_id == null || type == null)
            {
                Log.Warning("Wrong login request: sid={0}", session.Id);
                session.Close();
                return;
            }

            if (type == "fb")
            {
                // Facebook 인증을 먼저 합니다.
                string access_token = request.access_token;
                if (access_token == null)
                {
                    Log.Warning("Wrong login request. No access token: sid={0}, account_id={1}", session.Id, account_id);
                    session.Close();
                    return;
                }

                FacebookAuthentication.AuthenticationRequest fb_request =
                    new FacebookAuthentication.AuthenticationRequest(access_token);
                FacebookAuthentication.Authenticate(fb_request, (_1, _2, _3) => {
                    OnFacebookAuthenticated(_1, _2, _3, session, account_id, Session.EncodingScheme.kProtobufEncoding);
                });
            }
            else
            {
                // Guest 는 별도의 인증 없이 로그인 합니다.
                AccountManager.CheckAndSetLoggedInAsync(account_id, session, (_1, _2, _3) => { OnLogin_Completed(_1, _2, _3, Session.EncodingScheme.kProtobufEncoding); });
            }
        }
Exemple #2
0
 public static void AppendExtension_lobby_login_req(this FunMessage message, LobbyLoginRequest value)
 {
     ProtoBuf.Extensible.AppendValue(message, (int)ExtendedMessageFieldNumber.FunMessage_lobby_login_req, value);
 }
Exemple #3
0
 public static bool TryGetExtension_lobby_login_req(this FunMessage message, out LobbyLoginRequest value)
 {
     return(ProtoBuf.Extensible.TryGetValue(message, (int)ExtendedMessageFieldNumber.FunMessage_lobby_login_req, out value));
 }