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); }
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); }
/// <summary> /// 发布事件 /// </summary> /// <param name="evt"></param> protected void publish(HiEvent evt) { Ensure.IsNotNull(evt, "event不能为空"); _eventQueue.Enqueue(evt); }
/// <summary> /// 发布事件 /// </summary> /// <param name="evt"></param> public void Publish(HiEvent evt) { publish(evt); loop(); }