Commit db2ddbe4 authored by haiyoucuv's avatar haiyoucuv

task

parent b85feaad
This diff is collapsed.
......@@ -18,7 +18,7 @@
<!-- <script type="text/javascript" src="//cstaticdun.126.net/load.min.js"></script> -->
<!-- <script src="libs/zepto.min.js"></script> -->
<!-- <script src="libs/p2.js"></script> -->
<script src="libs/fyge.min.js"></script>
<!-- <script src="libs/fyge.min.js"></script>-->
<script src="http://localhost:3001/FYGE.js"></script>
<!-- <script src="libs/svgaParser.min.js"></script>-->
<style>
......
......@@ -2,7 +2,7 @@ import { Module } from "./Module";
export class Panel extends Module {
private isShowing: boolean
protected isShowing: boolean
showAni() {
if (this.isShowing) return;
this.isShowing = true;
......
......@@ -136,7 +136,7 @@
"atlas": "shopPanel.json"
},
{
"keys": "task_icon.png",
"keys": "task_chat_icon.png,task_collection_icon.png,task_done.png,task_friend_icon.png,task_go.png,task_icon.png,task_item_bg.png,task_shop_icon.png,task_sign_icon.png",
"name": "taskPanel",
"atlas": "taskPanel.json"
},
......
resource/panel/comm_bg.png

19.7 KB | W: | H:

resource/panel/comm_bg.png

22 KB | W: | H:

resource/panel/comm_bg.png
resource/panel/comm_bg.png
resource/panel/comm_bg.png
resource/panel/comm_bg.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -109,7 +109,7 @@
"name": "shopPanel"
},
{
"keys": "task_icon.png",
"keys": "task_buy_icon.png,task_chat_icon.png,task_done.png,task_friend_icon.png,task_go.png,task_icon.png,task_item_bg.png,task_shop_icon.png,task_sign_icon.png,task_vip_icon.png",
"name": "taskPanel"
},
{
......
......@@ -109,7 +109,7 @@ export const ResJson = {
"name": "shopPanel"
},
{
"keys": "task_icon.png",
"keys": "task_buy_icon.png,task_chat_icon.png,task_done.png,task_friend_icon.png,task_go.png,task_icon.png,task_item_bg.png,task_shop_icon.png,task_sign_icon.png,task_vip_icon.png",
"name": "taskPanel"
},
{
......
......@@ -71,6 +71,7 @@ export const s_PlantData = {
export const gameResource = [
'gameScene',
'plants',
'panel',
];
for (let k in s_PlantData) {
......
......@@ -2,6 +2,7 @@ import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
import MouseEvent = FYGE.MouseEvent;
import TextField = FYGE.TextField;
export default class ExSuccessPanel extends Panel {
get groupNames() {
......@@ -9,12 +10,33 @@ export default class ExSuccessPanel extends Panel {
}
closeBtn: Sprite;
prizeImg: Sprite;
prizeLabel: TextField;
btn: Sprite;
initUi() {
this.addChild(Tool.getSprite("exSuccessPanel_bg.png"));
// bg and closeBtn
this.addChild(Tool.getSprite('exSuccessPanel_bg.png'));
this.closeBtn = this.addChild(Tool.getSprite('closeBtn.png'));
this.closeBtn.position.set(600, 350);
// 图片
this.prizeImg = this.addChild(Tool.getSprite('进度_fill.png'));
this.prizeImg.width = 427;
this.prizeImg.height = 200;
this.prizeImg.position.set((this.width - this.prizeImg.width) / 2, 677);
// 文案
this.prizeLabel = this.addChild(new TextField());
this.prizeLabel.text = '6字文案';
this.prizeLabel.fillColor = '#c28b4c';
this.prizeLabel.size = 24;
this.prizeLabel.position.set((this.width - this.prizeLabel.textWidth) / 2, 910);
// 按钮
this.btn = this.addChild(Tool.getSprite('exSuccessPanel_btn.png'));
this.btn.position.set((this.width - this.btn.width) / 2, 960);
}
start(data) {
......@@ -22,11 +44,13 @@ export default class ExSuccessPanel extends Panel {
}
initEvents() {
this.closeBtn.addEventListener(MouseEvent.CLICK, this.hidePanel, this)
this.closeBtn.addEventListener(MouseEvent.CLICK, this.hidePanel, this);
this.btn.addEventListener(MouseEvent.CLICK, this.hidePanel, this);
}
removeEvents() {
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.hidePanel, this)
this.closeBtn.removeEventListener(MouseEvent.CLICK, this.hidePanel, this);
this.btn.removeEventListener(MouseEvent.CLICK, this.hidePanel, this);
}
}
......@@ -6,7 +6,7 @@ import { RES } from "../../../module/RES";
import GameLayer from "./GameLayer";
import OptionPool from "../../const/OptionPool";
import OptionEffect from "./Effects/OptionEffect";
import { OPTION_TYPE, PLANT_STATE, PLANT_TYPE, s_PlantData } from "../../const/staticData";
import { OPTION_TYPE, PLANT_STATE, PLANT_TYPE } from "../../const/staticData";
import Plant from "./Plant";
import ProgressBar from "./ProgressBar";
......@@ -145,6 +145,20 @@ export class Land extends Container {
}
}
/**
* 浇水
*/
public water() {
console.log("浇水");
}
/**
* 收获
*/
public get() {
console.log("收获");
}
/**
* 在不是种植状态的基础上改变为选中状态
*/
......@@ -198,7 +212,8 @@ export class Land extends Container {
}
private endTime() {
console.log(111);
console.log(this.id, '倒计时结束');
this.addOption(Math.random() > 0.5 ? OPTION_TYPE.WATER : OPTION_TYPE.GET);
}
/**
......@@ -228,6 +243,11 @@ export class Land extends Container {
private addOption(type: OPTION_TYPE) {
this.removeOption();
this.option = this.addChild(OptionPool.ins.takeOut(type));
if (type == OPTION_TYPE.WATER) {
this.option.addEventListener(MouseEvent.CLICK, this.water, this);
} else if (type == OPTION_TYPE.GET) {
this.option.addEventListener(MouseEvent.CLICK, this.get, this);
}
this.option.x = 160;
this.option.y = -50;
this.option.play();
......@@ -238,6 +258,7 @@ export class Land extends Container {
*/
private removeOption() {
if (this.option) {
this.option.removeAllEventListener();
this.removeChild(this.option);
OptionPool.ins.takeIn(this.option);
this.option = null;
......
......@@ -5,8 +5,10 @@ import { Tool } from "../../Tools";
import { getAdjustBottomHeight, getAdjustTopHeight } from "../../const/myLab";
import MouseEvent = FYGE.MouseEvent;
import PanelCtrl from "../../../module/ctrls/panelCtrl";
import ExSuccessPanel from "../../panels/ExSuccessPanel";
import RulePanel from "../../panels/RulePanel";
import TaskPanel from "../../panels/TaskPanel";
import WareHousePanel from "../../panels/WareHousePanel";
import ShopPanel from "../../panels/ShopPanel";
export class UILayer extends Container {
......@@ -50,17 +52,19 @@ export class UILayer extends Container {
switch (e.target) {
case this.taskBtn:
console.log('点击了任务');
PanelCtrl.instance.show(TaskPanel);
break;
case this.wareHouseBtn:
console.log('点击了仓库');
PanelCtrl.instance.show(WareHousePanel);
break;
case this.storeBtn:
console.log('点击了商店');
PanelCtrl.instance.show(ShopPanel);
break;
case this.ruleBtn:
console.log('点击了规则');
PanelCtrl.instance.show(RulePanel);
// PanelCtrl.instance.show(ExSuccessPanel);
break;
case this.adBtn:
console.log('点击了广告');
......
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