Merge pull request #1219 from thecodingmachine/rex_outline
Putting an outline on the character name
This commit is contained in:
commit
ee07f637fa
17
CHANGELOG.md
17
CHANGELOG.md
@ -1,4 +1,19 @@
|
|||||||
## Version 1.3.9 - in dev
|
## Version 1.4.x-dev
|
||||||
|
|
||||||
|
### Updates
|
||||||
|
|
||||||
|
- Added the ability to have animated tiles in maps #1216 #1217
|
||||||
|
- Enabled outlines on actionable item again (they were disabled when migrating to Phaser 3.50) #1218
|
||||||
|
- Enabled outlines on player names (when the mouse hovers on a player you can interact with) #1219
|
||||||
|
- Migrated the admin console to Svelte, and redesigned the console #1211
|
||||||
|
|
||||||
|
## Version 1.4.1
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
|
||||||
|
- Loading errors after the preload stage should not crash the game anymore
|
||||||
|
|
||||||
|
## Version 1.4.0
|
||||||
|
|
||||||
### BREAKING CHANGES
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import {Companion} from "../Companion/Companion";
|
|||||||
import type {GameScene} from "../Game/GameScene";
|
import type {GameScene} from "../Game/GameScene";
|
||||||
import {DEPTH_INGAME_TEXT_INDEX} from "../Game/DepthIndexes";
|
import {DEPTH_INGAME_TEXT_INDEX} from "../Game/DepthIndexes";
|
||||||
import {waScaleManager} from "../Services/WaScaleManager";
|
import {waScaleManager} from "../Services/WaScaleManager";
|
||||||
|
import type OutlinePipelinePlugin from "phaser3-rex-plugins/plugins/outlinepipeline-plugin.js";
|
||||||
|
|
||||||
const playerNameY = - 25;
|
const playerNameY = - 25;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ export abstract class Character extends Container {
|
|||||||
public companion?: Companion;
|
public companion?: Companion;
|
||||||
private emote: Phaser.GameObjects.Sprite | null = null;
|
private emote: Phaser.GameObjects.Sprite | null = null;
|
||||||
private emoteTween: Phaser.Tweens.Tween|null = null;
|
private emoteTween: Phaser.Tweens.Tween|null = null;
|
||||||
|
scene: GameScene;
|
||||||
|
|
||||||
constructor(scene: GameScene,
|
constructor(scene: GameScene,
|
||||||
x: number,
|
x: number,
|
||||||
@ -46,6 +48,7 @@ export abstract class Character extends Container {
|
|||||||
companionTexturePromise?: Promise<string>
|
companionTexturePromise?: Promise<string>
|
||||||
) {
|
) {
|
||||||
super(scene, x, y/*, texture, frame*/);
|
super(scene, x, y/*, texture, frame*/);
|
||||||
|
this.scene = scene;
|
||||||
this.PlayerValue = name;
|
this.PlayerValue = name;
|
||||||
this.invisible = true
|
this.invisible = true
|
||||||
|
|
||||||
@ -67,6 +70,19 @@ export abstract class Character extends Container {
|
|||||||
hitAreaCallback: Phaser.Geom.Circle.Contains, //eslint-disable-line @typescript-eslint/unbound-method
|
hitAreaCallback: Phaser.Geom.Circle.Contains, //eslint-disable-line @typescript-eslint/unbound-method
|
||||||
useHandCursor: true,
|
useHandCursor: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.on('pointerover',() => {
|
||||||
|
this.getOutlinePlugin()?.add(this.playerName, {
|
||||||
|
thickness: 2,
|
||||||
|
outlineColor: 0xffff00
|
||||||
|
});
|
||||||
|
this.scene.markDirty();
|
||||||
|
});
|
||||||
|
this.on('pointerout',() => {
|
||||||
|
this.getOutlinePlugin()?.remove(this.playerName);
|
||||||
|
this.scene.markDirty();
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.add.existing(this);
|
scene.add.existing(this);
|
||||||
@ -86,6 +102,10 @@ export abstract class Character extends Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getOutlinePlugin(): OutlinePipelinePlugin|undefined {
|
||||||
|
return this.scene.plugins.get('rexOutlinePipeline') as unknown as OutlinePipelinePlugin|undefined;
|
||||||
|
}
|
||||||
|
|
||||||
public addCompanion(name: string, texturePromise?: Promise<string>): void {
|
public addCompanion(name: string, texturePromise?: Promise<string>): void {
|
||||||
if (typeof texturePromise !== 'undefined') {
|
if (typeof texturePromise !== 'undefined') {
|
||||||
this.companion = new Companion(this.scene, this.x, this.y, name, texturePromise);
|
this.companion = new Companion(this.scene, this.x, this.y, name, texturePromise);
|
||||||
|
@ -69,6 +69,10 @@ export abstract class DirtyScene extends ResizableScene {
|
|||||||
return this.dirty || this.objectListChanged;
|
return this.dirty || this.objectListChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public markDirty(): void {
|
||||||
|
this.events.once(Phaser.Scenes.Events.POST_UPDATE, () => this.dirty = true);
|
||||||
|
}
|
||||||
|
|
||||||
public onResize(): void {
|
public onResize(): void {
|
||||||
this.objectListChanged = true;
|
this.objectListChanged = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user