Ejemplo n.º 1
0
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <param name="request">注册用户的请求</param>
        /// <returns></returns>
        public override async Task <RpcResult <RegisterRsp> > RegisterAsync(RegisterReq request)
        {
            var res = new RpcResult <RegisterRsp>();
            var rsp = new RegisterRsp();

            bool isvalid = ValidateRegisterInfo(request, out string errorMsg);

            if (!isvalid)
            {
                res.Code = ErrorCodes.PARAMS_VALIDATION_FAIL;
                res.Data.ReturnMessage = errorMsg;
                return(res);
            }

            var user = new UserInfo();

            user.Account    = request.Account;
            user.FullName   = request.FullName;
            user.Password   = CryptographyManager.Md5Encrypt(user.Account + request.Password);
            user.IsAdmin    = false;
            user.UpdateTime = DateTime.Now;
            user.CreateTime = DateTime.Now;
            var userId = await this._userRepo.InsertAsync(user);

            rsp.UserId = (int)userId;

            return(res);
        }
Ejemplo n.º 2
0
 public void SetRegisterAccount(Notify notify)
 {
     if (notify.Feedback == FeedBack.Success)
     {
         RegisterRsp rsp = RegisterRsp.Parser.ParseFrom(notify.message);
         GameFacade.SendNotification(notify.Protocol, CmdType.Presenter);
     }
     else
     {
         GameFacade.SendNotification(notify.Protocol, CmdType.Error, notify.Feedback);
     }
 }
Ejemplo n.º 3
0
        public void OnRegisterRsp(uint iMessageType, object kParam)
        {
            RegisterRsp rsp = kParam as RegisterRsp;

            Log4U.LogInfo(rsp.resultCode);
            if (rsp.resultCode == RegisterRsp.ResultCode.SUCCESS)
            {
                GlobalUser.GetInstance().TryLogin(_userID, _userPassword);
            }
            else
            {
                DialogManager.GetInstance().CreateSingleButtonDialog(rsp.resultCode.ToString());
                OnValueChangeRegisterInfo();
            }
        }
Ejemplo n.º 4
0
 public void RegisterRsp(RegisterRsp rsp)
 {
     if (rsp.OK)
     {
     }
 }
Ejemplo n.º 5
0
 public void RegisterRsp(RegisterRsp rsp)
 {
     TestManager.Instance.RegisterRsp(rsp);
 }
Ejemplo n.º 6
0
    public void Recv(List <MessagePackObject> recvObject)
    {
        if (recvObject.Count < 1)
        {
            Debug.Log("Why the recv object lenght less than 1?");
            return;
        }
        int proto = recvObject[0].AsInt32();

        switch (proto)
        {
        case PROTO_ID.REGISTERRSP:
            RegisterRsp oRegisterRsp = new RegisterRsp();
            oRegisterRsp.OK = recvObject[1].AsBoolean();
            NetCallBack.Instance.RegisterRsp(oRegisterRsp);
            break;

        case PROTO_ID.LOGINRSP:
            LoginRsp oLoginRsp = new LoginRsp();
            oLoginRsp.Userid = recvObject[2].AsInt32();
            oLoginRsp.OK     = recvObject[1].AsBoolean();
            NetCallBack.Instance.LoginRsp(oLoginRsp);
            break;

        case PROTO_ID.FRIENDRSP:
            FriendRsp         oFriendRsp             = new FriendRsp();
            List <FriendInfo> lsoFriendRspFriendInfo = new List <FriendInfo>();
            foreach (MessagePackObject mix1 in recvObject[3].AsList())
            {
                IList <MessagePackObject> lsMix1 = mix1.AsList();
                FriendInfo oFriendRspFriendInfo  = new FriendInfo();
                oFriendRspFriendInfo.Userid = lsMix1[0].AsInt32();
                oFriendRspFriendInfo.Name   = lsMix1[1].AsString();
                lsoFriendRspFriendInfo.Add(oFriendRspFriendInfo);
            }
            oFriendRsp.FriendList = lsoFriendRspFriendInfo;
            oFriendRsp.Ok         = recvObject[1].AsBoolean();
            List <int> lsoFriendRspint = new List <int>();
            foreach (MessagePackObject mix1 in recvObject[2].AsList())
            {
                lsoFriendRspint.Add(mix1.AsInt32());
            }
            oFriendRsp.IdList = lsoFriendRspint;
            NetCallBack.Instance.FriendRsp(oFriendRsp);
            break;

        case PROTO_ID.RUOKRSP:
            RUOKRsp oRUOKRsp = new RUOKRsp();
            oRUOKRsp.OK = recvObject[1].AsBoolean();
            NetCallBack.Instance.RUOKRsp(oRUOKRsp);
            break;

        case PROTO_ID.USERINTOMAPRSP:
            UserIntoMapRsp oUserIntoMapRsp = new UserIntoMapRsp();
            oUserIntoMapRsp.Y = recvObject[3].AsInt32();
            oUserIntoMapRsp.X = recvObject[2].AsInt32();
            List <EntityInfo> lsoUserIntoMapRspEntityInfo = new List <EntityInfo>();
            foreach (MessagePackObject mix1 in recvObject[4].AsList())
            {
                IList <MessagePackObject> lsMix1     = mix1.AsList();
                EntityInfo oUserIntoMapRspEntityInfo = new EntityInfo();
                oUserIntoMapRspEntityInfo.Y          = lsMix1[3].AsInt32();
                oUserIntoMapRspEntityInfo.X          = lsMix1[2].AsInt32();
                oUserIntoMapRspEntityInfo.Entityid   = lsMix1[0].AsInt32();
                oUserIntoMapRspEntityInfo.EntityType = lsMix1[1].AsInt32();
                lsoUserIntoMapRspEntityInfo.Add(oUserIntoMapRspEntityInfo);
            }
            oUserIntoMapRsp.EntityList = lsoUserIntoMapRspEntityInfo;
            oUserIntoMapRsp.Mapid      = recvObject[1].AsInt32();
            NetCallBack.Instance.UserIntoMapRsp(oUserIntoMapRsp);
            break;

        case PROTO_ID.ENTITYINTOMAPRSP:
            EntityIntoMapRsp oEntityIntoMapRsp           = new EntityIntoMapRsp();
            EntityInfo       oEntityIntoMapRspEntityInfo = new EntityInfo();
            foreach (MessagePackObject mix1 in recvObject[1].AsList())
            {
                IList <MessagePackObject> lsMix1 = mix1.AsList();
                oEntityIntoMapRspEntityInfo.Y          = lsMix1[3].AsInt32();
                oEntityIntoMapRspEntityInfo.X          = lsMix1[2].AsInt32();
                oEntityIntoMapRspEntityInfo.Entityid   = lsMix1[0].AsInt32();
                oEntityIntoMapRspEntityInfo.EntityType = lsMix1[1].AsInt32();
            }
            oEntityIntoMapRsp.Entity = oEntityIntoMapRspEntityInfo;
            NetCallBack.Instance.EntityIntoMapRsp(oEntityIntoMapRsp);
            break;

        case PROTO_ID.ENTITYOUTMAPRSP:
            EntityOutMapRsp oEntityOutMapRsp = new EntityOutMapRsp();
            oEntityOutMapRsp.Entityid = recvObject[1].AsInt32();
            NetCallBack.Instance.EntityOutMapRsp(oEntityOutMapRsp);
            break;

        case PROTO_ID.ENTITYPOSRSP:
            EntityPosRsp      oEntityPosRsp             = new EntityPosRsp();
            List <EntityInfo> lsoEntityPosRspEntityInfo = new List <EntityInfo>();
            foreach (MessagePackObject mix1 in recvObject[1].AsList())
            {
                IList <MessagePackObject> lsMix1   = mix1.AsList();
                EntityInfo oEntityPosRspEntityInfo = new EntityInfo();
                oEntityPosRspEntityInfo.Y          = lsMix1[3].AsInt32();
                oEntityPosRspEntityInfo.X          = lsMix1[2].AsInt32();
                oEntityPosRspEntityInfo.Entityid   = lsMix1[0].AsInt32();
                oEntityPosRspEntityInfo.EntityType = lsMix1[1].AsInt32();
                lsoEntityPosRspEntityInfo.Add(oEntityPosRspEntityInfo);
            }
            oEntityPosRsp.EntityList = lsoEntityPosRspEntityInfo;
            NetCallBack.Instance.EntityPosRsp(oEntityPosRsp);
            break;

        case PROTO_ID.ENTITYHPRSP:
            EntityHpRsp oEntityHpRsp = new EntityHpRsp();
            oEntityHpRsp.Entityid = recvObject[1].AsInt32();
            oEntityHpRsp.Hp       = recvObject[2].AsInt32();
            NetCallBack.Instance.EntityHpRsp(oEntityHpRsp);
            break;

        case PROTO_ID.BOMBINRSP:
            BombInRsp oBombInRsp = new BombInRsp();
            oBombInRsp.Y      = recvObject[3].AsInt32();
            oBombInRsp.Bombid = recvObject[1].AsInt32();
            oBombInRsp.X      = recvObject[2].AsInt32();
            NetCallBack.Instance.BombInRsp(oBombInRsp);
            break;

        case PROTO_ID.BOMBBLASTRSP:
            BombBlastRsp oBombBlastRsp = new BombBlastRsp();
            oBombBlastRsp.Bombid = recvObject[1].AsInt32();
            NetCallBack.Instance.BombBlastRsp(oBombBlastRsp);
            break;

        default:
            Debug.Log("Unknow proto id: " + proto);
            break;
        }
    }