mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 09:02:47 +02:00
[Bug] Fix ME scrolling
This commit is contained in:
parent
dd2f475ded
commit
5e2df13093
@ -506,16 +506,18 @@ export default class MysteryEncounterUiHandler extends UiHandler {
|
|||||||
|
|
||||||
// Sets up the mask that hides the description text to give an illusion of scrolling
|
// Sets up the mask that hides the description text to give an illusion of scrolling
|
||||||
const descriptionTextMaskRect = globalScene.make.graphics({});
|
const descriptionTextMaskRect = globalScene.make.graphics({});
|
||||||
|
const MaskHeight = 57;
|
||||||
descriptionTextMaskRect.setScale(6);
|
descriptionTextMaskRect.setScale(6);
|
||||||
descriptionTextMaskRect.fillStyle(0xffffff);
|
descriptionTextMaskRect.fillStyle(0xffffff);
|
||||||
descriptionTextMaskRect.beginPath();
|
descriptionTextMaskRect.beginPath();
|
||||||
descriptionTextMaskRect.fillRect(6, 53, 206, 57);
|
descriptionTextMaskRect.fillRect(6, 53, 206, MaskHeight);
|
||||||
|
|
||||||
const abilityDescriptionTextMask = descriptionTextMaskRect.createGeometryMask();
|
const abilityDescriptionTextMask = descriptionTextMaskRect.createGeometryMask();
|
||||||
|
|
||||||
descriptionTextObject.setMask(abilityDescriptionTextMask);
|
descriptionTextObject.setMask(abilityDescriptionTextMask);
|
||||||
|
|
||||||
const descriptionLineCount = Math.floor(descriptionTextObject.displayHeight / 10);
|
const displayHeight = descriptionTextObject.displayHeight;
|
||||||
|
const scrollAmount = displayHeight - MaskHeight;
|
||||||
|
|
||||||
if (this.descriptionScrollTween) {
|
if (this.descriptionScrollTween) {
|
||||||
this.descriptionScrollTween.remove();
|
this.descriptionScrollTween.remove();
|
||||||
@ -523,14 +525,14 @@ export default class MysteryEncounterUiHandler extends UiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Animates the description text moving upwards
|
// Animates the description text moving upwards
|
||||||
if (descriptionLineCount > 6) {
|
if (displayHeight > MaskHeight) {
|
||||||
this.descriptionScrollTween = globalScene.tweens.add({
|
this.descriptionScrollTween = globalScene.tweens.add({
|
||||||
targets: descriptionTextObject,
|
targets: descriptionTextObject,
|
||||||
delay: fixedInt(2000),
|
delay: fixedInt(2000),
|
||||||
loop: -1,
|
loop: -1,
|
||||||
hold: fixedInt(2000),
|
hold: fixedInt(2000),
|
||||||
duration: fixedInt((descriptionLineCount - 6) * 2000),
|
duration: fixedInt((scrollAmount / 10) * 2000),
|
||||||
y: `-=${10 * (descriptionLineCount - 6)}`,
|
y: `-=${scrollAmount}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,15 +619,17 @@ export default class MysteryEncounterUiHandler extends UiHandler {
|
|||||||
|
|
||||||
// Sets up the mask that hides the description text to give an illusion of scrolling
|
// Sets up the mask that hides the description text to give an illusion of scrolling
|
||||||
const tooltipTextMaskRect = globalScene.make.graphics({});
|
const tooltipTextMaskRect = globalScene.make.graphics({});
|
||||||
|
const MaskHeight = 32;
|
||||||
tooltipTextMaskRect.setScale(6);
|
tooltipTextMaskRect.setScale(6);
|
||||||
tooltipTextMaskRect.fillStyle(0xffffff);
|
tooltipTextMaskRect.fillStyle(0xffffff);
|
||||||
tooltipTextMaskRect.beginPath();
|
tooltipTextMaskRect.beginPath();
|
||||||
tooltipTextMaskRect.fillRect(this.tooltipContainer.x, this.tooltipContainer.y + 188.5, 150, 32);
|
tooltipTextMaskRect.fillRect(this.tooltipContainer.x, this.tooltipContainer.y + 188.5, 150, MaskHeight);
|
||||||
|
|
||||||
const textMask = tooltipTextMaskRect.createGeometryMask();
|
const textMask = tooltipTextMaskRect.createGeometryMask();
|
||||||
tooltipTextObject.setMask(textMask);
|
tooltipTextObject.setMask(textMask);
|
||||||
|
|
||||||
const tooltipLineCount = Math.floor(tooltipTextObject.displayHeight / 11.2);
|
const displayHeight = tooltipTextObject.displayHeight;
|
||||||
|
const scrollAmount = displayHeight - MaskHeight;
|
||||||
|
|
||||||
if (this.tooltipScrollTween) {
|
if (this.tooltipScrollTween) {
|
||||||
this.tooltipScrollTween.remove();
|
this.tooltipScrollTween.remove();
|
||||||
@ -633,14 +637,14 @@ export default class MysteryEncounterUiHandler extends UiHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Animates the tooltip text moving upwards
|
// Animates the tooltip text moving upwards
|
||||||
if (tooltipLineCount > 3) {
|
if (displayHeight > MaskHeight) {
|
||||||
this.tooltipScrollTween = globalScene.tweens.add({
|
this.tooltipScrollTween = globalScene.tweens.add({
|
||||||
targets: tooltipTextObject,
|
targets: tooltipTextObject,
|
||||||
delay: fixedInt(1200),
|
delay: fixedInt(1200),
|
||||||
loop: -1,
|
loop: -1,
|
||||||
hold: fixedInt(1200),
|
hold: fixedInt(1200),
|
||||||
duration: fixedInt((tooltipLineCount - 3) * 1200),
|
duration: fixedInt((scrollAmount / 11.2) * 1200),
|
||||||
y: `-=${11.2 * (tooltipLineCount - 3)}`,
|
y: `-=${scrollAmount}`,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user