Ejemplo n.º 1
0
        private void _ReturnDataValue(long returnId, IValue returnValue)
        {
            object             value   = returnValue.GetObject();
            PackageReturnValue package = new PackageReturnValue();

            package.ReturnTarget = returnId;
            package.ReturnValue  = _Serializer.Serialize(value);
            _Queue.Push(ServerToClientOpCode.ReturnValue, package.ToBuffer(_Serializer));
        }
Ejemplo n.º 2
0
        protected void _OnResponse(ServerToClientOpCode id, byte[] args)
        {
            if (id == ServerToClientOpCode.Ping)
            {
                Ping = _PingTimeCounter.Ticks;
                _StartPing();
            }
            else if (id == ServerToClientOpCode.SetProperty)
            {
                PackageSetProperty data = args.ToPackageData <PackageSetProperty>(_Serializer);
                _UpdateSetProperty(data.EntityId, data.Property, data.Value);
            }

            else if (id == ServerToClientOpCode.InvokeEvent)
            {
                PackageInvokeEvent data = args.ToPackageData <PackageInvokeEvent>(_Serializer);
                _InvokeEvent(data.EntityId, data.Event, data.HandlerId, data.EventParams);
            }
            else if (id == ServerToClientOpCode.ErrorMethod)
            {
                PackageErrorMethod data = args.ToPackageData <PackageErrorMethod>(_Serializer);

                _ErrorReturnValue(data.ReturnTarget, data.Method, data.Message);
            }
            else if (id == ServerToClientOpCode.ReturnValue)
            {
                PackageReturnValue data = args.ToPackageData <PackageReturnValue>(_Serializer);
                _SetReturnValue(data.ReturnTarget, data.ReturnValue);
            }
            else if (id == ServerToClientOpCode.LoadSoulCompile)
            {
                PackageLoadSoulCompile data = args.ToPackageData <PackageLoadSoulCompile>(_Serializer);

                _LoadSoulCompile(data.TypeId, data.EntityId, data.ReturnId, data.PassageId);
            }
            else if (id == ServerToClientOpCode.LoadSoul)
            {
                PackageLoadSoul data = args.ToPackageData <PackageLoadSoul>(_Serializer);

                _LoadSoul(data.TypeId, data.EntityId, data.ReturnType);
            }
            else if (id == ServerToClientOpCode.UnloadSoul)
            {
                PackageUnloadSoul data = args.ToPackageData <PackageUnloadSoul>(_Serializer);

                _UnloadSoul(data.TypeId, data.EntityId, data.PassageId);
            }
            else if (id == ServerToClientOpCode.ProtocolSubmit)
            {
                PackageProtocolSubmit data = args.ToPackageData <PackageProtocolSubmit>(_Serializer);

                _ProtocolSubmit(data);
            }
        }
Ejemplo n.º 3
0
        private void _ReturnDataValue(Guid returnId, IValue returnValue)
        {
            /*var argmants = new Dictionary<byte, byte[]>();
             * argmants.Add(0, ReturnId.ToByteArray());
             * var value = ReturnValue.GetObject();
             * argmants.Add(1, TypeHelper.Serialize(value));*/

            var value   = returnValue.GetObject();
            var package = new PackageReturnValue();

            package.ReturnTarget = returnId;
            package.ReturnValue  = _Serializer.Serialize(value);
            _Queue.Push(ServerToClientOpCode.ReturnValue, package.ToBuffer(_Serializer));
        }