题目间隔时间增加特效播放时间, 修改题目选取条件
This commit is contained in:
parent
9b475f0a4a
commit
aaeba429ad
@ -12,10 +12,22 @@ export class GameEnv {
|
|||||||
// PVP答对基础分
|
// PVP答对基础分
|
||||||
public pvpBaseScore: number
|
public pvpBaseScore: number
|
||||||
|
|
||||||
|
// 特效播放时间
|
||||||
|
public effectTimeLong: number
|
||||||
|
|
||||||
public init(data: Map<number, compound_vo>) {
|
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.pvpComboRate = +data.get(99017).value
|
||||||
this.pvpTimeRate = +data.get(99016).value
|
this.pvpTimeRate = +data.get(99016).value
|
||||||
this.pvpBaseScore = +data.get(99015).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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class PuzzleClass extends BaseModule {
|
|||||||
return this.findOne({deleted: 0, is_hide: 0, _id: {$gt: id }}).exec()
|
return this.findOne({deleted: 0, is_hide: 0, _id: {$gt: id }}).exec()
|
||||||
}
|
}
|
||||||
public static async randomQuestions(this: ReturnModelType<typeof PuzzleClass>, options: any, count: number) {
|
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)
|
Object.assign(options)
|
||||||
return Puzzle.aggregate([
|
return Puzzle.aggregate([
|
||||||
{ $match: filters },
|
{ $match: filters },
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
beginGame,
|
beginGame,
|
||||||
closeRoom,
|
|
||||||
endGame,
|
endGame,
|
||||||
sendQuestion,
|
sendQuestion,
|
||||||
updateRound,
|
updateRound,
|
||||||
@ -60,7 +59,7 @@ export function checkSubFinish(history: any, qid: string) {
|
|||||||
*/
|
*/
|
||||||
export async function startGame(roomId: string, sessionId: string) {
|
export async function startGame(roomId: string, sessionId: string) {
|
||||||
let history = await PuzzleSession.findById(sessionId)
|
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, {})
|
await beginGame(roomId, {})
|
||||||
history.questions = records.map(o => o._id)
|
history.questions = records.map(o => o._id)
|
||||||
await history.save()
|
await history.save()
|
||||||
@ -89,7 +88,7 @@ export async function sendOneQuestion(history: any) {
|
|||||||
await sendQuestion(roomId, qdata)
|
await sendQuestion(roomId, qdata)
|
||||||
history.current++
|
history.current++
|
||||||
await history.save()
|
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 subHistory = await PuzzleSession.findById(history.id)
|
||||||
let datas = []
|
let datas = []
|
||||||
for (let [accountid, data] of subHistory.members) {
|
for (let [accountid, data] of subHistory.members) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user