|
|
@@ -610,7 +610,10 @@ export class GameService implements OnModuleInit {
|
|
|
}
|
|
|
const subject = new Subject<GameEvent>()
|
|
|
let voteSubject = new Subject<string>()
|
|
|
- voteSubject.subscribe((v) => (choice = v))
|
|
|
+ voteSubject.subscribe({
|
|
|
+ next: (v) => (choice = v),
|
|
|
+ complete: () => (voteSubject = null)
|
|
|
+ })
|
|
|
const self = this
|
|
|
subject.subscribe({
|
|
|
async next(evt) {
|
|
|
@@ -645,7 +648,9 @@ export class GameService implements OnModuleInit {
|
|
|
break
|
|
|
}
|
|
|
this.logger.log('等待投票结束')
|
|
|
- !voteSubject.closed && (await lastValueFrom(voteSubject))
|
|
|
+ if (voteSubject) {
|
|
|
+ await lastValueFrom(voteSubject)
|
|
|
+ }
|
|
|
this.logger.log(`选择: ${choice}`)
|
|
|
addCharactor = null
|
|
|
if (lastState.charactors.filter((i) => !i.dead).length < 8) {
|