Commit 8df614f3 authored by wildfirecode's avatar wildfirecode

1

parent 1c89e887
This diff is collapsed.
......@@ -46,16 +46,16 @@ function launchWithCustomModule(customModule) {
}, 100);
setTimeout(() => {
engine.globalEvent.dispatchEvent('recycling-start', { time: 2, maxScore: 2 });
engine.globalEvent.dispatchEvent('recycling-start', { time: 200, maxScore: 222 });
const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 200);
setTimeout(() => {
engine.globalEvent.dispatchEvent('recycling-start', { time: 8, maxScore: 2 });
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('recycling-start', { time: 8, maxScore: 2 });
const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 1000 * 10);
// const d = engine.gameStage.sceneContainer.getChildAt(0);
// }, 1000 * 10);
});
engine.globalEvent.addEventListener('recycling-time-update', (e) => {
console.log(e.type, e.data);
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -20,6 +20,18 @@
"uuid": "1e7dd156-b59a-491d-8154-af2ecf425a8b",
"ext": ".jpg"
},
{
"name": "wrongTips",
"url": "//yun.duiba.com.cn/aurora/assets/875c53d7034aaca6a532c78122f79c9f98f132c1.png",
"uuid": "bc35abf4-2541-4751-9122-e8e185c52e45",
"ext": ".png"
},
{
"name": "rightTips",
"url": "//yun.duiba.com.cn/aurora/assets/61a6c5a09466497ab999a4a504606ce9f923be6b.png",
"uuid": "388ed033-852a-496c-bed8-d941243ea531",
"ext": ".png"
},
{
"name": "idlerWheel",
"url": "//yun.duiba.com.cn/aurora/assets/2a06e8c7b49d8e53955359f7a6dc5bd887978c21.png",
......
......@@ -9,6 +9,7 @@ import checkHit from "./utils/checkHit";
import removeChild from "./utils/removeChild";
import removeEle from "./utils/removeEle";
import shuffle from "./utils/shuffle";
import { getTargetRect } from "./views/WrongTips";
export default class Conveyors extends engine.Sprite {
......@@ -250,14 +251,14 @@ export default class Conveyors extends engine.Sprite {
}
onStageMouseMove(e: engine.MouseEvent) {
console.log('onStageMouseMove')
// console.log('onStageMouseMove')
const view = this._currentDragView;
view.x = e.stageX - view.texture.width / 2;
view.y = e.stageY - view.texture.height / 2;
}
onStageMouseUp(e: engine.MouseEvent) {
console.log('onStageMouseUp')
// console.log('onStageMouseUp')
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_UP, this.onStageMouseUp, this)
this.wrapper.removeEventListener(engine.MouseEvent.MOUSE_MOVE, this.onStageMouseMove, this)
if (!this._currentDragView) return;
......@@ -265,8 +266,10 @@ export default class Conveyors extends engine.Sprite {
if (result) {//落入
if (result == this._currentDragView['type']) {//匹配
this.addscore();
this.wrapper.rightTips.play(getTargetRect(result,this.wrapper));
} else {//不匹配
engine.Tween.get(this._currentTarget).to({ scaleX: 1, scaleY: 1 }, 300).call(() => { });
this.wrapper.wrongTips.play(getTargetRect(result,this.wrapper));
}
this.stores.push({ targetType: result, itemType: this._currentDragView['type'], itemName: this._currentDragView['name'] });
......@@ -283,7 +286,7 @@ export default class Conveyors extends engine.Sprite {
});
}
clear() {
clear() {
this.conveyor0.x = 0;
this.conveyor1.x = 764;
this.conveyorsPool.forEach(i => {
......
......@@ -10,6 +10,8 @@ import uiConfig from "./uiConfig";
import getGuideInfo, { setGuide } from "./utils/getGuideInfo";
import CountDownGroup from "./views/CountDownGroup";
import GuideView from "./views/guideView";
import WrongTips from "./views/WrongTips";
import RightTips from "./views/RightTips";
export default class GameView extends engine.Container {
private _timer;
......@@ -22,6 +24,8 @@ export default class GameView extends engine.Container {
countdown: CountDownGroup;
guide: GuideView;
conveyors: Conveyors;
wrongTips: WrongTips;
rightTips: RightTips;
constructor() {
super();
......@@ -60,7 +64,12 @@ export default class GameView extends engine.Container {
this.addChild(this.countdown)
this.guide = new GuideView();
this.addChild(this.guide)
this.addChild(this.guide);
this.wrongTips = new WrongTips();
this.rightTips = new RightTips()
this.addChild(this.wrongTips)
this.addChild(this.rightTips)
}
......
......@@ -71,7 +71,7 @@ const getTargetName = (type: GarbageTypes) => {
break;
case GarbageTypes.dryWaste:
return '垃圾'
return '其他垃圾'
break;
default:
......
import { getTextureByName } from "../utils";
import { props } from "../../props";
export default class RightTips extends engine.Sprite {
img: engine.Image;
txt: engine.TextField;
private SCORE = props.onceScore || 2;
constructor() {
super();
this.img = new engine.Image();
this.img.texture = getTextureByName('rightTips')
this.addChild(this.img);
this.img.anchorX = 88 / 2;
this.img.anchorY = 85 / 2;
this.visible = false;
this.txt = new engine.TextField();
this.addChild(this.txt)
this.txt.text = '+' + this.SCORE
this.txt.size = 60;
this.txt.fillColor = '#437726'
// this.txt.bold = true
engine.playSound
}
play(rect: engine.Rectangle) {
this.visible = true;
this.txt.x = 100;
engine.Tween.get(this.txt).set({ y: 60, alpha: 1 })
.to({ y: -50 }, 500)
.to({ alpha: 0 })
const DUR = 70;
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 0, scaleY: 0, alpha: 1 })
.to({ scaleX: 1, scaleY: 1 }, 200, engine.Ease.getBackOut(1))
.wait(200)
.to({ alpha: 0 }, 300)
this.x = rect.x + 180;
this.y = rect.y;
}
}
\ No newline at end of file
import { getTextureByName } from "../utils";
import { GarbageTypes } from "../datas/GarbageTypes";
import GameView from "../GameView";
export default class WrongTips extends engine.Sprite {
img: engine.Image;
constructor() {
super();
this.img = new engine.Image();
this.img.texture = getTextureByName('wrongTips')//wrongTips
this.addChild(this.img);
this.img.anchorX = 88 / 2;
this.img.anchorY = 85 / 2;
this.visible = false;
}
play(rect: engine.Rectangle) {
this.visible = true;
const dur = 70;
const stren = 20;
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 1 })
.to({ x: stren }, dur)
.to({ x: 0 }, dur)
.to({ x: -stren }, dur)
.to({ x: 0 }, dur)
.wait(200)
.to({ alpha: 0 }, 300)
this.x = rect.x + 180;
this.y = rect.y;
}
}
export const getTargetRect = (targetType, gameview: GameView) => {
switch (targetType) {
case GarbageTypes.dryWaste:
return gameview.dryWaste
break;
case GarbageTypes.wetWaste:
return gameview.wetWaste
break;
case GarbageTypes.harmfulWaste:
return gameview.harmfulWaste
break;
case GarbageTypes.recoverableWaste:
return gameview.recoverableWaste
break;
default:
break;
}
}
\ No newline at end of file
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