コード例 #1
0
ファイル: SoulProvider.cs プロジェクト: tuita520/Regulus
        private void _InvokeEvent(Guid entity_id, int event_id, object[] args)
        {
            var package = new PackageInvokeEvent();

            package.EntityId    = entity_id;
            package.Event       = event_id;
            package.EventParams = (from a in args select _Serializer.Serialize(a)).ToArray();
            _InvokeEvent(package.ToBuffer(_Serializer));
        }
コード例 #2
0
        private void _InvokeEvent(long entity_id, int event_id, long handler_id, object[] args)
        {
            PackageInvokeEvent package = new PackageInvokeEvent();

            package.EntityId    = entity_id;
            package.Event       = event_id;
            package.HandlerId   = handler_id;
            package.EventParams = (from a in args select _Serializer.Serialize(a)).ToArray();
            _InvokeEvent(package.ToBuffer(_Serializer));
        }
コード例 #3
0
ファイル: GhostProvider.cs プロジェクト: LupinChiu/Regulus
        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);
            }
        }