Commit 0cfdcca7 authored by haiyoucuv's avatar haiyoucuv

重构了种子动画,节省了一点资源

parent 0e6f3db0
......@@ -2,8 +2,22 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="31be0130-d27d-4740-b668-956a8050e1bf" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/resource/gameScene/种植框_time_bg.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/resource/gameScene/袋子.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/Land.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/Land.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/resource/gameScene/种植框_袋子.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/plants/Cashew_seed.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/plants/Chestnut_seed.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/plants/Peanut_seed.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/plants/Pecan_seed.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/plants/Pistachio_seed.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/plants/Sunflower_seed.png" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/resource/res.json" beforeDir="false" afterPath="$PROJECT_DIR$/resource/res.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/ResJson.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/ResJson.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/Effects/SeedEffect.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/Effects/SeedEffect.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/GameLayer.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/GameLayer.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/Plant.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/Plant.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/parts/Game/PlantList.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/parts/Game/PlantList.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -30,7 +44,7 @@
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/resource/exchangePanel" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/resource/gameScene" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
......@@ -39,11 +53,11 @@
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resource/gameScene" />
<recent name="$PROJECT_DIR$/resource/exchangePanel" />
<recent name="$PROJECT_DIR$/resource/exchange" />
<recent name="$PROJECT_DIR$/resource/wareHouse" />
<recent name="$PROJECT_DIR$/resource/shopPanel" />
<recent name="$PROJECT_DIR$/resource/taskPanel" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resource/panel" />
......@@ -53,7 +67,7 @@
<recent name="$PROJECT_DIR$/resource/exRecord" />
</key>
</component>
<component name="RunManager" selected="npm.flushRes">
<component name="RunManager" selected="npm.handleRes">
<configuration name="dev" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="run" />
......@@ -113,7 +127,7 @@
<workItem from="1591321317628" duration="18063000" />
<workItem from="1591438071338" duration="597000" />
<workItem from="1591581198126" duration="7855000" />
<workItem from="1591594488054" duration="7848000" />
<workItem from="1591594488054" duration="9174000" />
</task>
<task id="LOCAL-00001" summary="1">
<created>1591003912929</created>
......@@ -248,7 +262,14 @@
<option name="project" value="LOCAL" />
<updated>1591602213757</updated>
</task>
<option name="localTasksCounter" value="20" />
<task id="LOCAL-00020" summary="ExchangePanel">
<created>1591602426930</created>
<option name="number" value="00020" />
<option name="presentableId" value="LOCAL-00020" />
<option name="project" value="LOCAL" />
<updated>1591602426930</updated>
</task>
<option name="localTasksCounter" value="21" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
......@@ -283,36 +304,36 @@
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state x="671" y="259" key="#com.intellij.ide.util.MemberChooser/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591344864454" />
<state x="467" y="108" key="CommitChangelistDialog2" timestamp="1591602213418">
<state x="467" y="108" key="CommitChangelistDialog2" timestamp="1591602426620">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state x="466" y="108" key="CommitChangelistDialog2/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591003912498" />
<state x="2182" y="-102" key="CommitChangelistDialog2/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189619717" />
<state x="467" y="108" key="CommitChangelistDialog2/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591602213418" />
<state width="293" height="907" key="GridCell.Tab.0.bottom" timestamp="1591599693061">
<state x="467" y="108" key="CommitChangelistDialog2/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591602426620" />
<state width="293" height="907" key="GridCell.Tab.0.bottom" timestamp="1591603623337">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="499" height="907" key="GridCell.Tab.0.bottom/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953118" />
<state width="257" height="1057" key="GridCell.Tab.0.bottom/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189627828" />
<state width="293" height="907" key="GridCell.Tab.0.bottom/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591599693061" />
<state width="293" height="907" key="GridCell.Tab.0.center" timestamp="1591599693059">
<state width="293" height="907" key="GridCell.Tab.0.bottom/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591603623337" />
<state width="293" height="907" key="GridCell.Tab.0.center" timestamp="1591603623332">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="499" height="907" key="GridCell.Tab.0.center/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953116" />
<state width="257" height="1057" key="GridCell.Tab.0.center/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189627827" />
<state width="293" height="907" key="GridCell.Tab.0.center/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591599693059" />
<state width="293" height="907" key="GridCell.Tab.0.left" timestamp="1591599693058">
<state width="293" height="907" key="GridCell.Tab.0.center/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591603623332" />
<state width="293" height="907" key="GridCell.Tab.0.left" timestamp="1591603623330">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="499" height="907" key="GridCell.Tab.0.left/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953114" />
<state width="257" height="1057" key="GridCell.Tab.0.left/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189627825" />
<state width="293" height="907" key="GridCell.Tab.0.left/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591599693058" />
<state width="293" height="907" key="GridCell.Tab.0.right" timestamp="1591599693060">
<state width="293" height="907" key="GridCell.Tab.0.left/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591603623330" />
<state width="293" height="907" key="GridCell.Tab.0.right" timestamp="1591603623334">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state width="499" height="907" key="GridCell.Tab.0.right/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591065953118" />
<state width="257" height="1057" key="GridCell.Tab.0.right/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189627828" />
<state width="293" height="907" key="GridCell.Tab.0.right/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591599693060" />
<state width="293" height="907" key="GridCell.Tab.0.right/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591603623334" />
<state x="446" y="278" key="IDE.errors.dialog" timestamp="1591150813027">
<screen x="37" y="23" width="1643" height="1027" />
</state>
......@@ -322,11 +343,11 @@
</state>
<state x="614" y="245" key="RollbackChangesDialog/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1590993046653" />
<state x="615" y="245" key="RollbackChangesDialog/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591077661188" />
<state x="457" y="276" key="Vcs.Push.Dialog.v2" timestamp="1591602215561">
<state x="457" y="276" key="Vcs.Push.Dialog.v2" timestamp="1591602428231">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state x="2171" y="91" key="Vcs.Push.Dialog.v2/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591189622538" />
<state x="457" y="276" key="Vcs.Push.Dialog.v2/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591602215561" />
<state x="457" y="276" key="Vcs.Push.Dialog.v2/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591602428231" />
<state x="417" y="141" key="com.intellij.openapi.editor.actions.MultiplePasteAction$ClipboardContentChooser" timestamp="1591269112575">
<screen x="37" y="23" width="1643" height="1027" />
</state>
......@@ -339,11 +360,11 @@
<screen x="35" y="23" width="1645" height="1027" />
</state>
<state x="586" y="314" key="refactoring.ChangeSignatureDialog/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1590980819551" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591602261807">
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup" timestamp="1591603412154">
<screen x="37" y="23" width="1643" height="1027" />
</state>
<state x="522" y="250" width="670" height="676" key="search.everywhere.popup/35.23.1645.1027/1680.-199.1920.1177@35.23.1645.1027" timestamp="1591066027960" />
<state x="2248" y="61" width="783" height="775" key="search.everywhere.popup/37.23.1643.1027/1680.-199.1920.1177@1680.-199.1920.1177" timestamp="1591582557074" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591602261807" />
<state x="523" y="250" width="670" height="676" key="search.everywhere.popup/37.23.1643.1027/1680.-199.1920.1177@37.23.1643.1027" timestamp="1591603412154" />
</component>
</project>
\ No newline at end of file
......@@ -89,7 +89,7 @@
"name": "exchangePanel"
},
{
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_山核桃.png,种植框_开心果.png,种植框_板栗.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,种植框_袋子.png,进度_bg.png,进度_fill.png",
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_time_bg.png,种植框_山核桃.png,种植框_开心果.png,种植框_板栗.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,袋子.png,进度_bg.png,进度_fill.png",
"name": "gameScene"
},
{
......@@ -101,7 +101,7 @@
"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",
"keys": "Cashew_0.png,Cashew_1.png,Cashew_2.png,Chestnut_0.png,Chestnut_1.png,Chestnut_2.png,Peanut_0.png,Peanut_1.png,Peanut_2.png,Pecan_0.png,Pecan_1.png,Pecan_2.png,Pistachio_0.png,Pistachio_1.png,Pistachio_2.png,Sunflower_0.png,Sunflower_1.png,Sunflower_2.png",
"name": "plants"
},
{
......
......@@ -89,7 +89,7 @@ export const ResJson = {
"name": "exchangePanel"
},
{
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_山核桃.png,种植框_开心果.png,种植框_板栗.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,种植框_袋子.png,进度_bg.png,进度_fill.png",
"keys": "btn_仓库.png,btn_兑换记录.png,btn_商店.png,btn_规则.png,btn_领水滴.png,game_bg.jpg,广告.png,用户_bg.png,用户_头像.png,用户_水.png,田_初始.png,田_种植.png,田_选择.png,种植框_bg.png,种植框_left.png,种植框_right.png,种植框_time_bg.png,种植框_山核桃.png,种植框_开心果.png,种植框_板栗.png,种植框_瓜子.png,种植框_腰果.png,种植框_花生.png,袋子.png,进度_bg.png,进度_fill.png",
"name": "gameScene"
},
{
......@@ -101,7 +101,7 @@ export const ResJson = {
"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",
"keys": "Cashew_0.png,Cashew_1.png,Cashew_2.png,Chestnut_0.png,Chestnut_1.png,Chestnut_2.png,Peanut_0.png,Peanut_1.png,Peanut_2.png,Pecan_0.png,Pecan_1.png,Pecan_2.png,Pistachio_0.png,Pistachio_1.png,Pistachio_2.png,Sunflower_0.png,Sunflower_1.png,Sunflower_2.png",
"name": "plants"
},
{
......
import IEffect from "../../IEffect";
import { PLANT_TYPE } from "../../../const/staticData";
import Sprite = FYGE.Sprite;
import { PLANT_TYPE, s_PlantData } from "../../../const/staticData";
import Tween = FYGE.Tween;
import Event = FYGE.Event;
import Container = FYGE.Container;
......@@ -13,16 +12,17 @@ export default class SeedEffect extends Container implements IEffect {
return this._type
}
private img: Sprite;
constructor(type: PLANT_TYPE | string) {
super();
this._type = type;
this.img = this.addChild(Tool.getSprite(`${type}_seed.png`));
this.img.position.set(210, 110);
this.img.anchorTexture.set(0.5, 1);
this.addChild(Tool.getSprite('袋子.png'));
const seedImg = this.addChild(Tool.getSprite(`种植框_${s_PlantData[type].name}.png`));
seedImg.position.set((this.width - seedImg.width) / 2 - 5, (this.height - seedImg.height) / 2 + 10);
this.anchor.set(this.width / 2, this.height / 2);
}
public play(loop: boolean = false) {
......@@ -33,7 +33,7 @@ export default class SeedEffect extends Container implements IEffect {
// 位置:0s(原位) - 0.1s(原位保持不动) - 0.27s(上移10px) - 0.43s(下移10px至原位)
// -0.8s(原位保持不动) - 0.97s(上移10px) - 1.13s(下移10px至原位) - 1.4s(原位保持不动);
this.stop();
Tween.get(this.img, {loop: loop})
Tween.get(this, {loop: loop})
.set({scaleX: 1, scaleY: 1})
.to({scaleX: 1.1, scaleY: 0.9}, 100)
.to({scaleX: 0.9, scaleY: 1.1}, 170)
......@@ -48,13 +48,13 @@ export default class SeedEffect extends Container implements IEffect {
.to({scaleX: 1, scaleY: 1}, 70)
.wait(130)
const _y = this.img.y;
Tween.get(this.img, {loop: loop})
const _y = this.y;
Tween.get(this, {loop: loop})
.wait(100)
.to({y: _y - 10}, 170)
.to({y: _y - 20}, 170)
.to({y: _y}, 160)
.wait(370)
.to({y: _y - 10}, 170)
.to({y: _y - 20}, 170)
.to({y: _y}, 160)
.wait(270)
.call(() => {
......@@ -65,11 +65,11 @@ export default class SeedEffect extends Container implements IEffect {
public reset() {
this.stop();
this.img.scale.set(1, 1);
this.scale.set(1, 1);
}
public stop() {
Tween.removeTweens(this.img);
Tween.removeTweens(this);
}
}
......@@ -41,8 +41,8 @@ export default class GameLayer extends Container {
state: PLANT_STATE.STATE1,
},
{
type: PLANT_TYPE.Cashew,
state: PLANT_STATE.STATE2,
type: PLANT_TYPE.NONE,
state: 0,
},
{
type: PLANT_TYPE.Sunflower,
......
......@@ -50,6 +50,7 @@ export default class Plant extends Container {
// 播放种子动画
this.addChild(seedEffect);
seedEffect.position.set(155, 30);
seedEffect.play();
seedEffect.once(Event.END_FRAME, () => {
// 移除种子动画
......
......@@ -128,9 +128,12 @@ class ListPlant extends Container implements IScrollListItem {
this.width = 108;
this.height = 160;
this.addChild(Tool.getSprite('种植框_袋子.png'))
this.addChild(Tool.getSprite('袋子.png'))
.position.set(0, 21);
this.addChild(Tool.getSprite('种植框_time_bg.png'))
.position.set(73, 75);
// 名字的label
this.nameLabel = this.addChild(new TextField());
this.nameLabel.position.set(0, 125);
......
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