示例#1
0
        public void PublishMsgTest()
        {
            IocManager.Default.Configure(GetType());

            IocManager.Default.Register <MyType>(new MyType {
                Name = "Maxim"
            });

            var instance = IocManager.Default.Resolve <ITestMessenger>();

            Messenger.Default.Publish(new TestMessengerPayload {
                Msg = "Hello Messenger!"
            });

            Messenger.Default.Publish(new TestMessengerPayload <int> {
                Data = 111
            });

            Messenger.Default.Publish(new TestMessengerPayload1 {
                Data = new object()
            });

            Messenger.Default.Publish(new TestMessengerPayload <string> {
                Data = "1111"
            });

            Messenger.Default.Publish(new NewTestMessengerPayload {
                Data = 0.5
            });

            Messenger.Default.Publish <ITestMessengerPayload>(new TestMessengerPayload {
                Msg = "interface payload test"
            });

            IBroadcastPayload args1 = new TestMessengerPayload {
                Msg = "interface payload test"
            };

            Messenger.Default.Publish(args1);
        }
示例#2
0
 private void OnTestMessenger(TestMessengerPayload <string> args)
 {
     Debug.LogFormat("OnTestMessenger (MSG: \"{0}\")", args.Msg);
 }