IEnumerator Start() { MsgDispatcher.Send("Do", "Hello"); SendMsg("OK", "hello"); SendMsg("OK", "hello"); yield return(new WaitForSeconds(1.0f)); MsgDispatcher.Send("Do", "Hello1"); }
private static void MenuClicked() { //全部清空,确保事例有效 MsgDispatcher.UnRegisterAll("MSG1"); MsgDispatcher.Register("MSG1", OnMsgReceived); MsgDispatcher.Register("MSG1", OnMsgReceived); MsgDispatcher.Send("MSG1", "hello world"); MsgDispatcher.UnRegister("MSG1", OnMsgReceived); MsgDispatcher.Send("MSG1", "hello"); }
protected void SendMsg(string msgName, object data) { MsgDispatcher.Send(msgName, data); }