Example #1
0
    public virtual void makeClientLoginData(ClientLoginData data)
    {
        //游客
        if (platform == PlatformType.Visitor)
        {
            uid = getVisitorUID();
        }

        data.uid                    = uid;
        data.countryID              = countryID;
        data.platform               = platform;
        data.clientPlatformType     = SystemControl.clientPlatform;
        data.deviceType             = SystemInfo.deviceType.ToString();
        data.deviceUniqueIdentifier = SystemInfo.deviceUniqueIdentifier;
        data.visitorUID             = "";

        VersionSaveData localVersionData = ResourceInfoControl.getVersion();

        data.appVersion      = localVersionData.appVersion;
        data.resourceVersion = localVersionData.resourceVersion;

        ClientLoginCacheData loginCacheData = GameC.save.loadLoginCache();

        //游客平台,为自动绑定
        if (loginCacheData != null && loginCacheData.platform == PlatformType.Visitor && data.platform != PlatformType.Visitor)
        {
            data.visitorUID = loginCacheData.uid;
        }
    }
Example #2
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is ClientLoginExData))
        {
            return;
        }

        ClientLoginExData mData = (ClientLoginExData)data;

        if (mData.data != null)
        {
            this.data = (ClientLoginData)mData.data.clone();
        }
        else
        {
            this.data = null;
            nullObjError("data");
        }

        this.userID = mData.userID;

        this.ip = mData.ip;

        this.isAdult = mData.isAdult;

        this.areaID = mData.areaID;
    }
Example #3
0
        public void CreateSessionEvent(int conn)
        {
            // ---  Initial test! -------------------------------------
            var sessionID  = conn;
            var opCode     = (byte)RtsMessageType.OperationResponse;
            var opresponse = (byte)ResultCode.Ok;
            var ChannelID  = PeerSettings.MmoObjectEventChannel;
            var debug      = "Something goofed";

            this.LoginData = new ClientLoginData
            {
                ClientId      = 151,
                Username      = "******",
                CharacterName = "instance.id"
            };

            SendEvent(
                new EventData((byte)ClientEventCode.CharacterLoggedIn,
                              new Dictionary <byte, object>
            {
                { (byte)ParameterCode.CharacterName, this.LoginData.CharacterName },
                //{(byte) ParameterCode.ClientId, this.LoginData.CharacterName},
            }),
                new SendParameters
            {
                SessionId = sessionID
            });
        }
Example #4
0
    /// <summary>
    /// 复制(深拷贝)
    /// </summary>
    protected override void toCopy(BaseData data)
    {
        if (!(data is ClientLoginData))
        {
            return;
        }

        ClientLoginData mData = (ClientLoginData)data;

        this.uid = mData.uid;

        this.platform = mData.platform;

        this.countryID = mData.countryID;

        this.clientPlatformType = mData.clientPlatformType;

        this.deviceType = mData.deviceType;

        this.deviceUniqueIdentifier = mData.deviceUniqueIdentifier;

        this.visitorUID = mData.visitorUID;

        this.appVersion = mData.appVersion;

        this.resourceVersion = mData.resourceVersion;
    }
Example #5
0
 /// <summary>
 /// 回池
 /// </summary>
 protected override void toRelease(DataPool pool)
 {
     this.data    = null;
     this.userID  = 0L;
     this.ip      = "";
     this.isAdult = false;
     this.areaID  = 0;
 }
Example #6
0
    /** 创建登录数据 */
    public ClientLoginData createClientLoginData()
    {
        ClientLoginData data = GameC.factory.createClientLoginData();

        makeClientLoginData(data);

        return(data);
    }
    /// <summary>
    /// 创建实例
    /// </summary>
    public static ClientLoginHttpRequest create(int cMsgVersion, int gMsgVersion, ClientLoginData data)
    {
        ClientLoginHttpRequest re = new ClientLoginHttpRequest();

        re.cMsgVersion = cMsgVersion;
        re.gMsgVersion = gMsgVersion;
        re.data        = data;
        return(re);
    }
Example #8
0
    /// <summary>
    /// 读取字节流(简版)
    /// </summary>
    protected override void toReadBytesSimple(BytesReadStream stream)
    {
        this.data = (ClientLoginData)stream.readDataSimpleNotNull();

        this.userID = stream.readLong();

        this.ip = stream.readUTF();

        this.isAdult = stream.readBoolean();

        this.areaID = stream.readInt();
    }
Example #9
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        ClientLoginData mData = (ClientLoginData)data;

        if (this.uid != mData.uid)
        {
            return(false);
        }

        if (this.platform != mData.platform)
        {
            return(false);
        }

        if (this.countryID != mData.countryID)
        {
            return(false);
        }

        if (this.clientPlatformType != mData.clientPlatformType)
        {
            return(false);
        }

        if (this.deviceType != mData.deviceType)
        {
            return(false);
        }

        if (this.deviceUniqueIdentifier != mData.deviceUniqueIdentifier)
        {
            return(false);
        }

        if (this.visitorUID != mData.visitorUID)
        {
            return(false);
        }

        if (this.appVersion != mData.appVersion)
        {
            return(false);
        }

        if (this.resourceVersion != mData.resourceVersion)
        {
            return(false);
        }

        return(true);
    }
Example #10
0
    /** 通过登录数据,保存缓存数据 */
    public void saveByLogin(ClientLoginData data)
    {
        if (_loginData == null)
        {
            _loginData = new ClientLoginCacheData();
            _loginData.serverBornCode = -1;          //没有的时候
        }

        _loginData.uid      = data.uid;
        _loginData.platform = data.platform;

        //保存本次登录数据
        saveLoginCache(_loginData);
    }
    protected override void copyData()
    {
        base.copyData();
        ClientLoginData dataTemp = data;

        if (dataTemp != null)
        {
            this.data = (ClientLoginData)dataTemp.clone();
        }
        else
        {
            this.data = null;
            nullObjError("data");
        }
    }
Example #12
0
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is ClientLoginExData))
        {
            return;
        }

        ClientLoginExData mData = (ClientLoginExData)data;

        this.data    = mData.data;
        this.userID  = mData.userID;
        this.ip      = mData.ip;
        this.isAdult = mData.isAdult;
        this.areaID  = mData.areaID;
    }
Example #13
0
    /** 账号输入完毕 */
    public void inputUserOver(ClientLoginData data)
    {
        if (data.uid.isEmpty())
        {
            Ctrl.throwError("uid不能为空", data.uid);
            return;
        }

        if (data.platform.isEmpty())
        {
            Ctrl.throwError("platform不能为空", data.platform);
            return;
        }

        _loginData = data;

        GameC.save.saveByLogin(data);

        _stepTool.completeStep(InputUser);
    }
        public override void makeClientLoginData(ClientLoginData data)
        {
            if (!_g14)
            {
                _m14 = instance.Type.GetMethod("makeClientLoginData", 1);
                _g14 = true;
            }

            if (_m14 != null && !_b14)
            {
                _b14   = true;
                _p1[0] = data;
                appdomain.Invoke(_m14, instance, _p1);
                _p1[0] = null;
                _b14   = false;
            }
            else
            {
                base.makeClientLoginData(data);
            }
        }
Example #15
0
    /// <summary>
    /// 读取字节流(完整版)
    /// </summary>
    protected override void toReadBytesFull(BytesReadStream stream)
    {
        stream.startReadObj();

        BaseData dataT = stream.readDataFullNotNull();

        if (dataT != null)
        {
            if (dataT is ClientLoginData)
            {
                this.data = (ClientLoginData)dataT;
            }
            else
            {
                this.data = new ClientLoginData();
                if (!(dataT.GetType().IsAssignableFrom(typeof(ClientLoginData))))
                {
                    stream.throwTypeReadError(typeof(ClientLoginData), dataT.GetType());
                }
                this.data.shadowCopy(dataT);
            }
        }
        else
        {
            this.data = null;
        }

        this.userID = stream.readLong();

        this.ip = stream.readUTF();

        this.isAdult = stream.readBoolean();

        this.areaID = stream.readInt();

        stream.endReadObj();
    }
Example #16
0
        private void IncomingSessionHandler(NetworkMessage msg)
        {
            var peer          = msg.conn.connectionId;
            var byteArray     = msg.ReadMessage <ByteMessage>();
            var recievedBytes = byteArray.Data;
            var deserial      = _noc.DeserializeSession(recievedBytes);

            //TODO Log Message
            Debug.Log(LZ4MessagePackSerializer.ToJson(deserial));


//            SendOperationResponse(new OperationRequest((byte) ServerOperationCode.AckClientUserLogin,
//                    new AckClientUserLogin
//                    {
//                        SessionId = peer,
//                        Username = userData.Username
//                    }),
//                new SendParameters());

            //---------------------- Session Response --------------------
            var sessionID  = peer;
            var opCode     = (byte)RtsMessageType.OperationResponse;
            var opresponse = (byte)ResultCode.Ok;
            var ChannelID  = PeerSettings.MmoObjectEventChannel;
            var debug      = "Something goofed";

            this.LoginData = new ClientLoginData
            {
                ClientId      = 151,
                Username      = "******",
                CharacterName = "instance.id"
            };

            SendEvent(
                new EventData((byte)ClientEventCode.CharacterLoggedIn,
                              new Dictionary <byte, object>
            {
                { (byte)ParameterCode.CharacterName, this.LoginData.CharacterName }
            }),
                new SendParameters
            {
                SessionId = sessionID
            });

            //---------------------- Add Session ---- --------------------
            var param      = deserial.parameters;
            var charName   = param[22];
            var condition  = param[59];
            var Parameters = new Dictionary <byte, object>
            {
                { (byte)ParameterCode.SessionId, peer },
                { (byte)ParameterCode.CharacterName, charName },
                { (byte)ParameterCode.Condition, condition },
                //{(byte)0, masterPeer.ClientId},
            };

//            _worldServerPeer.OnServerEvent(
//                new EventData(deserial.sessActionTemp, Parameters),
//                new SendParameters
//                {
//                    SessionId = peer,
//                    //ClientId = masterPeer.ClientId
//                });

            Debug.Log("Sent");
        }
Example #17
0
 /// <summary>
 /// 初始化初值
 /// </summary>
 public override void initDefault()
 {
     this.data = new ClientLoginData();
     this.data.initDefault();
 }