Exemplo n.º 1
0
        private void DelegateOnLoginCallback(Object obj)
        {
            ResponseMsg msg = obj as ResponseMsg;

            if (msg.ErrorCode == RpcErrorCodeEnum.Ok)
            {
                LoginResponse resp     = LoginResponse.ParseFrom(msg.ProtoData);
                UserInfo      userInfo = resp.UserInfo;
                AppValues.UserInfoBuilder = userInfo.ToBuilder();
                this.Hide();
            }
            else
            {
                string tips = string.Format("登录失败,errorCode = {0}", msg.ErrorCode);
                MessageBox.Show(this, tips, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemplo n.º 2
0
    private void Response(int error, List <byte[]> btData)
    {
        var response   = LoginResponse.ParseFrom(btData[0]);
        var playerInfo = response.PlayerInfo;
        var userName   = playerInfo.UserName;
        var userId     = playerInfo.UserId;
        var rank       = playerInfo.Rank;
        var winning    = playerInfo.Winning;
        var losing     = playerInfo.Losing;
        var winCount   = playerInfo.WinCount;
        var loseCount  = playerInfo.LoseCount;
        var draw       = playerInfo.Draw;
        var index      = playerInfo.UserRank;

        m_userProxy.SetPlayerInfo(userName, userId, rank, winning, losing, winCount, loseCount, draw, index);
        App.NetworkManager.UserId = userId;
        Debug.Log("Login Success ! UserName: "******" UserId: " + userId);

        SendNotification(NotificationConstant.LoginResponse);
    }