Last active
August 29, 2015 14:10
-
-
Save huanlin/eaa6c3d9d9246b5ece21 to your computer and use it in GitHub Desktop.
Unity Example 6-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface INotificationManager | |
{ | |
void Notify(string to, string msg); | |
} | |
public class NotificationManager : INotificationManager | |
{ | |
private readonly IMessageService _msgService = null; | |
// 從建構函式注入訊息服務物件。 | |
public NotificationManager(IMessageService svc) | |
{ | |
_msgService = svc; | |
} | |
// 利用訊息服務來發送訊息給指定對象。 | |
public void Notify(string to, string msg) | |
{ | |
_msgService.SendMessage(to, msg); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment