fix: partySize
This commit is contained in:
parent
c424499a96
commit
66f21b1c7e
2 changed files with 8 additions and 8 deletions
|
@ -138,8 +138,8 @@ export default class RPCClient implements Disposable {
|
||||||
else return this._activity.changePartyId();
|
else return this._activity.changePartyId();
|
||||||
});
|
});
|
||||||
liveshare.onDidChangePeers(({ added, removed }: { added: vsls.Peer[], removed: vsls.Peer[] }) => {
|
liveshare.onDidChangePeers(({ added, removed }: { added: vsls.Peer[], removed: vsls.Peer[] }) => {
|
||||||
if (added.length) return this._activity.increasePartySize();
|
if (added.length) return this._activity.increasePartySize(added.length);
|
||||||
else if (removed.length) return this._activity.decreasePartySize();
|
else if (removed.length) return this._activity.decreasePartySize(removed.length);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -164,23 +164,23 @@ export default class Activity implements Disposable {
|
||||||
return this._state;
|
return this._state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public increasePartySize() {
|
public increasePartySize(size?: number) {
|
||||||
if (!this._state || !this._state.partySize) return;
|
if (!this._state) return;
|
||||||
if (this.state && this._state.partySize === 5) return;
|
if (this.state && this._state.partySize === 5) return;
|
||||||
this._state = {
|
this._state = {
|
||||||
...this._state,
|
...this._state,
|
||||||
partySize: this._state.partySize + 1
|
partySize: this._state.partySize ? this._state.partySize + 1 : size
|
||||||
};
|
};
|
||||||
|
|
||||||
return this._state;
|
return this._state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public decreasePartySize() {
|
public decreasePartySize(size?: number) {
|
||||||
if (!this._state || !this._state.partySize) return;
|
if (!this._state) return;
|
||||||
if (this.state && this._state.partySize === 1) return;
|
if (this.state && this._state.partySize === 1) return;
|
||||||
this._state = {
|
this._state = {
|
||||||
...this._state,
|
...this._state,
|
||||||
partySize: this._state.partySize - 1
|
partySize: this._state.partySize ? this._state.partySize - 1 : size
|
||||||
};
|
};
|
||||||
|
|
||||||
return this._state;
|
return this._state;
|
||||||
|
|
Loading…
Reference in a new issue