Пример #1
0
        /// <summary>
        /// 普通代理
        /// </summary>
        public void CommonProxy()
        {
            IGamePlayer proxy = new GamePlayerProxy("张三");

            proxy.Login("admin", "123456");
            proxy.KillBoss();
            proxy.Upgrade();
        }
Пример #2
0
        public void TestMethod1()
        {
            IGamePlayer playerA     = new GamePlayerA();
            IGamePlayer proxyPlayer = new GamePlayerProxy(playerA);

            proxyPlayer.KillBoss();
            proxyPlayer.Upgrade();
            IGamePlayer playerB = new GamePlayerB();

            proxyPlayer = new GamePlayerProxy(playerB);
            proxyPlayer.KillBoss();
            proxyPlayer.Upgrade();
            proxyPlayer.Upgrade();

            //Debug Trace:
//A: 杀怪
//A:升级
//现总升级费用为50
//B: 杀怪
//B:升级
//现总升级费用为50
//B: 升级
//现总升级费用为100
        }