2025-09-08 15:10:51 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 技师的解锁数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
import { BaseData } from "./BaseData";
|
|
|
|
|
|
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
2025-09-21 19:49:08 +08:00
|
|
|
|
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
2025-09-08 15:10:51 +08:00
|
|
|
|
|
|
|
|
|
|
export class GirlUnlockData extends BaseData {
|
|
|
|
|
|
// id
|
|
|
|
|
|
private id: number;
|
|
|
|
|
|
// 付费技师是否已经解锁
|
2025-09-22 17:54:33 +08:00
|
|
|
|
private isRelease: boolean;
|
|
|
|
|
|
// 角色解锁时间,时间戳,秒
|
|
|
|
|
|
private unlockTime: number;
|
2025-09-08 15:10:51 +08:00
|
|
|
|
// 解锁图片 id
|
|
|
|
|
|
private unlockedImageIds: number[];
|
|
|
|
|
|
// 解锁视频 id
|
|
|
|
|
|
private unlockedVideoIds: number[];
|
|
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
|
super();
|
|
|
|
|
|
this.id = 0;
|
|
|
|
|
|
this.isRelease = false;
|
2025-09-22 17:54:33 +08:00
|
|
|
|
this.unlockTime = 0;
|
2025-09-08 15:10:51 +08:00
|
|
|
|
this.unlockedImageIds = [];
|
|
|
|
|
|
this.unlockedVideoIds = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public reset(): void {
|
|
|
|
|
|
this.id = 0;
|
|
|
|
|
|
this.isRelease = false;
|
2025-09-22 17:54:33 +08:00
|
|
|
|
this.unlockTime = 0;
|
2025-09-08 15:10:51 +08:00
|
|
|
|
this.unlockedImageIds = [];
|
|
|
|
|
|
this.unlockedVideoIds = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public clear(): void {
|
|
|
|
|
|
this.id = 0;
|
|
|
|
|
|
this.isRelease = false;
|
2025-09-22 17:54:33 +08:00
|
|
|
|
this.unlockTime = 0;
|
2025-09-08 15:10:51 +08:00
|
|
|
|
this.unlockedImageIds = [];
|
|
|
|
|
|
this.unlockedVideoIds = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public destroy(): void {
|
|
|
|
|
|
super.destroy();
|
|
|
|
|
|
this.id = null;
|
|
|
|
|
|
this.isRelease = null;
|
2025-09-22 17:54:33 +08:00
|
|
|
|
this.unlockTime = null;
|
2025-09-08 15:10:51 +08:00
|
|
|
|
this.unlockedImageIds = null;
|
|
|
|
|
|
this.unlockedVideoIds = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取 id */
|
|
|
|
|
|
public getId(): number {
|
|
|
|
|
|
return this.id;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 保存 id */
|
|
|
|
|
|
public setId(value: number): void {
|
|
|
|
|
|
this.id = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取 付费技师是否已经解锁 */
|
|
|
|
|
|
public getIsRelease(): boolean {
|
|
|
|
|
|
return this.isRelease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 保存 付费技师是否已经解锁 */
|
|
|
|
|
|
public setIsRelease(value: boolean): void {
|
|
|
|
|
|
this.isRelease = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-22 17:54:33 +08:00
|
|
|
|
/** 获取 角色解锁时间,时间戳,秒 */
|
|
|
|
|
|
public getUnlockTime(): number {
|
|
|
|
|
|
return this.unlockTime;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 保存 角色解锁时间,时间戳,秒 */
|
|
|
|
|
|
public setUnlockTime(value: number): void {
|
|
|
|
|
|
this.unlockTime = value;
|
|
|
|
|
|
// logger.log("设置角色 ", this.id, " 的解锁时间:", this.unlockTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-08 15:10:51 +08:00
|
|
|
|
/** 判断图片是否解锁,根据 id */
|
|
|
|
|
|
public isImageUnlock(id: number): boolean {
|
|
|
|
|
|
for (let i = 0; i < this.unlockedImageIds.length; i++) {
|
|
|
|
|
|
if (this.unlockedImageIds[i] === id) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 解锁图片 */
|
|
|
|
|
|
public unlockImage(id: number) {
|
|
|
|
|
|
// 去重
|
|
|
|
|
|
let exists = this.isImageUnlock(id);
|
|
|
|
|
|
if (!exists) {
|
|
|
|
|
|
this.unlockedImageIds.push(id);
|
|
|
|
|
|
}
|
2025-09-21 19:49:08 +08:00
|
|
|
|
logger.log("技师 ", this.id, " 当前解锁图片的所有id:",this.unlockedImageIds);
|
2025-09-08 15:10:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取所有解锁图片的 id */
|
|
|
|
|
|
public getUnlockedImageIds(): number[] {
|
|
|
|
|
|
return this.unlockedImageIds;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 保存解锁图片 id */
|
|
|
|
|
|
public setUnlockedImageIds(value: number[]): void {
|
|
|
|
|
|
for(let one of value) {
|
|
|
|
|
|
this.unlockImage(one);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 判断视频是否解锁,根据 id */
|
|
|
|
|
|
public isVideoUnlock(id: number): boolean {
|
|
|
|
|
|
for (let i = 0; i < this.unlockedVideoIds.length; i++) {
|
|
|
|
|
|
if (this.unlockedVideoIds[i] === id) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 解锁视频 */
|
|
|
|
|
|
public unlockVideo(id: number) {
|
|
|
|
|
|
// 去重
|
|
|
|
|
|
let exists = this.isVideoUnlock(id);;
|
|
|
|
|
|
if (!exists) {
|
|
|
|
|
|
this.unlockedVideoIds.push(id);
|
2025-09-08 16:35:21 +08:00
|
|
|
|
}
|
2025-09-21 19:49:08 +08:00
|
|
|
|
logger.log("技师 ", this.id, " 当前解锁视频的所有id:",this.unlockedVideoIds);
|
2025-09-08 15:10:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 获取所有解锁视频的 id */
|
|
|
|
|
|
public getUnlockedVideoIds(): number[] {
|
|
|
|
|
|
return this.unlockedVideoIds;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 保存解锁视频 id */
|
|
|
|
|
|
public setUnlockedVideoIds(value: number[]): void {
|
|
|
|
|
|
for(let one of value) {
|
|
|
|
|
|
this.unlockVideo(one);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|