Exemple #1
0
        public void PrintTest()
        {
            Console.WriteLine("开始下钓");
            var rand = new Random();

            // 等待鱼上钓的通知
            FishingEventHandler fishingEventHandler = new FishingEventHandler();

            EventBus.Instance.Subscribe(fishingEventHandler);

            while (rand.Next(1, 4) % 2 == 0)
            {
                Console.WriteLine("铃铛:叮叮叮,鱼儿咬钩了");
                FishManEvent fishManEvent = new FishManEvent {
                    Name = "shx"
                };
                // 发布消息
                EventBus.Instance.Publish(fishManEvent, Callback);
            }
            Console.ReadKey();
        }
Exemple #2
0
 public static void Callback(FishManEvent fishManEvent, bool result, Exception ex)
 {
     Console.WriteLine("钓鱼完成");
 }