//三方登陆响应
    public void onThirdPartyLoginResult(object data)
    {
        AccountEvent.ThirdPartyLoginResult ret = (AccountEvent.ThirdPartyLoginResult)data;

        //设置nowaccount的 third
        Account.thirdOpenID = ret.openId;
        Account.thirdToken  = ret.token;

        //登陆
        msgLogin msg = new msgLogin();

        msg.userID      = 0;
        msg.area        = 1; //用户所选服务器
        msg.appVersion  = CommonUtil.Util.getAppVer();
        msg.channelID   = CommonUtil.Util.getChanelId();
        msg.deviceID    = SystemInfo.deviceUniqueIdentifier;
        msg.ipAddr      = 1111;
        msg.loginType   = (msgLogin.eLoginType)_loginType;
        msg.netWorkType = 1;
        msg.osVersion   = 10000;
        msg.password    = "******";

        //
        msg.openID     = ret.openId;
        msg.token      = ret.token;
        msg.nickName   = ret.name;
        msg.head       = ret.head;
        msg.sex        = ret.sex;
        msg.expireTime = ret.expireTime;
        //.. etc.
        ProtocolManager.getInstance().sendMsg(LobbyProtocol.P_LOBBY_REQ_LOGIN, msg, OnLoginSuccess);

        //显示加载,禁止点击
        ViewManagerEvent.EM().InvokeEvent(ViewManagerEvent.EVENT.SHOW_LOADING_ANI, true);
    }
示例#2
0
    /////////////////////////////////////LOBBY/////////////////////////////////////

    /// <summary>
    /// 请求登陆
    /// </summary>
    /// <param name="pID">P I.</param>
    /// <param name="msg">Message.</param>
    /// <param name="action">Action.</param>
    public void sendMsg(LobbyProtocol pID, msgLogin msg, Action <Message> action)
    {
        //填写相应字段
        JsonObject jsonMsg = new JsonObject();

        jsonMsg.Add("userID", msg.userID);
        jsonMsg.Add("area", msg.area);
        jsonMsg.Add("loginType", (int)msg.loginType);
        jsonMsg.Add("openID", msg.openID);
        jsonMsg.Add("password", msg.password);
        jsonMsg.Add("deviceID", msg.deviceID);
        jsonMsg.Add("nickName", msg.nickName);
        jsonMsg.Add("osVersion", msg.osVersion);
        jsonMsg.Add("ipAddr", msg.ipAddr);
        jsonMsg.Add("channelID", msg.channelID);
        jsonMsg.Add("appVersion", msg.appVersion);
        jsonMsg.Add("netWorkType", msg.netWorkType);

        jsonMsg.Add("token", msg.token);
        jsonMsg.Add("head", msg.head);
        jsonMsg.Add("sex", msg.sex);
        jsonMsg.Add("expireTime", msg.expireTime);

        sendMsg(pID, jsonMsg, action);
    }
    private void loginServer(int userId, string openId, string pwd, NowAccount.eLoginType loginType, int area)
    {
        msgLogin msg = new msgLogin();

        msg.userID     = userId;
        msg.area       = area;  //用户所选服务器
        msg.appVersion = CommonUtil.Util.getAppVer();
        msg.channelID  = CommonUtil.Util.getChanelId();

        msg.deviceID    = SystemInfo.deviceUniqueIdentifier;
        msg.ipAddr      = 1111;
        msg.loginType   = (msgLogin.eLoginType)loginType;
        msg.netWorkType = 1;
        msg.osVersion   = 10000;
        msg.password    = pwd;

        //
        msg.openID = openId;
        //.. etc.
        ProtocolManager.getInstance().sendMsg(LobbyProtocol.P_LOBBY_REQ_LOGIN, msg, OnLoginSuccess);

        //显示加载,禁止点击
        ViewManagerEvent.EM().InvokeEvent(ViewManagerEvent.EVENT.SHOW_LOADING_ANI, true);
    }