Exemple #1
0
        internal void AddSupply(PropertyInfo info, PassageCallback passage)
        {
            long passageId = _NotifierPassage.RegisterSupply(passage);

            PackageNotifierEvent package = new PackageNotifierEvent();

            package.Entity   = _Ghost.GetID();
            package.Property = _Protocol.GetMemberMap().GetProperty(info);
            package.Passage  = passageId;
            _Requester.Request(ClientToServerOpCode.AddNotifierSupply, package.ToBuffer(_Protocol.GetSerialize()));
        }
Exemple #2
0
        internal void Add(System.Reflection.EventInfo info, long handler)
        {
            MemberMap map = _Protocol.GetMemberMap();

            Serialization.ISerializer serialize = _Protocol.GetSerialize();

            PackageAddEvent package = new PackageAddEvent();

            package.Entity  = _Ghost.GetID();
            package.Event   = map.GetEvent(info);
            package.Handler = handler;
            _Requester.Request(ClientToServerOpCode.AddEvent, package.ToBuffer(serialize));
        }
Exemple #3
0
 public void Register(IGhost ghost)
 {
     var id = ghost.GetID();
     WeakReference instance;
     if(_Exists.TryGetValue(id, out instance) == false)
     {
         _Exists.Add(id, new WeakReference(ghost));
     }
 }
Exemple #4
0
        public void Register(IGhost ghost)
        {
            var id = ghost.GetID();

            if (_Exists.TryGetValue(id, out WeakReference instance) == false)
            {
                _Exists.Add(id, new WeakReference(ghost));
            }
        }
Exemple #5
0
        public void Register(IGhost ghost)
        {
            long id = ghost.GetID();
            WeakReference <IGhost> instance;

            if (_Exists.TryGetValue(id, out instance) == false)
            {
                _Exists.Add(id, new WeakReference <IGhost>(ghost));
            }
        }
Exemple #6
0
        public void Run(MethodInfo info, object[] args, IValue return_value)
        {
            var map       = _Protocol.GetMemberMap();
            var serialize = _Protocol.GetSerialize();
            var method    = map.GetMethod(info);

            var package = new PackageCallMethod();

            package.EntityId     = _Ghost.GetID();
            package.MethodId     = method;
            package.MethodParams = args.Select(arg => serialize.Serialize(arg)).ToArray();

            if (return_value != null)
            {
                package.ReturnId = _ReturnValueQueue.PushReturnValue(return_value);
            }

            _Requester.Request(ClientToServerOpCode.CallMethod, package.ToBuffer(serialize));
        }