Add damage numbers feature
This commit is contained in:
1 parent
f48464d48d
commit
716d8853a3
7 files changed
+198
-3
No files matched your search
@@ -36,6 +36,24 @@ export function initGameSpeed() {
|
||||
config.hold = transformValue(config.hold);
|
||||
return originalTweensAdd.apply(this, [ config ]);
|
||||
};
|
||||
const originalTweensChain = this.tweens.chain;
|
||||
this.tweens.chain = function (config: Phaser.Types.Tweens.TweenChainBuilderConfig): Phaser.Tweens.TweenChain {
|
||||
if (config.tweens) {
|
||||
config.tweens.forEach(t => {
|
||||
if (t.duration)
|
||||
t.duration = transformValue(t.duration);
|
||||
if (t.delay)
|
||||
t.delay = transformValue(t.delay);
|
||||
if (t.repeatDelay)
|
||||
t.repeatDelay = transformValue(t.repeatDelay);
|
||||
if (t.loopDelay)
|
||||
t.loopDelay = transformValue(t.loopDelay);
|
||||
if (t.hold)
|
||||
t.hold = transformValue(t.hold);
|
||||
});
|
||||
}
|
||||
return originalTweensChain.apply(this, [ config ]);
|
||||
};
|
||||
const originalAddCounter = this.tweens.addCounter;
|
||||
this.tweens.addCounter = function (config: Phaser.Types.Tweens.NumberTweenBuilderConfig) {
|
||||
if (config.duration)
|
||||
|
||||
@@ -7,6 +7,7 @@ export enum Setting {
|
||||
Master_Volume = "MASTER_VOLUME",
|
||||
BGM_Volume = "BGM_VOLUME",
|
||||
SE_Volume = "SE_VOLUME",
|
||||
Damage_Numbers = "DAMAGE_NUMBERS",
|
||||
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS",
|
||||
Window_Type = "WINDOW_TYPE",
|
||||
Tutorials = "TUTORIALS",
|
||||
@@ -29,6 +30,7 @@ export const settingOptions: SettingOptions = {
|
||||
[Setting.Master_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||
[Setting.BGM_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||
[Setting.SE_Volume]: new Array(11).fill(null).map((_, i) => i ? (i * 10).toString() : 'Mute'),
|
||||
[Setting.Damage_Numbers]: [ 'Off', 'Simple', 'Fancy' ],
|
||||
[Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ],
|
||||
[Setting.Window_Type]: new Array(4).fill(null).map((_, i) => (i + 1).toString()),
|
||||
[Setting.Tutorials]: [ 'Off', 'On' ],
|
||||
@@ -43,6 +45,7 @@ export const settingDefaults: SettingDefaults = {
|
||||
[Setting.Master_Volume]: 5,
|
||||
[Setting.BGM_Volume]: 10,
|
||||
[Setting.SE_Volume]: 10,
|
||||
[Setting.Damage_Numbers]: 0,
|
||||
[Setting.Show_Stats_on_Level_Up]: 1,
|
||||
[Setting.Window_Type]: 0,
|
||||
[Setting.Tutorials]: 1,
|
||||
@@ -69,6 +72,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
|
||||
scene.seVolume = value ? parseInt(settingOptions[setting][value]) * 0.01 : 0;
|
||||
scene.updateSoundVolume();
|
||||
break;
|
||||
case Setting.Damage_Numbers:
|
||||
scene.damageNumbersMode = value;
|
||||
break;
|
||||
case Setting.Show_Stats_on_Level_Up:
|
||||
scene.showLevelUpStats = settingOptions[setting][value] === 'On';
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user