Created
December 20, 2018 10:27
-
-
Save nickyeh97/391f9e5450886dbca2a5a29cc76004f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using UnityEngine; | |
using System.Collections; | |
using DesignPattern_Bridge; | |
public class BridgeTest : MonoBehaviour { | |
void Start () { | |
UnitTest(); | |
UnitTest_Window(); | |
} | |
// | |
void UnitTest () { | |
// 產生 | |
Abstraction theAbstraction = new RefinedAbstraction1(); | |
// 設定 | |
theAbstraction.SetImplementor( new ConcreteImplementor1()); | |
theAbstraction.Operation(); | |
// 設定 | |
theAbstraction.SetImplementor( new ConcreteImplementor2()); | |
theAbstraction.Operation(); | |
// 產生 | |
theAbstraction = new RefinedAbstraction2(); | |
// 設定 | |
theAbstraction.SetImplementor( new ConcreteImplementor1()); | |
theAbstraction.Operation(); | |
// 設定 | |
theAbstraction.SetImplementor( new ConcreteImplementor2()); | |
theAbstraction.Operation(); | |
} | |
void UnitTest_Window () | |
{ | |
Window pWindow= null; | |
// 產生在XWindow環境下的IconWindow | |
pWindow = new IconWindow(); | |
pWindow.SetImplementor( new XWindowImp()); | |
pWindow.Show(); | |
// 產生在PMWindow環境下的IconWindow | |
pWindow = new IconWindow(); | |
pWindow.SetImplementor( new PMWindowImp()); | |
pWindow.Show(); | |
// 產生在XWindow環境下的TransientWindow | |
pWindow = new TransientWindow(); | |
pWindow.SetImplementor( new XWindowImp()); | |
pWindow.Show(); | |
// 產生在PMWindow環境下的TransientWindow | |
pWindow = new TransientWindow(); | |
pWindow.SetImplementor( new PMWindowImp()); | |
pWindow.Show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment