题目间隔时间增加特效播放时间, 修改题目选取条件

This commit is contained in:
zhl 2021-05-10 11:27:22 +08:00
parent 9b475f0a4a
commit aaeba429ad
3 changed files with 16 additions and 5 deletions

View File

@ -12,10 +12,22 @@ export class GameEnv {
// PVP答对基础分
public pvpBaseScore: number
// 特效播放时间
public effectTimeLong: number
public init(data: Map<number, compound_vo>) {
this.pvpInterval = (+data.get(99018).value) * 1000
this.pvpInterval = (+data.get(99018).value)
this.pvpComboRate = +data.get(99017).value
this.pvpTimeRate = +data.get(99016).value
this.pvpBaseScore = +data.get(99015).value
this.effectTimeLong = +data.get(99025).value
}
/**
* pvp模式下每题之间的间隔
* @return {number}
*/
public get pvpQuestionInterval() {
return (this.pvpInterval + this.effectTimeLong) * 1000
}
}

View File

@ -98,7 +98,7 @@ class PuzzleClass extends BaseModule {
return this.findOne({deleted: 0, is_hide: 0, _id: {$gt: id }}).exec()
}
public static async randomQuestions(this: ReturnModelType<typeof PuzzleClass>, options: any, count: number) {
let filters = {status: 1, is_hide: 0, deleted: 0}
let filters = {status: 1, is_hide: 0, deleted: 0, dp: 1}
Object.assign(options)
return Puzzle.aggregate([
{ $match: filters },

View File

@ -1,6 +1,5 @@
import {
beginGame,
closeRoom,
endGame,
sendQuestion,
updateRound,
@ -60,7 +59,7 @@ export function checkSubFinish(history: any, qid: string) {
*/
export async function startGame(roomId: string, sessionId: string) {
let history = await PuzzleSession.findById(sessionId)
let records = await Puzzle.randomQuestions({}, history.total)
let records = await Puzzle.randomQuestions({status: 1, is_hide: 0, deleted: 0, dp: 1}, history.total)
await beginGame(roomId, {})
history.questions = records.map(o => o._id)
await history.save()
@ -89,7 +88,7 @@ export async function sendOneQuestion(history: any) {
await sendQuestion(roomId, qdata)
history.current++
await history.save()
new Schedule().beginSchedule(new GameEnv().pvpInterval, async function () {
new Schedule().beginSchedule(new GameEnv().pvpQuestionInterval, async function () {
let subHistory = await PuzzleSession.findById(history.id)
let datas = []
for (let [accountid, data] of subHistory.members) {