Skip to content

Commit

Permalink
修复一些小问题
Browse files Browse the repository at this point in the history
  • Loading branch information
MisaLiu committed Nov 19, 2022
1 parent 7f8387d commit b70b96d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
1 change: 1 addition & 0 deletions public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ div.error-window pre * {
width: 100%;
height: 100%;
color: #FFF;
overflow: hidden;
z-index: 10;
pointer-events: none;
touch-action: none;
Expand Down
4 changes: 3 additions & 1 deletion src/chart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default class Chart
stage.addChild(this.sprites.info.songDiff);
}

resizeSprites(size)
resizeSprites(size, isEnded)
{
this.renderSize = size;

Expand Down Expand Up @@ -232,6 +232,7 @@ export default class Chart
judgeline.sprite.position.x = judgeline.x * this.renderSize.width;
judgeline.sprite.position.y = judgeline.y * this.renderSize.height;

if (isEnded) judgeline.sprite.alpha = 0;
if (judgeline.debugSprite) judgeline.debugSprite.scale.set(this.renderSize.heightPercent);
});
}
Expand All @@ -249,6 +250,7 @@ export default class Chart

note.sprite.baseScale = this.renderSize.noteScale;
note.sprite.scale.set(this.renderSize.noteScale * note.xScale, this.renderSize.noteScale);
if (isEnded) note.sprite.alpha = 0;
if (note.debugSprite) note.debugSprite.scale.set(this.renderSize.heightPercent);
});
}
Expand Down
12 changes: 8 additions & 4 deletions src/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export default class Game
this._gameStartTime = NaN;
this._gameEndTime = NaN;
this._isPaused = false;
this._isEnded = false;

this.resize = this.resize.bind(this);
this._pauseBtnClickCallback = this._pauseBtnClickCallback.bind(this);
Expand Down Expand Up @@ -349,6 +350,7 @@ export default class Game
this.chart.calcTime(0);

this._isPaused = false;
this._isEnded = false;

this._animateStatus = 0;
this._gameStartTime = Date.now();
Expand Down Expand Up @@ -531,6 +533,7 @@ export default class Game
});

this._isPaused = false;
this._isEnded = false;
this.sprites.fakeJudgeline.visible = false;

this._runCallback('start');
Expand All @@ -540,6 +543,7 @@ export default class Game
{
this._animateStatus = 3;
this._isPaused = true;
this._isEnded = true;
this._runCallback('end');
}
}
Expand Down Expand Up @@ -631,7 +635,7 @@ export default class Game
this.render.mainContainerCover.visible = false;
}

if (this.sprites)
if (!this._isEnded && this.sprites)
{
if (this.sprites.progressBar)
{
Expand All @@ -653,7 +657,7 @@ export default class Game
this.sprites.fakeJudgeline.position.y = this.render.sizer.height / 2;

this.sprites.fakeJudgeline.height = this.render.sizer.lineScale * 18.75 * 0.008;
if (shouldResetFakeJudgeLine)
if (shouldResetFakeJudgeLine || this._isEnded)
{
this.sprites.fakeJudgeline.width = 0;
}
Expand All @@ -678,8 +682,8 @@ export default class Game

if (withChartSprites)
{
this.judgement.resizeSprites(this.render.sizer);
this.chart.resizeSprites(this.render.sizer);
this.judgement.resizeSprites(this.render.sizer, this._isEnded);
this.chart.resizeSprites(this.render.sizer, this._isEnded);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/judgement/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export default class Judgement
// this.stage.addChild(this.input.sprite);
}

resizeSprites(size)
resizeSprites(size, isEnded)
{
this.renderSize = size;
this.score.resizeSprites(size);
this.input.resizeSprites(size);
this.score.resizeSprites(size, isEnded);
this.input.resizeSprites(size, isEnded);
}

calcTick()
Expand Down
28 changes: 19 additions & 9 deletions src/judgement/score.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class Score
}
}

resizeSprites(size)
resizeSprites(size, isEnded)
{
this.renderSize = size;

Expand All @@ -159,16 +159,26 @@ export default class Score

this.sprites.score.style.fontSize = size.heightPercent * 50;

this.sprites.combo.container.position.x = size.heightPercent * 72;
this.sprites.combo.container.position.y = size.heightPercent * 41;
this.sprites.combo.text.position.x = this.sprites.combo.number.width + size.heightPercent * 6;
this.sprites.combo.text.position.y = size.heightPercent * 30;
if (!isEnded)
{
this.sprites.combo.container.position.x = size.heightPercent * 72;
this.sprites.combo.container.position.y = size.heightPercent * 41;
this.sprites.combo.text.position.x = this.sprites.combo.number.width + size.heightPercent * 6;
this.sprites.combo.text.position.y = size.heightPercent * 30;

this.sprites.acc.position.x = size.heightPercent * 72;
this.sprites.acc.position.y = size.heightPercent * 113;
this.sprites.acc.position.x = size.heightPercent * 72;
this.sprites.acc.position.y = size.heightPercent * 113;

this.sprites.score.position.x = size.width - size.heightPercent * 139;
this.sprites.score.position.y = size.heightPercent * 61;
this.sprites.score.position.x = size.width - size.heightPercent * 139;
this.sprites.score.position.y = size.heightPercent * 61;
}
else
{
this.sprites.combo.container.position.y = size.height;
this.sprites.combo.text.position.y = size.height;
this.sprites.acc.position.y = size.height;
this.sprites.score.position.y = size.height;
}
}

pushJudge(type = 0, judgelines = [])
Expand Down

0 comments on commit b70b96d

Please sign in to comment.