public override void SendMessage(Colleague colleague, string Message) //关键点! { if (colleague == m_Colleague1) { m_colleague2.Request(Message); } if (colleague == m_colleague2) { m_Colleague1.Request(Message); } }
// 收到来自Colleague的通知请求 public override void SendMessage(Colleague theColleague, string Message) { // 收到Colleague1通知Colleague2 if (m_Colleague1 == theColleague) { m_Colleague2.Request(Message); } // 收到Colleague2通知Colleague1 if (m_Colleague2 == theColleague) { m_Colleague1.Request(Message); } }