Commit 19b56259 authored by haiyoucuv's avatar haiyoucuv

111

parent 03b78564
{
"Cashew_0.png": {
"x": 875,
"y": 198,
"w": 57,
"h": 90,
"ox": 0,
"oy": 0,
"sw": 57,
"sh": 90,
"ro": true
},
"Cashew_1.png": {
"x": 2,
"y": 153,
"w": 114,
"h": 146,
"ox": 0,
"oy": 0,
"sw": 114,
"sh": 146,
"ro": true
},
"Cashew_2.png": {
"x": 2,
"y": 2,
"w": 124,
"h": 149,
"ox": 0,
"oy": 0,
"sw": 124,
"sh": 149,
"ro": false
},
"Cashew_seed.png": {
"x": 792,
"y": 100,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
},
"Chestnut_0.png": {
"x": 886,
"y": 83,
"w": 78,
"h": 87,
"ox": 0,
"oy": 0,
"sw": 78,
"sh": 87,
"ro": false
},
"Chestnut_1.png": {
"x": 128,
"y": 2,
"w": 138,
"h": 133,
"ox": 0,
"oy": 0,
"sw": 138,
"sh": 133,
"ro": true
},
"Chestnut_2.png": {
"x": 414,
"y": 118,
"w": 92,
"h": 132,
"ox": 0,
"oy": 0,
"sw": 92,
"sh": 132,
"ro": false
},
"Chestnut_seed.png": {
"x": 739,
"y": 2,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
},
"Peanut_0.png": {
"x": 966,
"y": 61,
"w": 77,
"h": 48,
"ox": 0,
"oy": 0,
"sw": 77,
"sh": 48,
"ro": true
},
"Peanut_1.png": {
"x": 790,
"y": 198,
"w": 83,
"h": 64,
"ox": 0,
"oy": 0,
"sw": 83,
"sh": 64,
"ro": false
},
"Peanut_2.png": {
"x": 833,
"y": 2,
"w": 101,
"h": 79,
"ox": 0,
"oy": 0,
"sw": 101,
"sh": 79,
"ro": false
},
"Peanut_seed.png": {
"x": 698,
"y": 100,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
},
"Pecan_0.png": {
"x": 709,
"y": 198,
"w": 69,
"h": 79,
"ox": 0,
"oy": 0,
"sw": 69,
"sh": 79,
"ro": true
},
"Pecan_1.png": {
"x": 296,
"y": 125,
"w": 116,
"h": 140,
"ox": 0,
"oy": 0,
"sw": 116,
"sh": 140,
"ro": false
},
"Pecan_2.png": {
"x": 408,
"y": 2,
"w": 114,
"h": 141,
"ox": 0,
"oy": 0,
"sw": 114,
"sh": 141,
"ro": true
},
"Pecan_seed.png": {
"x": 645,
"y": 2,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
},
"Pistachio_0.png": {
"x": 936,
"y": 2,
"w": 57,
"h": 82,
"ox": 0,
"oy": 0,
"sw": 57,
"sh": 82,
"ro": true
},
"Pistachio_1.png": {
"x": 150,
"y": 142,
"w": 121,
"h": 144,
"ox": 0,
"oy": 0,
"sw": 121,
"sh": 144,
"ro": true
},
"Pistachio_2.png": {
"x": 263,
"y": 2,
"w": 121,
"h": 143,
"ox": 0,
"oy": 0,
"sw": 121,
"sh": 143,
"ro": true
},
"Pistachio_seed.png": {
"x": 604,
"y": 100,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
},
"Sunflower_0.png": {
"x": 966,
"y": 140,
"w": 53,
"h": 47,
"ox": 0,
"oy": 0,
"sw": 53,
"sh": 47,
"ro": true
},
"Sunflower_1.png": {
"x": 604,
"y": 198,
"w": 68,
"h": 103,
"ox": 0,
"oy": 0,
"sw": 68,
"sh": 103,
"ro": true
},
"Sunflower_2.png": {
"x": 508,
"y": 118,
"w": 94,
"h": 107,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 107,
"ro": false
},
"Sunflower_seed.png": {
"x": 551,
"y": 2,
"w": 96,
"h": 92,
"ox": 0,
"oy": 0,
"sw": 96,
"sh": 92,
"ro": true
}
}
\ No newline at end of file
import { PLANT_STATE, PLANT_TYPE, s_PlantData } from "./staticData";
import Plant from "../parts/Game/Plant";
import PlantEffect from "../parts/Game/Effects/PlantEffect";
/**
* ${名字}_${状态}_${过程}.svga
* 名字: 枚举的值
* 状态: 幼苗 0 小树 1 成熟 2
* 过程: 出生、种子 0 呼吸 1
* 如:
* 山核桃的成熟呼吸动画: Pecan_2_1.svga
* 瓜子的小树生成动画: Sunflower_1_0.svga
*/
/**
* option的pool
*/
export default class PlantEffectPool {
// 单例
private static _ins: PlantEffectPool;
public static get ins(): PlantEffectPool {
return PlantEffectPool._ins || (PlantEffectPool._ins = new PlantEffectPool());
}
// 缓存池
private pool = {}
// pool = {
// seed:{
// name:[],
// [...]
// },
// name: [
// state1:[
// progress1:[],
// progress1:[],
// ],
// [...]
// ]
// [...]
// }
private constructor() {
// 先加一些缓存起来
this.pool['seed'] = {};
for (let type in s_PlantData) {
this.pool[type] || (this.pool[type] = []);
[PLANT_STATE.STATE1, PLANT_STATE.STATE2, PLANT_STATE.STATE3].forEach((v) => {
this.pool[type][v] || (this.pool[type][v] = []);
this.pool[type][v][0] = [new PlantEffect(type, v, 0)];
this.pool[type][v][1] = [new PlantEffect(type, v, 1)];
});
this.pool['seed'][type] = [];
}
}
public takeOut(type: PLANT_TYPE) {
return this.pool[type].splice(0, 1)[0] || new Plant(type);
}
public takeIn(plant: Plant) {
plant.reset();
this.pool[plant.type].push(plant);
}
}
import Container = FYGE.Container;
import { PLANT_STATE, PLANT_TYPE } from "../../../const/staticData";
import IEffect from "../../IEffect";
export default class PlantEffect extends Container implements IEffect {
private mv;
private type: PLANT_TYPE;
constructor(type: PLANT_TYPE | string, state: PLANT_STATE | 0, progress: number) {
super();
// const svgaName = `${type}_${state}_${progress}`;
// Tool.getSvga(svgaName).then((mv) => {
// this.mv = mv;
// this.addChild(this.mv);
// });
}
public play() {
}
public reset() {
}
public stop() {
}
}
import Container = FYGE.Container;
import { PLANT_TYPE } from "../../const/staticData";
export default class Plant extends Container {
private _type: PLANT_TYPE;
public get type() {
return this._type;
}
constructor(type: PLANT_TYPE) {
super();
this._type = type;
}
public reset() {
}
}
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