create message to report
This commit is contained in:
parent
07c17452e7
commit
aeced0c648
6 changed files with 77 additions and 27 deletions
|
@ -1,12 +1,14 @@
|
|||
import {GameScene} from "../Game/GameScene";
|
||||
import {PointInterface} from "../../Connexion/ConnexionModels";
|
||||
import {Character} from "../Entity/Character";
|
||||
import {Sprite} from "./Sprite";
|
||||
|
||||
/**
|
||||
* Class representing the sprite of a remote player (a player that plays on another computer)
|
||||
*/
|
||||
export class RemotePlayer extends Character {
|
||||
userId: number;
|
||||
private report: Sprite;
|
||||
|
||||
constructor(
|
||||
userId: number,
|
||||
|
@ -23,6 +25,25 @@ export class RemotePlayer extends Character {
|
|||
//set data
|
||||
this.userId = userId;
|
||||
|
||||
this.report = new Sprite(Scene, 20, -10, 'report_flag', 3);
|
||||
this.report.setInteractive();
|
||||
this.report.visible = false;
|
||||
this.report.on('pointerup', () => {
|
||||
//this.scene.events.emit('reportUser', {reportedUserId: userId, reportComment: comment});
|
||||
this.scene.events.emit('reportUser', {reportedUserId: this.userId, reportComment: 'test'});
|
||||
this.report.visible = false;
|
||||
});
|
||||
this.add(this.report);
|
||||
|
||||
this.sprites.forEach((sprite: Sprite) => {
|
||||
sprite.on('pointerover', () => {
|
||||
this.report.visible = true;
|
||||
});
|
||||
sprite.on('pointerup', () => {
|
||||
this.report.visible = true;
|
||||
});
|
||||
})
|
||||
|
||||
//the current player model should be push away by other players to prevent conflict
|
||||
//this.setImmovable(false);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue