Files
18xchat/assets/Scripts/chat18x/data/PlayerData.ts
T

62 lines
1.3 KiB
TypeScript
Raw Normal View History

2025-08-14 16:30:08 +08:00
/**
* 玩家数据
*/
import { BaseData } from "./BaseData";
export class PlayerData extends BaseData {
2025-08-25 16:27:18 +08:00
// 用户名
2025-08-14 16:30:08 +08:00
private _name: string = '';
2025-08-25 16:27:18 +08:00
// 钻石数
private _diamond: number = 0;
// vip失效时间戳
private _vipExpire: number = 0;
2025-08-14 16:30:08 +08:00
public reset(): void {
this._name = '';
2025-08-25 16:27:18 +08:00
this._diamond = 0;
this._vipExpire = 0;
2025-08-14 16:30:08 +08:00
}
public clear(): void {
this._name = '';
2025-08-25 16:27:18 +08:00
this._diamond = 0;
this._vipExpire = 0;
2025-08-14 16:30:08 +08:00
}
public destroy(): void {
super.destroy();
2025-08-25 16:27:18 +08:00
this._name = null;
this._diamond = null;
this._vipExpire = null;
2025-08-14 16:30:08 +08:00
}
2025-08-25 16:27:18 +08:00
/** 设置用户名 */
public set name(value: string) {
this._name = value;
2025-08-14 16:30:08 +08:00
}
2025-08-25 16:27:18 +08:00
/** 获取用户名 */
public get name(): string {
2025-08-14 16:30:08 +08:00
return this._name;
}
2025-08-25 16:27:18 +08:00
/** 设置钻石数 */
public set diamond(value: number) {
this._diamond = value;
}
/** 获取钻石数 */
public get diamond(): number {
return this._diamond;
}
/** 设置vip失效时间戳 */
public set vipExpire(value: number) {
this._vipExpire = value;
}
/** 获取vip失效时间戳 */
public get vipExpire(): number {
return this._vipExpire;
}
2025-08-14 16:30:08 +08:00
}