Example #1
0
    private DeviceInfoPro deviceInfo; // 设备信息

    public PSCreateAccount(string asHostName, int asHostPort, string accountName, string accountPassword, int channelId, DeviceInfoPro deviceInfo)
    {
        this.asHostName      = asHostName;
        this.asHostPort      = asHostPort;
        this.accountName     = accountName;
        this.accountPassword = accountPassword;
        this.channelId       = channelId;
        this.deviceInfo      = deviceInfo;
    }
Example #2
0
 /// <summary>
 /// 本地登陆协议
 /// </summary>
 public PSLoginAS(string asHost, int asPort, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo)
 {
     this.asHost      = asHost;
     this.asPort      = asPort;
     this.accountName = accountName;
     this.password    = password;
     this.randomSeed  = randomSeed;
     this.channelId   = channelId;
     this.version     = version;
     this.deviceInfo  = deviceInfo;
 }
Example #3
0
 /// <summary>
 /// 平台登陆协议
 /// </summary>
 public PSLoginAS(string asHost, int asPort, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo, string userId, string channelUserId, string channelCode, string productCode, string token)
 {
     this.asHost        = asHost;
     this.asPort        = asPort;
     this.accountName   = accountName;
     this.password      = password;
     this.randomSeed    = randomSeed;
     this.channelId     = channelId;
     this.version       = version;
     this.deviceInfo    = deviceInfo;
     this.userId        = userId;
     this.channelUserId = channelUserId;
     this.channelCode   = channelCode;
     this.productCode   = productCode;
     this.token         = token;
 }
Example #4
0
    public void LoginGame(string accountName = "aa", string password = "******")
    {
        DeviceInfoPro device = new DeviceInfoPro();

        device.deviceName = "test";
        device.deviceType = 1;
        device.UDID       = "test";

        System.Random random     = new System.Random();
        int           randomSeed = random.Next(Int32.MinValue, Int32.MaxValue);

        NetworkManagerProxy.Instance.Client.LoginAS("192.168.99.123",
                                                    889,
                                                    accountName, password, "" + randomSeed,
                                                    1,
                                                    "1", device);
    }
Example #5
0
        public bool LoginAS(string asHost, int asPort, int callback, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo, string userId, string channelUserId, string channelCode, string productCode, string token)
        {
            bool result;

            try
            {
                result = ConnectAS(asHost, asPort, new CALoginAuthMessage
                {
                    CallBackId = callback,
                    Protocol   =
                    {
                        platformLoginReq  = new LoginReq.PlatformLoginReq()
                        {
                            email         = accountName,
                            password      = password,
                            channelID     = channelId,
                            randomSeed    = randomSeed,
                            version       = version,
                            deviceInfo    = deviceInfo,
                            userId        = userId,
                            channelUserId = channelUserId,
                            channelCode   = channelCode,
                            productCode   = productCode,
                            token         = token
                        }
                    }
                });
            }
            catch (Exception ex)
            {
                LoggerManager.Instance.Error(ex.ToString());
                result = false;
            }

            return(result);
        }
Example #6
0
        public bool BindAccountAS(string asHost, int asPort, int callback, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo)
        {
            bool result;

            try
            {
                result = ConnectAS(asHost, asPort, new CABindAccountMessage
                {
                    CallBackId = callback,
                    Protocol   =
                    {
                        email      = accountName,
                        password   = password,
                        channelID  = channelId,
                        randomSeed = randomSeed,
                        version    = version,
                        deviceInfo = deviceInfo
                    }
                });
            }
            catch (Exception ex)
            {
                LoggerManager.Instance.Error(ex.ToString());
                result = false;
            }

            return(result);
        }
Example #7
0
 public bool LoginAS(string asHost, int asPort, int callback, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo, string userId, string channelUserId, string channelCode, string productCode, string token)
 {
     PrintBusinessLog("[ServerBusiness] LoginAS {0}:{1}", asHost, asPort);
     return(protocol.LoginAS(asHost, asPort, callback, accountName, password, randomSeed, channelId, version, deviceInfo, userId, channelUserId, channelCode, productCode, token));
 }
Example #8
0
 // 认证服务器上绑定账号
 public bool BindAccountAS(string authServerHostName, int port, string email, string password, int callback, string version, int chanelId, DeviceInfoPro deviceInfo)
 {
     PrintBusinessLog("[Serverbusiness] BindAccountAS");
     return(protocol.BindAccountAS(authServerHostName, port, callback, email, password, UnityEngine.Random.Range(1, 1000000).ToString(), chanelId, version, deviceInfo));
 }
Example #9
0
 // 认证服务器上创建账号
 public bool CreateAccountAS(string asHost, int asPort, int callback, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo)
 {
     PrintBusinessLog("[ServerBusiness] CreateAccountAS");
     return(protocol.CreateAccountAS(asHost, asPort, callback, accountName, password, randomSeed, channelId, version, deviceInfo));
 }
        public bool BindAccountAS(string asHost, int asPort, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo)
        {
            connection = NetworkManager.GetInstance().CreateConnection(this.type);
            connection.SetNetworkInitializer(networkInitializer);
            try
            {
                connection.ConnectAsync(new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0), new IPEndPoint(NetUtil.GetIPV4Address(asHost), asPort));

                CA_BindAccountMessage message = new CA_BindAccountMessage();
                message.Protocol.email      = accountName;
                message.Protocol.password   = password;
                message.Protocol.channelID  = channelId;
                message.Protocol.randomSeed = randomSeed;
                message.Protocol.version    = version;
                message.Protocol.deviceInfo = deviceInfo;

                waitSendAuthMsg = message;
                return(true);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                Console.Write(ex.ToString());
                return(false);
            }
        }
        public bool LoginAS(string asHost, int asPort, string accountName, string password, string randomSeed, int channelId, string version, DeviceInfoPro deviceInfo)
        {
            connection = NetworkManager.GetInstance().CreateConnection(this.type);
            connection.SetNetworkInitializer(networkInitializer);
            try
            {
                connection.ConnectAsync(new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0), new IPEndPoint(NetUtil.GetIPV4Address(asHost), asPort));

                CA_LoginAuthMessage loginMsg = new CA_LoginAuthMessage();
                loginMsg.Protocol.email      = accountName;
                loginMsg.Protocol.password   = password;
                loginMsg.Protocol.channelID  = channelId;
                loginMsg.Protocol.randomSeed = randomSeed;
                loginMsg.Protocol.version    = version;
                loginMsg.Protocol.deviceInfo = deviceInfo;

                waitSendAuthMsg = loginMsg;
                //connection.Send(waitSendAuthMsg);
                return(true);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString());
                Console.Write(ex.ToString());
                return(false);
            }


            //If using ConnectAsync, need set the connection handler
            //ASLoginConnectionHandler connectionHandler = new ASLoginConnectionHandler(req);
            //connectionHandler.ClientHelper = this;
            //messageInitializer.SetConnectionActiveHandler(connectionHandler);
        }