Ejemplo n.º 1
0
        public ApolloResult Register <TResp, TReceipt>(TalkerMessageWithReceiptHandler <TResp, TReceipt> handler) where TResp : IUnpackable where TReceipt : IPackable
        {
            Type   type     = typeof(TResp);
            string fullName = type.FullName;

            return(this.Register <TResp, TReceipt>(fullName, handler));
        }
Ejemplo n.º 2
0
 internal ApolloResult Register <TResp, TReceipt>(TalkerCommand command, TalkerMessageWithReceiptHandler <TResp, TReceipt> handler) where TResp : IUnpackable where TReceipt : IPackable
 {
     if (command != null && handler != null)
     {
         if (ApolloMessageManager.Instance.Exist(command))
         {
         }
         ApolloMessage apolloMessage = new ApolloMessage(command);
         apolloMessage.RespType           = typeof(TResp);
         apolloMessage.ReceiptType        = typeof(TReceipt);
         apolloMessage.Talker             = this;
         apolloMessage.HandlerWithReceipt = delegate(IUnpackable resp, ref IPackable receipt)
         {
             TReceipt tReceipt = default(TReceipt);
             handler((TResp)((object)resp), ref tReceipt);
             receipt = tReceipt;
             ADebug.Log("Register receipt:" + (receipt != null));
         };
         ApolloMessageManager.Instance.Add(apolloMessage);
         return(ApolloResult.Success);
     }
     return(ApolloResult.InvalidArgument);
 }
Ejemplo n.º 3
0
 public ApolloResult Register <TResp, TReceipt>(string command, TalkerMessageWithReceiptHandler <TResp, TReceipt> handler) where TResp : IUnpackable where TReceipt : IPackable
 {
     return(this.Register <TResp, TReceipt>(new TalkerCommand(TalkerCommand.CommandDomain.App, command), handler));
 }