123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- /*
- ***********************************************************************************
- * 姓名:xxj
- * 功能:数据
- * 日期:2021.2.1
- * 备注:
- ***********************************************************************************
- */
- let dataName = 'tBall_';
- /**
- * 用户数据
- */
- export class UserData {
- public userId: string = ""; //本地用户唯一标识
- public isAgree: boolean = false; //
- public coinNum: number = 0; //金币数量
- public gemNum: number = 0; //宝石数量
- public sound: boolean = true; //是否播放声音
- public vibration: boolean = true; //震动
- public currentDate: number = 0; //当前日期
- public createTime: number = 0; //用户创建时间
- public awardTime: number = 0; //登陆奖励时间
- public roleId: number = 1; //使用到角色id
- public roleList: number[] = []; //
- public roleAds: number[] = []; // 角色广告计数
- public dressId: number = 101; //装饰ID
- public itemId: number = 201; //装饰ID
- //大招技能等级
- public bigSkills = [1, 1, 1, 1, 1];
- //金币
- public coin: number = 4000;//金币
- public diamond: number = 0;//钻石
- public skillSuccessTimes = 0;//大招模式连胜次数
- public skillGuide: number = 0;//大招模式新手引导
- public skillAccTimes = 0;//大招模式累计胜利次数
- //摆球达人关卡通关情况
- public placeBallData: Array<any> = [];
- //每日分享钻石次数
- public shareDiamondTimes: number = 0;
- //每日录屏分享次数
- public dailyVideoShareTimes: number = 0;
- //小秘书
- public secretary: Array<number> = [1, 0];
- //当前选中的秘书
- public curSecretary: number = 0;
- //球杆
- public ballRod: Array<number> = [1, 0, 0, 0, 0, 1];
- //当前使用的球杆
- public curBallRod: number = 5;
- //签到天数
- public signData: number = 0;
- //签到时间戳
- public signTime: number = 0;
- //转盘转动次数
- public drawTimes: number = 0;
- //转盘中奖励领取次数
- public drawAwardTimes: number = 0;
- //每日免费转盘
- public dailyfreeDrawTimes: number = 1;
- //体力
- public power: number = 5;
- public powerTime: number = 0; //体力计时
- //挑战赛次数
- public challengeTimes = 0;
- //每日是否额外领取签到奖励
- public extraSign = 0;
- //经典模式胜利场次
- public classicTimes = 0;
- //引导看广告延长辅助线
- public guideHelpLine = 0;
- //是否是新用户
- public newUser = true;
- //首次白球进洞
- rootBallFoul = 0;
- //首次超时犯规
- timeoutFoul = 0;
- constructor() {
- this.roleList = [1];
- }
- public saveData() {
- let data = {};
- for (let k in this) {
- data[k.toString()] = this[k];
- }
- // console.log('zh:savedata start ');
- Laya.LocalStorage.setItem(dataName + "userdata", JSON.stringify(data));
- // console.log('zh:savedata end ');
- }
- public getData() {
- let ld = Laya.LocalStorage.getItem(dataName + "userdata");
- if (ld) {
- let localData = JSON.parse(ld);
- if (localData) {
- for (let k in this) {
- let key = k.toString();
- let data = localData[key];
- if (data != undefined) {
- this[k] = data;
- }
- }
- }
- }
- }
- }
- export class ItemData {
- public itemList: {}; //获得的道具
- constructor() {
- this.itemList = {};
- //添加默认道具
- this.itemList[101] = { id: 101, count: 1, adnum: 0, active: true };
- this.itemList[201] = { id: 201, count: 1, adnum: 0, active: true };
- }
- public saveData(): void {
- Laya.LocalStorage.setItem(dataName + "itemdata", JSON.stringify(this.itemList));
- }
- public getData(): void {
- let ld = Laya.LocalStorage.getItem(dataName + "itemdata");
- if (ld) {
- let localData = JSON.parse(ld);
- if (localData) {
- this.itemList = localData;
- }
- }
- }
- }
- /**
- * 游戏数据
- */
- export class GameData {
- public curLevel: number = 0; //当前关卡
- public gameType: number = 1; //游戏类别
- public signIdx: number = 0; //签到序号
- public signMax: number = 0; //可签序号
- public rotaryTime: number = 0; //抽奖时间
- public rotaryCount: number = 0; //抽奖次数
- public rotaryList: number[] = []; //当前轮已抽取了的
- public diyCount: number = 3; //
- public awardIdx: number = 0; //当前奖励进度
- //public adGem:number=10; //获得钻石次数
- public shareNum: number = 2; //分享奖励次数
- public rankWeek: number = 0; //周排行榜记录
- public rankScore: number = 0; //排行榜本地数据
- public gameCount: number = 0; //大招模式游戏次数
- public trySkill: number = -1; //试用技能
- public tryTime: number = 0; //大招试用时间点
- constructor() {
- }
- public saveData(): void {
- let data = {};
- for (let k in this) {
- data[k.toString()] = this[k];
- }
- Laya.LocalStorage.setItem(dataName + "gamedata", JSON.stringify(data));
- }
- public getData(): void {
- let ld = Laya.LocalStorage.getItem(dataName + "gamedata");
- if (ld) {
- let localData = JSON.parse(ld);
- if (localData) {
- for (let k in this) {
- let key = k.toString();
- let data = localData[key];
- if (data != undefined) {
- this[k] = data;
- }
- }
- }
- }
- }
- }
|