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 CLICK_DATA: { type: number; //上传数据类型 success: boolean; //此局游戏正确与否 round: number; //回合数 choice: number; //玩家选择,0:时间截止前未做选择,1,2,3:三个按钮从上到下依次对应 rightChoice: number; //本轮的按正确答案,含义与choice相同 item: string; //此关展示的物品 roundType: number; //展示方式。1:图像 2:音频 stepTime: number; //玩家每一关用时毫秒数 音频关卡从播放结束开始计时 levelConfig: number; //使用的是哪一套关卡配置 ignite: boolean; //玩家此轮有没有点火 igniteCount: number; //玩家总计成功点火数 }; static GAME_DATA: any[]; //关卡数据 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; //用于测试跳关卡 level: number; //具体游戏内进行到第几步 stepTimeList: number; //整局游戏用时,由于涉及场景切换,数据需要保留 successList: any[]; //整局胜负 gameTime: number; //单次游戏倒计时时间 igniteCount: number; //玩家总计成功点火数 }; static LEVEL_INFO: { id: number; map: number[][]; }[][]; static CUSTOM_INFO: { moveSpeed: number; //洪峰移动速度 waitTime: number; //洪峰冲击倒计时 fastPath: 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 //最短路径 } ] } //数据备用 static GM_INFO_init() { this.GM_INFO = { // isEnd: false, mean_Time: 0, //平均放箭速度 total: 0, //总共对的个数 currSeed: 200000, //用于随机数种子 gameId: "100010", //游戏ID userId: 200139, //用户ID guide: true, //是否有引导 url: "https://api.sparkus.cn",//访问域名 success: false, //用户游戏成功与否 matchId: null, //用于埋点上传的ID custom: 0, //用于测试跳关卡 level: 0, //具体游戏内进行到第几步 stepTimeList:0, //整局游戏用时,由于涉及场景切换,数据需要保留 successList:[], //整局胜负 gameTime:5, igniteCount: 0, //玩家总计成功点火数 }; } static GM_INFO_SET(key,value) { this.GM_INFO[key] = value; } static CLICK_init() { this.CLICK_DATA = { type: 1, //上传数据类型 success: false, //此局游戏正确与否 round: 0, //回合数 choice: 0, //玩家选择,0:时间截止前未做选择,1,2,3:三个按钮从上到下依次对应 rightChoice: 0, //本轮的按正确答案,含义与choice相同 item: "", //此关展示的物品 roundType: 0, //展示方式。1:图像 2:音频 stepTime: 0, //玩家每一关用时毫秒数 音频关卡从播放结束开始计时 levelConfig: 0, //使用的是哪一套关卡配置 ignite: false, //玩家此轮有没有点火 igniteCount: 0, //玩家总计成功点火数 } } static CLICK_SET(key,value) { this.CLICK_DATA[key] = value; } static LEVEL_INFO_init() { /* moveSpeed: 0, //洪峰移动速度 waitTime: 20, //洪峰冲击倒计时 fastPath: 5 //最短路径 */ this.LEVEL_INFO = [ [ { "id": 1001, "map": [ [0,0,0,4], [0,0,0,0], [0,0,0,0], [0,1,0,0] ] }, { "id": 1002, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1003, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1004, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1005, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1006, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1007, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1008, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1009, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] }, { "id": 1010, "map": [ [1,0,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,6] ] } ], ] } static Authentication(){ cc.fx.GameTool.Authentication(); } }