Merge pull request #358 from thecodingmachine/develop

Deploy 2020-10-21 2
This commit is contained in:
David Négrier 2020-10-21 23:39:10 +02:00 committed by GitHub
commit 13a74126a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1140,31 +1140,21 @@ export class GameScene extends ResizableScene implements CenterListener {
} }
private doShareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface) { private doShareGroupPosition(groupPositionMessage: GroupCreatedUpdatedMessageInterface) {
const groupId = groupPositionMessage.groupId; //delete previous group
const groupSize = groupPositionMessage.groupSize; this.doDeleteGroup(groupPositionMessage.groupId);
const group = this.groups.get(groupId);
if (group !== undefined) {
group.setPosition(Math.round(groupPositionMessage.position.x), Math.round(groupPositionMessage.position.y));
} else {
// TODO: circle radius should not be hard stored // TODO: circle radius should not be hard stored
const positionX = 48; //create new group
const positionY = 48;
let texture = 'circleSprite-red';
if(groupSize < 4){
texture = 'circleSprite-white';
}
const sprite = new Sprite( const sprite = new Sprite(
this, this,
Math.round(groupPositionMessage.position.x), Math.round(groupPositionMessage.position.x),
Math.round(groupPositionMessage.position.y), Math.round(groupPositionMessage.position.y),
texture groupPositionMessage.groupSize === 4 ? 'circleSprite-red' : 'circleSprite-white'
); );
sprite.setDisplayOrigin(positionX, positionY); sprite.setDisplayOrigin(48, 48);
this.add.existing(sprite); this.add.existing(sprite);
this.groups.set(groupId, sprite); this.groups.set(groupPositionMessage.groupId, sprite);
} return sprite;
} }
deleteGroup(groupId: number): void { deleteGroup(groupId: number): void {