Beispiel #1
0
        public void Logon(AccountInfo rd)
        {
            NormalAccountInfo ad = new NormalAccountInfo();

            ad.UID = rd.UID;
            CL_Cmd_AccountLogon ncb = new CL_Cmd_AccountLogon();

            ncb.SetCmdType(NetCmdType.CMD_CL_AccountLogon);
            ncb.AccountName = rd.UID;
            if (NativeInterface.ComputeCrc(ad.UID, rd.PWD, out ad.CRC1, out ad.CRC2, out ad.CRC3))
            {
                ncb.PasswordCrc1 = ad.CRC1;
                ncb.PasswordCrc2 = ad.CRC2;
                ncb.PasswordCrc3 = ad.CRC3;
            }
            accountInfo     = rd;
            ncb.VersionID   = ServerSetting.ClientVer;
            ncb.PlateFormID = (Byte)UIDevice.GetPlatformString();
            ncb.PathCrc     = ServerSetting.RES_VERSION;
            ncb.MacAddress  = UIDevice.GetMacAddress();
            Debug.Log("发送登录......");
            //发送命令
            NetManager.Instance.Send <CL_Cmd_AccountLogon>(ncb);
            return;
        }
Beispiel #2
0
        public void RegisterLogon(AccountInfo rd)
        {
            if (m_State != LogonState.LOGON_INIT)
            {
                return;
            }
            NormalAccountInfo ad = new NormalAccountInfo();

            ad.UID = rd.UID;
            CL_Cmd_AccountRsg ncb = new CL_Cmd_AccountRsg();

            ncb.SetCmdType(NetCmdType.CMD_CL_AccountRsg);
            ncb.AccountName = rd.UID;
            if (!NativeInterface.ComputeCrc(ad.UID, rd.PWD, out ad.CRC1, out ad.CRC2, out ad.CRC3))
            {
                ncb.PasswordCrc1 = ad.CRC1;
                ncb.PasswordCrc2 = ad.CRC2;
                ncb.PasswordCrc3 = ad.CRC3;
            }
            ncb.MacAddress  = UIDevice.GetMacAddress();
            ncb.VersionID   = ServerSetting.ClientVer;
            ncb.PlateFormID = (Byte)UIDevice.GetPlatformString();
            ncb.PathCrc     = ServerSetting.RES_VERSION;

            //发送命令
            NetManager.Instance.Send <CL_Cmd_AccountRsg>(ncb);
        }
 public void SavePhonePassWord(string strpass)
 {
     if (GlobalLogon.Instance.AccountData != null && GlobalLogon.Instance.AccountData.bIsSavePhonePassword)
     {
         NativeInterface.ComputeCrc("", strpass, out GlobalLogon.Instance.AccountData.PhoneInfo.phoneCRC1, out GlobalLogon.Instance.AccountData.PhoneInfo.phoneCRC2, out GlobalLogon.Instance.AccountData.PhoneInfo.phoneCRC3);
         // SaveAccountData(GlobalLogon.Instance.AccountData);
         GlobalLogon.Instance.AccountData.SaveAccountData();
     }
 }
Beispiel #4
0
    public bool ResetAccountPassword(string OldPassword, string NewPassword)
    {
        if (GlobalLogon.Instance.AccountData == null)
        {
            return(false);
        }
        //进行验证
        if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, OldPassword, StringCheckType.SCT_Password))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ChangePassword_Failed_1);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, NewPassword, StringCheckType.SCT_Password))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ChangePassword_Failed_2);
            MsgEventHandle.HandleMsg(pUOM);
        }
        if (NewPassword.CompareTo(OldPassword) == 0)
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ChangePassword_Failed_3);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        string AccountName = GlobalLogon.Instance.AccountData.AccountInfo.UID;
        //发送命令到服务器去
        UInt32 OldCrc1, OldCrc2, OldCrc3;

        if (!NativeInterface.ComputeCrc(AccountName, OldPassword, out OldCrc1, out OldCrc2, out OldCrc3))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ChangePassword_Failed_4);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        UInt32 NewCrc1, NewCrc2, NewCrc3;

        if (!NativeInterface.ComputeCrc(AccountName, NewPassword, out NewCrc1, out NewCrc2, out NewCrc3))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ChangePassword_Failed_5);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        CL_Cmd_ResetPassword ncb = new CL_Cmd_ResetPassword();

        ncb.SetCmdType(NetCmdType.CMD_CL_ResetPassword);
        ncb.OldPasswordCrc1 = OldCrc1;
        ncb.OldPasswordCrc2 = OldCrc2;
        ncb.OldPasswordCrc3 = OldCrc3;
        ncb.NewPasswordCrc1 = NewCrc1;
        ncb.NewPasswordCrc2 = NewCrc2;
        ncb.NewPasswordCrc3 = NewCrc3;
        NetServices.Instance.Send <CL_Cmd_ResetPassword>(ncb);
        return(true);
    }
Beispiel #5
0
    public bool ResetAccountInfo(string AccountInfo, string Password)//无须旧密码 因为游客根本不找到旧密码
    {
        //必须为游客才可以重置账号
        if (!PlayerRole.Instance.RoleInfo.RoleMe.GetIsCanResetAccount())
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ResetAccount_Failed_1);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.AccountNameMinLength, FishDataInfo.AccountNameLength, AccountInfo, StringCheckType.SCT_AccountName))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ResetAccount_Failed_2);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, Password, StringCheckType.SCT_Password))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ResetAccount_Failed_3);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        UInt32 NewCrc1, NewCrc2, NewCrc3;

        if (!NativeInterface.ComputeCrc(AccountInfo, Password, out NewCrc1, out NewCrc2, out NewCrc3))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Role_ResetAccount_Failed_4);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        //发送命令到服务器端去 需要判断账号是否存在
        CL_Cmd_AccountResetAccount ncb = new CL_Cmd_AccountResetAccount();

        ncb.SetCmdType(NetCmdType.CMD_CL_AccountResetAccount);
        ncb.NewAccountName = AccountInfo;
        ncb.PasswordCrc1   = NewCrc1;
        ncb.PasswordCrc2   = NewCrc2;
        ncb.PasswordCrc3   = NewCrc3;
        NetServices.Instance.Send <CL_Cmd_AccountResetAccount>(ncb);

        GlobalLogon.Instance.AccountData.TempAccountInfo.Clear();
        GlobalLogon.Instance.AccountData.TempPhoneInfo.Clear();
        GlobalLogon.Instance.AccountData.TempAccountInfo.UID  = AccountInfo;
        GlobalLogon.Instance.AccountData.TempAccountInfo.CRC1 = NewCrc1;
        GlobalLogon.Instance.AccountData.TempAccountInfo.CRC2 = NewCrc2;
        GlobalLogon.Instance.AccountData.TempAccountInfo.CRC3 = NewCrc3;

        return(true);
    }
Beispiel #6
0
    public bool OnBindPhone(UInt32 BindValue, string SecPassword)
    {
        //if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.MIN_PHONE_LENGTH, FishDataInfo.MAX_PHONE_LENGTH, PhoneName, StringCheckType.SCT_Normal))
        //{
        //    tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Operate_GetPhoneVerificationNum_Failed_1);
        //    MsgEventHandle.HandleMsg(pUOM);
        //    return false;
        //}
        //if (PhoneName <= 1000000000)
        //{
        //    tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_Operate_GetPhoneVerificationNum_Failed_1);
        //    MsgEventHandle.HandleMsg(pUOM);
        //    return false;
        //}

        //绑定二级密码
        if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, SecPassword, StringCheckType.SCT_Password))
        {
            return(false);
        }
        PhoneAccountInfo ad = new PhoneAccountInfo();

        if (!NativeInterface.ComputeCrc("", SecPassword, out ad.phoneCRC1, out ad.phoneCRC2, out ad.phoneCRC3))
        {
            return(false);
        }

        CL_Cmd_BindPhone ncb = new CL_Cmd_BindPhone();

        ncb.SetCmdType(NetCmdType.CMD_CL_BindPhone);
        //ncb.PhoneNumber = PhoneName;
        ncb.BindNumber = BindValue;

        ncb.SecPasswordCrc1 = ad.phoneCRC1;
        ncb.SecPasswordCrc2 = ad.phoneCRC2;
        ncb.SecPasswordCrc3 = ad.phoneCRC3;

        GlobalLogon.Instance.AccountData.TempPhoneInfo.phoneCRC1 = ad.phoneCRC1;
        GlobalLogon.Instance.AccountData.TempPhoneInfo.phoneCRC2 = ad.phoneCRC2;
        GlobalLogon.Instance.AccountData.TempPhoneInfo.phoneCRC3 = ad.phoneCRC3;

        NetServices.Instance.Send <CL_Cmd_BindPhone>(ncb);
        return(true);
    }
Beispiel #7
0
    public bool ChangeSecPassword(string OldPassword, string NewPassword)
    {
        //修改二级密码
        CL_Cmd_ChangeSecondPassword ncb = new CL_Cmd_ChangeSecondPassword();

        ncb.SetCmdType(NetCmdType.CMD_CL_ChangeSecondPassword);

        if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, OldPassword, StringCheckType.SCT_Password))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_1);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        if (!FishConfig.Instance.m_ErrorString.CheckStringIsError(FishDataInfo.PasswordMinLength, FishDataInfo.PasswordLength, NewPassword, StringCheckType.SCT_Password))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_2);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }
        if (NewPassword.CompareTo(OldPassword) == 0)
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_3);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }

        NormalAccountInfo ad1 = new NormalAccountInfo();

        if (!NativeInterface.ComputeCrc("", OldPassword, out ad1.CRC1, out ad1.CRC2, out ad1.CRC3))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_4);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }

        NormalAccountInfo ad2 = new NormalAccountInfo();

        if (!NativeInterface.ComputeCrc("", NewPassword, out ad2.CRC1, out ad2.CRC2, out ad2.CRC3))
        {
            tagUserOperationEvent pUOM = new tagUserOperationEvent(UserOperateMessage.UOM_ChangeSecPass_Faile_5);
            MsgEventHandle.HandleMsg(pUOM);
            return(false);
        }

        GlobalLogon.Instance.AccountData.SaveAccountData();

        ncb.dwOldCrc1 = ad1.CRC1;
        ncb.dwOldCrc2 = ad1.CRC2;
        ncb.dwOldCrc3 = ad1.CRC3;

        ncb.dwNewCrc1 = ad2.CRC1;
        ncb.dwNewCrc2 = ad2.CRC2;
        ncb.dwNewCrc3 = ad2.CRC3;

        GlobalLogon.Instance.AccountData.TempPhoneInfo.Clear();
        GlobalLogon.Instance.AccountData.TempAccountInfo.Clear();
        GlobalLogon.Instance.AccountData.TempAccountInfo.UID  = GlobalLogon.Instance.AccountData.AccountInfo.UID;
        GlobalLogon.Instance.AccountData.TempAccountInfo.CRC1 = ad2.CRC1;
        GlobalLogon.Instance.AccountData.TempAccountInfo.CRC2 = ad2.CRC2;
        GlobalLogon.Instance.AccountData.TempAccountInfo.CRC3 = ad2.CRC3;

        NetServices.Instance.Send <CL_Cmd_ChangeSecondPassword>(ncb);

        return(true);
    }