| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { find } from "cc";
- import { FarmIcon } from "./FarmIcon";
- import { FarmSystem } from "./FarmSystem";
- /**
- * 窗口管理器
- * 实际管理在窗口系统,这里仅仅作为API调用
- * @author 袁浩
- */
- export class FarmManager {
- private static get farmSystem(): FarmSystem {
- var farmSystemNode = find("Canvas/FarmSystem");
- return farmSystemNode ? farmSystemNode.getComponent(FarmSystem) : null;
- }
- public static plantCountMap: Map<number, number> = new Map();
- public static plantWindowIsOpening = false;
- public static plantIsRequesting = false;
- public static onPlant(id: number): void {
- this.farmSystem.plant(id);
- }
- public static getCurrFarm(): FarmIcon {
- return this.farmSystem.currSelectFarm;
- }
- public static selectFristFarm(): void {
- let farm = this.farmSystem.selectNextFarm();
- if (!farm) {
- this.farmSystem.currSelectFarm = this.farmSystem.farms[0];
- }
- }
- public static novice_selectFristFarm(): void {
- this.farmSystem.currSelectFarm = this.farmSystem.farms[0];
- }
- public static novice_plant(): void {
- this.farmSystem.novice_plant();
- }
- public static novice_clean(): void {
- this.farmSystem.novice_clean();
- }
- }
|