mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 00:52:47 +02:00
Cleanup text.ts file
This commit is contained in:
parent
c353f54a42
commit
6030dd6462
10
src/@types/ui.ts
Normal file
10
src/@types/ui.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import type Phaser from "phaser";
|
||||
import type InputText from "phaser3-rex-plugins/plugins/gameobjects/dom/inputtext/InputText";
|
||||
|
||||
export interface TextStyleOptions {
|
||||
scale: number;
|
||||
styleOptions: Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig;
|
||||
shadowColor: string;
|
||||
shadowXpos: number;
|
||||
shadowYpos: number;
|
||||
}
|
@ -7,14 +7,7 @@ import { globalScene } from "#app/global-scene";
|
||||
import { ModifierTier } from "../enums/modifier-tier";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { TextStyle } from "#enums/text-style";
|
||||
|
||||
export interface TextStyleOptions {
|
||||
scale: number;
|
||||
styleOptions: Phaser.Types.GameObjects.Text.TextStyle | InputText.IConfig;
|
||||
shadowColor: string;
|
||||
shadowXpos: number;
|
||||
shadowYpos: number;
|
||||
}
|
||||
import type { TextStyleOptions } from "#app/@types/ui";
|
||||
|
||||
export function addTextObject(
|
||||
x: number,
|
||||
@ -29,9 +22,10 @@ export function addTextObject(
|
||||
extraStyleOptions,
|
||||
);
|
||||
|
||||
const ret = globalScene.add.text(x, y, content, styleOptions);
|
||||
ret.setScale(scale);
|
||||
ret.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
const ret = globalScene.add
|
||||
.text(x, y, content, styleOptions)
|
||||
.setScale(scale)
|
||||
.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) {
|
||||
ret.setLineSpacing(scale * 30);
|
||||
}
|
||||
@ -53,8 +47,7 @@ export function setTextStyle(
|
||||
globalScene.uiTheme,
|
||||
extraStyleOptions,
|
||||
);
|
||||
obj.setScale(scale);
|
||||
obj.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
obj.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
if (!(styleOptions as Phaser.Types.GameObjects.Text.TextStyle).lineSpacing) {
|
||||
obj.setLineSpacing(scale * 30);
|
||||
}
|
||||
@ -79,8 +72,7 @@ export function addBBCodeTextObject(
|
||||
|
||||
const ret = new BBCodeText(globalScene, x, y, content, styleOptions as BBCodeText.TextStyle);
|
||||
globalScene.add.existing(ret);
|
||||
ret.setScale(scale);
|
||||
ret.setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
ret.setScale(scale).setShadow(shadowXpos, shadowYpos, shadowColor);
|
||||
if (!(styleOptions as BBCodeText.TextStyle).lineSpacing) {
|
||||
ret.setLineSpacing(scale * 60);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user