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