Commit b85feaad authored by haiyoucuv's avatar haiyoucuv

111

parent 6af1df8b
This diff is collapsed.
{
"Cashew_0.png": {
"x": 875,
"y": 198,
"x": 2,
"y": 947,
"w": 57,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 57,
"sh": 90,
"ro": true
"ro": false
},
"Cashew_1.png": {
"x": 2,
"y": 153,
"y": 128,
"w": 114,
"h": 146,
"ox": 0,
......@@ -30,22 +30,22 @@
"oy": 0,
"sw": 124,
"sh": 149,
"ro": false
"ro": true
},
"Cashew_seed.png": {
"x": 792,
"y": 100,
"x": 144,
"y": 719,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
"ro": false
},
"Chestnut_0.png": {
"x": 886,
"y": 83,
"x": 61,
"y": 930,
"w": 78,
"h": 87,
"ox": 0,
......@@ -55,19 +55,19 @@
"ro": false
},
"Chestnut_1.png": {
"x": 128,
"y": 2,
"x": 2,
"y": 724,
"w": 138,
"h": 133,
"ox": 0,
"oy": 0,
"sw": 138,
"sh": 133,
"ro": true
"ro": false
},
"Chestnut_2.png": {
"x": 414,
"y": 118,
"x": 142,
"y": 813,
"w": 92,
"h": 132,
"ox": 0,
......@@ -77,30 +77,30 @@
"ro": false
},
"Chestnut_seed.png": {
"x": 739,
"y": 2,
"x": 145,
"y": 529,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
"ro": false
},
"Peanut_0.png": {
"x": 966,
"y": 61,
"x": 141,
"y": 1013,
"w": 77,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 77,
"sh": 48,
"ro": true
"ro": false
},
"Peanut_1.png": {
"x": 790,
"y": 198,
"x": 141,
"y": 947,
"w": 83,
"h": 64,
"ox": 0,
......@@ -110,8 +110,8 @@
"ro": false
},
"Peanut_2.png": {
"x": 833,
"y": 2,
"x": 150,
"y": 190,
"w": 101,
"h": 79,
"ox": 0,
......@@ -121,19 +121,19 @@
"ro": false
},
"Peanut_seed.png": {
"x": 698,
"y": 100,
"x": 147,
"y": 435,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
"ro": false
},
"Pecan_0.png": {
"x": 709,
"y": 198,
"x": 61,
"y": 859,
"w": 69,
"h": 79,
"ox": 0,
......@@ -143,19 +143,19 @@
"ro": true
},
"Pecan_1.png": {
"x": 296,
"y": 125,
"x": 2,
"y": 606,
"w": 116,
"h": 140,
"ox": 0,
"oy": 0,
"sw": 116,
"sh": 140,
"ro": false
"ro": true
},
"Pecan_2.png": {
"x": 408,
"y": 2,
"x": 2,
"y": 490,
"w": 114,
"h": 141,
"ox": 0,
......@@ -165,30 +165,30 @@
"ro": true
},
"Pecan_seed.png": {
"x": 645,
"y": 2,
"x": 148,
"y": 341,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
"ro": false
},
"Pistachio_0.png": {
"x": 936,
"y": 2,
"x": 2,
"y": 859,
"w": 57,
"h": 82,
"ox": 0,
"oy": 0,
"sw": 57,
"sh": 82,
"ro": true
"ro": false
},
"Pistachio_1.png": {
"x": 150,
"y": 142,
"x": 2,
"y": 244,
"w": 121,
"h": 144,
"ox": 0,
......@@ -198,8 +198,8 @@
"ro": true
},
"Pistachio_2.png": {
"x": 263,
"y": 2,
"x": 2,
"y": 367,
"w": 121,
"h": 143,
"ox": 0,
......@@ -209,30 +209,30 @@
"ro": true
},
"Pistachio_seed.png": {
"x": 604,
"y": 100,
"x": 153,
"y": 96,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
"ro": false
},
"Sunflower_0.png": {
"x": 966,
"y": 140,
"x": 61,
"y": 1019,
"w": 53,
"h": 47,
"ox": 0,
"oy": 0,
"sw": 53,
"sh": 47,
"ro": true
"ro": false
},
"Sunflower_1.png": {
"x": 604,
"y": 198,
"x": 148,
"y": 271,
"w": 68,
"h": 103,
"ox": 0,
......@@ -242,18 +242,18 @@
"ro": true
},
"Sunflower_2.png": {
"x": 508,
"y": 118,
"x": 144,
"y": 623,
"w": 94,
"h": 107,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 107,
"ro": false
"ro": true
},
"Sunflower_seed.png": {
"x": 551,
"x": 153,
"y": 2,
"w": 96,
"h": 92,
......@@ -261,6 +261,6 @@
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
"ro": false
}
}
\ No newline at end of file
released/resource/plants/plants.png

296 KB | W: | H:

released/resource/plants/plants.png

316 KB | W: | H:

released/resource/plants/plants.png
released/resource/plants/plants.png
released/resource/plants/plants.png
released/resource/plants/plants.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -95,6 +95,11 @@
"name": "common",
"atlas": "common.json"
},
{
"keys": "record_icon.png,record_item_bg.png",
"name": "exRecordPanel",
"atlas": "exRecordPanel.json"
},
{
"keys": "exSuccessPanel_bg.png,exSuccessPanel_btn.png",
"name": "exSuccessPanel",
......@@ -110,6 +115,11 @@
"name": "loadingScene",
"atlas": "loadingScene.json"
},
{
"keys": "comm_bg.png",
"name": "panel",
"atlas": "panel.json"
},
{
"keys": "Cashew_0.png,Cashew_1.png,Cashew_2.png,Cashew_seed.png,Chestnut_0.png,Chestnut_1.png,Chestnut_2.png,Chestnut_seed.png,Peanut_0.png,Peanut_1.png,Peanut_2.png,Peanut_seed.png,Pecan_0.png,Pecan_1.png,Pecan_2.png,Pecan_seed.png,Pistachio_0.png,Pistachio_1.png,Pistachio_2.png,Pistachio_seed.png,Sunflower_0.png,Sunflower_1.png,Sunflower_2.png,Sunflower_seed.png",
"name": "plants",
......@@ -119,6 +129,21 @@
"keys": "rule_bg.png",
"name": "rulePanel",
"atlas": "rulePanel.json"
},
{
"keys": "shop_icon.png",
"name": "shopPanel",
"atlas": "shopPanel.json"
},
{
"keys": "task_icon.png",
"name": "taskPanel",
"atlas": "taskPanel.json"
},
{
"keys": "wareHouse_icon.png",
"name": "wareHouse",
"atlas": "wareHouse.json"
}
],
"path": "./resource/"
......
......@@ -76,6 +76,10 @@
"keys": "closeBtn.png,game_get.png,game_plant.png,game_water.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "common"
},
{
"keys": "record_icon.png,record_item_bg.png",
"name": "exRecordPanel"
},
{
"keys": "exSuccessPanel_bg.png,exSuccessPanel_btn.png",
"name": "exSuccessPanel"
......@@ -88,6 +92,10 @@
"keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png",
"name": "loadingScene"
},
{
"keys": "comm_bg.png",
"name": "panel"
},
{
"keys": "Cashew_0.png,Cashew_1.png,Cashew_2.png,Cashew_seed.png,Chestnut_0.png,Chestnut_1.png,Chestnut_2.png,Chestnut_seed.png,Peanut_0.png,Peanut_1.png,Peanut_2.png,Peanut_seed.png,Pecan_0.png,Pecan_1.png,Pecan_2.png,Pecan_seed.png,Pistachio_0.png,Pistachio_1.png,Pistachio_2.png,Pistachio_seed.png,Sunflower_0.png,Sunflower_1.png,Sunflower_2.png,Sunflower_seed.png",
"name": "plants"
......@@ -95,6 +103,18 @@
{
"keys": "rule_bg.png",
"name": "rulePanel"
},
{
"keys": "shop_icon.png",
"name": "shopPanel"
},
{
"keys": "task_icon.png",
"name": "taskPanel"
},
{
"keys": "wareHouse_icon.png",
"name": "wareHouse"
}
],
"path": "./resource/"
......
......@@ -82,8 +82,8 @@ function getTmCmd(src, outPath, name) {
'TexturePacker ' + //基础指令
src + //要合图集的文件夹路径
' --format json' + //图集数据格式
' --max-size 1024' + //最大尺寸
' --allow-free-size' +//允许使用最小尺寸输出,webgl最好别设置,现在小程序只有canvas模式,所以用最小尺寸导出吧
' --max-size 1080' + //最大尺寸
' --allow-free-size' +//允许使用最小comm_bg.png尺寸输出,webgl最好别设置,现在小程序只有canvas模式,所以用最小尺寸导出吧
' --shape-padding 2' + //图片间隔
' --border-padding 2' + //边界间隔
' --enable-rotation' + //旋转 diable-rotation
......
......@@ -76,6 +76,10 @@ export const ResJson = {
"keys": "closeBtn.png,game_get.png,game_plant.png,game_water.png,toastBg.png,waitingBg.png,waitingRot.png",
"name": "common"
},
{
"keys": "record_icon.png,record_item_bg.png",
"name": "exRecordPanel"
},
{
"keys": "exSuccessPanel_bg.png,exSuccessPanel_btn.png",
"name": "exSuccessPanel"
......@@ -88,6 +92,10 @@ export const ResJson = {
"keys": "loading_bg.jpg,loading_per_bg.png,loading_per_fill.png,loading_title.png,loading_绳子.png",
"name": "loadingScene"
},
{
"keys": "comm_bg.png",
"name": "panel"
},
{
"keys": "Cashew_0.png,Cashew_1.png,Cashew_2.png,Cashew_seed.png,Chestnut_0.png,Chestnut_1.png,Chestnut_2.png,Chestnut_seed.png,Peanut_0.png,Peanut_1.png,Peanut_2.png,Peanut_seed.png,Pecan_0.png,Pecan_1.png,Pecan_2.png,Pecan_seed.png,Pistachio_0.png,Pistachio_1.png,Pistachio_2.png,Pistachio_seed.png,Sunflower_0.png,Sunflower_1.png,Sunflower_2.png,Sunflower_seed.png",
"name": "plants"
......@@ -95,6 +103,18 @@ export const ResJson = {
{
"keys": "rule_bg.png",
"name": "rulePanel"
},
{
"keys": "shop_icon.png",
"name": "shopPanel"
},
{
"keys": "task_icon.png",
"name": "taskPanel"
},
{
"keys": "wareHouse_icon.png",
"name": "wareHouse"
}
],
"path": "./resource/"
......
......@@ -67,9 +67,6 @@ export default class PlantEffectPool {
// this.seed[type] = [new SeedEffect(type)];
this.seed[type] = [];
}
console.log(this.plant, this.seed);
}
/**
......
......@@ -3,7 +3,7 @@ import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
import MouseEvent = FYGE.MouseEvent;
export class ExSuccessPanel extends Panel {
export default class ExSuccessPanel extends Panel {
get groupNames() {
return ["exSuccessPanel"];
}
......
......@@ -6,7 +6,7 @@ import ScrollPage = FYGE.ScrollPage;
import TextField = FYGE.TextField;
import TEXT_lINETYPE = FYGE.TEXT_lINETYPE;
export class RulePanel extends Panel {
export default class RulePanel extends Panel {
get groupNames() {
return ["rulePanel"];
}
......
import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
export default class ShopPanel extends Panel {
get groupNames() {
return ["shopPanel"];
}
closeBtn: Sprite;
initUi() {
this.addChild(Tool.getSprite("rule_bg.png"));
this.closeBtn = this.addChild(Tool.getSprite('closeBtn.png'));
this.closeBtn.position.set(600, 350);
}
start(data) {
super.start();
}
initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
removeEvents() {
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
}
import { Panel } from "../../module/views/Panel";
import { Tool } from "../Tools";
import Sprite = FYGE.Sprite;
export default class WareHousePanel extends Panel {
get groupNames() {
return ["wareHouse"];
}
closeBtn: Sprite;
initUi() {
this.addChild(Tool.getSprite("rule_bg.png"));
this.closeBtn = this.addChild(Tool.getSprite('closeBtn.png'));
this.closeBtn.position.set(600, 350);
}
start(data) {
super.start();
}
initEvents() {
this.closeBtn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
removeEvents() {
this.closeBtn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
}
......@@ -35,6 +35,27 @@ export default class GameLayer extends Container {
// 种植列表
this.plantList = this.addChild(new PlantList());
const initData = [
{
type: PLANT_TYPE.Pistachio,
state: PLANT_STATE.STATE1,
},
{
type: PLANT_TYPE.Cashew,
state: PLANT_STATE.STATE2,
},
{
type: PLANT_TYPE.Sunflower,
state: PLANT_STATE.STATE2,
},
{
type: PLANT_TYPE.Peanut,
state: PLANT_STATE.STATE3,
},
];
this.initPlant(initData);
}
/**
......@@ -55,10 +76,24 @@ export default class GameLayer extends Container {
this.landList[landId - 1].updatePlant(state);
}
/**
* 清除植物,收获植物
* @param {number} landId
*/
public clearPlant(landId: number) {
this.landList[landId - 1].clearPlant();
}
/**
* 初始化植物,比如刚进游戏的时候
* @param initData
*/
public initPlant(initData) {
this.landList.forEach((land: Land, index: number) => {
land.initPlant(initData[index].type, initData[index].state);
});
}
public initEvent() {
}
......
......@@ -6,8 +6,9 @@ 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 } from "../../const/staticData";
import { OPTION_TYPE, PLANT_STATE, PLANT_TYPE, s_PlantData } from "../../const/staticData";
import Plant from "./Plant";
import ProgressBar from "./ProgressBar";
export enum LAND_STATE {
DEFAULT = 'default',
......@@ -25,9 +26,9 @@ export class Land extends Container {
public static activeLand: Land = null;
// 三个田的选择状态对应的 texture 田_初始.png 田_种植.png 田_选择.png
private land_default_texture = RES.getRes('田_初始.png');
private land_choose_texture = RES.getRes('田_选择.png');
private land_plant_texture = RES.getRes('田_种植.png');
private land_default_texture;
private land_choose_texture;
private land_plant_texture;
private landSprite = new Sprite(); // 土地的精灵
......@@ -45,8 +46,8 @@ export class Land extends Container {
return this._id;
}
private plant: Plant;
private progressBar: ProgressBar;
/**
* @constructor
......@@ -54,13 +55,25 @@ export class Land extends Container {
constructor() {
super();
this.land_default_texture = RES.getRes('田_初始.png');
this.land_choose_texture = RES.getRes('田_选择.png');
this.land_plant_texture = RES.getRes('田_种植.png');
this.addChild(this.landSprite);
this.setTouchFun(); // 改变这个图片的点击方法
// 给自己加个土地
this.plant = this.addChild(new Plant());
this.plant.mouseEnable = false;
this.plant.mouseChildren = false;
this.progressBar = this.addChild(new ProgressBar());
this.progressBar.setData({
type: PLANT_TYPE.Sunflower,
timestamp: Date.now(),
fullTime: 3,
});
// 添加事件
this.addEvent();
......@@ -86,6 +99,19 @@ export class Land extends Container {
this.plant.updatePlant(state);
}
/**
* 初始化一个植物,比如刚进游戏当时候
* @param {PLANT_TYPE} type
* @param {PLANT_STATE} state
*/
public initPlant(type: PLANT_TYPE, state: PLANT_STATE) {
if (type === PLANT_TYPE.NONE) {
return;
}
this.plant.initPlant(type, state);
this.changeState(LAND_STATE.PLANT);
}
/**
* 清除植物,收获植物
*/
......@@ -147,17 +173,32 @@ export class Land extends Container {
}
}
private clickThis() {
console.log(`点到了土地: ${this.id}, state: ${this.state}`);
if (this.state == LAND_STATE.PLANT) {
this.progressBar.show();
return;
}
GameLayer.ins.plantList.show(this.id); // 显示种植列表
this.activate(); // 变成选中状态
}
/**
* 添加事件
*/
private addEvent() {
// 加个监听
this.addEventListener(MouseEvent.CLICK, () => {
if (this.state == LAND_STATE.PLANT) return;
console.log(`点到了土地: ${this.id}`);
GameLayer.ins.plantList.show(this.id); // 显示种植列表
this.activate(); // 变成选中状态
});
this.addEventListener(MouseEvent.CLICK, this.clickThis, this);
this.progressBar.addEventListener('endTime', this.endTime, this);
}
private removeEvent() {
this.removeEventListener(MouseEvent.CLICK, this.clickThis, this);
this.progressBar.removeEventListener('endTime', this.endTime, this);
}
private endTime() {
console.log(111);
}
/**
......@@ -203,4 +244,9 @@ export class Land extends Container {
}
}
public destroy() {
this.removeEvent();
super.destroy();
}
}
......@@ -5,8 +5,8 @@ import { Tool } from "../../Tools";
import { getAdjustBottomHeight, getAdjustTopHeight } from "../../const/myLab";
import MouseEvent = FYGE.MouseEvent;
import PanelCtrl from "../../../module/ctrls/panelCtrl";
import { RulePanel } from "../../panels/RulePanel";
import { ExSuccessPanel } from "../../panels/ExSuccessPanel";
import ExSuccessPanel from "../../panels/ExSuccessPanel";
import RulePanel from "../../panels/RulePanel";
export class UILayer extends Container {
......
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