Beispiel #1
0
 public override void Deserialize(IoBuffer input, ISerializationContext context)
 {
     FromType = input.GetEnum <UserReferenceType>();
     From     = input.GetUInt32();
     To       = input.GetUInt32();
     Type     = input.GetEnum <InstantMessageType>();
     Message  = input.GetPascalVLCString();
     AckID    = input.GetPascalVLCString();
     Reason   = input.GetEnum <InstantMessageFailureReason>();
 }
Beispiel #2
0
        public void RemoveListener(InstantMessageType type, InstantMessageHandler handler)
        {
            InstantMessageHandler messageHandler;

            if (handlerRegistry.TryGetValue(type, out messageHandler))
            {
                if (messageHandler != null)
                {
                    //Debug.Log("Removing a handler for " + type.ToString() + ": " + handler.Method.Name);
                    handlerRegistry[type] -= handler;
                }
            }
        }
Beispiel #3
0
        public void DeliverMessage(InstantMessageType aType, object sender, object anArg = null)
        {
            InstantMessageHandler messageHandler;

            if (handlerRegistry.TryGetValue(aType, out messageHandler))
            {
                if (messageHandler != null)
                {
                    messageHandler(sender, new InstantMessageArgs {
                        type = aType, arg = anArg
                    });
                }
            }
        }
Beispiel #4
0
        public void AddListener(InstantMessageType type, InstantMessageHandler handler)
        {
            InstantMessageHandler messageHandler;

            if (handlerRegistry.TryGetValue(type, out messageHandler))
            {
                if (messageHandler == null)
                {
                    //Debug.Log("Setting new handler for " + type.ToString() + ": " + handler.Method.Name);
                    handlerRegistry[type] = handler;
                }
                else
                {
                    //Debug.Log("Adding new handler for " + type.ToString() + ": " + handler.Method.Name);
                    handlerRegistry[type] += handler;
                }
            }
        }