private IEnumerator Start() { MsgDispatcher.Send("Do", "你好"); yield return(new WaitForSeconds(3f)); MsgDispatcher.Send("Do", "你好呀,哈哈"); }
void OnDestroy() { OnBeforeDestroy(); foreach (var msgRecord in mMsgRecords) { MsgDispatcher.UnRegister(msgRecord.Name, msgRecord.OnMysgReceived); msgRecord.Recycle(); } }
private static void MenuClicked() { MsgDispatcher.UnRegisterAll("Do"); MsgDispatcher.UnRegisterAll("OK"); UnityEditor.EditorApplication.isPlaying = true; new GameObject("MsgReceiverObj") .AddComponent <FrameworkExample>(); }
private static void MenuClicked() { MsgDispatcher.UnRegisterAll("Message_1"); MsgDispatcher.Register("Message_1", OnMsgReceived); MsgDispatcher.Register("Message_1", OnMsgReceived); MsgDispatcher.Send("Message_1", "hello world"); MsgDispatcher.UnRegister("Message_1", OnMsgReceived); MsgDispatcher.Send("Message_1", "hello"); }
private IEnumerator Start() { MsgDispatcher.Send("Do", "hello"); yield return(new WaitForSeconds(1.0f)); MsgDispatcher.Send("Do", "hello1"); SendMsg("OK", "hello"); SendMsg("OK", "hello"); }
protected void UnRegisterMsg(string msgName) { var selectedRecords = mMsgRecorder.FindAll(recorder => recorder.Name == msgName); selectedRecords.ForEach(selectRecord => { MsgDispatcher.UnRegister(selectRecord.Name, selectRecord.OnMsgReceived); mMsgRecorder.Remove(selectRecord); }); selectedRecords.Clear(); }
private void OnDestroy() { OnBeforeDestroy(); foreach (var msgRecord in mMsgRecorder) { MsgDispatcher.UnRegister(msgRecord.Name, msgRecord.OnMsgReceived); msgRecord.Recycle(); } mMsgRecorder.Clear(); }
public void UnRegisterMsg(string msgName) { var selectedRecords = mMsgRecords.FindAll(record => record.Name == msgName); selectedRecords.ForEach(record => { MsgDispatcher.UnRegister(record.Name, record.OnMysgReceived); mMsgRecords.Remove(record); record.Recycle(); }); selectedRecords.Clear(); }
private static void MenuClicked() { // 全部清空,确保测试有效 MsgDispatcher.UnRegisterAll("消息1"); MsgDispatcher.Register("消息1", OnMsgReceived); MsgDispatcher.Register("消息1", OnMsgReceived); MsgDispatcher.Send("消息1", "hello world"); MsgDispatcher.UnRegister("消息1", OnMsgReceived); MsgDispatcher.Send("消息1", "hello"); }
protected void UnRegisterMsg(string msgName, Action <object> onMsgRecevived) { var selectedRecords = m_MsgRegisterRecorder.FindAll(recorder => recorder.MsgName == msgName && recorder.OnMsgReceived == onMsgRecevived); selectedRecords.ForEach(selectedRecord => { MsgDispatcher.UnRegister(selectedRecord.MsgName, selectedRecord.OnMsgReceived); m_MsgRegisterRecorder.Remove(selectedRecord); }); selectedRecords.Clear(); }
public static void SendMsg(string msgName, object data) { MsgDispatcher.Send(msgName, data); }
public void RegisterMsg(string msgName, Action <object> onMsgReceived) { MsgDispatcher.Register(msgName, onMsgReceived); // mMsgRegisterRecorder.Add(msgName, onMsgReceived); mMsgRecords.Add(MsgRecord.Allocate(msgName, onMsgReceived)); }
protected void SendMsg(string msgName, object data) { MsgDispatcher.Send(msgName, data); }
protected void RegisterMsg(string msgName, Action <object> onMsgReceived) { MsgDispatcher.Register(msgName, onMsgReceived); m_MsgRegisterRecorder.Add(MsgRecord.Allocate(msgName, onMsgReceived)); }