Commit a0ad980b authored by haiyoucuv's avatar haiyoucuv

1

parent ac06d6d7
This diff is collapsed.
This diff is collapsed.
import Container = FYGE.Container; import Container = FYGE.Container;
import { Land } from "./Land"; import { Land } from "./Land";
import PlantList from "./PlantList"; import PlantList from "./PlantList";
import { PLANT_STATE, PLANT_TYPE } from "../../const/staticData"; import { PLANT_STATE, PLANT_TYPE, s_PlantData } from "../../const/staticData";
import { Tool } from "../../Tools";
import { UILayer } from "../UI/UILayer";
import { layers } from "../../../module/views/layers";
/** /**
* GameLayer * GameLayer
...@@ -28,8 +31,6 @@ export default class GameLayer extends Container { ...@@ -28,8 +31,6 @@ export default class GameLayer extends Container {
private constructor() { private constructor() {
super(); super();
window['gameLayer'] = this;
this.initLand(); this.initLand();
// 种植列表 // 种植列表
...@@ -56,6 +57,8 @@ export default class GameLayer extends Container { ...@@ -56,6 +57,8 @@ export default class GameLayer extends Container {
]; ];
this.initPlant(initData); this.initPlant(initData);
this.getEffect(PLANT_TYPE.Cashew, 1);
} }
/** /**
...@@ -94,6 +97,13 @@ export default class GameLayer extends Container { ...@@ -94,6 +97,13 @@ export default class GameLayer extends Container {
}); });
} }
public getEffect(type: PLANT_TYPE, id: number) {
const getEffect = this.addChild(Tool.getSprite(`种植框_${s_PlantData[type].name}.png`));
getEffect.position.set(this.landList[id - 1].x + 185, this.landList[id - 1].y + 55);
let x = 375;
let y = layers.stageWidth - layers.stageOffsetY;
}
public initEvent() { public initEvent() {
} }
......
...@@ -89,6 +89,12 @@ export class Land extends Container { ...@@ -89,6 +89,12 @@ export class Land extends Container {
public addPlant(type: PLANT_TYPE) { public addPlant(type: PLANT_TYPE) {
this.plant.plant(type); this.plant.plant(type);
this.changeState(LAND_STATE.PLANT); this.changeState(LAND_STATE.PLANT);
this.progressBar.setData({
type: type,
timestamp: Date.now(),
fullTime: 3,
});
this.progressBar.show();
} }
/** /**
...@@ -97,6 +103,12 @@ export class Land extends Container { ...@@ -97,6 +103,12 @@ export class Land extends Container {
*/ */
public updatePlant(state: PLANT_STATE) { public updatePlant(state: PLANT_STATE) {
this.plant.updatePlant(state); this.plant.updatePlant(state);
this.progressBar.setData({
type: this.plant.type,
timestamp: Date.now(),
fullTime: 3,
});
this.progressBar.show();
} }
/** /**
...@@ -115,6 +127,7 @@ export class Land extends Container { ...@@ -115,6 +127,7 @@ export class Land extends Container {
timestamp: Date.now(), timestamp: Date.now(),
fullTime: 3, fullTime: 3,
}); });
this.progressBar.show();
} }
/** /**
...@@ -123,6 +136,9 @@ export class Land extends Container { ...@@ -123,6 +136,9 @@ export class Land extends Container {
public clearPlant() { public clearPlant() {
this.plant.clearPlant(); this.plant.clearPlant();
this.changeState(LAND_STATE.DEFAULT); this.changeState(LAND_STATE.DEFAULT);
this.progressBar.setData({
type: PLANT_TYPE.NONE,
});
} }
/** /**
...@@ -163,6 +179,8 @@ export class Land extends Container { ...@@ -163,6 +179,8 @@ export class Land extends Container {
*/ */
public get(e: MouseEvent) { public get(e: MouseEvent) {
e.stopPropagation(); e.stopPropagation();
this.removeOption();
this.clearPlant();
console.log("收获"); console.log("收获");
} }
......
...@@ -57,7 +57,11 @@ export default class ProgressBar extends Container { ...@@ -57,7 +57,11 @@ export default class ProgressBar extends Container {
* @param data * @param data
*/ */
public setData(data) { public setData(data) {
if (data.type == PLANT_TYPE.NONE) return; if (data.type == PLANT_TYPE.NONE) {
Tween.removeTweens(this);
this.visible = false;
return;
}
this.nameLabel.text = s_PlantData[data.type].name; this.nameLabel.text = s_PlantData[data.type].name;
this.nameLabel.position.set(80 + (56 - this.nameLabel.textWidth) / 2, 139); this.nameLabel.position.set(80 + (56 - this.nameLabel.textWidth) / 2, 139);
......
...@@ -5,7 +5,6 @@ import { Tool } from "../../Tools"; ...@@ -5,7 +5,6 @@ import { Tool } from "../../Tools";
import { getAdjustBottomHeight, getAdjustTopHeight } from "../../const/myLab"; import { getAdjustBottomHeight, getAdjustTopHeight } from "../../const/myLab";
import MouseEvent = FYGE.MouseEvent; import MouseEvent = FYGE.MouseEvent;
import PanelCtrl from "../../../module/ctrls/panelCtrl"; import PanelCtrl from "../../../module/ctrls/panelCtrl";
import RulePanel from "../../panels/RulePanel";
import TaskPanel from "../../panels/TaskPanel"; import TaskPanel from "../../panels/TaskPanel";
import WareHousePanel from "../../panels/WareHousePanel"; import WareHousePanel from "../../panels/WareHousePanel";
import ShopPanel from "../../panels/ShopPanel"; import ShopPanel from "../../panels/ShopPanel";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment