Commit 3d9785b1 authored by 范雪寒's avatar 范雪寒

feat: 铺界面

parent 3695f7ce
This source diff could not be displayed because it is too large. You can view the blob instead.
export let defaultData = {
tittle: {
word: "C",
text: "listen and select the right word you just heard.",
audio: "tittle"
},
showType: "B",
words: [
"aaaa bbbb cccc",
"ccc bbabb cccc",
"eee bbbb cccc",
"dd bbbb cccc",
"xxx bbbb cccc",
"zzzz bbbb cccc",
],
wholeAuido: "bbbb",
audios: [
"aaaa",
"aaaa",
"aaaa",
"aaaa",
"aaaa",
"aaaa",
]
};
\ No newline at end of file
import {
MySprite,
Label,
removeItemFromArr,
hideItem,
showItem,
moveItem,
tweenChange,
} from './../Unit';
import TWEEN from '@tweenjs/tween.js';
export class Game {
_parent = null;
_z = 0;
children: any = [this];
constructor(parent) {
this._parent = parent;
}
initData(data) {
}
initView() {
}
addChild(node, z = 1) {
this._parent.renderArr.push(node);
if (this.children.indexOf(node) === -1) {
this.children.push(node);
node._z = z;
}
this.children.sort((a, b) => {
return a._z - b._z;
});
}
removeChildren() {
for (let i = 0; i < this.children.length; i++) {
if (this.children[i]) {
if (this.children[i] !== this) {
let child = this.children.splice(i, 1);
removeItemFromArr(this._parent.renderArr, child);
i--;
}
}
}
}
removeChild(child) {
const index = this.children.indexOf(child);
if (index !== -1) {
this.children.splice(index, 1);
}
removeItemFromArr(this._parent.renderArr, child);
}
_checkHitPosition(node, pos) {
let rightNode = null;
if (node.visible && node._touchEnabled && node._checkHitPosition(pos)) {
rightNode = node;
}
if (node.children.length > 1) {
for (var i = 1; i < node.children.length; ++i) {
if (node.children[i] != node) {
let result = this._checkHitPosition(node.children[i], pos);
if (result != null) {
rightNode = result;
}
}
}
}
return rightNode;
}
_currentTouchSprite = null;
_onTouchBegan(pos) {
let result = this._checkHitPosition(this, pos);
this._currentTouchSprite = result;
if (result != null) {
if (result._onTouchBeganListener &&
typeof (result._onTouchBeganListener) == 'function') {
result._onTouchBeganListener(pos);
}
}
}
_onTouchMove(pos) {
if (this._currentTouchSprite != null) {
if (this._currentTouchSprite._checkHitPosition(pos)) {
if (this._currentTouchSprite._onTouchMoveListener &&
typeof (this._currentTouchSprite._onTouchMoveListener) == 'function') {
this._currentTouchSprite._onTouchMoveListener(pos);
}
} else {
if (this._currentTouchSprite._onTouchCancelListener &&
typeof (this._currentTouchSprite._onTouchCancelListener) == 'function') {
this._currentTouchSprite._onTouchCancelListener(pos);
}
this._currentTouchSprite = null;
}
}
}
_onTouchEnd(pos) {
if (this._currentTouchSprite != null) {
if (this._currentTouchSprite._onTouchEndListener &&
typeof (this._currentTouchSprite._onTouchEndListener) == 'function') {
this._currentTouchSprite._onTouchEndListener(pos);
}
}
}
getChildByName(name) {
for (var i = 1; i < this.children.length; ++i) {
let node = this.children[i];
if (node.getName() == name) {
return node;
}
}
return null;
}
seekChildByName(name) {
let result = this.getChildByName(name);
if (result == null) {
for (var i = 1; i < this.children.length; ++i) {
let node = this.children[i];
if (typeof (node.seekChildByName) == 'function') {
result = node.seekChildByName(name);
if (result != null) {
return result;
}
}
}
}
return result;
}
getScreenSize() {
return {
width: this._parent.canvasWidth,
height: this._parent.canvasHeight
};
}
getDefaultScreenSize() {
return {
width: this._parent.canvasBaseW,
height: this._parent.canvasBaseH
};
}
getFullScaleXY() {
let screenSize = this.getScreenSize();
let defaultSize = this.getDefaultScreenSize();
return Math.max(screenSize.height / defaultSize.height, screenSize.width / defaultSize.width);
}
_showMode = false;
showModeOn() {
this._showMode = true;
}
showModeOff() {
this._showMode = false;
}
isShowMode() {
return this._showMode;
}
}
// 节点名
class Nameable {
_parent = null;
constructor(parent) {
this._parent = parent;
}
_name = 'name';
setName(name) {
this._name = name;
}
getName() {
return this._name;
}
getChildByName(name) {
for (var i = 1; i < this._parent.children.length; ++i) {
let node = this._parent.children[i];
if (node.getName() == name) {
return node;
}
}
return null;
}
seekChildByName(name) {
let result = this.getChildByName(name);
if (result == null) {
for (var i = 1; i < this._parent.children.length; ++i) {
let node = this._parent.children[i];
if (typeof (node.seekChildByName) == 'function') {
result = node.seekChildByName(name);
if (result != null) {
return result;
}
}
}
}
return result;
}
}
class UserData {
// 用户自定义数据
userData = {};
get(key) {
return this.userData[key];
}
set(key, value) {
this.userData[key] = value;
}
}
export class MyLabel extends Label {
_nameable = new Nameable(this);
setName(name) {
this._nameable.setName(name);
}
getName() {
return this._nameable.getName();
}
getChildByName(name) {
return this._nameable.getChildByName(name);
}
seekChildByName(name) {
return this._nameable.seekChildByName(name);
}
// 位置
setPosition(x: any = 0, y = undefined) {
if (y !== undefined) {
this.x = x;
this.y = y;
} else {
this.x = x.x;
this.y = x.y;
}
}
setPositionX(x = 0) {
this.x = x;
}
setPositionY(y = 0) {
this.y = y;
}
_userData = new UserData();
get(key) {
return this._userData.get(key);
}
set(key, value) {
this._userData.set(key, value);
}
_touchEnabled = false;
// _swallowTouches = false; // TODO:多重触摸以后用到了再说
_onTouchBeganListener = null;
_onTouchMoveListener = null;
_onTouchEndListener = null;
_onTouchCancelListener = null;
addTouchBeganListener(func) {
this._touchEnabled = true;
this._onTouchBeganListener = func;
}
addTouchMoveListener(func) {
this._touchEnabled = true;
this._onTouchMoveListener = func;
}
addTouchEndListener(func) {
this._touchEnabled = true;
this._onTouchEndListener = func;
}
addTouchCancelListener(func) {
this._touchEnabled = true;
this._onTouchCancelListener = func;
}
_checkHitPosition(pos) {
const rect = this.getBoundingBox();
if (this._checkPointInRect(pos.x, pos.y, rect)) {
return true;
}
return false;
}
_checkPointInRect(x, y, rect) {
if (x >= rect.x && x <= rect.x + rect.width) {
if (y >= rect.y && y <= rect.y + rect.height) {
return true;
}
}
return false;
}
drawText() {
if (!this.text) {
return;
}
this.ctx.font = `${this.fontSize}px ${this.fontName}`;
this.ctx.textAlign = this.textAlign;
this.ctx.textBaseline = 'middle';
this.ctx.fontWeight = this.fontWeight;
let x = -(this.anchorX) * this._width;
let y = 0;
if (this._outlineFlag) {
this.ctx.lineWidth = this._outLineWidth;
this.ctx.strokeStyle = this._outLineColor;
this.ctx.strokeText(this.text, x, y);
}
this.ctx.fillStyle = this.fontColor;
if (this.outline > 0) {
this.ctx.lineWidth = this.outline;
this.ctx.strokeStyle = this.outlineColor;
this.ctx.strokeText(this.text, x, y);
}
this.ctx.fillText(this.text, x, y);
// console.log('汪汪汪: ' + this.scaleX * this.anchorX);
// console.log('汪汪汪: ' + this._width);
}
}
export class TouchSprite extends MySprite {
_nameable = new Nameable(this);
setName(name) {
this._nameable.setName(name);
}
getName() {
return this._nameable.getName();
}
getChildByName(name) {
return this._nameable.getChildByName(name);
}
seekChildByName(name) {
return this._nameable.seekChildByName(name);
}
_touchEnabled = false;
// _swallowTouches = false; // TODO:多重触摸以后用到了再说
_onTouchBeganListener = null;
_onTouchMoveListener = null;
_onTouchEndListener = null;
_onTouchCancelListener = null;
addTouchBeganListener(func) {
this._touchEnabled = true;
this._onTouchBeganListener = func;
}
addTouchMoveListener(func) {
this._touchEnabled = true;
this._onTouchMoveListener = func;
}
addTouchEndListener(func) {
this._touchEnabled = true;
this._onTouchEndListener = func;
}
addTouchCancelListener(func) {
this._touchEnabled = true;
this._onTouchCancelListener = func;
}
_checkHitPosition(pos) {
const rect = this.getBoundingBox();
if (this._checkPointInRect(pos.x, pos.y, rect)) {
return true;
}
return false;
}
_checkPointInRect(x, y, rect) {
if (x >= rect.x && x <= rect.x + rect.width) {
if (y >= rect.y && y <= rect.y + rect.height) {
return true;
}
}
return false;
}
// 位置
setPosition(x: any = 0, y = undefined) {
if (y !== undefined) {
this.x = x;
this.y = y;
} else {
this.x = x.x;
this.y = x.y;
}
}
setPositionX(x = 0) {
this.x = x;
}
setPositionY(y = 0) {
this.y = y;
}
// 用户自定义数据
_userData = new UserData();
get(key) {
return this._userData.get(key);
}
set(key, value) {
this._userData.set(key, value);
}
}
export function blinkItem(item: TouchSprite, time = 0.7) {
let interval = item.get('_blinkInterval');
if (interval) {
clearInterval(interval);
}
interval = setInterval(() => {
showItem(item, time, () => {
hideItem(item, time);
});
}, time * 2 * 1000);
item.set('_blinkInterval', interval);
}
export function stopBlinkItem(item: TouchSprite) {
let interval = item.get('_blinkInterval');
if (interval) {
clearInterval(interval);
}
item.set('_blinkInterval', null);
item.alpha = 0;
}
export function RandomInt(a, b = 0) {
let max = Math.max(a, b);
let min = Math.min(a, b);
return Math.floor(Math.random() * (max - min) + min);
}
export function shake(item, time = 0.5, rate = 1) {
let shakeSelf = function(item, time, callback, rate) {
const offX = 15 * item.scaleX * rate;
const offY = 15 * item.scaleX * rate;
const baseX = item.x;
const baseY = item.y;
const easing = TWEEN.Easing.Sinusoidal.InOut;
const move2 = () => {
moveItem(item, baseX, baseY, time * 9 / 16, () => {
if (callback) {
callback();
}
}, easing);
};
const move1 = () => {
moveItem(item, baseX + offX, baseY + offY, time * 7 / 16, () => {
move2();
}, easing);
};
move1();
}
shakeSelf(item, time, shake.bind(this, item, time, rate), rate);
}
export async function asyncDelayTime(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, time * 1000);
})
}
export async function asyncTweenChange(node, obj, time) {
return new Promise((resolve, reject) => {
tweenChange(node, obj, time, () => {
resolve();
});
});
}
\ No newline at end of file
import {
Game,
TouchSprite,
RandomInt,
MyLabel,
blinkItem,
stopBlinkItem,
asyncDelayTime,
asyncTweenChange,
} from './Game';
import {
Label,
jelly,
showPopParticle,
tweenChange,
rotateItem,
scaleItem,
delayCall,
hideItem,
showItem,
moveItem,
shake,
ShapeRect,
} from './../Unit';
import TWEEN from '@tweenjs/tween.js';
import { defaultData } from './DefaultData';
export class MyGame extends Game {
images = null;
data = null;
status = null;
initData(data) {
this.images = data.images;
this.status = {};
if (!data.data || Object.is(data.data, {}) || !data.data.tittle) {
this.data = defaultData;
} else {
this.data = data.data;
let imgUrlList = [];
// this.data.cubes.forEach((cube) => {
// imgUrlList.push(cube.image.url);
// });
let audioUrlList = [];
// this.data.cubes.forEach((cube) => {
// audioUrlList.push(...(cube.audios.flat(Infinity).filter(val => val !== '')));
// });
// audioUrlList.push(this.data.tittle.audio);
this.preLoadData(imgUrlList, audioUrlList);
}
}
preLoadData(imgUrlList, audioUrlList) {
for (var i = 0; i < imgUrlList.length; ++i) {
this._parent.addUrlToImages(imgUrlList[i]);
}
for (var i = 0; i < audioUrlList.length; ++i) {
this._parent.addUrlToAudioObj(audioUrlList[i]);
}
}
initView() {
// 初始化背景
this.initBg();
// 初始化标题
this.initTittle();
// 初始化中间部分
this.initMiddle();
// 游戏开始
this.gameStart();
}
bg = null;
initBg() {
this.removeChild(this.getChildByName('bg'));
this.getFullScaleXY();
let screenSize = this.getScreenSize();
let defaultSize = this.getDefaultScreenSize();
let bgSized = new TouchSprite();
bgSized.init(this.images.get('Img_bg'));
bgSized.anchorX = 0.5;
bgSized.anchorY = 1;
bgSized.setPosition(this._parent.canvasWidth / 2, this._parent.canvasHeight);
bgSized.setScaleXY(this.getFullScaleXY());
this.addChild(bgSized);
// 背景
let bg = new TouchSprite();
bg.init(this.images.get('Img_bg'))
bg.setPosition(this._parent.canvasWidth / 2, this._parent.canvasHeight / 2);
bg.setScaleXY(this._parent.mapScale);
bg.alpha = 0.5;
bg.setName('bg');
this.addChild(bg);
this.bg = bg;
const bgRect = new ShapeRect();
bgRect.setSize(57, 65);
bgRect.fillColor = '#f8c224';
const sx = this._parent.canvasWidth / this._parent.canvasBaseW;
bgRect.setScaleXY(sx);
bgRect.x = 65 * sx;
bgRect.alpha = 0;
this._parent.renderArr.push(bgRect);
this.bgRect = bgRect;
}
bgRect = null;
getTittleBlockPositionX() {
return this.bgRect.x + 28.5 * this.bgRect.scaleX;
}
initTittle() {
// 标题字母背景
let tittleWordBg = new TouchSprite();
tittleWordBg.init(this.images.get('Img_tittleBg'));
tittleWordBg.setScaleXY(this._parent.mapScale);
tittleWordBg.setPosition(this.getTittleBlockPositionX(), 31 * this._parent.mapScale);
this.addChild(tittleWordBg);
// 标题字母
let tittleWord = new MyLabel();
tittleWord.fontSize = 48;
tittleWord.fontName = 'BerlinSansFBDemi-Bold';
tittleWord.fontColor = '#ab5b22';
tittleWord.text = this.data.tittle.word;
tittleWord.anchorX = 0.5;
tittleWord.anchorY = 0.5;
tittleWord.setPosition(0, 0);
tittleWordBg.addChild(tittleWord);
tittleWord.refreshSize();
// 标题文字
let questionLabel = new MyLabel();
questionLabel.fontSize = 36;
questionLabel.fontName = 'FuturaBT-Bold';
questionLabel.fontColor = '#000000';
questionLabel.text = this.data.tittle.text;
questionLabel.anchorX = 0;
questionLabel.anchorY = 0.5;
questionLabel.setPosition(50, 0);
questionLabel.addTouchBeganListener(() => {
this.onClickTittle();
});
tittleWordBg.addChild(questionLabel);
questionLabel.refreshSize();
}
initMiddle() {
// 创建背景
this.createMiddlebg();
// 创建单词
this.createWords();
// 创建右下角的喇叭
this.createSpeaker();
}
createMiddlebg() {
// 背景
const bookBg = new TouchSprite();
bookBg.init(this.images.get(this.typeDiff('Img_whole_bg_type_A', 'Img_whole_bg_type_B')));
this.bg.addChild(bookBg);
}
createWords() {
const leftPosX = this.typeDiff(-500, -480);
const rightPosX = this.typeDiff(100, 90);
const topPosY = -170;
const middlePosY = 0;
const bottomPosY = this.typeDiff(165, 170);
const positionList = [
[leftPosX, topPosY],
[leftPosX, middlePosY],
[leftPosX, bottomPosY],
[rightPosX, topPosY],
[rightPosX, middlePosY],
[rightPosX, bottomPosY],
];
this.data.words.forEach((word, idx) => {
const questionLabel = new MyLabel();
questionLabel.fontSize = this.typeDiff(48, 54);
questionLabel.fontName = this.typeDiff('CenturyGothic', 'BerlinSansFBDemi-Bold');
questionLabel.fontColor = '#000000';
questionLabel.text = word;
questionLabel.anchorX = 0;
questionLabel.anchorY = 0.5;
questionLabel.setPosition(...positionList[idx]);
questionLabel.addTouchBeganListener(() => {
this.onClickWords(idx);
});
this.bg.addChild(questionLabel);
questionLabel.refreshSize();
});
}
createSpeaker() {
const speaker = new TouchSprite();
speaker.init(this.images.get('Btn_play'));
speaker.setPositionX((this.getScreenSize().width / 2 - 50));
speaker.setPositionY((this.getScreenSize().height / 2 - 50));
this.bg.addChild(speaker);
}
typeDiff(a, b) {
if (this.data.showType === 'A') {
return a;
} else {
return b;
}
}
printCurrentStatus() {
console.log(JSON.stringify(this.status));
}
onClickTittle() {
this._parent.playAudio(this.data.tittle.audio);
}
onClickWords(idx) {
// this._parent.playAudio(this.data.audios[idx]);
}
onClickWinWords(idx) {
}
gameStart() {
this.playIncomeAudio();
}
playIncomeAudio() {
this._parent.playAudio('audio_new_page');
}
}
...@@ -13,7 +13,24 @@ ...@@ -13,7 +13,24 @@
@font-face @font-face
{ {
font-family: 'BRLNSDB'; font-family: 'BerlinSansFBDemi-Bold';
src: url("../../assets/font/BRLNSDB.TTF") ; src: url("../../assets/font/BerlinSansFBDemi-Bold.TTF") ;
}
@font-face
{
font-family: 'FuturaBT-Bold';
src: url("../../assets/font/FuturaBT-Bold.TTF") ;
}
@font-face
{
font-family: 'CenturyGothic';
src: url("../../assets/font/CenturyGothic.TTF") ;
}
@font-face
{
font-family: 'CenturyGothic-Bold';
src: url("../../assets/font/CenturyGothic.TTF") ;
} }
...@@ -12,6 +12,7 @@ import {debounceTime} from 'rxjs/operators'; ...@@ -12,6 +12,7 @@ import {debounceTime} from 'rxjs/operators';
import TWEEN from '@tweenjs/tween.js'; import TWEEN from '@tweenjs/tween.js';
import {MyGame} from "./game/MyGame";
...@@ -57,7 +58,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -57,7 +58,7 @@ export class PlayComponent implements OnInit, OnDestroy {
canvasLeft; canvasLeft;
canvasTop; canvasTop;
saveKey = 'test_0011'; saveKey = 'ym-2-26';
btnLeft; btnLeft;
...@@ -69,6 +70,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -69,6 +70,8 @@ export class PlayComponent implements OnInit, OnDestroy {
curPic; curPic;
game;
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize(event) { onResize(event) {
this.winResizeEventStream.next(); this.winResizeEventStream.next();
...@@ -86,7 +89,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -86,7 +89,13 @@ export class PlayComponent implements OnInit, OnDestroy {
if (data && typeof data == 'object') { if (data && typeof data == 'object') {
this.data = data; this.data = data;
} }
// console.log('data:' , data);
this.game = new MyGame(this);
this.game.initData({
images: this.images,
data: this.data,
});
// 初始化 各事件监听 // 初始化 各事件监听
this.initListener(); this.initListener();
...@@ -432,10 +441,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -432,10 +441,10 @@ export class PlayComponent implements OnInit, OnDestroy {
*/ */
initDefaultData() { initDefaultData() {
if (!this.data.pic_url) { // if (!this.data.pic_url) {
this.data.pic_url = 'assets/play/default/pic.jpg'; // this.data.pic_url = 'assets/play/default/pic.jpg';
this.data.pic_url_2 = 'assets/play/default/pic.jpg'; // this.data.pic_url_2 = 'assets/play/default/pic.jpg';
} // }
} }
...@@ -444,8 +453,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -444,8 +453,8 @@ export class PlayComponent implements OnInit, OnDestroy {
*/ */
initImg() { initImg() {
this.addUrlToImages(this.data.pic_url); // this.addUrlToImages(this.data.pic_url);
this.addUrlToImages(this.data.pic_url_2); // this.addUrlToImages(this.data.pic_url_2);
} }
...@@ -455,11 +464,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -455,11 +464,15 @@ export class PlayComponent implements OnInit, OnDestroy {
initAudio() { initAudio() {
// 音频资源 // 音频资源
this.addUrlToAudioObj(this.data.audio_url); // this.addUrlToAudioObj(this.data.audio_url);
this.addUrlToAudioObj(this.data.audio_url_2); // this.addUrlToAudioObj(this.data.audio_url_2);
// 音效 for (let item of this.rawAudios) {
this.addUrlToAudioObj('click', this.rawAudios.get('click'), 0.3); if (item[0] != item[1]) {
// 音效
this.addUrlToAudioObj(item[0], this.rawAudios.get(item[0]), 0.3);
}
}
} }
...@@ -491,88 +504,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -491,88 +504,7 @@ export class PlayComponent implements OnInit, OnDestroy {
* 初始化试图 * 初始化试图
*/ */
initView() { initView() {
this.game.initView();
this.initPic();
this.initBottomPart();
}
initBottomPart() {
const btnLeft = new MySprite();
btnLeft.init(this.images.get('btn_left'));
btnLeft.x = this.canvasWidth - 150 * this.mapScale;
btnLeft.y = this.canvasHeight - 100 * this.mapScale;
btnLeft.setScaleXY(this.mapScale);
this.renderArr.push(btnLeft);
this.btnLeft = btnLeft;
const btnRight = new MySprite();
btnRight.init(this.images.get('btn_right'));
btnRight.x = this.canvasWidth - 50 * this.mapScale;
btnRight.y = this.canvasHeight - 100 * this.mapScale;
btnRight.setScaleXY(this.mapScale);
this.renderArr.push(btnRight);
this.btnRight = btnRight;
}
initPic() {
const maxW = this.canvasWidth * 0.7;
const pic1 = new MySprite();
pic1.init(this.images.get(this.data.pic_url));
pic1.x = this.canvasWidth / 2;
pic1.y = this.canvasHeight / 2;
pic1.setScaleXY(maxW / pic1.width);
this.renderArr.push(pic1);
this.pic1 = pic1;
const label1 = new Label();
label1.text = this.data.text;
label1.textAlign = 'center';
label1.fontSize = 50;
label1.fontName = 'BRLNSDB';
label1.fontColor = '#ffffff';
pic1.addChild(label1);
const pic2 = new MySprite();
pic2.init(this.images.get(this.data.pic_url_2));
pic2.x = this.canvasWidth / 2 + this.canvasWidth;
pic2.y = this.canvasHeight / 2;
pic2.setScaleXY(maxW / pic2.width);
this.renderArr.push(pic2);
this.pic2 = pic2;
this.curPic = pic1;
}
btnLeftClicked() {
this.lastPage();
}
btnRightClicked() {
this.nextPage();
} }
lastPage() { lastPage() {
...@@ -620,39 +552,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -620,39 +552,15 @@ export class PlayComponent implements OnInit, OnDestroy {
mapDown(event) { mapDown(event) {
this.game._onTouchBegan({x:this.mx,y:this.my});
if (!this.canTouch) {
return;
}
if ( this.checkClickTarget(this.btnLeft) ) {
this.btnLeftClicked();
return;
}
if ( this.checkClickTarget(this.btnRight) ) {
this.btnRightClicked();
return;
}
if ( this.checkClickTarget(this.pic1) ) {
this.pic1Clicked();
return;
}
if ( this.checkClickTarget(this.pic2) ) {
this.pic2Clicked();
return;
}
} }
mapMove(event) { mapMove(event) {
this.game._onTouchMove({x:this.mx,y:this.my});
} }
mapUp(event) { mapUp(event) {
this.game._onTouchEnd({x:this.mx,y:this.my});
} }
......
const res = [ const res = [
// ['bg', "assets/play/bg.jpg"], ['Btn_close', "assets/play/Btn_close.png"],
['btn_left', "assets/play/btn_left.png"], ['Btn_play', "assets/play/Btn_play.png"],
['btn_right', "assets/play/btn_right.png"], ['Img_bg', "assets/play/Img_bg.png"],
// ['text_bg', "assets/play/text_bg.png"], ['Img_mask', "assets/play/Img_mask.png"],
['Img_tittleBg', "assets/play/Img_tittleBg.png"],
['Img_whole_bg_type_A', "assets/play/Img_whole_bg_type_A.png"],
['Img_whole_bg_type_B', "assets/play/Img_whole_bg_type_B.png"],
['Img_winBg_type_A', "assets/play/Img_winBg_type_A.png"],
['Img_winBg_type_B', "assets/play/Img_winBg_type_B.png"],
]; ];
...@@ -11,7 +16,7 @@ const res = [ ...@@ -11,7 +16,7 @@ const res = [
const resAudio = [ const resAudio = [
['click', "assets/play/music/click.mp3"], // ['click', "assets/play/music/click.mp3"],
]; ];
......
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