军团活动:修复活动结束之后还继续挑战的bug

This commit is contained in:
luying
2022-05-27 12:04:46 +08:00
parent d6c6819723
commit fe711307d6
8 changed files with 64 additions and 8 deletions
@@ -12,6 +12,7 @@ export class CityActivityObject {
private guilds: Map<string, number> = new Map(); // 军团所在的城池 guildCode => cityId
private historyCity: Map<string, number> = new Map(); // 获取自己打开过的城池的页面 roleId => cityId
private sentCity: string[] = [];
private startTime: number = 0;
private getKey(serverId: number, cityId: number) {
return `${serverId}_${cityId}`;
@@ -36,6 +37,14 @@ export class CityActivityObject {
}
}
public startActivity() {
this.startTime = Date.now();
}
public getTimeGap() {
return Date.now() - this.startTime;
}
public hasSent(serverId: number, cityId: number) {
let key = this.getKey(serverId, cityId);
return this.sentCity.indexOf(key) != -1;