Commit ef65364d authored by limingzhe's avatar limingzhe

fix: 修复走查bug

parent de1fdac1
......@@ -1857,12 +1857,9 @@ export function showShapeParticle(shapeType, shapeW, shapeH, pos, parent, num =
const randomColorArr = [
'#ff0000',
'#00ff00',
'#0000ff',
'#00ffff',
'#ff00ff',
'#ffff00',
'#6996af',
'#4da940',
'#911b40',
]
for (let i = 0; i < num; i ++) {
......
......@@ -14,7 +14,7 @@ export async function loadFonts (fontName, fontFile) {
console.log(location.href.split("#")[0] + "assets/play/font/" + fontFile);
const font = new FontFace(
fontName,
"url(" + location.href.split("#")[0] + "assets/play/font/" + fontFile + ")"
"url(" + location.href.split("#")[0] + "../../assets/play/font/" + fontFile + ")"
);
console.log('start: ', new Date().getTime())
......@@ -23,8 +23,6 @@ export async function loadFonts (fontName, fontFile) {
document.fonts.add(font);
document.body.classList.add("fonts-loaded");
} catch (error) {
console.log(error);
}
......
......@@ -23,6 +23,11 @@
src: url("../../assets/play/font/Aileron-Black.ttf")
}
@font-face
{
font-family: 'Aileron-Bold';
src: url("../../assets/play/font/Aileron-Bold.ttf")
}
......
<span style="font-family:'DroidSansFallback'" ></span>
<span style="font-family:'Aileron-Black'" ></span>
<span style="font-family:'Aileron-Bold'" ></span>
<div class="game-container" #wrap>
<canvas id="canvas" style="width: 100%; height: 100%;" #canvas></canvas>
......
......@@ -372,7 +372,9 @@ export class PlayComponent implements OnInit, OnDestroy {
};
addOneAudio('open', this.rawAudios.get('open'), 0.5);
addOneAudio('click', this.rawAudios.get('click'), 0.8);
addOneAudio('more', this.rawAudios.get('more'), 0.8);
addOneAudio('submit', this.rawAudios.get('submit'), 0.8);
// addOneAudio('cow_start', this.rawAudios.get('cow_start'), 1);
// addOneAudio('eat', this.rawAudios.get('eat'), 1);
......@@ -438,7 +440,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// 预加载资源
this.loadResources().then(() => {
......@@ -446,15 +448,15 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('aaaaaa');
loadFonts('DroidSansFallback', 'DroidSansFallback.ttf').then(() => {
console.log('bbbbb');
loadFonts('Aileron-Black', 'Aileron-Black.ttf').then(() => {
console.log('cccc');
this.addServerListener();
window['air'].hideAirClassLoading(this.KEY, this.data);
loadFonts('DroidSansFallback', 'DroidSansFallback.ttf').then( () => {
console.log('bbbbb');
loadFonts('Aileron-Black', 'Aileron-Black.ttf').then( () => {
console.log('cccc');
this.addServerListener();
window['air'].hideAirClassLoading(this.KEY, this.data);
})
})
})
});
......@@ -534,7 +536,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.initView();
}
......@@ -1008,6 +1010,17 @@ export class PlayComponent implements OnInit, OnDestroy {
}
getFillLabel() {
const label = new Label();
label.fontSize = 56;
label.fontColor = '#000000'
label.fontName = 'Aileron-Bold';
label.setScaleXY(this.mapScale);
return label;
}
getSentenceLabel() {
const richText = new RichText();
......@@ -1240,7 +1253,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const title = new Label();
title.fontSize = 72;
title.fontName = 'Aileron-Black';
title.fontName = 'Aileron-Bold';
title.textAlign = 'center';
// title.setMaxSize(this.canvasWidth * 0.9);
// title.x = this.canvasWidth / 2;
......@@ -1278,6 +1291,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.checkClickTarget(this.sentBtn)) {
this.sendServerEvent('game_start', {});
this.setPageData('progress', '1');
this.playAudio('submit', true);
}
}
......@@ -1287,6 +1302,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.moreBtn) {
if (this.checkClickTarget(this.moreBtn)) {
this.moreBtnClick();
this.playAudio('more', true);
return;
}
}
......@@ -1297,6 +1314,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.btnArr[i].visible && this.checkClickTarget(this.btnArr[i])) {
if (!this.btnArr[i].isOff) {
this.btnDown(this.btnArr[i]);
}
return;
}
......@@ -1306,6 +1324,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.checkClickTarget(this.sentenceEmptyArr[i])) {
if (!this.sentenceEmptyArr[i].isRight) {
this.emptyRectDown(this.sentenceEmptyArr[i]);
}
console.log('empty clicked!!');
return;
......@@ -1315,6 +1334,8 @@ export class PlayComponent implements OnInit, OnDestroy {
if (this.checkClickTarget(this.submitBtn)) {
if (this.submitBtn.visible) {
this.submitBtnClick();
this.playAudio('submit', true);
}
return;
}
......@@ -1492,7 +1513,7 @@ export class PlayComponent implements OnInit, OnDestroy {
showRightParticle(emptyRect, point ) {
const shapeW = 25 // * this.mapScale;
const shapeH = 25 // * this.mapScale;
showShapeParticle( 'rect', shapeW, shapeH, point, emptyRect, 30, 50, 180, 0.4);
showShapeParticle( 'rect', shapeW, shapeH, point, emptyRect, 20, 50, 180, 0.4);
}
......@@ -1512,6 +1533,8 @@ export class PlayComponent implements OnInit, OnDestroy {
for (let i = 0; i < this.sentenceEmptyArr.length; i++) {
if (this.checkClickTarget(this.sentenceEmptyArr[i])) {
this.playAudio('click', true);
if (this.sentenceEmptyArr[i].isRight) {
this.moveItemBack();
return;
......@@ -1560,23 +1583,26 @@ export class PlayComponent implements OnInit, OnDestroy {
const data = emptyRect.parent.data;
if (!emptyRect.label) {
emptyRect.label = this.getSentenceLabel();
emptyRect.label = this.getFillLabel();
this.renderArr.push(emptyRect.label);
}
const label = emptyRect.label
label.text = text;
label.width = emptyRect.width;
// label.width = emptyRect.width / this.mapScale;
// label.setScaleXY(1);
label.refreshSize();
const h = label.getAreaHeight();
label.anchorY = 0.5;
label.y = emptyRect.parent.y - label.height * label.scaleY ;
label.x = emptyRect.parent.x + ( emptyRect.x + emptyRect.width / 2 - label.width / 2 ) * emptyRect.parent.scaleX;
label.y = emptyRect.parent.y //- label.height * label.scaleY ;
label.x = emptyRect.parent.x + ( emptyRect.x + emptyRect.width / 2 - label.width / 2 ) * this.mapScale
// const w1 = emptyRect.width / this.mapScale;
// const w2 = label.width;
// label.width = w1// w2 < w1 ? w1: w2;
label['moveOffX'] = -label.width / 2 * label.scaleX;
label['moveOffY'] = -label.height / 1 * label.scaleY;
label['moveOffY'] = 0// -label.height / 2 * label.scaleY;
label['baseX'] = label.x;
label['baseY'] = label.y;
emptyRect.label = label;
......
......@@ -27,7 +27,9 @@ const res = [
const resAudio = [
['open', "assets/play/music/open.mp3"],
['click', "assets/play/music/click.mp3"],
['submit', "assets/play/music/submit.mp3"],
['more', "assets/play/music/more.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