little cleanup
This commit is contained in:
parent
06d403ebe3
commit
5ae039b987
@ -11,7 +11,7 @@ vim: ft=typescript
|
||||
|
||||
function name(userId: number): string {
|
||||
const user = gameScene.MapPlayersByKey.get(userId);
|
||||
return user ? user.PlayerValue : "";
|
||||
return user ? user.playerName : "";
|
||||
}
|
||||
|
||||
function sendFollowRequest() {
|
||||
|
@ -30,8 +30,8 @@ const interactiveRadius = 35;
|
||||
|
||||
export abstract class Character extends Container {
|
||||
private bubble: SpeechBubble | null = null;
|
||||
private readonly playerName: Text;
|
||||
public PlayerValue: string;
|
||||
private readonly playerNameText: Text;
|
||||
public playerName: string;
|
||||
public sprites: Map<string, Sprite>;
|
||||
protected lastDirection: PlayerAnimationDirections = PlayerAnimationDirections.Down;
|
||||
//private teleportation: Sprite;
|
||||
@ -59,7 +59,7 @@ export abstract class Character extends Container {
|
||||
) {
|
||||
super(scene, x, y /*, texture, frame*/);
|
||||
this.scene = scene;
|
||||
this.PlayerValue = name;
|
||||
this.playerName = name;
|
||||
this.invisible = true;
|
||||
|
||||
this.sprites = new Map<string, Sprite>();
|
||||
@ -83,7 +83,7 @@ export abstract class Character extends Container {
|
||||
});
|
||||
});
|
||||
|
||||
this.playerName = new Text(scene, 0, playerNameY, name, {
|
||||
this.playerNameText = new Text(scene, 0, playerNameY, name, {
|
||||
fontFamily: '"Press Start 2P"',
|
||||
fontSize: "8px",
|
||||
strokeThickness: 2,
|
||||
@ -94,8 +94,8 @@ export abstract class Character extends Container {
|
||||
fontSize: 35,
|
||||
},
|
||||
});
|
||||
this.playerName.setOrigin(0.5).setDepth(DEPTH_INGAME_TEXT_INDEX);
|
||||
this.add(this.playerName);
|
||||
this.playerNameText.setOrigin(0.5).setDepth(DEPTH_INGAME_TEXT_INDEX);
|
||||
this.add(this.playerNameText);
|
||||
|
||||
if (isClickable) {
|
||||
this.setInteractive({
|
||||
@ -114,10 +114,10 @@ export abstract class Character extends Container {
|
||||
|
||||
this.outlineColorStoreUnsubscribe = this.outlineColorStore.subscribe((color) => {
|
||||
if (color === undefined) {
|
||||
this.getOutlinePlugin()?.remove(this.playerName);
|
||||
this.getOutlinePlugin()?.remove(this.playerNameText);
|
||||
} else {
|
||||
this.getOutlinePlugin()?.remove(this.playerName);
|
||||
this.getOutlinePlugin()?.add(this.playerName, {
|
||||
this.getOutlinePlugin()?.remove(this.playerNameText);
|
||||
this.getOutlinePlugin()?.add(this.playerNameText, {
|
||||
thickness: 2,
|
||||
outlineColor: color,
|
||||
});
|
||||
@ -408,7 +408,7 @@ export abstract class Character extends Container {
|
||||
private destroyEmote() {
|
||||
this.emote?.destroy();
|
||||
this.emote = null;
|
||||
this.playerName.setVisible(true);
|
||||
this.playerNameText.setVisible(true);
|
||||
}
|
||||
|
||||
public get pictureStore(): PictureStore {
|
||||
|
@ -57,24 +57,10 @@ export class RemotePlayer extends Character {
|
||||
actionsMenuStore.clear();
|
||||
return;
|
||||
}
|
||||
actionsMenuStore.initialize(this.PlayerValue);
|
||||
actionsMenuStore.addAction(
|
||||
"Visiting Card", () => {
|
||||
requestVisitCardsStore.set(this.visitCardUrl);
|
||||
actionsMenuStore.clear();
|
||||
});
|
||||
actionsMenuStore.addAction(
|
||||
"Log Hello", () => {
|
||||
console.log('HELLO');
|
||||
});
|
||||
actionsMenuStore.addAction(
|
||||
"Log Goodbye", () => {
|
||||
console.log('GOODBYE');
|
||||
});
|
||||
actionsMenuStore.addAction(
|
||||
"Clear Goodbye Action", () => {
|
||||
actionsMenuStore.removeAction("Log Goodbye");
|
||||
});
|
||||
actionsMenuStore.initialize(this.playerName);
|
||||
for (const action of this.getActionsMenuActions()) {
|
||||
actionsMenuStore.addAction(action.actionName, action.callback);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -96,4 +82,34 @@ export class RemotePlayer extends Character {
|
||||
actionsMenuStore.clear();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
private getActionsMenuActions(): { actionName: string, callback: Function }[] {
|
||||
return [
|
||||
{
|
||||
actionName: "Visiting Card",
|
||||
callback: () => {
|
||||
requestVisitCardsStore.set(this.visitCardUrl);
|
||||
actionsMenuStore.clear();
|
||||
}
|
||||
},
|
||||
{
|
||||
actionName: "Log Hello",
|
||||
callback: () => {
|
||||
console.log('HELLO');
|
||||
}
|
||||
},
|
||||
{
|
||||
actionName: "Log Goodbye",
|
||||
callback: () => {
|
||||
console.log('GOODBYE');
|
||||
}
|
||||
},
|
||||
{
|
||||
actionName: "Clear Goodbye Action",
|
||||
callback: () => {
|
||||
actionsMenuStore.removeAction("Log Goodbye");
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user