Commit 6c7611b1 authored by wildfirecode's avatar wildfirecode

1

parent 5e341b08
This diff is collapsed.
...@@ -46,10 +46,16 @@ function launchWithCustomModule(customModule) { ...@@ -46,10 +46,16 @@ function launchWithCustomModule(customModule) {
}, 100); }, 100);
setTimeout(() => { setTimeout(() => {
engine.globalEvent.dispatchEvent('recycling-start', { time: 200, maxScore: 222, speed: 3 }); engine.globalEvent.dispatchEvent('recycling-start', { time: 15, maxScore: 2, speed: 3, sound: 1 });
const d = engine.gameStage.sceneContainer.getChildAt(0); const d = engine.gameStage.sceneContainer.getChildAt(0);
}, 200); }, 2000);
// setTimeout(() => {
// engine.globalEvent.dispatchEvent('recycling-sound-update', { sound: 1 });
// const d = engine.gameStage.sceneContainer.getChildAt(0);
// }, 10 * 100);
// setTimeout(() => { // setTimeout(() => {
// engine.globalEvent.dispatchEvent('recycling-start', { time: 8, maxScore: 2 }); // engine.globalEvent.dispatchEvent('recycling-start', { time: 8, maxScore: 2 });
......
...@@ -44,7 +44,30 @@ ...@@ -44,7 +44,30 @@
<script src="props.js"></script> <script src="props.js"></script>
<script src="load-assets.js"></script> <script src="load-assets.js"></script>
<script src="main.js"></script> <script src="main.js"></script>
<audio style="display:none;
height: 0" id="wrongTips" preload="auto" src="https://yun.duiba.com.cn/db_games/activity/garbageSorting1.00/wrongTips.mp3">
</audio>
<audio style="display:none;
height: 0" id="go" preload="auto" src="https://yun.duiba.com.cn/db_games/activity/garbageSorting1.00/go.mp3">
</audio>
<audio style="display:none;
height: 0" id="gameOver" preload="auto" src="https://yun.duiba.com.cn/db_games/activity/garbageSorting1.00/gameOver.mp3">
</audio>
<script> <script>
// localStorage.clear() // localStorage.clear()
function playMusic(id = "bgMusic", isPlay = true) {
var media = document.getElementById(id);
if (isPlay && media.paused) {
media.play();
}
if (!isPlay && !media.paused) {
media.pause();
}
}
</script> </script>
</body> </body>
\ No newline at end of file
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
function getTextureByName(name) { function getTextureByName(name) {
return getTexture(engine.getAssetByName(name).uuid); return getTexture(engine.getAssetByName(name).uuid);
} }
function playSound(name) {
engine.playSound(engine.getAssetByName(name).uuid, { keep: true });
}
function createSvga(name, anchorName) { function createSvga(name, anchorName) {
var inst = new svga.Svga(); var inst = new svga.Svga();
inst.source = 'asset://' + engine.getAssetByName(name).uuid; inst.source = 'asset://' + engine.getAssetByName(name).uuid;
return inst; return inst;
} }
//# sourceMappingURL=utils.js.map
var props = {}; var props = {};
function prepareProps() { function prepareProps() {
...@@ -25,7 +27,6 @@ ...@@ -25,7 +27,6 @@
function injectProps(p) { function injectProps(p) {
engine.injectProp(props, p); engine.injectProp(props, p);
} }
//# sourceMappingURL=props.js.map
var Conveyor = (function (_super) { var Conveyor = (function (_super) {
tslib.__extends(Conveyor, _super); tslib.__extends(Conveyor, _super);
...@@ -61,7 +62,6 @@ ...@@ -61,7 +62,6 @@
}; };
return Conveyor; return Conveyor;
}(engine.Sprite)); }(engine.Sprite));
//# sourceMappingURL=Conveyor.js.map
var GarbageTypes; var GarbageTypes;
(function (GarbageTypes) { (function (GarbageTypes) {
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
GarbageTypes["wetWaste"] = "wetWaste"; GarbageTypes["wetWaste"] = "wetWaste";
GarbageTypes["dryWaste"] = "dryWaste"; GarbageTypes["dryWaste"] = "dryWaste";
})(GarbageTypes || (GarbageTypes = {})); })(GarbageTypes || (GarbageTypes = {}));
//# sourceMappingURL=GarbageTypes.js.map
var GarbageConfig = (function () { var GarbageConfig = (function () {
function GarbageConfig() { function GarbageConfig() {
...@@ -130,7 +129,6 @@ ...@@ -130,7 +129,6 @@
]; ];
return GarbageConfig; return GarbageConfig;
}()); }());
//# sourceMappingURL=GarbageConfig.js.map
var transStores = (function (list) { var transStores = (function (list) {
var tmp = []; var tmp = [];
...@@ -189,7 +187,6 @@ ...@@ -189,7 +187,6 @@
return '其他垃圾'; return '其他垃圾';
} }
}; };
//# sourceMappingURL=transStores.js.map
var checkHit = (function (view, rect) { var checkHit = (function (view, rect) {
var x = view.x, y = view.y; var x = view.x, y = view.y;
...@@ -199,14 +196,12 @@ ...@@ -199,14 +196,12 @@
} }
return false; return false;
}); });
//# sourceMappingURL=checkHit.js.map
var removeChild = (function (d) { var removeChild = (function (d) {
if (d && d.parent) { if (d && d.parent) {
d.parent.removeChild(d); d.parent.removeChild(d);
} }
}); });
//# sourceMappingURL=removeChild.js.map
var removeEle = (function (e, arr) { var removeEle = (function (e, arr) {
var index = arr.indexOf(e); var index = arr.indexOf(e);
...@@ -214,7 +209,6 @@ ...@@ -214,7 +209,6 @@
arr.splice(index, 1); arr.splice(index, 1);
} }
}); });
//# sourceMappingURL=removeEle.js.map
var shuffle = (function (arr) { var shuffle = (function (arr) {
var _a; var _a;
...@@ -240,6 +234,9 @@ ...@@ -240,6 +234,9 @@
} }
WrongTips.prototype.play = function (rect) { WrongTips.prototype.play = function (rect) {
this.visible = true; this.visible = true;
if (props.sound) {
window["playMusic"]("wrongTips");
}
var dur = 70; var dur = 70;
var stren = 20; var stren = 20;
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 1 }) engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 1 })
...@@ -266,7 +263,6 @@ ...@@ -266,7 +263,6 @@
return gameview.recoverableWaste; return gameview.recoverableWaste;
} }
}; };
//# sourceMappingURL=WrongTips.js.map
var Conveyors = (function (_super) { var Conveyors = (function (_super) {
tslib.__extends(Conveyors, _super); tslib.__extends(Conveyors, _super);
...@@ -318,6 +314,8 @@ ...@@ -318,6 +314,8 @@
if (this.score == (props.maxScore || 100)) { if (this.score == (props.maxScore || 100)) {
this.gameOver(); this.gameOver();
this.wrapper.stop(); this.wrapper.stop();
if (props.sound)
window['playMusic']("gameOver");
} }
this.conveyorsPool.forEach(function (conveyor) { this.conveyorsPool.forEach(function (conveyor) {
conveyor.x -= props.speed || 3; conveyor.x -= props.speed || 3;
...@@ -582,7 +580,6 @@ ...@@ -582,7 +580,6 @@
}, },
]; ];
}); });
//# sourceMappingURL=uiConfig.js.map
var getGuideInfo = (function () { var getGuideInfo = (function () {
if (!window.localStorage) { if (!window.localStorage) {
...@@ -594,7 +591,6 @@ ...@@ -594,7 +591,6 @@
if (window.localStorage) if (window.localStorage)
localStorage.setItem('recyclingGuide', '1'); localStorage.setItem('recyclingGuide', '1');
}; };
//# sourceMappingURL=getGuideInfo.js.map
var createBg = (function (a) { var createBg = (function (a) {
if (a === void 0) { a = 1; } if (a === void 0) { a = 1; }
...@@ -605,12 +601,10 @@ ...@@ -605,12 +601,10 @@
rect.alpha = a; rect.alpha = a;
return rect; return rect;
}); });
//# sourceMappingURL=createBg.js.map
var createImg = (function (texture) { var createImg = (function (texture) {
return new engine.Sprite(getTextureByName(texture)); return new engine.Sprite(getTextureByName(texture));
}); });
//# sourceMappingURL=createImg.js.map
var CountDownGroup = (function (_super) { var CountDownGroup = (function (_super) {
tslib.__extends(CountDownGroup, _super); tslib.__extends(CountDownGroup, _super);
...@@ -659,15 +653,28 @@ ...@@ -659,15 +653,28 @@
_this.visible = true; _this.visible = true;
_this.num3.alpha = 1; _this.num3.alpha = 1;
var n3 = engine.Tween.get(_this.num3); var n3 = engine.Tween.get(_this.num3);
if (props.sound) {
playSound("numCountDown");
}
n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () { n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
_this.num2.alpha = 1; _this.num2.alpha = 1;
var n2 = engine.Tween.get(_this.num2); var n2 = engine.Tween.get(_this.num2);
if (props.sound) {
playSound("numCountDown");
}
n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () { n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
_this.num1.alpha = 1; _this.num1.alpha = 1;
var n1 = engine.Tween.get(_this.num1); var n1 = engine.Tween.get(_this.num1);
if (props.sound) {
playSound("numCountDown");
}
n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () { n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(function () {
_this.go.alpha = 1; _this.go.alpha = 1;
var go = engine.Tween.get(_this.go); var go = engine.Tween.get(_this.go);
if (props.sound) {
if (props.sound)
window["playMusic"]("go");
}
go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(function () { go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(function () {
_this.visible = false; _this.visible = false;
r(); r();
...@@ -681,7 +688,6 @@ ...@@ -681,7 +688,6 @@
}; };
return CountDownGroup; return CountDownGroup;
}(engine.Sprite)); }(engine.Sprite));
//# sourceMappingURL=CountDownGroup.js.map
var GuideView = (function (_super) { var GuideView = (function (_super) {
tslib.__extends(GuideView, _super); tslib.__extends(GuideView, _super);
...@@ -701,6 +707,8 @@ ...@@ -701,6 +707,8 @@
this.guideBg.y = 552; this.guideBg.y = 552;
this.guideEle.x = 361; this.guideEle.x = 361;
this.guideEle.y = 877; this.guideEle.y = 877;
this.guideEle.anchorX = 14;
this.guideEle.anchorY = 88;
this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true; this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;
var svga = createSvga("guideTips"); var svga = createSvga("guideTips");
this.svga = svga; this.svga = svga;
...@@ -728,6 +736,8 @@ ...@@ -728,6 +736,8 @@
var offset = [0, 0]; var offset = [0, 0];
var guideOver = function () { var guideOver = function () {
_this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this); _this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, _this);
_this.guideEle.anchorX = 14;
_this.guideEle.anchorY = 44;
engine.Tween.get(_this.guideEle).to({ scaleX: 0, scaleY: 0 }, 300).call(function () { engine.Tween.get(_this.guideEle).to({ scaleX: 0, scaleY: 0 }, 300).call(function () {
_this.visible = false; _this.visible = false;
r(); r();
...@@ -742,6 +752,7 @@ ...@@ -742,6 +752,7 @@
_this.svga.visible = true; _this.svga.visible = true;
_this.guideEle.x = 361; _this.guideEle.x = 361;
_this.guideEle.y = 877; _this.guideEle.y = 877;
engine.Tween.get(_this.guideEle).set({ scaleX: 0, scaleY: 0 }).to({ scaleX: 1, scaleY: 1 }, 300);
} }
}; };
var onMove = function (e) { var onMove = function (e) {
...@@ -761,7 +772,6 @@ ...@@ -761,7 +772,6 @@
}; };
return GuideView; return GuideView;
}(engine.Sprite)); }(engine.Sprite));
//# sourceMappingURL=guideView.js.map
var RightTips = (function (_super) { var RightTips = (function (_super) {
tslib.__extends(RightTips, _super); tslib.__extends(RightTips, _super);
...@@ -783,6 +793,9 @@ ...@@ -783,6 +793,9 @@
return _this; return _this;
} }
RightTips.prototype.play = function (rect) { RightTips.prototype.play = function (rect) {
if (props.sound) {
playSound("rightTipsSound");
}
this.visible = true; this.visible = true;
this.txt.x = 100; this.txt.x = 100;
engine.Tween.get(this.txt).set({ y: 60, alpha: 1 }) engine.Tween.get(this.txt).set({ y: 60, alpha: 1 })
...@@ -797,7 +810,6 @@ ...@@ -797,7 +810,6 @@
}; };
return RightTips; return RightTips;
}(engine.Sprite)); }(engine.Sprite));
//# sourceMappingURL=RightTips.js.map
var GameView = (function (_super) { var GameView = (function (_super) {
tslib.__extends(GameView, _super); tslib.__extends(GameView, _super);
...@@ -936,6 +948,8 @@ ...@@ -936,6 +948,8 @@
if (this.getSecond() == 0) { if (this.getSecond() == 0) {
this.stop(); this.stop();
this.conveyors.timeout(); this.conveyors.timeout();
if (props.sound)
window['playMusic']("gameOver");
} }
}; };
GameView.prototype.stop = function () { GameView.prototype.stop = function () {
...@@ -956,18 +970,21 @@ ...@@ -956,18 +970,21 @@
}; };
return GameView; return GameView;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameView.js.map
var GameWrapper = (function (_super) { var GameWrapper = (function (_super) {
tslib.__extends(GameWrapper, _super); tslib.__extends(GameWrapper, _super);
function GameWrapper() { function GameWrapper() {
var _this = _super.call(this) || this; var _this = _super.call(this) || this;
engine.globalEvent.addEventListener('recycling-start', _this.start, _this); engine.globalEvent.addEventListener('recycling-start', _this.start, _this);
engine.globalEvent.addEventListener('recycling-sound-update', _this.updateSound, _this);
engine.globalEvent.addEventListener('recycling-stop', _this.stop, _this); engine.globalEvent.addEventListener('recycling-stop', _this.stop, _this);
var gameView = _this._gameView = new GameView(); var gameView = _this._gameView = new GameView();
_this.addChild(gameView); _this.addChild(gameView);
return _this; return _this;
} }
GameWrapper.prototype.updateSound = function (event) {
injectProps(event.data);
};
GameWrapper.prototype.start = function (event) { GameWrapper.prototype.start = function (event) {
injectProps(event.data); injectProps(event.data);
this._gameView.start(); this._gameView.start();
...@@ -977,7 +994,6 @@ ...@@ -977,7 +994,6 @@
}; };
return GameWrapper; return GameWrapper;
}(engine.Container)); }(engine.Container));
//# sourceMappingURL=GameWrapper.js.map
function index (props) { function index (props) {
prepareProps(); prepareProps();
...@@ -985,7 +1001,6 @@ ...@@ -985,7 +1001,6 @@
var instance = new GameWrapper(); var instance = new GameWrapper();
return instance; return instance;
} }
//# sourceMappingURL=index.js.map
return index; return index;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
}, },
{ {
"name": "playBg", "name": "playBg",
"url": "//yun.duiba.com.cn/aurora/assets/76b9491f50eaf51ae2becf9958d96a93770854ee.jpg", "url": "//yun.duiba.com.cn/aurora/assets/2a5b5087d915c2510f1b96facdb9532798ab59cd.jpg",
"uuid": "1e7dd156-b59a-491d-8154-af2ecf425a8b", "uuid": "1e7dd156-b59a-491d-8154-af2ecf425a8b",
"ext": ".jpg" "ext": ".jpg"
}, },
...@@ -385,6 +385,18 @@ ...@@ -385,6 +385,18 @@
"url": "//yun.duiba.com.cn/aurora/assets/d2f1d01024247ea64cf35c610fec85f19dd89c21.png", "url": "//yun.duiba.com.cn/aurora/assets/d2f1d01024247ea64cf35c610fec85f19dd89c21.png",
"uuid": "g00", "uuid": "g00",
"ext": ".png" "ext": ".png"
},
{
"name": "rightTipsSound",
"url": "//yun.duiba.com.cn/aurora/assets/dbf1ec24569c939bbf599475fd49110e51951584.mp3",
"uuid": "d7aa31a9-24b9-4082-98f5-a071e1f81a5a",
"ext": ".mp3"
},
{
"name": "numCountDown",
"url": "//yun.duiba.com.cn/aurora/assets/b7a6e76838c82ef34ed6af0e13550633910e0aec.mp3",
"uuid": "c8bae79c-6973-4021-adc1-45db51afe93e",
"ext": ".mp3"
} }
], ],
......
...@@ -82,6 +82,8 @@ export default class Conveyors extends engine.Sprite { ...@@ -82,6 +82,8 @@ export default class Conveyors extends engine.Sprite {
if (this.score == (props.maxScore || 100)) { if (this.score == (props.maxScore || 100)) {
this.gameOver(); this.gameOver();
this.wrapper.stop(); this.wrapper.stop();
if (props.sound) window['playMusic']("gameOver")
} }
// console.log('this.conveyorsPool.length', this.conveyorsPool.length) // console.log('this.conveyorsPool.length', this.conveyorsPool.length)
......
...@@ -172,7 +172,7 @@ export default class GameView extends engine.Container { ...@@ -172,7 +172,7 @@ export default class GameView extends engine.Container {
if (this.getSecond() == 0) { if (this.getSecond() == 0) {
this.stop(); this.stop();
this.conveyors.timeout(); this.conveyors.timeout();
if (props.sound) window['playMusic']("gameOver")
} }
} }
......
...@@ -7,12 +7,18 @@ import { injectProps } from "../props"; ...@@ -7,12 +7,18 @@ import { injectProps } from "../props";
export class GameWrapper extends engine.Container { export class GameWrapper extends engine.Container {
updateSound(event: engine.Event) {
injectProps(event.data);
}
// private _status; // private _status;
private _gameView: GameView; private _gameView: GameView;
constructor() { constructor() {
super(); super();
engine.globalEvent.addEventListener('recycling-start', this.start, this); engine.globalEvent.addEventListener('recycling-start', this.start, this);
engine.globalEvent.addEventListener('recycling-sound-update', this.updateSound, this);
engine.globalEvent.addEventListener('recycling-stop', this.stop, this); engine.globalEvent.addEventListener('recycling-stop', this.stop, this);
//创建实例 //创建实例
......
import createBg from "./createBg"; import createBg from "./createBg";
import createImg from "./createImg"; import createImg from "./createImg";
import { props } from "../../props";
import { playSound } from "../utils";
export default class CountDownGroup extends engine.Sprite { export default class CountDownGroup extends engine.Sprite {
num1: engine.Sprite; num1: engine.Sprite;
...@@ -54,33 +56,31 @@ export default class CountDownGroup extends engine.Sprite { ...@@ -54,33 +56,31 @@ export default class CountDownGroup extends engine.Sprite {
this.num3.alpha = 1; this.num3.alpha = 1;
let n3 = engine.Tween.get(this.num3); let n3 = engine.Tween.get(this.num3);
// if (GameConst.isPlayMusic) { if (props.sound) {
playSound("numCountDown");
// playSound("numCountDown"); }
// }
n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => { n3.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {
this.num2.alpha = 1; this.num2.alpha = 1;
let n2 = engine.Tween.get(this.num2); let n2 = engine.Tween.get(this.num2);
// if (GameConst.isPlayMusic) { if (props.sound) {
playSound("numCountDown");
// playSound("numCountDown"); }
// }
n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => { n2.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {
this.num1.alpha = 1; this.num1.alpha = 1;
let n1 = engine.Tween.get(this.num1); let n1 = engine.Tween.get(this.num1);
// if (GameConst.isPlayMusic) { if (props.sound) {
playSound("numCountDown");
// playSound("numCountDown"); }
// }
n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => { n1.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).to({ scaleX: 0, scaleY: 0 }, 200).call(() => {
this.go.alpha = 1; this.go.alpha = 1;
let go = engine.Tween.get(this.go); let go = engine.Tween.get(this.go);
// if (GameConst.isPlayMusic) { if (props.sound) {
// window["playMusic"]("go"); if (props.sound) window["playMusic"]("go");
// } }
go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(() => { go.to({ scaleX: 0.8, scaleY: 0.8 }, 200).to({ scaleX: 1, scaleY: 1 }, 100).wait(500).call(() => {
this.visible = false; this.visible = false;
r() r()
}) })
}) })
......
import { getTextureByName } from "../utils"; import { getTextureByName, playSound } from "../utils";
import { props } from "../../props"; import { props } from "../../props";
export default class RightTips extends engine.Sprite { export default class RightTips extends engine.Sprite {
...@@ -25,6 +25,10 @@ export default class RightTips extends engine.Sprite { ...@@ -25,6 +25,10 @@ export default class RightTips extends engine.Sprite {
} }
play(rect: engine.Rectangle) { play(rect: engine.Rectangle) {
if (props.sound) {
playSound("rightTipsSound");
}
this.visible = true; this.visible = true;
this.txt.x = 100; this.txt.x = 100;
......
import { getTextureByName } from "../utils"; import { getTextureByName } from "../utils";
import { GarbageTypes } from "../datas/GarbageTypes"; import { GarbageTypes } from "../datas/GarbageTypes";
import GameView from "../GameView"; import GameView from "../GameView";
import { props } from "../../props";
export default class WrongTips extends engine.Sprite { export default class WrongTips extends engine.Sprite {
img: engine.Image; img: engine.Image;
...@@ -18,6 +19,10 @@ export default class WrongTips extends engine.Sprite { ...@@ -18,6 +19,10 @@ export default class WrongTips extends engine.Sprite {
play(rect: engine.Rectangle) { play(rect: engine.Rectangle) {
this.visible = true; this.visible = true;
if (props.sound) {
window["playMusic"]("wrongTips");
}
const dur = 70; const dur = 70;
const stren = 20; const stren = 20;
engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 1 }) engine.Tween.get(this.img).set({ x: 0, y: 0, scaleX: 1, scaleY: 1, alpha: 1 })
......
...@@ -22,7 +22,10 @@ export default class GuideView extends engine.Sprite { ...@@ -22,7 +22,10 @@ export default class GuideView extends engine.Sprite {
this.guideBg.x = 393; this.guideBg.x = 393;
this.guideBg.y = 552; this.guideBg.y = 552;
this.guideEle.x = 361; this.guideEle.x = 361;
this.guideEle.y = 877; this.guideEle.y = 877;
this.guideEle.anchorX=14;
this.guideEle.anchorY=88;
this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true; this.guideEle.mouseEnabled = this.guideEle.mouseChildren = true;
let svga = createSvga("guideTips"); let svga = createSvga("guideTips");
...@@ -51,6 +54,8 @@ export default class GuideView extends engine.Sprite { ...@@ -51,6 +54,8 @@ export default class GuideView extends engine.Sprite {
let offset = [0, 0] let offset = [0, 0]
const guideOver = () => { const guideOver = () => {
this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, this) this.guideEle.removeEventListener(engine.MouseEvent.MOUSE_DOWN, ondown, this)
this.guideEle.anchorX=14;
this.guideEle.anchorY=44;
engine.Tween.get(this.guideEle).to({scaleX:0,scaleY:0},300).call(()=>{ engine.Tween.get(this.guideEle).to({scaleX:0,scaleY:0},300).call(()=>{
this.visible = false; this.visible = false;
r(); r();
...@@ -65,6 +70,7 @@ export default class GuideView extends engine.Sprite { ...@@ -65,6 +70,7 @@ export default class GuideView extends engine.Sprite {
this.svga.visible = true; this.svga.visible = true;
this.guideEle.x = 361; this.guideEle.x = 361;
this.guideEle.y = 877; this.guideEle.y = 877;
engine.Tween.get(this.guideEle).set({scaleX:0,scaleY:0}).to({scaleX:1,scaleY:1},300)
} }
} }
......
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