《吸血鬼倖存者》女巫奶牛場打法分享

package com.life.design.facade;

publicclass SmartAppliancesFacade {

private Light light;

private TV tv;

private AirCondition airCondition;

public SmartAppliancesFacade() {

light = new Light();

tv = new TV();

airCondition = new AirCondition();

}

publicvoid say(String message) {

if (message.contains("開啟")) {

on();

} elseif (message.contains("關閉")) {

off();

} else {

System.out.println("我還聽不懂你說的");

}

}

publicvoid on() {

light.on();

tv.on();

airCondition.on();

}

publicvoid off() {

light.off();

tv.off();

airCondition.off();

}

}

package com.life.design.facade;

publicclass Light {

publicvoid on() {

System.out.println("開啟電燈");

}

publicvoid off() {

System.out.println("關閉電燈");

}

}

package com.life.design.facade;

publicclass Client {

publicstaticvoid main(String[] args) {

SmartAppliancesFacade facade = new SmartAppliancesFacade();

facade.say("開啟");

facade.say("關閉");

}

}

 

以上是 《吸血鬼倖存者》女巫奶牛場打法分享 的全部内容, 来源链接: utcz.com/yxgl/575697.html

回到顶部