2023-03-28 19:54:52 +01:00
|
|
|
export enum TextStyle {
|
|
|
|
MESSAGE,
|
|
|
|
WINDOW,
|
2023-04-02 01:06:44 +01:00
|
|
|
BATTLE_INFO,
|
2023-03-28 19:54:52 +01:00
|
|
|
PARTY
|
|
|
|
};
|
|
|
|
|
|
|
|
export function addTextObject(scene: Phaser.Scene, x: number, y: number, content: string, style: TextStyle, extraStyleOptions?: Phaser.Types.GameObjects.Text.TextStyle) {
|
|
|
|
let styleOptions;
|
|
|
|
let shadowColor;
|
2023-04-02 01:06:44 +01:00
|
|
|
let shadowSize = 6;
|
2023-03-28 19:54:52 +01:00
|
|
|
|
|
|
|
switch (style) {
|
|
|
|
case TextStyle.WINDOW:
|
|
|
|
styleOptions = {
|
|
|
|
fontFamily: 'emerald',
|
|
|
|
fontSize: '96px',
|
|
|
|
color: '#484848',
|
|
|
|
padding: {
|
|
|
|
bottom: 6
|
|
|
|
}
|
|
|
|
};
|
|
|
|
shadowColor = '#d0d0c8';
|
|
|
|
break;
|
|
|
|
case TextStyle.MESSAGE:
|
|
|
|
styleOptions = {
|
|
|
|
fontFamily: 'emerald',
|
|
|
|
fontSize: '96px',
|
|
|
|
color: '#f8f8f8',
|
|
|
|
padding: {
|
|
|
|
bottom: 6
|
|
|
|
}
|
|
|
|
};
|
|
|
|
shadowColor = '#6b5a73';
|
|
|
|
break;
|
2023-04-02 01:06:44 +01:00
|
|
|
case TextStyle.BATTLE_INFO:
|
|
|
|
styleOptions = {
|
|
|
|
fontFamily: 'emerald',
|
|
|
|
fontSize: '72px',
|
|
|
|
color: '#404040'
|
|
|
|
};
|
|
|
|
shadowColor = '#ded6b5';
|
|
|
|
shadowSize = 4;
|
|
|
|
break;
|
2023-03-28 19:54:52 +01:00
|
|
|
case TextStyle.PARTY:
|
|
|
|
styleOptions = {
|
|
|
|
fontFamily: 'pkmnems',
|
|
|
|
fontSize: '66px',
|
|
|
|
color: '#f8f8f8',
|
|
|
|
padding: {
|
|
|
|
bottom: 6
|
|
|
|
}
|
|
|
|
};
|
|
|
|
shadowColor = '#707070';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (extraStyleOptions)
|
|
|
|
styleOptions = Object.assign(styleOptions, extraStyleOptions);
|
|
|
|
|
|
|
|
const ret = scene.add.text(x, y, content, styleOptions);
|
|
|
|
ret.setScale(0.1666666667);
|
2023-04-02 01:06:44 +01:00
|
|
|
ret.setShadow(shadowSize, shadowSize, shadowColor);
|
2023-03-28 19:54:52 +01:00
|
|
|
ret.setLineSpacing(5);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|