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();
|
||||
});
|
||||
liveshare.onDidChangePeers(({ added, removed }: { added: vsls.Peer[], removed: vsls.Peer[] }) => {
|
||||
if (added.length) return this._activity.increasePartySize();
|
||||
else if (removed.length) return this._activity.decreasePartySize();
|
||||
if (added.length) return this._activity.increasePartySize(added.length);
|
||||
else if (removed.length) return this._activity.decreasePartySize(removed.length);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -164,23 +164,23 @@ export default class Activity implements Disposable {
|
|||
return this._state;
|
||||
}
|
||||
|
||||
public increasePartySize() {
|
||||
if (!this._state || !this._state.partySize) return;
|
||||
public increasePartySize(size?: number) {
|
||||
if (!this._state) return;
|
||||
if (this.state && this._state.partySize === 5) return;
|
||||
this._state = {
|
||||
...this._state,
|
||||
partySize: this._state.partySize + 1
|
||||
partySize: this._state.partySize ? this._state.partySize + 1 : size
|
||||
};
|
||||
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public decreasePartySize() {
|
||||
if (!this._state || !this._state.partySize) return;
|
||||
public decreasePartySize(size?: number) {
|
||||
if (!this._state) return;
|
||||
if (this.state && this._state.partySize === 1) return;
|
||||
this._state = {
|
||||
...this._state,
|
||||
partySize: this._state.partySize - 1
|
||||
partySize: this._state.partySize ? this._state.partySize - 1 : size
|
||||
};
|
||||
|
||||
return this._state;
|
||||
|
|
Loading…
Reference in a new issue