Esempio n. 1
0
    override protected void Awake()
    {
        base.Awake();
        //this.gameObject.SetActive(false);

        HiEvent.RemoveEventListener(HiEventID.Window_Show);
        HiEvent.RemoveEventListener(HiEventID.Window_Hide);

        HiEvent.AddEventListener <DG_Normal>(HiEventID.Window_Show, ShowWindowPanel);
        HiEvent.AddEventListener <DG_Normal>(HiEventID.Window_Hide, HideWindowPanel);
    }
Esempio n. 2
0
        public void protocol_test()
        {
            var protocol = new DefaultProtocol();

            var evt = new HiEvent();

            var json = JsonConvert.SerializeObject(evt);

            var bytes = Encoding.UTF8.GetBytes(json);

            var hievent = protocol.Serialize(bytes);

            Assert.AreEqual(evt.TagId.ToString(), hievent.TagId.ToString());
            Assert.AreEqual(evt.Type, hievent.Type);
            Assert.AreEqual(evt.TimeStamp, hievent.TimeStamp);
            Assert.AreEqual(evt.Data, hievent.Data);
        }
Esempio n. 3
0
        /// <summary>
        /// 发布事件
        /// </summary>
        /// <param name="evt"></param>
        protected void publish(HiEvent evt)
        {
            Ensure.IsNotNull(evt, "event不能为空");

            _eventQueue.Enqueue(evt);
        }
Esempio n. 4
0
        /// <summary>
        /// 发布事件
        /// </summary>
        /// <param name="evt"></param>
        public void Publish(HiEvent evt)
        {
            publish(evt);

            loop();
        }