import { WeChat } from "../Share/share"; import { GameTool } from "../Tool/GameTool"; const { ccclass, property } = cc._decorator; @ccclass('GameConfig') export class GameConfig { //所有控制信息都通过GameAppStart内控制 private static _instance : GameConfig = null; static GAME_DATA: any[]; //关卡数据 static CUSTOM_INFO: { moveSpeed: number; //洪峰移动速度 waitTime: number; //洪峰冲击倒计时 fastPath: number; //最短路径 }[]; static TIME_INFO: { waterSpeed: number[]; //洪峰速度 totalTime: number; //游戏总时长 waterTime: number[]; //洪峰来的倒计时 roadSpeed: number; //河道修筑速度 ReinforceSpeed: number; //加固时间速度 Xi_SoilSpeed: number; }; //用于盛放埋点数据上传,每次上传后清空 static CLICK_DATA: { type: number; //上传数据类型 success: boolean; //此局游戏正确与否 round: number; //回合数轮次 getScore: number; //本轮得分,失败为0分 cumulativeScore: number; //本剧游戏总计得分 mapId: string; //地图ID difficulty: number; //地图难度 optimizedSteps: number; //关卡最短步数 usedSteps: number; //玩家修建总步数 stepList: any[]; //U、D、L、R X 息壤 F 加固 startTime: number; //从游戏开始到玩家操作的第一步截止时间 单位毫秒 submitTime: number; //从第一步操作到提交时间,如果未提交为-1 单位毫秒 duration: number; //游戏总用时(截止到提交) 单位毫秒 drawingBack: number; //后退次数 drawingReset: number; //清空次数 timer: number; //游戏倒计时剩余时长 秒 }; static GM_INFO: { // isEnd: false, mean_Time: number; //平均放箭速度 total: number; //总共对的个数 currSeed: number; //用于随机数种子 gameId: string; //游戏ID userId: number; //用户ID guide: boolean; //是否有引导 url: string; //访问域名 success: boolean; //用户游戏成功与否 matchId: any; //用于埋点上传的ID custom: number; //用于测试跳关卡 round: number; //回合数 level: number; //具体游戏内进行到第几步 stepTimeList: number; //整局游戏用时,由于涉及场景切换,数据需要保留 successList: any[]; //整局胜负 fen: number; //小局得分 score: number; //总得分 igniteCount: number; //玩家总计成功点火数 min_Steps: number; //每次上一把最小步数 min_Time: number; //每一把上次距离洪峰到来时间 }; static LEVEL_INFO: { id: string; //地图ID start: string[][]; //起始状态 goal: string[][]; //目标状态 middle: string[][][]; //中间状态 steps: number; //最大步数 }[]; //游戏内信息 static get Instance() { if (this._instance == null) { this._instance = new GameConfig(); } return this._instance; } //getSeedRandom static init(Authentication){ this.CLICK_init(); this.LEVEL_INFO_init(); this.GM_INFO_init(); var self = this; // cc.resources.load('Json/CLICK_DATA', (err: any, res: cc.JsonAsset) => { // if (err) { // return; // } // let jsonData: object = res.json!; // self.CLICK_DATA = jsonData["data"]; // }) // cc.resources.load('Json/LEVEL_INFO', (err: any, res: cc.JsonAsset) => { // if (err) { // return; // } // let jsonData: object = res.json!; // self.LEVEL_INFO = jsonData["data"]; // }) // cc.resources.load('Json/GM_INFO', (err: any, res: cc.JsonAsset) => { // if (err) { // if(!Authentication) self.Authentication(); // return; // } // let jsonData: object = res.json!; // self.GM_INFO = jsonData["data"]; // cc.fx.GameTool.getCustom(false); // if(!Authentication) self.Authentication(); // }) //GAME_DATA 废弃了,暂时不删除以防后面修改回 一整局传一次 this.GAME_DATA = [ ] this.CUSTOM_INFO = [ //第一难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第二难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第三难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第四难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第五难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第六难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第七难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第八难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第九难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 }, //第十难度 { moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 } ] WeChat.setShare(location.href); if(!Authentication) self.Authentication(); } //数据备用 static GM_INFO_init() { this.GM_INFO = { // isEnd: false, mean_Time: 0, //平均放箭速度 total: 0, //总共对的个数 currSeed: 200000, //用于随机数种子 gameId: "100012", //游戏ID userId: 0, //用户ID guide: false, //是否有引导 url: "https://api.sparkus.cn",//访问域名 success: false, //用户游戏成功与否 matchId: null, //用于埋点上传的ID custom: 0, //用于测试跳关卡 round:0, //回合数 level: 0, //具体游戏内进行到第几步 stepTimeList:0, //整局游戏用时,由于涉及场景切换,数据需要保留 successList:[], //整局胜负 fen:0, //小局得分 score:0, //总得分 igniteCount: 0, //玩家总计成功点火数 min_Steps:0, //每次上一把最小步数 min_Time:0 //每一把上次距离洪峰到来时间 }; } static GM_INFO_SET(key,value) { this.GM_INFO[key] = value; } static CLICK_init() { this.CLICK_DATA = { type: 1, //上传数据类型 success: false, //此局游戏正确与否 round: 0, //回合数轮次 getScore: 0, //本轮得分,失败为0分 cumulativeScore: 0, //本剧游戏总计得分 mapId: "", //地图ID difficulty: 0, //地图难度 optimizedSteps: 0, //关卡最短步数 usedSteps: 0, //玩家修建总步数 stepList: [], //U、D、L、R X 息壤 F 加固 startTime:-1, //从游戏开始到玩家操作的第一步截止时间 单位毫秒 submitTime:-1, //从第一步操作到提交时间,如果未提交为-1 单位毫秒 duration:0, //游戏总用时(截止到提交) 单位毫秒 如果未他移交则为时间上限 drawingBack:0, //后退次数 drawingReset:0, //清空次数 timer: 0, //测评倒计时剩余时间 去秒 } } static CLICK_SET(key,value) { this.CLICK_DATA[key] = value; } static LEVEL_INFO_init() { this.TIME_INFO = { waterSpeed:[0.3,0.25,0.2,0.18,0.16,0.14,0.12,0.1], //洪峰速度 totalTime: 20, //游戏总时长 waterTime:[10,12,14,16,18,20,20,20], //洪峰来的倒计时 roadSpeed:0.2, //河道修筑速度 ReinforceSpeed:0.2, //加固时间速度 Xi_SoilSpeed:0.2, //息壤时间速度 } this.LEVEL_INFO = [{"id":"0001", //地图ID "start":[['r'], ['b'], ['g']], //起始状态 "goal":[[], ['r', 'g'], ['b']], //目标状态 "middle":[[['b', 'r', 'g'], [], []], [['g'], ['b'], ['r']], [['r', 'b'], ['g'], []]],//中间状态 "steps":17 //最大步数 }]; // 0 12 3 // 312 0 0 2 3 1 13 2 0 } static Authentication(){ cc.fx.GameTool.Authentication(); } }