核心功能玩法更新

This commit is contained in:
YZ\249929363 2024-07-12 17:38:10 +08:00
parent a526219e57
commit 35c180c112
88 changed files with 10747 additions and 4110 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,38 +8,57 @@
const {ccclass, property} = cc._decorator;
export enum BlockType{
/*起点地块 */
Start = 0,
/*普通地块 */
Nomal = 1,
Nomal = 0,
/*起点地块 */
Start = 1,
/*湿地 */
Nunja = 2,
/*山峰 */
Peak = 3,
/*息壤 */
Xi_Soil = 4,
/*息壤 */
Construct = 5,
/*终点地块 */
End = 5
End = 4,
/*息壤 */
Xi_Soil = 5,
/*加固 */
Reinforce = 6
}
export enum PathType{
err = "err",
up = "up",
down = "down",
left = "left",
right = "right",
up_left = "up_left",
up_right = "up_right",
down_left = "down_left",
down_right = "down_right",
left_up = "left_up",
left_down = "left_down",
right_up = "right_up",
right_down = "right_down",
}
@ccclass
export default class NewClass extends cc.Component {
// LIFE-CYCLE CALLBACKS:
block_type:number;
block_Type:number;
path_Type:string;
finishi:boolean
onLoad () {
this.finishi = false;
}
start () {
}
initData(type){
this.block_type = type;
if(type == cc.Enum(BlockType).Start){
this.block_Type = type;
if(type == cc.Enum(BlockType).Start){
this.node.color = cc.color(245,70,70);
}
else if(type == cc.Enum(BlockType).End){
@ -47,5 +66,82 @@ export default class NewClass extends cc.Component {
}
}
setPath(type){
this.path_Type = type;
}
//洪峰执行
runWater(data){
var target = null;
var progress = 1;
var time = data.time;
var order = data.order + 1;
target = this.node.getChildByName("vertical");
console.log(this.path_Type);
if(this.path_Type == cc.Enum(PathType).up){
}
else if(this.path_Type == cc.Enum(PathType).down){
target.angle = 180;
}
else if(this.path_Type == cc.Enum(PathType).left){
target.angle = 90;
}
else if(this.path_Type == cc.Enum(PathType).right){
target.angle = 270;
}
else{
target = this.node.getChildByName("turn");
progress = 0.25;
if(this.path_Type == cc.Enum(PathType).up_left){
target.setPosition(-9,-9);
}
else if(this.path_Type == cc.Enum(PathType).up_right){
target.scaleX = -1;
target.setPosition(9,-9);
}
else if(this.path_Type == cc.Enum(PathType).down_left){
target.angle = 180;
target.scaleX = -1;
target.setPosition(-9,9);
}
else if(this.path_Type == cc.Enum(PathType).down_right){
target.angle = 180;
target.scaleX = 1;
target.setPosition(9,9);
}
else if(this.path_Type == cc.Enum(PathType).left_up){
target.angle = -90;
target.scaleY = -1;
target.setPosition(9,9);
}
else if(this.path_Type == cc.Enum(PathType).left_down){
target.angle = 90;
target.scaleY = -1;
target.setPosition(-9,-9);
}
else if(this.path_Type == cc.Enum(PathType).right_up){
target.angle = -90;
// target.scaleY = -1;
target.setPosition(-9,9);
}
else if(this.path_Type == cc.Enum(PathType).right_down){
target.angle = -90;
target.scaleX = -1;
target.setPosition(-9,-9);
}
}
target.active = true;
target.getComponent(cc.Sprite).fillRange = 0;
cc.tween(target.getComponent(cc.Sprite))
.to(time,{fillRange:progress})
.call(() =>{
if(data.circulate)
cc.fx.Notifications.emit(cc.fx.Message.next,order);
})
.start();
}
// update (dt) {}
}

View File

@ -21,6 +21,7 @@ export default class NewClass extends cc.Component {
tipArray:any;
controlArray:any;
canTouch:boolean;
// LIFE-CYCLE CALLBACKS:
@ -28,6 +29,7 @@ export default class NewClass extends cc.Component {
start () {
this.tipArray = [];
this.controlArray = [];
this.canTouch = true;
}
@ -54,6 +56,7 @@ export default class NewClass extends cc.Component {
tip.removeFromParent(this.Map);
tip = null;
this.tipArray.pop();
this.controlArray.pop();
}
}
@ -69,6 +72,7 @@ export default class NewClass extends cc.Component {
tip.parent = this.Map;
this.setPosition(tip);
this.tipArray.push(tip);
this.controlArray.push(data);
cc.fx.Notifications.emit(cc.fx.Message.control,data);
}
@ -76,7 +80,7 @@ export default class NewClass extends cc.Component {
start_Click(){
if(!this.canTouch) return;
this.canTouch = false;
cc.fx.Notifications.emit(cc.fx.Message.startGame,null);
cc.fx.Notifications.emit(cc.fx.Message.startGame,this.controlArray);
}
// update (dt) {}

View File

@ -1,3 +1,5 @@
import { BlockType } from "./Block";
// 主游戏控制类
const {ccclass, property} = cc._decorator;
@ccclass
@ -11,7 +13,8 @@ export default class GameManager extends cc.Component {
countTime: number;
block_Array: any;
path_Array: any;
map_Array: any;
onLoad () {
@ -25,21 +28,61 @@ export default class GameManager extends cc.Component {
this.initMap();
}
//初始化地图
initMap(){
this.block_Array = [];
let map = cc.fx.GameConfig.LEVEL_INFO[0].map;
for(let i=0;i<map.length;i++){
for(let j=0; j<map[i].length;j++){
this.path_Array = [];
this.map_Array = [];
this.map_Array = cc.fx.GameConfig.LEVEL_INFO[0][0].map;
//将地图x,y轴切换
for(let m=0;m<Math.floor(this.map_Array .length/2);m++){
for(let n=0; n<this.map_Array [m].length;n++){
let temp = this.map_Array [m][n];
this.map_Array [m][n] = this.map_Array [n][m];
this.map_Array [n][m] = temp;
}
}
for(let i=0;i<this.map_Array .length;i++){
for(let j=0; j<this.map_Array [i].length;j++){
let block = cc.instantiate(this.Block);
block.parent= this.Map;
block.getComponent("Block").initData(map[i][j]);
block.setPosition(cc.v2(-block.width*1.5 + j*block.width,-block.height*1.5 + i*block.height));
block.getComponent("Block").initData(this.map_Array [i][j]);
if(this.map_Array [i][j] == cc.Enum(BlockType).Start) this.path_Array.push(cc.v3(i,j,cc.Enum(BlockType).Nomal));
block.setPosition(cc.v2(-block.width*1.5 + i*block.width,block.height*1.5 - j*block.height));
this.block_Array.push(block);
}
}
}
//开始后,按玩家操作,将路径中地图块放入数组中
setMap(data){
for(let i=0; i<data.length; i++){
let start = this.path_Array[this.path_Array.length-1];
switch(data[i]){
case "up":
this.path_Array.push(cc.v3(start.x,start.y-1,cc.Enum(BlockType).Nomal));
break;
case "down":
this.path_Array.push(cc.v3(start.x,start.y+1,cc.Enum(BlockType).Nomal));
break;
case "left":
this.path_Array.push(cc.v3(start.x-1,start.y,cc.Enum(BlockType).Nomal));
break;
case "right":
this.path_Array.push(cc.v3(start.x+1,start.y,cc.Enum(BlockType).Nomal));
break;
case "reinforce":
this.path_Array.push(cc.v3(0,0,cc.Enum(BlockType).Reinforce));
break;
case "soil":
this.path_Array.push(cc.v3(0,0,cc.Enum(BlockType).Xi_Soil));
break;
}
}
this.runWater(0);
}
setModel(){
let time = 0.3;
let block2 = this.node.getChildByName("Block1").getChildByName("icon").getComponent(cc.Sprite);
@ -74,6 +117,131 @@ export default class GameManager extends cc.Component {
.start();
}
//开始执行洪峰来了的动画
runWater(order){
order = parseInt(order);
if(order <= this.path_Array.length-1){
let i = this.path_Array[order].x*this.map_Array[0].length+this.path_Array[order].y;
let direction = "";
let circulate = true;
if(order == this.path_Array.length-1){
circulate = false;
direction = this.getDirection(order-1);
if(direction == "up" || direction == "right_up" || direction == "left_up"){
direction = "up";
}
else if(direction == "down" || direction == "left_down" || direction == "right_down"){
direction = "down";
}
else if(direction == "left" || direction == "up_left" || direction == "down_left"){
direction = "left";
}
else if(direction == "right" || direction == "up_right" || direction == "down_right"){
direction = "right";
}
}
else{
direction = this.getDirection(order);
}
let target = this.block_Array[i].getComponent("Block");
target.setPath(direction);
let data = {
order:order,
time:0.3,
type:this.path_Array[order].z,
circulate:circulate
};
target.runWater(data);
}
}
//获取洪峰方向
getDirection(order){
var name = "";
//入海口比较复杂单独判断
if(order == 0){
let nextX = this.path_Array[order+1].x - this.path_Array[order].x;
let nextY = this.path_Array[order].y - this.path_Array[order+1].y;
//在底边
if(this.path_Array[order].y == this.map_Array.length-1){
if(nextX == 0){
if(nextY == 1)name = "up";
else if(nextY == -1) name = "err";
}
else if(nextX == 1) name = "up_right";
else if(nextX == -1) name = "up_left";
}
//在顶边
else if(this.path_Array[order].y == 0){
if(nextX == 0){
if(nextY == 1)name = "err";
else if(nextY == -1) name = "down";
}
else if(nextX == 1) name = "down_right";
else if(nextX == -1) name = "down_left";
}
//在左边
else if(this.path_Array[order].x == 0){
if(nextX == 0){
if(nextY == 1)name = "right_up";
else if(nextY == -1) name = "right_down";
}
else if(nextX == 1) name = "right";
else if(nextX == -1) name = "err";
}
//在右边
else if(this.path_Array[order].x == this.map_Array[0].length-1){
if(nextX == 0){
if(nextY == 1)name = "left_up";
else if(nextY == -1) name = "left_down";
}
else if(nextX == 1) name = "err";
else if(nextX == -1) name = "left";
}
}
//不是第一步,已经走过一步
else if(order > 0){
//用于判断此点的上一个点,是为了判断当前方块洪水七点,以及下一个移动方向,判断洪终点方向
let nextX = this.path_Array[order+1].x - this.path_Array[order].x;
let nextY = this.path_Array[order].y - this.path_Array[order+1].y
let previousX = this.path_Array[order].x - this.path_Array[order-1].x;
let previousY = this.path_Array[order-1].y - this.path_Array[order].y;
if(previousX == 0 && previousY == 1){
if(nextX == 0){
if(nextY == 1)name = "up";
else if(nextY == -1) name = "err";
}
else if(nextX == 1) name = "up_right";
else if(nextX == -1) name = "up_left";
}
else if(previousX == 0 && previousY == -1){
if(nextX == 0){
if(nextY == 1)name = "err";
else if(nextY == -1) name = "down";
}
else if(nextX == 1) name = "down_right";
else if(nextX == -1) name = "down_left";
}
else if(previousX == 1 && previousY == 0){
if(nextX == 0){
if(nextY == 1)name = "right_up";
else if(nextY == -1) name = "right_down";
}
else if(nextX == 1) name = "right";
else if(nextX == -1) name = "err";
}
else if(previousX == -1 && previousY == 0){
if(nextX == 0){
if(nextY == 1)name = "left_up";
else if(nextY == -1) name = "left_down";
}
else if(nextX == 1) name = "err";
else if(nextX == -1) name = "left";
}
}
return name ;
}
//根据是否全面屏,做独立适配方面
fit(){
var jg = this.setFit();
@ -124,8 +292,8 @@ export default class GameManager extends cc.Component {
}
//开始游戏
startGame(){
startGame(data){
this.setMap(data);
}
@ -135,10 +303,6 @@ export default class GameManager extends cc.Component {
this.countTime -= 1;
// this.time.string = cc.fx.GameTool.getTimeMargin(this.countTime);
if(this.countTime < 5){
// cc.tween(this.time.node)
// .to(0.25,{scale:1.5,color:cc.color(255,0,0)})
// .to(0.25,{scale:1,color:cc.color(255,255,255)})
// .start()
let over = this.node.getChildByName("Over");
cc.tween(over)
.to(0.2,{opacity:255})
@ -149,11 +313,12 @@ export default class GameManager extends cc.Component {
if(this.countTime <= 0){
this.unschedule(this.updateCountDownTime);
var time = 0;
this.gameOver(time);
this.gameOver(time);
}
}
}
//上传每次操作数据
setData(){
cc.fx.GameTool.setGameData();
@ -177,11 +342,21 @@ export default class GameManager extends cc.Component {
}
nextWater(){
}
onEnable () {
cc.fx.Notifications.on(cc.fx.Message.control, this.clickSun, this);
cc.fx.Notifications.on(cc.fx.Message.next, this.runWater, this);
cc.fx.Notifications.on(cc.fx.Message.startGame, this.startGame, this);
}
onDisable () {
cc.fx.Notifications.off(cc.fx.Message.control, this.clickSun);
cc.fx.Notifications.off(cc.fx.Message.next, this.runWater);
cc.fx.Notifications.off(cc.fx.Message.startGame, this.startGame);
}
update (dt) {
}

View File

@ -16,7 +16,7 @@ export default class NewClass extends cc.Component {
start () {
window.initMgr();
cc.fx.GameConfig.init(this.localTest);
cc.fx.AudioManager.Instance.init();
// cc.fx.AudioManager.Instance.init();
this.testVersion.string = this.clientTestVersion;
}

View File

@ -1,3 +1,5 @@
import { WeChat } from "../Share/share";
import { GameTool } from "../Tool/GameTool";
const { ccclass, property } = cc._decorator;
@ -6,6 +8,22 @@ export class GameConfig {
//所有控制信息都通过GameAppStart内控制
private static _instance : GameConfig = null;
//用于盛放埋点数据上传,每次上传后清空
static CLICK_DATA: {
type: number; //上传数据类型
success: boolean; //此局游戏正确与否
round: number; //回合数
choice: number; //玩家选择0时间截止前未做选择123三个按钮从上到下依次对应
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; //平均放箭速度
@ -18,30 +36,23 @@ export class GameConfig {
success: boolean; //用户游戏成功与否
matchId: any; //用于埋点上传的ID
custom: number; //用于测试跳关卡
level: number; //具体游戏内进行到第几步
stepTimeList: number; //整局游戏用时,由于涉及场景切换,数据需要保留
successList: any[]; //整局胜负
gameTime: number; //单次游戏倒计时时间
igniteCount: number; //玩家总计成功点火数
};
static CLICK_DATA: {
type: number; //上传数据类型
success: boolean; //此局游戏胜负
round: number; //回合数
totalSunCount: number; //太阳总数
movedSunCount: number; //可移动太阳个数
sunSpeed: number; //太阳移动速度
overlapSunCount: number; //重叠太阳个数
colorList: any[]; //太阳颜色数组
duration: number; //每次点击的反应时间
difficultyLevel: number; //此次难度
sunList: any[]; //太阳数组,用于存放太阳类型 0:普通 1:移动 2:重叠
stepTimeList: any[]; //每次点击间隔
remainder: number; //游戏剩余时间
};
static GAME_DATA: any[];
static LEVEL_INFO: {
map: number[][]; //地图
opacity: number; //提示透明度
moveSpeed: number;//洪水移动速度
static LEVEL_INFO: { id: number; map: number[][]; }[][];
static CUSTOM_INFO: {
moveSpeed: number; //洪峰移动速度
waitTime: number; //洪峰冲击倒计时
fastPath: number; //最短路径
}[];
//游戏内信息
static get Instance()
{
@ -51,42 +62,104 @@ export class GameConfig {
}
return this._instance;
}
//getSeedRandom
static init(Authentication){
this.GM_INFO_init();
this.CLICK_init();
this.LEVEL_INFO_init();
// cc.resources.load('Json/GM_INFO', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.GM_INFO_init();
// if(!Authentication) this.Authentication();
// return;
// }
// let jsonData: object = res.json!;
// this.GM_INFO = jsonData["data"];
// if(!Authentication) this.Authentication();
// })
this.GM_INFO_init();
var self = this;
// cc.resources.load('Json/CLICK_DATA', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.CLICK_init();
// return;
// }
// let jsonData: object = res.json!;
// this.CLICK_DATA = jsonData["data"];
// self.CLICK_DATA = jsonData["data"];
// })
// cc.resources.load('Json/LEVEL_INFO', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.LEVEL_INFO_init();
// return;
// }
// let jsonData: object = res.json!;
// this.LEVEL_INFO = jsonData["data"];
// 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 //最短路径
}
]
}
//数据备用
@ -95,58 +168,152 @@ export class GameConfig {
// isEnd: false,
mean_Time: 0, //平均放箭速度
total: 0, //总共对的个数
currSeed: 203213, //用于随机数种子
gameId: '100009', //游戏ID
userId: 0, //用户ID
currSeed: 200000, //用于随机数种子
gameId: "100010", //游戏ID
userId: 200139, //用户ID
guide: true, //是否有引导
url: "http://api.sparkus.cn",//访问域名
url: "https://api.sparkus.cn",//访问域名
success: false, //用户游戏成功与否
matchId: null, //用于埋点上传的ID
custom: 0 //用于测试跳关卡
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, //此局游戏胜负
success: false, //此局游戏正确与否
round: 0, //回合数
totalSunCount: 0, //太阳总数
movedSunCount: 0, //可移动太阳个数
sunSpeed: 0, //太阳移动速度
overlapSunCount: 0, //重叠太阳个数
colorList: [], //太阳颜色数组
duration: 0, //每次点击的反应时间
difficultyLevel: 0, //此次难度
sunList: [], //太阳数组,用于存放太阳类型 0:普通 1:移动 2:重叠
stepTimeList: [], //每次点击间隔
remainder: 120 //游戏剩余时间
choice: 0, //玩家选择0时间截止前未做选择123三个按钮从上到下依次对应
rightChoice: 0, //本轮的按正确答案含义与choice相同
item: "", //此关展示的物品
roundType: 0, //展示方式。1图像 2音频
stepTime: 0, //玩家每一关用时毫秒数 音频关卡从播放结束开始计时
levelConfig: 0, //使用的是哪一套关卡配置
ignite: false, //玩家此轮有没有点火
igniteCount: 0, //玩家总计成功点火数
}
}
static LEVEL_INFO_init() {
this.LEVEL_INFO = [
{ //地图
map: [
[
1,0,1,1
],
[
1,1,1,1
],
[
1,1,1,1
],
[
1,1,1,5
]
], //太阳总数
opacity: 0.9, //提示透明度
moveSpeed: 0.3, //洪水移动速度
}
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();
}

View File

@ -2,14 +2,20 @@
const {ccclass, property} = cc._decorator;
import CryptoJS = require('./crypto-js.min.js'); //引用AES源码js
const BASE_URL = "http://api.sparkus.cn";
const BASE_URL = "https://api.sparkus.cn";
//只负责网络接口 次类只负责和后端交互,不负责处理数据 数据处理在GameTool
@ccclass
export default class HttpUtil extends cc.Component {
static async getShareInfo(shareUrl: string): Promise<any> {
console.log("设置分享链接:",shareUrl);
const time = Math.floor((new Date().getTime()) / 1000)
const url = HttpUtil.apiSign(`/api/share/cfg?gameId=${config.gameId}&time=${time}&url=${shareUrl}`,{})
return this.post(url,null,null);
}
//排行榜
static async rankData(type,callback,data): Promise<any> {
const time = Math.floor((new Date().getTime()) / 1000)
const url = apiSign(`/api/get/rank/data?gameId=${config.gameId}&dataType=${type}&time=${time}`, data)
const url = HttpUtil.apiSign(`/api/get/rank/data?gameId=${config.gameId}&dataType=${type}&time=${time}`, data)
this.post(url,data,callback);
}
@ -20,7 +26,7 @@ export default class HttpUtil extends cc.Component {
//暂时用不到
static async getUserRecord(data,callback): Promise<any> {
const time = Math.floor((new Date().getTime()) / 1000)
const url = apiSign(`/api/get/user/data?gameId=${config.gameId}&time=${time}`, data)
const url = HttpUtil.apiSign(`/api/get/user/data?gameId=${config.gameId}&time=${time}`, data)
this.post(url,data,callback);
}
static async post(url, data, callback) {
@ -53,6 +59,30 @@ export default class HttpUtil extends cc.Component {
return null;
}
}
/**
*
* @param url {string}
* @param params {object}
*/
static apiSign(url: string, params = {}) {
let convertUrl = url.trim()
if (convertUrl.indexOf('?') === -1) {
convertUrl += '?'
}
// 传入参数转换拼接字符串
let postStr = getQueryString(params)
const signedStr = genSignStr(convertUrl, postStr)
const encryptStr = `sign=${signedStr}`
let encryptSignStr = fxCry.encryptByDES(encryptStr, config.secretKey)
encryptSignStr = encodeURIComponent(encryptSignStr)
return `${urlencode(convertUrl)}&_p=${encryptSignStr}`
}
}
function responseHandler(response: { data: any }) {
@ -61,8 +91,8 @@ function responseHandler(response: { data: any }) {
// 响应拦截器
// Rq.interceptors.response.use(responseHandler)
const config = {
gameId: "100009",
secretKey: "CMNhOzBA",
gameId: "100010",
secretKey: "wozrGKsL",
EK:"hui231%1"
};
@ -195,27 +225,5 @@ function urlencode(url: string): string {
return `${baseUrl}?${params.toString()}`;
}
/**
*
* @param url {string}
* @param params {object}
*/
function apiSign(url: string, params = {}) {
let convertUrl = url.trim()
if (convertUrl.indexOf('?') === -1) {
convertUrl += '?'
}
// 传入参数转换拼接字符串
let postStr = getQueryString(params)
const signedStr = genSignStr(convertUrl, postStr)
const encryptStr = `sign=${signedStr}`
let encryptSignStr = fxCry.encryptByDES(encryptStr, config.secretKey)
encryptSignStr = encodeURIComponent(encryptSignStr)
return `${urlencode(convertUrl)}&_p=${encryptSignStr}`
}

View File

@ -1,17 +1,19 @@
import { GameConfig } from "../Config/GameConfig";
import HttpUtil from "../Crypto/HttpUtil";
import { AudioManager } from "../Music/AudioManager";
import AudioManager from "../Music/AudioManager";
import { Notifications } from "../Notification/Notification";
import { StorageMessage } from "../Storage/Storage";
import { GameTool } from "../Tool/GameTool";
window.initMgr = function() {
if(cc.fx)
{
return;
}
cc.fx = {};
console.log("初始化");
console.log("1初始化");
//基础状态信息
cc.fx.StateInfo = {
debugMode: true,
@ -20,15 +22,9 @@ window.initMgr = function() {
isOnForeground: true //当前是否是在前台
};
cc.fx.Message = {
control: "操作控制",
mapDsetory: "2",
mapCreate: "3",
startGame: "4"
}
//应用系统信息
//配置文件
cc.fx.GameConfig = GameConfig;
cc.fx.HttpUtil = HttpUtil;
cc.fx.GameTool = GameTool;
@ -40,6 +36,12 @@ window.initMgr = function() {
queryId : -1 //分享id
};
cc.fx.Message = {
control: "10001", //传递操作控制
startGame:"10002", //传递开始建筑
next: "10003" //传递执行下一个格子洪水流过
}
/*
*
*/
@ -78,31 +80,21 @@ window.initMgr = function() {
All : "all", //不区分
};
//用于存储消息的ID
cc.fx.storageType = cc.Enum({
storageTypeCustom: 1000101, //用于存储关卡等级
});
//暂时不用
cc.fx.clickStatEventType = {
clickStatEventTypeVideoAD : 20173201,//视频播放完成
clickStatEventTypeClickAdVideo : 20173202,//视频播放为完成
clickStatEventTypeBannerAD : 20173203,//banner播放为完成
clickStatEventTypeUserFrom : 99990001,//用户来源
clickStatEventTypeShare : 99990002,//用户分享
clickStatEventTypeClickAdBtn : 99990007,//点击分流icon
clickStatEventTypeBannerAD2 : 67890033, // banner广告干预
clickStatEventTypeSubmitVersionInfo : 9999, //上报微信版本及基础库信息
clickStatEventTypeClickFirstAd : 99990003, //分流icon显示
clickStatEventTypeClickSecondAd : 99990004, //玩家点击分流按钮
clickStatEventTypeWxLoginStart : 10001,//微信登录开始
clickStatEventTypeWxLoginSuccess : 10002,//微信登录成功
clickStatEventTypeWxLoginFailed : 10003,//微信登录失败
clickStatEventTypeAuthorizationStart : 10003,//授权开始
clickStatEventTypeAuthorizationSuccess : 10004,//授权成功
clickStatEventTypeAuthorizationFailed : 10005,//授权失败
clickStatEventTypeLoginSDKStart : 10007,//登录SDK开始
clickStatEventTypeLoginSDKSuccess : 10008,//登录SDK成功
clickStatEventTypeLoginSDKFailed : 10009,//登录SDK时失败
clickStatEventTypeTCP_Start : 10009,//TCP连接开始
clickStatEventTypeTCP_Success : 10010,//TCP连接成功
clickStatEventTypeTCP_Failed : 10011,//TCP连接失败
};
//用于存储提示语 按照步骤提示
cc.fx.tipType = cc.Enum({
tipOne: '神农氏回到家中,开始整理今天收集来的物品。当他第一次拿出或说出一种植物时,请告诉他这是新植物。',
tipTwo: '如果他拿出或说出的植物你今天看到过,请告诉他上次是看到的;如果你听他说过,则请告诉他上次是听到的。', //用于存储关卡等级
tipErrNew: '这是这局游戏第一次出现{植物}',
tipErrOld: '{植物}刚才出现过呢',
tipErrHear: '上次遇到{植物}时,似乎不是听到的吧',
tipErrSee: '上次遇到{植物}时,似乎不是看到的吧',
tipErrLast: '之前确实看到过{植物},但最近一次似乎不是看到的呢',
});
};

View File

@ -1,23 +1,64 @@
const { ccclass, property } = cc._decorator;
@ccclass('AudioManager')
export class AudioManager {
private static _instance : AudioManager = null;
const {ccclass, property} = cc._decorator;
@ccclass
export default class AudioManager extends cc.Component {
static _instance: any;
//背景音乐
@property(cc.AudioClip)
audioGameBgm0: cc.AudioClip = null;
//跳跃
@property(cc.AudioClip)
audioButtonClick: cc.AudioClip = null;
//落地上
baishao_audio: cc.AudioClip = null;
@property(cc.AudioClip)
audioWarning: cc.AudioClip = null;
//碰撞
cha_audio: cc.AudioClip = null;
@property(cc.AudioClip)
audioWin: cc.AudioClip = null;
//落方块上
chixiaodou_audio: cc.AudioClip = null;
@property(cc.AudioClip)
danggui_audio: cc.AudioClip = null;
@property(cc.AudioClip)
danshen_audio: cc.AudioClip = null;
@property(cc.AudioClip)
dazao_audio: cc.AudioClip = null;
@property(cc.AudioClip)
gancao_audio: cc.AudioClip = null;
@property(cc.AudioClip)
ganjiang_audio: cc.AudioClip = null;
@property(cc.AudioClip)
gouqi_audio: cc.AudioClip = null;
@property(cc.AudioClip)
jingjie_audio: cc.AudioClip = null;
@property(cc.AudioClip)
jinju_audio: cc.AudioClip = null;
@property(cc.AudioClip)
lizhi_audio: cc.AudioClip = null;
@property(cc.AudioClip)
lizi_audio: cc.AudioClip = null;
@property(cc.AudioClip)
longyan_audio: cc.AudioClip = null;
@property(cc.AudioClip)
moli_audio: cc.AudioClip = null;
@property(cc.AudioClip)
muchai_audio: cc.AudioClip = null;
@property(cc.AudioClip)
mudan_audio: cc.AudioClip = null;
@property(cc.AudioClip)
mulan_audio: cc.AudioClip = null;
@property(cc.AudioClip)
pugongying_audio: cc.AudioClip = null;
@property(cc.AudioClip)
putao_audio: cc.AudioClip = null;
@property(cc.AudioClip)
renshen_audio: cc.AudioClip = null;
@property(cc.AudioClip)
taozi_audio: cc.AudioClip = null;
@property(cc.AudioClip)
zhuye_audio: cc.AudioClip = null;
@property(cc.AudioClip)
err: cc.AudioClip = null;
@property(cc.AudioClip)
yes: cc.AudioClip = null;
mAudioMap: {};
bgMusicVolume: number;
@ -30,8 +71,20 @@ export class AudioManager {
rewardCount: number;
mMusicKey: any;
static playWarning() {
throw new Error('Method not implemented.');
onLoad() {
if (AudioManager._instance == null) {
AudioManager._instance = this;
cc.game.addPersistRootNode(this.node);
}
else {
return;
}
this.reward = false;
this.finish = false;
this.rewardCount = 0;
this.ctor();
this.preload();
}
ctor () {
@ -47,16 +100,19 @@ export class AudioManager {
this.mEffectSwitch = 1;
}
play (audioSource, loop, callback, isBgMusic) {
if (isBgMusic && !this.mMusicSwitch) return;
if (!isBgMusic && !this.mEffectSwitch) return;
// if (isBgMusic && !this.mMusicSwitch) return;
// if (!isBgMusic && !this.mEffectSwitch) return;
var volume = isBgMusic ? this.bgMusicVolume : this.effectMusicVolume;
if (cc.sys.isBrowser) {
if(audioSource == this.brickSound){
volume = 0.1;
}
// if (cc.sys.isBrowser) {
// if(audioSource == this.brickSound){
// volume = 0.1;
// }
volume = 1;
var context = cc.audioEngine.play(audioSource, loop, volume);
cc.audioEngine.setEffectsVolume(1);
cc.audioEngine.setMusicVolume(1);
var context = cc.audioEngine.playEffect(audioSource, loop);
if (callback){
cc.audioEngine.setFinishCallback(context, function(){
callback.call(this);
@ -66,9 +122,9 @@ export class AudioManager {
this.mAudioMap[audioSource] = context;
return audioSource;
} else {
return audioSource;
}
// } else {
// return audioSource;
// }
}
save () {
@ -76,22 +132,15 @@ export class AudioManager {
// cc.wwx.Storage.setItem(cc.wwx.Storage.Key_Setting_Effect_Volume, this.mEffectSwitch);
}
static get Instance()
{
if (this._instance == null)
{
this._instance = new AudioManager();
}
return this._instance;
}
// static get Instance()
// {
// if (this._instance == null)
// {
// this._instance = new AudioManager();
// }
// return this._instance;
// }
public init() {
this.reward = false;
this.finish = false;
this.rewardCount = 0;
this.ctor();
this.preload();
}
preload () {
if (!(cc.sys.platform === cc.sys.WECHAT_GAME)) { return; }
@ -121,7 +170,6 @@ export class AudioManager {
{
this.mMusicSwitch = 1-this.mMusicSwitch;
// this.save();
}
if(on)
{
@ -146,6 +194,12 @@ export class AudioManager {
onShow () {
cc.audioEngine.resumeAll();
}
//播放音效
playEffect(name,callback){
if(this[name])
return this.play(this[name], false,callback,this.mEffectSwitch);
}
playMusic (key, callback, loop) {
loop = typeof loop == 'undefined' || loop ? true : false;
this.stopMusic();
@ -175,15 +229,6 @@ export class AudioManager {
}
}
// 炸弹、火箭爆炸音效
playWin () {
return this.play(this.audioWin, false,null,this.mEffectSwitch);
}
//激光音效
playWarning()
{
return this.play(this.audioWarning, false,null,this.mEffectSwitch);
}
/*
*
@ -222,7 +267,7 @@ export class AudioManager {
*
*/
playAudioButton () {
return this.play(this.audioButtonClick, false,null,this.mEffectSwitch);
// return this.play(this.audioButtonClick, false,null,this.mEffectSwitch);
}
};

View File

@ -12,10 +12,12 @@ export default class ItemRender extends cc.Component {
/**数据改变时调用 */
public dataChanged(){
cc.fx.GameTool.subName(this.data.name,6);
cc.fx.GameTool.subName(this.data.name,6);
this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
this.node.getChildByName("nameLab").getComponent(cc.Label).string = this.data.name + "";
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "";
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "%";
let timeTemp = cc.fx.GameTool.getTimeShenNong(this.data.time);
this.node.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
this.node.getChildByName("rank").getChildByName("one").active = false;
this.node.getChildByName("rank").getChildByName("two").active = false;
this.node.getChildByName("rank").getChildByName("three").active = false;

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "bdc76845-baea-4381-911e-af437cccf839",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

Binary file not shown.

View File

@ -0,0 +1,6 @@
{
"ver": "1.0.3",
"uuid": "b42c4fc1-4cd1-4b12-b206-930cea3d49ca",
"importer": "asset",
"subMetas": {}
}

View File

@ -0,0 +1,95 @@
var shareConfig = {
gameId: "100010",
shareLine: "zDLsruVI",
EK:"hui231%1"
};
// 定义微信配置数据的接口
interface IWeChatConfig {
appId: string;
timestamp: number;
nonceStr: string;
signature: string;
jsApiList: [];
}
// 微信操作类
export class WeChat {
static setShare(url) {
var urlTemp = this.removeQueryParams(url);
shareConfig.shareLine = urlTemp;
WeChat.getSignature(url);
}
static getResult(res){
if(res){
var data = res.data;
wx.config({
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: ['onMenuShareTimeline','updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage']
});
wx.checkJsApi({
jsApiList: ['updateAppMessageShareData'], // 需要检测的JS接口列表所有JS接口列表见附录2,
success: function(res) {
setTimeout(() => {
WeChat.changeShare();
}, 100);
setTimeout(() => {
WeChat.changeShare();
}, 200);
}
});
}
}
static changeShare(){
wx.ready(() => {
wx.updateAppMessageShareData({
title: '记忆力认知测评', // 分享标题
desc: '你的认知灵活性和选择注意有问题吗', // 分享描述
link: shareConfig.shareLine, // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg', // 分享图标
success: function () {
// 设置成功
console.log("分享好友成功回调");
}
});
wx.updateTimelineShareData({
title: '记忆力认知测评', // 分享标题
link: shareConfig.shareLine, // 分享链接该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg', // 分享图标
success: function () {
// 设置成功
console.log("分享朋友圈成功回调");
}
})
});
}
static getSignature(url: string): Promise<IWeChatConfig> {
return new Promise((resolve) => {
WeChat.getShareInfo((encodeURIComponent(url)),WeChat.getResult);
});
}
static async getShareInfo(shareUrl: string, callback:Function): Promise<any> {
const time = Math.floor((new Date().getTime()) / 1000)
const url = cc.fx.HttpUtil.apiSign(`/api/share/cfg?gameId=${shareConfig.gameId}&time=${time}&url=${shareUrl}`,{})
return cc.fx.HttpUtil.get(url,callback)
}
static containsNanana(str) {
return /test/i.test(str);
}
static removeQueryParams(url) {
return url.replace(/\?.*$/, '');
}
}

View File

@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "7290c680-dfdc-4c59-9736-a614cc2a8bcf",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -9,7 +9,7 @@ var GameTool = {
let name = "user_" + cc.fx.GameConfig.GM_INFO.gameId;
var data = JSON.parse(localStorage.getItem(name));
if(data == "undifend" || data==null || data == ""){
let url = "http://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback="+location.href;
let url = "https://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback="+location.href;
window.location.href = url;
}
else{
@ -33,7 +33,7 @@ var GameTool = {
"data": data
};
// console.log("上传数据:")
console.log("上传数据:");
cc.fx.HttpUtil.uploadUserLogData(postData,function(){})
},
//上传排行榜 type为1
@ -43,8 +43,8 @@ var GameTool = {
"gameId":cc.fx.GameConfig.GM_INFO.gameId,
"userId":cc.fx.GameConfig.GM_INFO.userId,
"type":1,
"reactionTime": data,
"totalSunCount": cc.fx.GameConfig.GM_INFO.total,
"totleTimes": data.totleTimes,
"accuracy": data.accuracy,
"success": cc.fx.GameConfig.GM_INFO.success
};
cc.fx.HttpUtil.rankData(1,function(){},postData);
@ -64,6 +64,7 @@ var GameTool = {
//获取matchId 用于上传每次点击数据里面记录id方便查询
getMatchId (){
let matchId = cc.sys.localStorage.getItem("matchId");
let tempId = matchId;
if(matchId == "undifend" || matchId==null){
matchId = this.setMatchId();
}
@ -72,15 +73,20 @@ var GameTool = {
matchId = this.setMatchId();
}
else{
let char = parseInt(matchId[10]);
if(this.level == 1){
let char = parseInt(tempId.substring(10,tempId.length));
if(cc.fx.GameConfig.GM_INFO.level == 1){
char += 1;
matchId = tempId.slice(0, 10) + char + "";
if(this.containsNanana(matchId)) matchId = this.setMatchId();
cc.fx.GameConfig.GM_INFO.matchId = matchId;
cc.sys.localStorage.setItem("matchId",matchId);
}
matchId = matchId.slice(0, 10) + char + "";
cc.fx.GameConfig.GM_INFO.matchId = matchId;
cc.sys.localStorage.setItem("matchId",matchId);
}
}
if(this.containsNanana(matchId) == true){
matchId = this.setMatchId();
}
return matchId;
},
//检测matchId 如果有缓存以前的nanana数据清除
@ -152,7 +158,7 @@ var GameTool = {
let self = false;
cc.fx.GameTool.setPic(target.selfNode.getChildByName("pic").getChildByName("icon"),target.selfData.pic);
for(let i=0;i<=target.listData.length-1;i++){
rankData.push({rank:(i+1), name:target.listData[i].nickName, total:target.listData[i].totalSunCount, pic:target.listData[i].pic});
rankData.push({rank:(i+1), name:target.listData[i].nickName, total:target.listData[i].accuracy,time:target.listData[i].totleTimes, pic:target.listData[i].pic});
if(cc.fx.GameConfig.GM_INFO.userId == target.listData[i].userId){
self = true;
target.rankNumber = i;
@ -165,7 +171,9 @@ var GameTool = {
}
cc.fx.GameTool.subName(target.selfData.nickName,nameLength);
target.selfNode.getChildByName("nameLab").getComponent(cc.Label).string = target.selfData.nickName;
target.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = target.selfData.totalSunCount;
target.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = target.selfData.accuracy + "%";
let timeTemp = cc.fx.GameTool.getTimeShenNong(target.selfData.totleTimes);
target.selfNode.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
switch(target.selfNode.getChildByName("rankLab").getComponent(cc.Label).string){
case "1":
target.selfNode.getChildByName("rank").getChildByName("one").active = true;
@ -176,7 +184,6 @@ var GameTool = {
case "3":
target.selfNode.getChildByName("rank").getChildByName("three").active = true;
break;
}
// 大排行
if(nameLength == 6){
@ -186,6 +193,121 @@ var GameTool = {
}
},
getSeedRandom: function (min, max) {//包含min 不包含max
console.log("随机数:",cc.fx.GameConfig.GM_INFO.currSeed);
max = max || 1;
min = min || 0;
cc.fx.GameConfig.GM_INFO.currSeed = (cc.fx.GameConfig.GM_INFO.currSeed * 9301 + 49297) % 233280;
let rnd = cc.fx.GameConfig.GM_INFO.currSeed / 233280.0;
let tmp = min + rnd * (max - min);
return parseInt(tmp);
},
//获取关卡配置的那个关卡数
getCustom(type){
let custom = cc.fx.StorageMessage.getStorage(cc.fx.storageType.storageTypeCustom);
if(custom == "undifend" || custom==null || custom == ""){
this.setCustom();
}
else{
cc.fx.GameConfig.GM_INFO_SET("custom",custom[0]);
if(custom[0] != 0 || type == true){
custom.shift();
if(custom.length == 0){
this.setCustom();
}
else cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom,custom);
}
}
},
//本地没有存储到配置,或者配置用完,重新创建配置
setCustom(){
let arrayLength = cc.fx.GameConfig.LEVEL_INFO.length;
let arrayList = [];
for(let i=1; i<arrayLength;i++){
arrayList.push(i);
}
arrayList.sort(() => Math.random() - 0.5);
arrayList.unshift(0)
cc.fx.GameConfig.GM_INFO_SET("custom",arrayList[0]);
cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom,arrayList);
},
getFoodName(food){
var name = "葡萄";
switch(food){
case "baishao":
name = "白芍";
break;
case "jingjie":
name = "荆芥";
break;
case "renshen":
name = "人参";
break;
case "danshen":
name = "丹参";
break;
case "danggui":
name = "当归";
break;
case "gouqi":
name = "枸杞";
break;
case "mudan":
name = "牡丹";
break;
case "mulan":
name = "木兰";
break;
case "pugongying":
name = "蒲公英";
break;
case "moli":
name = "茉莉";
break;
case "jinju":
name = "金桔";
break;
case "dazao":
name = "大枣";
break;
case "lizi":
name = "李子";
break;
case "lizhi":
name = "荔枝";
break;
case "taozi":
name = "桃子";
break;
case "putao":
name = "葡萄";
break;
case "muchai":
name = "木柴";
break;
case "ganjiang":
name = "干姜";
break;
case "zhuye":
name = "竹叶";
break;
case "longyan":
name = "龙眼";
break;
case "chixiaodou":
name = "赤小豆";
break;
case "gancao":
name = "甘草";
break;
case "cha":
name = "茶";
break;
}
return name;
},
getSetScreenResolutionFlag: function () {
let size = cc.winSize;
let width = size.width;
@ -212,6 +334,25 @@ var GameTool = {
setGameInfo: function(pd){
},
//打字机效果
typingAni(label,text,cb,target){
var self = target;
var html = '';
var arr = text.split('');
var len = arr.length;
var step = 0;
self.func = ()=>{
html += arr[step];
label.string = html;
if (++step == len) {
self.unschedule(self.func);
cb && cb();
}
}
self.schedule(self.func,0.1, cc.macro.REPEAT_FOREVER, 0)
},
//输入秒,返回需要展示时间格式
getTimeMargin:(second) => {
let total = 0;
@ -228,6 +369,22 @@ var GameTool = {
return m + ':' + miao
},
//输入秒,返回需要展示时间格式
getTimeShenNong:(second) => {
second = parseInt(second/1000+"");
let total = 0;
total = second;
let min = 0;
if(total > 60){
min = parseInt((total / 60)+"");//计算整数分
}
let m = min + "'";
let afterMin = total - min * 60;//取得算出分后剩余的秒数
let miao = afterMin + "''";
return m + miao
},
//获取时间戳
getTime(){
const timestamp = new Date().getTime();

View File

@ -16,18 +16,25 @@
"_name": "Block",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
"_children": [
{
"__id__": 2
},
{
"__id__": 3
"__id__": 5
}
],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
}
],
"_prefab": {
"__id__": 4
"__id__": 10
},
"_opacity": 255,
"_color": {
@ -76,6 +83,220 @@
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "vertical",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 60,
"height": 96
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "af8457b5-c84c-4585-9402-aee73193f450"
},
"_type": 3,
"_sizeMode": 1,
"_fillType": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "1cW1eKjG1IzrE0Me3F5dzp",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "turn",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 78,
"height": 78
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
9,
9,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e3acc841-072e-46c4-b892-be3da3cb608b"
},
"_type": 3,
"_sizeMode": 1,
"_fillType": 2,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0.185,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "0en916QFNENrq/dQ8DeOiU",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",

View File

@ -15,7 +15,7 @@ var GameTool = {
var name = "user_" + cc.fx.GameConfig.GM_INFO.gameId;
var data = JSON.parse(localStorage.getItem(name));
if (data == "undifend" || data == null || data == "") {
var url = "http://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback=" + location.href;
var url = "https://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback=" + location.href;
window.location.href = url;
}
else {
@ -37,7 +37,7 @@ var GameTool = {
"matchId": matchId,
"data": data
};
// console.log("上传数据:")
console.log("上传数据:");
cc.fx.HttpUtil.uploadUserLogData(postData, function () { });
},
//上传排行榜 type为1
@ -47,8 +47,8 @@ var GameTool = {
"gameId": cc.fx.GameConfig.GM_INFO.gameId,
"userId": cc.fx.GameConfig.GM_INFO.userId,
"type": 1,
"reactionTime": data,
"totalSunCount": cc.fx.GameConfig.GM_INFO.total,
"totleTimes": data.totleTimes,
"accuracy": data.accuracy,
"success": cc.fx.GameConfig.GM_INFO.success
};
cc.fx.HttpUtil.rankData(1, function () { }, postData);
@ -68,6 +68,7 @@ var GameTool = {
//获取matchId 用于上传每次点击数据里面记录id方便查询
getMatchId: function () {
var matchId = cc.sys.localStorage.getItem("matchId");
var tempId = matchId;
if (matchId == "undifend" || matchId == null) {
matchId = this.setMatchId();
}
@ -76,15 +77,20 @@ var GameTool = {
matchId = this.setMatchId();
}
else {
var char = parseInt(matchId[10]);
if (this.level == 1) {
var char = parseInt(tempId.substring(10, tempId.length));
if (cc.fx.GameConfig.GM_INFO.level == 1) {
char += 1;
matchId = tempId.slice(0, 10) + char + "";
if (this.containsNanana(matchId))
matchId = this.setMatchId();
cc.fx.GameConfig.GM_INFO.matchId = matchId;
cc.sys.localStorage.setItem("matchId", matchId);
}
matchId = matchId.slice(0, 10) + char + "";
cc.fx.GameConfig.GM_INFO.matchId = matchId;
cc.sys.localStorage.setItem("matchId", matchId);
}
}
if (this.containsNanana(matchId) == true) {
matchId = this.setMatchId();
}
return matchId;
},
//检测matchId 如果有缓存以前的nanana数据清除
@ -156,7 +162,7 @@ var GameTool = {
var self = false;
cc.fx.GameTool.setPic(target.selfNode.getChildByName("pic").getChildByName("icon"), target.selfData.pic);
for (var i = 0; i <= target.listData.length - 1; i++) {
rankData.push({ rank: (i + 1), name: target.listData[i].nickName, total: target.listData[i].totalSunCount, pic: target.listData[i].pic });
rankData.push({ rank: (i + 1), name: target.listData[i].nickName, total: target.listData[i].accuracy, time: target.listData[i].totleTimes, pic: target.listData[i].pic });
if (cc.fx.GameConfig.GM_INFO.userId == target.listData[i].userId) {
self = true;
target.rankNumber = i;
@ -169,7 +175,9 @@ var GameTool = {
}
cc.fx.GameTool.subName(target.selfData.nickName, nameLength);
target.selfNode.getChildByName("nameLab").getComponent(cc.Label).string = target.selfData.nickName;
target.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = target.selfData.totalSunCount;
target.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = target.selfData.accuracy + "%";
var timeTemp = cc.fx.GameTool.getTimeShenNong(target.selfData.totleTimes);
target.selfNode.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
switch (target.selfNode.getChildByName("rankLab").getComponent(cc.Label).string) {
case "1":
target.selfNode.getChildByName("rank").getChildByName("one").active = true;
@ -189,6 +197,120 @@ var GameTool = {
target.selfNode.opacity = 0;
}
},
getSeedRandom: function (min, max) {
console.log("随机数:", cc.fx.GameConfig.GM_INFO.currSeed);
max = max || 1;
min = min || 0;
cc.fx.GameConfig.GM_INFO.currSeed = (cc.fx.GameConfig.GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = cc.fx.GameConfig.GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return parseInt(tmp);
},
//获取关卡配置的那个关卡数
getCustom: function (type) {
var custom = cc.fx.StorageMessage.getStorage(cc.fx.storageType.storageTypeCustom);
if (custom == "undifend" || custom == null || custom == "") {
this.setCustom();
}
else {
cc.fx.GameConfig.GM_INFO_SET("custom", custom[0]);
if (custom[0] != 0 || type == true) {
custom.shift();
if (custom.length == 0) {
this.setCustom();
}
else
cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom, custom);
}
}
},
//本地没有存储到配置,或者配置用完,重新创建配置
setCustom: function () {
var arrayLength = cc.fx.GameConfig.LEVEL_INFO.length;
var arrayList = [];
for (var i = 1; i < arrayLength; i++) {
arrayList.push(i);
}
arrayList.sort(function () { return Math.random() - 0.5; });
arrayList.unshift(0);
cc.fx.GameConfig.GM_INFO_SET("custom", arrayList[0]);
cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom, arrayList);
},
getFoodName: function (food) {
var name = "葡萄";
switch (food) {
case "baishao":
name = "白芍";
break;
case "jingjie":
name = "荆芥";
break;
case "renshen":
name = "人参";
break;
case "danshen":
name = "丹参";
break;
case "danggui":
name = "当归";
break;
case "gouqi":
name = "枸杞";
break;
case "mudan":
name = "牡丹";
break;
case "mulan":
name = "木兰";
break;
case "pugongying":
name = "蒲公英";
break;
case "moli":
name = "茉莉";
break;
case "jinju":
name = "金桔";
break;
case "dazao":
name = "大枣";
break;
case "lizi":
name = "李子";
break;
case "lizhi":
name = "荔枝";
break;
case "taozi":
name = "桃子";
break;
case "putao":
name = "葡萄";
break;
case "muchai":
name = "木柴";
break;
case "ganjiang":
name = "干姜";
break;
case "zhuye":
name = "竹叶";
break;
case "longyan":
name = "龙眼";
break;
case "chixiaodou":
name = "赤小豆";
break;
case "gancao":
name = "甘草";
break;
case "cha":
name = "茶";
break;
}
return name;
},
getSetScreenResolutionFlag: function () {
var size = cc.winSize;
var width = size.width;
@ -216,6 +338,23 @@ var GameTool = {
//设置游戏信息
setGameInfo: function (pd) {
},
//打字机效果
typingAni: function (label, text, cb, target) {
var self = target;
var html = '';
var arr = text.split('');
var len = arr.length;
var step = 0;
self.func = function () {
html += arr[step];
label.string = html;
if (++step == len) {
self.unschedule(self.func);
cb && cb();
}
};
self.schedule(self.func, 0.1, cc.macro.REPEAT_FOREVER, 0);
},
//输入秒,返回需要展示时间格式
getTimeMargin: function (second) {
var total = 0;
@ -233,6 +372,20 @@ var GameTool = {
miao = "0" + afterMin;
return m + ':' + miao;
},
//输入秒,返回需要展示时间格式
getTimeShenNong: function (second) {
second = parseInt(second / 1000 + "");
var total = 0;
total = second;
var min = 0;
if (total > 60) {
min = parseInt((total / 60) + ""); //计算整数分
}
var m = min + "'";
var afterMin = total - min * 60; //取得算出分后剩余的秒数
var miao = afterMin + "''";
return m + miao;
},
//获取时间戳
getTime: function () {
var timestamp = new Date().getTime();

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ var NewClass = /** @class */ (function (_super) {
NewClass.prototype.start = function () {
window.initMgr();
cc.fx.GameConfig.init(this.localTest);
cc.fx.AudioManager.Instance.init();
// cc.fx.AudioManager.Instance.init();
this.testVersion.string = this.clientTestVersion;
};
//开始游戏,跳转至引导页面

View File

@ -1 +1 @@
{"version":3,"sources":["assets\\Script\\Load.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACM,IAAA,KAAwC,EAAE,CAAC,UAAU,EAApD,OAAO,aAAA,EAAE,QAAQ,cAAA,EAAE,gBAAgB,sBAAiB,CAAC;AAG5D;IAAsC,4BAAY;IAAlD;QAAA,qEAmCC;QAhCG,eAAS,GAAY,KAAK,CAAC;QAG3B,uBAAiB,GAAW,OAAO,CAAC;QAGpC,iBAAW,GAAa,IAAI,CAAC;;IA0BjC,CAAC;IAxBG,wBAAK,GAAL;QACI,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACrD,CAAC;IAED,cAAc;IACd,4BAAS,GAAT;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACnC,uCAAuC;IAC3C,CAAC;IACD,gBAAgB;IAChB,2BAAQ,GAAR,UAAS,KAAK,EAAC,IAAI;QACf,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjD,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IACD,OAAO;IACP,2BAAQ,GAAR;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAES,yBAAM,GAAhB,UAAiB,EAAU;IAC3B,CAAC;IA/BD;QADC,QAAQ,CAAC,KAAK,CAAC;+CACW;IAG3B;QADC,QAAQ,CAAC,EAAE,CAAC;uDACuB;IAGpC;QADC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC;iDACU;IATZ,QAAQ;QAD5B,OAAO;OACa,QAAQ,CAmC5B;IAAD,eAAC;CAnCD,AAmCC,CAnCqC,EAAE,CAAC,SAAS,GAmCjD;kBAnCoB,QAAQ","file":"","sourceRoot":"/","sourcesContent":["\r\nconst {ccclass, property, requireComponent} = cc._decorator;\r\n\r\n@ccclass\r\nexport default class NewClass extends cc.Component {\r\n\r\n @property(false)\r\n localTest: boolean = false;\r\n\r\n @property(\"\")\r\n clientTestVersion: string = \"1.0.0\";\r\n\r\n @property(cc.Label)\r\n testVersion: cc.Label = null;\r\n\r\n start () {\r\n window.initMgr();\r\n cc.fx.GameConfig.init(this.localTest);\r\n cc.fx.AudioManager.Instance.init();\r\n this.testVersion.string = this.clientTestVersion;\r\n }\r\n\r\n //开始游戏,跳转至引导页面\r\n startGame(){\r\n cc.director.loadScene(\"GameScene\");\r\n // cc.director.loadScene(\"GuideScene\");\r\n }\r\n //备用,用来测试跳转 指定关卡\r\n clickBtn(event,data){\r\n cc.fx.GameConfig.GM_INFO.custom = parseInt(data);\r\n cc.director.loadScene(\"GameScene\");\r\n } \r\n //打开排行榜\r\n openRank(){\r\n cc.director.loadScene(\"RankScene\");\r\n }\r\n \r\n protected update(dt: number): void {\r\n }\r\n}\r\n"]}
{"version":3,"sources":["assets\\Script\\Load.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACM,IAAA,KAAwC,EAAE,CAAC,UAAU,EAApD,OAAO,aAAA,EAAE,QAAQ,cAAA,EAAE,gBAAgB,sBAAiB,CAAC;AAG5D;IAAsC,4BAAY;IAAlD;QAAA,qEAmCC;QAhCG,eAAS,GAAY,KAAK,CAAC;QAG3B,uBAAiB,GAAW,OAAO,CAAC;QAGpC,iBAAW,GAAa,IAAI,CAAC;;IA0BjC,CAAC;IAxBG,wBAAK,GAAL;QACI,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,sCAAsC;QACtC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACrD,CAAC;IAED,cAAc;IACd,4BAAS,GAAT;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACnC,uCAAuC;IAC3C,CAAC;IACD,gBAAgB;IAChB,2BAAQ,GAAR,UAAS,KAAK,EAAC,IAAI;QACf,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjD,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IACD,OAAO;IACP,2BAAQ,GAAR;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAES,yBAAM,GAAhB,UAAiB,EAAU;IAC3B,CAAC;IA/BD;QADC,QAAQ,CAAC,KAAK,CAAC;+CACW;IAG3B;QADC,QAAQ,CAAC,EAAE,CAAC;uDACuB;IAGpC;QADC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC;iDACU;IATZ,QAAQ;QAD5B,OAAO;OACa,QAAQ,CAmC5B;IAAD,eAAC;CAnCD,AAmCC,CAnCqC,EAAE,CAAC,SAAS,GAmCjD;kBAnCoB,QAAQ","file":"","sourceRoot":"/","sourcesContent":["\r\nconst {ccclass, property, requireComponent} = cc._decorator;\r\n\r\n@ccclass\r\nexport default class NewClass extends cc.Component {\r\n\r\n @property(false)\r\n localTest: boolean = false;\r\n\r\n @property(\"\")\r\n clientTestVersion: string = \"1.0.0\";\r\n\r\n @property(cc.Label)\r\n testVersion: cc.Label = null;\r\n\r\n start () {\r\n window.initMgr();\r\n cc.fx.GameConfig.init(this.localTest);\r\n // cc.fx.AudioManager.Instance.init();\r\n this.testVersion.string = this.clientTestVersion;\r\n }\r\n\r\n //开始游戏,跳转至引导页面\r\n startGame(){\r\n cc.director.loadScene(\"GameScene\");\r\n // cc.director.loadScene(\"GuideScene\");\r\n }\r\n //备用,用来测试跳转 指定关卡\r\n clickBtn(event,data){\r\n cc.fx.GameConfig.GM_INFO.custom = parseInt(data);\r\n cc.director.loadScene(\"GameScene\");\r\n } \r\n //打开排行榜\r\n openRank(){\r\n cc.director.loadScene(\"RankScene\");\r\n }\r\n \r\n protected update(dt: number): void {\r\n }\r\n}\r\n"]}

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,19 @@ cc._RF.push(module, '58403/n16JCa5sZhNMjZzGo', 'AudioManager');
// Script/module/Music/AudioManager.ts
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -10,22 +23,54 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AudioManager = void 0;
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var AudioManager = /** @class */ (function () {
var AudioManager = /** @class */ (function (_super) {
__extends(AudioManager, _super);
function AudioManager() {
var _this = _super !== null && _super.apply(this, arguments) || this;
//背景音乐
this.audioGameBgm0 = null;
//跳跃
this.audioButtonClick = null;
//落地上
this.audioWarning = null;
//碰撞
this.audioWin = null;
_this.audioGameBgm0 = null;
_this.baishao_audio = null;
_this.cha_audio = null;
_this.chixiaodou_audio = null;
_this.danggui_audio = null;
_this.danshen_audio = null;
_this.dazao_audio = null;
_this.gancao_audio = null;
_this.ganjiang_audio = null;
_this.gouqi_audio = null;
_this.jingjie_audio = null;
_this.jinju_audio = null;
_this.lizhi_audio = null;
_this.lizi_audio = null;
_this.longyan_audio = null;
_this.moli_audio = null;
_this.muchai_audio = null;
_this.mudan_audio = null;
_this.mulan_audio = null;
_this.pugongying_audio = null;
_this.putao_audio = null;
_this.renshen_audio = null;
_this.taozi_audio = null;
_this.zhuye_audio = null;
_this.err = null;
_this.yes = null;
return _this;
}
AudioManager_1 = AudioManager;
AudioManager.playWarning = function () {
throw new Error('Method not implemented.');
AudioManager.prototype.onLoad = function () {
if (AudioManager_1._instance == null) {
AudioManager_1._instance = this;
cc.game.addPersistRootNode(this.node);
}
else {
return;
}
this.reward = false;
this.finish = false;
this.rewardCount = 0;
this.ctor();
this.preload();
};
AudioManager.prototype.ctor = function () {
this.mAudioMap = {};
@ -39,51 +84,41 @@ var AudioManager = /** @class */ (function () {
this.mEffectSwitch = 1;
};
AudioManager.prototype.play = function (audioSource, loop, callback, isBgMusic) {
if (isBgMusic && !this.mMusicSwitch)
return;
if (!isBgMusic && !this.mEffectSwitch)
return;
// if (isBgMusic && !this.mMusicSwitch) return;
// if (!isBgMusic && !this.mEffectSwitch) return;
var volume = isBgMusic ? this.bgMusicVolume : this.effectMusicVolume;
if (cc.sys.isBrowser) {
if (audioSource == this.brickSound) {
volume = 0.1;
}
volume = 1;
var context = cc.audioEngine.play(audioSource, loop, volume);
if (callback) {
cc.audioEngine.setFinishCallback(context, function () {
callback.call(this);
}.bind(this));
}
// cc.wwx.OutPut.log('play audio effect isBrowser: ' + context.src);
this.mAudioMap[audioSource] = context;
return audioSource;
}
else {
return audioSource;
// if (cc.sys.isBrowser) {
// if(audioSource == this.brickSound){
// volume = 0.1;
// }
volume = 1;
cc.audioEngine.setEffectsVolume(1);
cc.audioEngine.setMusicVolume(1);
var context = cc.audioEngine.playEffect(audioSource, loop);
if (callback) {
cc.audioEngine.setFinishCallback(context, function () {
callback.call(this);
}.bind(this));
}
// cc.wwx.OutPut.log('play audio effect isBrowser: ' + context.src);
this.mAudioMap[audioSource] = context;
return audioSource;
// } else {
// return audioSource;
// }
};
AudioManager.prototype.save = function () {
// cc.wwx.Storage.setItem(cc.wwx.Storage.Key_Setting_Music_Volume, this.mMusicSwitch);
// cc.wwx.Storage.setItem(cc.wwx.Storage.Key_Setting_Effect_Volume, this.mEffectSwitch);
};
Object.defineProperty(AudioManager, "Instance", {
get: function () {
if (this._instance == null) {
this._instance = new AudioManager_1();
}
return this._instance;
},
enumerable: false,
configurable: true
});
AudioManager.prototype.init = function () {
this.reward = false;
this.finish = false;
this.rewardCount = 0;
this.ctor();
this.preload();
};
// static get Instance()
// {
// if (this._instance == null)
// {
// this._instance = new AudioManager();
// }
// return this._instance;
// }
AudioManager.prototype.preload = function () {
if (!(cc.sys.platform === cc.sys.WECHAT_GAME)) {
return;
@ -128,6 +163,11 @@ var AudioManager = /** @class */ (function () {
AudioManager.prototype.onShow = function () {
cc.audioEngine.resumeAll();
};
//播放音效
AudioManager.prototype.playEffect = function (name, callback) {
if (this[name])
return this.play(this[name], false, callback, this.mEffectSwitch);
};
AudioManager.prototype.playMusic = function (key, callback, loop) {
loop = typeof loop == 'undefined' || loop ? true : false;
this.stopMusic();
@ -155,14 +195,6 @@ var AudioManager = /** @class */ (function () {
cc.audioEngine.stop(context);
}
};
// 炸弹、火箭爆炸音效
AudioManager.prototype.playWin = function () {
return this.play(this.audioWin, false, null, this.mEffectSwitch);
};
//激光音效
AudioManager.prototype.playWarning = function () {
return this.play(this.audioWarning, false, null, this.mEffectSwitch);
};
/*
* 游戏开始音效
*
@ -191,28 +223,93 @@ var AudioManager = /** @class */ (function () {
* 按钮
*/
AudioManager.prototype.playAudioButton = function () {
return this.play(this.audioButtonClick, false, null, this.mEffectSwitch);
// return this.play(this.audioButtonClick, false,null,this.mEffectSwitch);
};
var AudioManager_1;
AudioManager._instance = null;
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioGameBgm0", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioButtonClick", void 0);
], AudioManager.prototype, "baishao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioWarning", void 0);
], AudioManager.prototype, "cha_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioWin", void 0);
], AudioManager.prototype, "chixiaodou_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "danggui_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "danshen_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "dazao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "gancao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "ganjiang_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "gouqi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "jingjie_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "jinju_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "lizhi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "lizi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "longyan_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "moli_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "muchai_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "mudan_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "mulan_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "pugongying_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "putao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "renshen_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "taozi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "zhuye_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "err", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "yes", void 0);
AudioManager = AudioManager_1 = __decorate([
ccclass('AudioManager')
ccclass
], AudioManager);
return AudioManager;
}());
exports.AudioManager = AudioManager;
}(cc.Component));
exports.default = AudioManager;
;
// export { AudioManager };

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ window.initMgr = function () {
return;
}
cc.fx = {};
console.log("初始化");
console.log("1初始化");
//基础状态信息
cc.fx.StateInfo = {
debugMode: true,
@ -23,23 +23,22 @@ window.initMgr = function () {
networkType: 'none',
isOnForeground: true //当前是否是在前台
};
cc.fx.Message = {
control: "操作控制",
mapDsetory: "2",
mapCreate: "3",
startGame: "4"
};
//应用系统信息
//配置文件
cc.fx.GameConfig = GameConfig_1.GameConfig;
cc.fx.HttpUtil = HttpUtil_1.default;
cc.fx.GameTool = GameTool_1.GameTool;
cc.fx.AudioManager = AudioManager_1.AudioManager;
cc.fx.AudioManager = AudioManager_1.default;
cc.fx.Notifications = Notification_1.Notifications;
cc.fx.StorageMessage = Storage_1.StorageMessage;
cc.fx.ShareInfo = {
queryId: -1 //分享id
};
cc.fx.Message = {
control: "10001",
startGame: "10002",
next: "10003" //传递执行下一个格子洪水流过
};
/*
* 客户端埋点分享类型
*/
@ -74,31 +73,20 @@ window.initMgr = function () {
Friend: "friend",
All: "all",
};
//暂时不用
cc.fx.clickStatEventType = {
clickStatEventTypeVideoAD: 20173201,
clickStatEventTypeClickAdVideo: 20173202,
clickStatEventTypeBannerAD: 20173203,
clickStatEventTypeUserFrom: 99990001,
clickStatEventTypeShare: 99990002,
clickStatEventTypeClickAdBtn: 99990007,
clickStatEventTypeBannerAD2: 67890033,
clickStatEventTypeSubmitVersionInfo: 9999,
clickStatEventTypeClickFirstAd: 99990003,
clickStatEventTypeClickSecondAd: 99990004,
clickStatEventTypeWxLoginStart: 10001,
clickStatEventTypeWxLoginSuccess: 10002,
clickStatEventTypeWxLoginFailed: 10003,
clickStatEventTypeAuthorizationStart: 10003,
clickStatEventTypeAuthorizationSuccess: 10004,
clickStatEventTypeAuthorizationFailed: 10005,
clickStatEventTypeLoginSDKStart: 10007,
clickStatEventTypeLoginSDKSuccess: 10008,
clickStatEventTypeLoginSDKFailed: 10009,
clickStatEventTypeTCP_Start: 10009,
clickStatEventTypeTCP_Success: 10010,
clickStatEventTypeTCP_Failed: 10011,
};
//用于存储消息的ID
cc.fx.storageType = cc.Enum({
storageTypeCustom: 1000101,
});
//用于存储提示语 按照步骤提示
cc.fx.tipType = cc.Enum({
tipOne: '神农氏回到家中,开始整理今天收集来的物品。当他第一次拿出或说出一种植物时,请告诉他这是新植物。',
tipTwo: '如果他拿出或说出的植物你今天看到过,请告诉他上次是看到的;如果你听他说过,则请告诉他上次是听到的。',
tipErrNew: '这是这局游戏第一次出现{植物}',
tipErrOld: '{植物}刚才出现过呢',
tipErrHear: '上次遇到{植物}时,似乎不是听到的吧',
tipErrSee: '上次遇到{植物}时,似乎不是看到的吧',
tipErrLast: '之前确实看到过{植物},但最近一次似乎不是看到的呢',
});
};
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,130 @@
"use strict";
cc._RF.push(module, '7290caA39xMWZc2phTMKovP', 'share');
// Script/module/Share/share.ts
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WeChat = void 0;
var shareConfig = {
gameId: "100010",
shareLine: "zDLsruVI",
EK: "hui231%1"
};
// 微信操作类
var WeChat = /** @class */ (function () {
function WeChat() {
}
WeChat.setShare = function (url) {
var urlTemp = this.removeQueryParams(url);
shareConfig.shareLine = urlTemp;
WeChat.getSignature(url);
};
WeChat.getResult = function (res) {
if (res) {
var data = res.data;
wx.config({
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: ['onMenuShareTimeline', 'updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage']
});
wx.checkJsApi({
jsApiList: ['updateAppMessageShareData'],
success: function (res) {
setTimeout(function () {
WeChat.changeShare();
}, 100);
setTimeout(function () {
WeChat.changeShare();
}, 200);
}
});
}
};
WeChat.changeShare = function () {
wx.ready(function () {
wx.updateAppMessageShareData({
title: '记忆力认知测评',
desc: '你的认知灵活性和选择注意有问题吗',
link: shareConfig.shareLine,
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg',
success: function () {
// 设置成功
console.log("分享好友成功回调");
}
});
wx.updateTimelineShareData({
title: '记忆力认知测评',
link: shareConfig.shareLine,
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg',
success: function () {
// 设置成功
console.log("分享朋友圈成功回调");
}
});
});
};
WeChat.getSignature = function (url) {
return new Promise(function (resolve) {
WeChat.getShareInfo((encodeURIComponent(url)), WeChat.getResult);
});
};
WeChat.getShareInfo = function (shareUrl, callback) {
return __awaiter(this, void 0, Promise, function () {
var time, url;
return __generator(this, function (_a) {
time = Math.floor((new Date().getTime()) / 1000);
url = cc.fx.HttpUtil.apiSign("/api/share/cfg?gameId=" + shareConfig.gameId + "&time=" + time + "&url=" + shareUrl, {});
return [2 /*return*/, cc.fx.HttpUtil.get(url, callback)];
});
});
};
WeChat.containsNanana = function (str) {
return /test/i.test(str);
};
WeChat.removeQueryParams = function (url) {
return url.replace(/\?.*$/, '');
};
return WeChat;
}());
exports.WeChat = WeChat;
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -61,20 +61,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var CryptoJS = require("./crypto-js.min.js"); //引用AES源码js
var BASE_URL = "http://api.sparkus.cn";
var BASE_URL = "https://api.sparkus.cn";
//只负责网络接口 次类只负责和后端交互,不负责处理数据 数据处理在GameTool
var HttpUtil = /** @class */ (function (_super) {
__extends(HttpUtil, _super);
function HttpUtil() {
return _super !== null && _super.apply(this, arguments) || this;
}
HttpUtil_1 = HttpUtil;
HttpUtil.getShareInfo = function (shareUrl) {
return __awaiter(this, void 0, Promise, function () {
var time, url;
return __generator(this, function (_a) {
console.log("设置分享链接:", shareUrl);
time = Math.floor((new Date().getTime()) / 1000);
url = HttpUtil_1.apiSign("/api/share/cfg?gameId=" + config.gameId + "&time=" + time + "&url=" + shareUrl, {});
return [2 /*return*/, this.post(url, null, null)];
});
});
};
//排行榜
HttpUtil.rankData = function (type, callback, data) {
return __awaiter(this, void 0, Promise, function () {
var time, url;
return __generator(this, function (_a) {
time = Math.floor((new Date().getTime()) / 1000);
url = apiSign("/api/get/rank/data?gameId=" + config.gameId + "&dataType=" + type + "&time=" + time, data);
url = HttpUtil_1.apiSign("/api/get/rank/data?gameId=" + config.gameId + "&dataType=" + type + "&time=" + time, data);
this.post(url, data, callback);
return [2 /*return*/];
});
@ -96,7 +108,7 @@ var HttpUtil = /** @class */ (function (_super) {
var time, url;
return __generator(this, function (_a) {
time = Math.floor((new Date().getTime()) / 1000);
url = apiSign("/api/get/user/data?gameId=" + config.gameId + "&time=" + time, data);
url = HttpUtil_1.apiSign("/api/get/user/data?gameId=" + config.gameId + "&time=" + time, data);
this.post(url, data, callback);
return [2 /*return*/];
});
@ -163,7 +175,27 @@ var HttpUtil = /** @class */ (function (_super) {
});
});
};
HttpUtil = __decorate([
/**
*
* @param url {string} 接口地址
* @param params {object} 需要加密的参数对象
*/
HttpUtil.apiSign = function (url, params) {
if (params === void 0) { params = {}; }
var convertUrl = url.trim();
if (convertUrl.indexOf('?') === -1) {
convertUrl += '?';
}
// 传入参数转换拼接字符串
var postStr = getQueryString(params);
var signedStr = genSignStr(convertUrl, postStr);
var encryptStr = "sign=" + signedStr;
var encryptSignStr = fxCry.encryptByDES(encryptStr, config.secretKey);
encryptSignStr = encodeURIComponent(encryptSignStr);
return urlencode(convertUrl) + "&_p=" + encryptSignStr;
};
var HttpUtil_1;
HttpUtil = HttpUtil_1 = __decorate([
ccclass
], HttpUtil);
return HttpUtil;
@ -175,8 +207,8 @@ function responseHandler(response) {
// 响应拦截器
// Rq.interceptors.response.use(responseHandler)
var config = {
gameId: "100009",
secretKey: "CMNhOzBA",
gameId: "100010",
secretKey: "wozrGKsL",
EK: "hui231%1"
};
var Crypoto = /** @class */ (function () {
@ -289,24 +321,5 @@ function urlencode(url) {
var params = new URLSearchParams(queryString);
return baseUrl + "?" + params.toString();
}
/**
*
* @param url {string} 接口地址
* @param params {object} 需要加密的参数对象
*/
function apiSign(url, params) {
if (params === void 0) { params = {}; }
var convertUrl = url.trim();
if (convertUrl.indexOf('?') === -1) {
convertUrl += '?';
}
// 传入参数转换拼接字符串
var postStr = getQueryString(params);
var signedStr = genSignStr(convertUrl, postStr);
var encryptStr = "sign=" + signedStr;
var encryptSignStr = fxCry.encryptByDES(encryptStr, config.secretKey);
encryptSignStr = encodeURIComponent(encryptSignStr);
return urlencode(convertUrl) + "&_p=" + encryptSignStr;
}
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var Block_1 = require("./Block");
// 主游戏控制类
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var GameManager = /** @class */ (function (_super) {
@ -43,19 +44,59 @@ var GameManager = /** @class */ (function (_super) {
GameManager.prototype.init = function () {
this.initMap();
};
//初始化地图
GameManager.prototype.initMap = function () {
this.block_Array = [];
var map = cc.fx.GameConfig.LEVEL_INFO[0].map;
for (var i = 0; i < map.length; i++) {
for (var j = 0; j < map[i].length; j++) {
this.path_Array = [];
this.map_Array = [];
this.map_Array = cc.fx.GameConfig.LEVEL_INFO[0][0].map;
//将地图x,y轴切换
for (var m = 0; m < Math.floor(this.map_Array.length / 2); m++) {
for (var n = 0; n < this.map_Array[m].length; n++) {
var temp = this.map_Array[m][n];
this.map_Array[m][n] = this.map_Array[n][m];
this.map_Array[n][m] = temp;
}
}
for (var i = 0; i < this.map_Array.length; i++) {
for (var j = 0; j < this.map_Array[i].length; j++) {
var block = cc.instantiate(this.Block);
block.parent = this.Map;
block.getComponent("Block").initData(map[i][j]);
block.setPosition(cc.v2(-block.width * 1.5 + j * block.width, -block.height * 1.5 + i * block.height));
block.getComponent("Block").initData(this.map_Array[i][j]);
if (this.map_Array[i][j] == cc.Enum(Block_1.BlockType).Start)
this.path_Array.push(cc.v3(i, j, cc.Enum(Block_1.BlockType).Nomal));
block.setPosition(cc.v2(-block.width * 1.5 + i * block.width, block.height * 1.5 - j * block.height));
this.block_Array.push(block);
}
}
};
//开始后,按玩家操作,将路径中地图块放入数组中
GameManager.prototype.setMap = function (data) {
for (var i = 0; i < data.length; i++) {
var start = this.path_Array[this.path_Array.length - 1];
switch (data[i]) {
case "up":
this.path_Array.push(cc.v3(start.x, start.y - 1, cc.Enum(Block_1.BlockType).Nomal));
break;
case "down":
this.path_Array.push(cc.v3(start.x, start.y + 1, cc.Enum(Block_1.BlockType).Nomal));
break;
case "left":
this.path_Array.push(cc.v3(start.x - 1, start.y, cc.Enum(Block_1.BlockType).Nomal));
break;
case "right":
this.path_Array.push(cc.v3(start.x + 1, start.y, cc.Enum(Block_1.BlockType).Nomal));
break;
case "reinforce":
this.path_Array.push(cc.v3(0, 0, cc.Enum(Block_1.BlockType).Reinforce));
break;
case "soil":
this.path_Array.push(cc.v3(0, 0, cc.Enum(Block_1.BlockType).Xi_Soil));
break;
}
}
this.runWater(0);
};
GameManager.prototype.setModel = function () {
var time = 0.3;
var block2 = this.node.getChildByName("Block1").getChildByName("icon").getComponent(cc.Sprite);
@ -85,6 +126,161 @@ var GameManager = /** @class */ (function (_super) {
.to(time, { fillRange: 0.25 })
.start();
};
//开始执行洪峰来了的动画
GameManager.prototype.runWater = function (order) {
order = parseInt(order);
if (order <= this.path_Array.length - 1) {
var i = this.path_Array[order].x * this.map_Array[0].length + this.path_Array[order].y;
var direction = "";
var circulate = true;
if (order == this.path_Array.length - 1) {
circulate = false;
direction = this.getDirection(order - 1);
if (direction == "up" || direction == "right_up" || direction == "left_up") {
direction = "up";
}
else if (direction == "down" || direction == "left_down" || direction == "right_down") {
direction = "down";
}
else if (direction == "left" || direction == "up_left" || direction == "down_left") {
direction = "left";
}
else if (direction == "right" || direction == "up_right" || direction == "down_right") {
direction = "right";
}
}
else {
direction = this.getDirection(order);
}
var target = this.block_Array[i].getComponent("Block");
target.setPath(direction);
var data = {
order: order,
time: 0.3,
type: this.path_Array[order].z,
circulate: circulate
};
target.runWater(data);
}
};
//获取洪峰方向
GameManager.prototype.getDirection = function (order) {
var name = "";
//入海口比较复杂单独判断
if (order == 0) {
var nextX = this.path_Array[order + 1].x - this.path_Array[order].x;
var nextY = this.path_Array[order].y - this.path_Array[order + 1].y;
//在底边
if (this.path_Array[order].y == this.map_Array.length - 1) {
if (nextX == 0) {
if (nextY == 1)
name = "up";
else if (nextY == -1)
name = "err";
}
else if (nextX == 1)
name = "up_right";
else if (nextX == -1)
name = "up_left";
}
//在顶边
else if (this.path_Array[order].y == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "err";
else if (nextY == -1)
name = "down";
}
else if (nextX == 1)
name = "down_right";
else if (nextX == -1)
name = "down_left";
}
//在左边
else if (this.path_Array[order].x == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "right_up";
else if (nextY == -1)
name = "right_down";
}
else if (nextX == 1)
name = "right";
else if (nextX == -1)
name = "err";
}
//在右边
else if (this.path_Array[order].x == this.map_Array[0].length - 1) {
if (nextX == 0) {
if (nextY == 1)
name = "left_up";
else if (nextY == -1)
name = "left_down";
}
else if (nextX == 1)
name = "err";
else if (nextX == -1)
name = "left";
}
}
//不是第一步,已经走过一步
else if (order > 0) {
//用于判断此点的上一个点,是为了判断当前方块洪水七点,以及下一个移动方向,判断洪终点方向
var nextX = this.path_Array[order + 1].x - this.path_Array[order].x;
var nextY = this.path_Array[order].y - this.path_Array[order + 1].y;
var previousX = this.path_Array[order].x - this.path_Array[order - 1].x;
var previousY = this.path_Array[order - 1].y - this.path_Array[order].y;
if (previousX == 0 && previousY == 1) {
if (nextX == 0) {
if (nextY == 1)
name = "up";
else if (nextY == -1)
name = "err";
}
else if (nextX == 1)
name = "up_right";
else if (nextX == -1)
name = "up_left";
}
else if (previousX == 0 && previousY == -1) {
if (nextX == 0) {
if (nextY == 1)
name = "err";
else if (nextY == -1)
name = "down";
}
else if (nextX == 1)
name = "down_right";
else if (nextX == -1)
name = "down_left";
}
else if (previousX == 1 && previousY == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "right_up";
else if (nextY == -1)
name = "right_down";
}
else if (nextX == 1)
name = "right";
else if (nextX == -1)
name = "err";
}
else if (previousX == -1 && previousY == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "left_up";
else if (nextY == -1)
name = "left_down";
}
else if (nextX == 1)
name = "err";
else if (nextX == -1)
name = "left";
}
}
return name;
};
//根据是否全面屏,做独立适配方面
GameManager.prototype.fit = function () {
var jg = this.setFit();
@ -133,7 +329,8 @@ var GameManager = /** @class */ (function (_super) {
//5: 694
};
//开始游戏
GameManager.prototype.startGame = function () {
GameManager.prototype.startGame = function (data) {
this.setMap(data);
};
//如果是倒计时 调用此方法
GameManager.prototype.updateCountDownTime = function () {
@ -141,10 +338,6 @@ var GameManager = /** @class */ (function (_super) {
this.countTime -= 1;
// this.time.string = cc.fx.GameTool.getTimeMargin(this.countTime);
if (this.countTime < 5) {
// cc.tween(this.time.node)
// .to(0.25,{scale:1.5,color:cc.color(255,0,0)})
// .to(0.25,{scale:1,color:cc.color(255,255,255)})
// .start()
var over = this.node.getChildByName("Over");
cc.tween(over)
.to(0.2, { opacity: 255 })
@ -179,11 +372,17 @@ var GameManager = /** @class */ (function (_super) {
};
GameManager.prototype.clickSun = function (data) {
};
GameManager.prototype.nextWater = function () {
};
GameManager.prototype.onEnable = function () {
cc.fx.Notifications.on(cc.fx.Message.control, this.clickSun, this);
cc.fx.Notifications.on(cc.fx.Message.next, this.runWater, this);
cc.fx.Notifications.on(cc.fx.Message.startGame, this.startGame, this);
};
GameManager.prototype.onDisable = function () {
cc.fx.Notifications.off(cc.fx.Message.control, this.clickSun);
cc.fx.Notifications.off(cc.fx.Message.next, this.runWater);
cc.fx.Notifications.off(cc.fx.Message.startGame, this.startGame);
};
GameManager.prototype.update = function (dt) {
};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
{
"__type__": "cc.Asset",
"_name": "Share",
"_objFlags": 0,
"_native": ".zip"
}

View File

@ -17,6 +17,7 @@ var GameConfig = /** @class */ (function () {
}
GameConfig_1 = GameConfig;
Object.defineProperty(GameConfig, "Instance", {
//游戏内信息
get: function () {
if (this._instance == null) {
this._instance = new GameConfig_1();
@ -26,38 +27,100 @@ var GameConfig = /** @class */ (function () {
enumerable: false,
configurable: true
});
//getSeedRandom
GameConfig.init = function (Authentication) {
this.GM_INFO_init();
this.CLICK_init();
this.LEVEL_INFO_init();
// cc.resources.load('Json/GM_INFO', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.GM_INFO_init();
// if(!Authentication) this.Authentication();
// return;
// }
// let jsonData: object = res.json!;
// this.GM_INFO = jsonData["data"];
// if(!Authentication) this.Authentication();
// })
this.GM_INFO_init();
var self = this;
// cc.resources.load('Json/CLICK_DATA', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.CLICK_init();
// return;
// }
// let jsonData: object = res.json!;
// this.CLICK_DATA = jsonData["data"];
// self.CLICK_DATA = jsonData["data"];
// })
// cc.resources.load('Json/LEVEL_INFO', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.LEVEL_INFO_init();
// return;
// }
// let jsonData: object = res.json!;
// this.LEVEL_INFO = jsonData["data"];
// 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 //最短路径
}
];
};
//数据备用
GameConfig.GM_INFO_init = function () {
@ -65,54 +128,142 @@ var GameConfig = /** @class */ (function () {
// isEnd: false,
mean_Time: 0,
total: 0,
currSeed: 203213,
gameId: '100009',
userId: 0,
currSeed: 200000,
gameId: "100010",
userId: 200139,
guide: true,
url: "http://api.sparkus.cn",
url: "https://api.sparkus.cn",
success: false,
matchId: null,
custom: 0 //用于测试跳关卡
custom: 0,
level: 0,
stepTimeList: 0,
successList: [],
gameTime: 5,
igniteCount: 0,
};
};
GameConfig.GM_INFO_SET = function (key, value) {
this.GM_INFO[key] = value;
};
GameConfig.CLICK_init = function () {
this.CLICK_DATA =
{
type: 1,
success: false,
round: 0,
totalSunCount: 0,
movedSunCount: 0,
sunSpeed: 0,
overlapSunCount: 0,
colorList: [],
duration: 0,
difficultyLevel: 0,
sunList: [],
stepTimeList: [],
remainder: 120 //游戏剩余时间
choice: 0,
rightChoice: 0,
item: "",
roundType: 0,
stepTime: 0,
levelConfig: 0,
ignite: false,
igniteCount: 0,
};
};
GameConfig.CLICK_SET = function (key, value) {
this.CLICK_DATA[key] = value;
};
GameConfig.LEVEL_INFO_init = function () {
/*
moveSpeed: 0, //洪峰移动速度
waitTime: 20, //洪峰冲击倒计时
fastPath: 5 //最短路径
*/
this.LEVEL_INFO = [
{
map: [
[
1, 0, 1, 1
],
[
1, 1, 1, 1
],
[
1, 1, 1, 1
],
[
1, 1, 1, 5
[
{
"id": 1001,
"map": [
[0, 0, 0, 4],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 1, 0, 0]
]
],
opacity: 0.9,
moveSpeed: 0.3,
}
},
{
"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]
]
}
],
];
};
GameConfig.Authentication = function () {

File diff suppressed because one or more lines are too long

View File

@ -29,25 +29,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockType = void 0;
exports.PathType = exports.BlockType = void 0;
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var BlockType;
(function (BlockType) {
/*起点地块 */
BlockType[BlockType["Start"] = 0] = "Start";
/*普通地块 */
BlockType[BlockType["Nomal"] = 1] = "Nomal";
BlockType[BlockType["Nomal"] = 0] = "Nomal";
/*起点地块 */
BlockType[BlockType["Start"] = 1] = "Start";
/*湿地 */
BlockType[BlockType["Nunja"] = 2] = "Nunja";
/*山峰 */
BlockType[BlockType["Peak"] = 3] = "Peak";
/*息壤 */
BlockType[BlockType["Xi_Soil"] = 4] = "Xi_Soil";
/*息壤 */
BlockType[BlockType["Construct"] = 5] = "Construct";
/*终点地块 */
BlockType[BlockType["End"] = 5] = "End";
BlockType[BlockType["End"] = 4] = "End";
/*息壤 */
BlockType[BlockType["Xi_Soil"] = 5] = "Xi_Soil";
/*加固 */
BlockType[BlockType["Reinforce"] = 6] = "Reinforce";
})(BlockType = exports.BlockType || (exports.BlockType = {}));
var PathType;
(function (PathType) {
PathType["err"] = "err";
PathType["up"] = "up";
PathType["down"] = "down";
PathType["left"] = "left";
PathType["right"] = "right";
PathType["up_left"] = "up_left";
PathType["up_right"] = "up_right";
PathType["down_left"] = "down_left";
PathType["down_right"] = "down_right";
PathType["left_up"] = "left_up";
PathType["left_down"] = "left_down";
PathType["right_up"] = "right_up";
PathType["right_down"] = "right_down";
})(PathType = exports.PathType || (exports.PathType = {}));
var NewClass = /** @class */ (function (_super) {
__extends(NewClass, _super);
function NewClass() {
@ -59,7 +75,7 @@ var NewClass = /** @class */ (function (_super) {
NewClass.prototype.start = function () {
};
NewClass.prototype.initData = function (type) {
this.block_type = type;
this.block_Type = type;
if (type == cc.Enum(BlockType).Start) {
this.node.color = cc.color(245, 70, 70);
}
@ -67,6 +83,79 @@ var NewClass = /** @class */ (function (_super) {
this.node.color = cc.color(20, 255, 0);
}
};
NewClass.prototype.setPath = function (type) {
this.path_Type = type;
};
//洪峰执行
NewClass.prototype.runWater = function (data) {
var target = null;
var progress = 1;
var time = data.time;
var order = data.order + 1;
target = this.node.getChildByName("vertical");
console.log(this.path_Type);
if (this.path_Type == cc.Enum(PathType).up) {
}
else if (this.path_Type == cc.Enum(PathType).down) {
target.angle = 180;
}
else if (this.path_Type == cc.Enum(PathType).left) {
target.angle = 90;
}
else if (this.path_Type == cc.Enum(PathType).right) {
target.angle = 270;
}
else {
target = this.node.getChildByName("turn");
progress = 0.25;
if (this.path_Type == cc.Enum(PathType).up_left) {
target.setPosition(-9, -9);
}
else if (this.path_Type == cc.Enum(PathType).up_right) {
target.scaleX = -1;
target.setPosition(9, -9);
}
else if (this.path_Type == cc.Enum(PathType).down_left) {
target.angle = 180;
target.scaleX = -1;
target.setPosition(-9, 9);
}
else if (this.path_Type == cc.Enum(PathType).down_right) {
target.angle = 180;
target.scaleX = 1;
target.setPosition(9, 9);
}
else if (this.path_Type == cc.Enum(PathType).left_up) {
target.angle = -90;
target.scaleY = -1;
target.setPosition(9, 9);
}
else if (this.path_Type == cc.Enum(PathType).left_down) {
target.angle = 90;
target.scaleY = -1;
target.setPosition(-9, -9);
}
else if (this.path_Type == cc.Enum(PathType).right_up) {
target.angle = -90;
// target.scaleY = -1;
target.setPosition(-9, 9);
}
else if (this.path_Type == cc.Enum(PathType).right_down) {
target.angle = -90;
target.scaleX = -1;
target.setPosition(-9, -9);
}
}
target.active = true;
target.getComponent(cc.Sprite).fillRange = 0;
cc.tween(target.getComponent(cc.Sprite))
.to(time, { fillRange: progress })
.call(function () {
if (data.circulate)
cc.fx.Notifications.emit(cc.fx.Message.next, order);
})
.start();
};
NewClass = __decorate([
ccclass
], NewClass);

File diff suppressed because one or more lines are too long

View File

@ -16,18 +16,25 @@
"_name": "Block",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
"_children": [
{
"__id__": 2
},
{
"__id__": 3
"__id__": 5
}
],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
}
],
"_prefab": {
"__id__": 4
"__id__": 10
},
"_opacity": 255,
"_color": {
@ -76,6 +83,220 @@
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "vertical",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 60,
"height": 96
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "af8457b5-c84c-4585-9402-aee73193f450"
},
"_type": 3,
"_sizeMode": 1,
"_fillType": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "1cW1eKjG1IzrE0Me3F5dzp",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "turn",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 78,
"height": 78
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
9,
9,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e3acc841-072e-46c4-b892-be3da3cb608b"
},
"_type": 3,
"_sizeMode": 1,
"_fillType": 2,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0.185,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "0en916QFNENrq/dQ8DeOiU",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",

View File

@ -39,7 +39,9 @@ var ItemRender = /** @class */ (function (_super) {
cc.fx.GameTool.subName(this.data.name, 6);
this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
this.node.getChildByName("nameLab").getComponent(cc.Label).string = this.data.name + "";
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "";
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "%";
var timeTemp = cc.fx.GameTool.getTimeShenNong(this.data.time);
this.node.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
this.node.getChildByName("rank").getChildByName("one").active = false;
this.node.getChildByName("rank").getChildByName("two").active = false;
this.node.getChildByName("rank").getChildByName("three").active = false;

File diff suppressed because one or more lines are too long

View File

@ -45,6 +45,7 @@ var NewClass = /** @class */ (function (_super) {
// onLoad () {}
NewClass.prototype.start = function () {
this.tipArray = [];
this.controlArray = [];
this.canTouch = true;
};
NewClass.prototype.setPosition = function (tip) {
@ -70,6 +71,7 @@ var NewClass = /** @class */ (function (_super) {
tip.removeFromParent(this.Map);
tip = null;
this.tipArray.pop();
this.controlArray.pop();
}
};
NewClass.prototype.btn_Click = function (target, data) {
@ -88,13 +90,14 @@ var NewClass = /** @class */ (function (_super) {
tip.parent = this.Map;
this.setPosition(tip);
this.tipArray.push(tip);
this.controlArray.push(data);
cc.fx.Notifications.emit(cc.fx.Message.control, data);
};
NewClass.prototype.start_Click = function () {
if (!this.canTouch)
return;
this.canTouch = false;
cc.fx.Notifications.emit(cc.fx.Message.startGame, null);
cc.fx.Notifications.emit(cc.fx.Message.startGame, this.controlArray);
};
__decorate([
property(cc.Node)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,7 @@
]
},
{
"width": 641.3229370117188,
"width": 641,
"height": 556.3333740234375,
"type": "panel",
"active": 0,
@ -47,7 +47,7 @@
]
},
{
"width": 414.6770935058594,
"width": 415,
"height": 556.3333740234375,
"type": "panel",
"active": 0,

View File

@ -13,10 +13,10 @@
"2d2f792f-a40c-49bb-a189-ed176a246e49",
"ec5b9995-a54c-47bd-adb5-27ec0160146e",
"9c08062d-4cf1-4b6e-a8ba-4a3881cc7e7d",
"c930d64e-2707-474f-b691-6220e2932ddd",
"4eaf518b-35ec-4262-928d-4d497c3f2830",
"47657f05-243e-4f2a-a32d-200631f1c252",
"9e91c351-bd17-446b-b773-3b715fe6ba48",
"7a90e76c-37f8-4f8c-84e9-f05b34afe481"
"7a90e76c-37f8-4f8c-84e9-f05b34afe481",
"47657f05-243e-4f2a-a32d-200631f1c252",
"c930d64e-2707-474f-b691-6220e2932ddd"
]
}

View File

@ -242,6 +242,8 @@
"1fbTpWLYlNZLS1K2qX7DMT",
"28dTblBn1OXo41F/TH/PkP",
"d8vKRljyRIqaGUyKrK/M8p",
"3bl+uYG3NFPbPnwoeRy9IT"
"3bl+uYG3NFPbPnwoeRy9IT",
"18kkByH6hCGYGlkcLdXww4",
"9fuGW0Qm1Mi7w6MEPzI7c1"
]
}

File diff suppressed because it is too large Load Diff

View File

@ -16,18 +16,25 @@
"_name": "Block",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
"_children": [
{
"__id__": 2
},
{
"__id__": 3
"__id__": 5
}
],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
}
],
"_prefab": {
"__id__": 4
"__id__": 10
},
"_opacity": 255,
"_color": {
@ -76,6 +83,220 @@
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "vertical",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 60,
"height": 96
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "af8457b5-c84c-4585-9402-aee73193f450"
},
"_type": 3,
"_sizeMode": 1,
"_fillType": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "1cW1eKjG1IzrE0Me3F5dzp",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "turn",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 78,
"height": 78
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
9,
9,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e3acc841-072e-46c4-b892-be3da3cb608b"
},
"_type": 3,
"_sizeMode": 1,
"_fillType": 2,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0.185,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "0en916QFNENrq/dQ8DeOiU",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",

View File

@ -1 +1 @@
{"version":"1.0.8","stats":{"C:/Work/Project/WaterControl/temp/quick-scripts/src/__qc_index__.js":"2024-07-10T10:18:24.489Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/ControlManager.js":"2024-07-10T10:18:24.450Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoTiledMap.js":"2024-07-10T10:18:24.409Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/TmoDemo/Script/TmoGame.js":"2024-07-10T10:18:24.412Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js":"2024-07-10T10:18:24.437Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/DynamicAtlasManager.js":"2024-07-10T10:18:24.431Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/GameManager.js":"2024-07-10T10:18:24.440Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/Load.js":"2024-07-10T10:18:24.424Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/GameScene.js":"2024-07-10T10:18:24.455Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/RankManager.js":"2024-07-10T10:18:24.453Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/GameOver.js":"2024-07-10T10:18:24.439Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/Map.js":"2024-07-10T10:18:24.420Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/Block.js":"2024-07-10T10:18:24.443Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoSprite.js":"2024-07-10T10:18:24.427Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoTiledLayer.js":"2024-07-10T10:18:24.448Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoObjectGroup.js":"2024-07-10T10:18:24.421Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoAssembler.js":"2024-07-10T10:18:24.417Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Music/AudioManager.js":"2024-07-10T10:18:24.430Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Notification/Notification.js":"2024-07-10T10:18:24.429Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Crypto/HttpUtil.js":"2024-07-10T10:18:24.436Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Storage/Storage.js":"2024-07-10T10:18:24.415Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/RankList/ItemRender.js":"2024-07-10T10:18:24.445Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Tool/GameTool.js":"2024-07-10T10:18:24.423Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/GameStart/GameAppStart.js":"2024-07-10T10:18:24.434Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Config/GameConfig.js":"2024-07-10T10:18:24.442Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Crypto/crypto-js.min.js":"2024-07-10T10:18:24.451Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/RankList/List.js":"2024-07-10T10:18:24.446Z"}}
{"version":"1.0.8","stats":{"C:/Work/Project/WaterControl/temp/quick-scripts/src/__qc_index__.js":"2024-07-12T01:55:49.080Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoSprite.js":"2024-07-12T01:55:49.035Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/TmoDemo/Script/TmoGame.js":"2024-07-12T01:55:49.024Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/DynamicAtlasManager.js":"2024-07-12T01:55:49.038Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js":"2024-07-12T01:55:49.044Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/GameManager.js":"2024-07-12T01:55:49.046Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/RankManager.js":"2024-07-12T01:55:49.055Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/GameOver.js":"2024-07-12T01:55:49.045Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/GameScene.js":"2024-07-12T01:55:49.056Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/Load.js":"2024-07-12T01:55:49.034Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Crypto/HttpUtil.js":"2024-07-12T01:55:49.042Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoAssembler.js":"2024-07-12T01:55:49.028Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/Map.js":"2024-07-12T01:55:49.030Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoObjectGroup.js":"2024-07-12T01:55:49.030Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/ControlManager.js":"2024-07-12T01:55:49.053Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/Block.js":"2024-07-12T01:55:49.048Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoTiledLayer.js":"2024-07-12T01:55:49.051Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/tiledmap-optimize-resource/Script/TmoTiledMap.js":"2024-07-12T01:55:49.022Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Music/AudioManager.js":"2024-07-12T01:55:49.037Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/GameStart/GameAppStart.js":"2024-07-12T01:55:49.040Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/RankList/ItemRender.js":"2024-07-12T01:55:49.049Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Share/share.js":"2024-07-12T01:55:49.040Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Tool/GameTool.js":"2024-07-12T01:55:49.032Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Storage/Storage.js":"2024-07-12T01:55:49.026Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Notification/Notification.js":"2024-07-12T01:55:49.036Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Config/GameConfig.js":"2024-07-12T01:55:49.047Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/Crypto/crypto-js.min.js":"2024-07-12T01:55:49.054Z","C:/Work/Project/WaterControl/temp/quick-scripts/src/assets/Script/module/RankList/List.js":"2024-07-12T01:55:49.050Z"}}

File diff suppressed because one or more lines are too long

View File

@ -27,6 +27,7 @@ require('./assets/Script/module/Music/AudioManager');
require('./assets/Script/module/Notification/Notification');
require('./assets/Script/module/RankList/ItemRender');
require('./assets/Script/module/RankList/List');
require('./assets/Script/module/Share/share');
require('./assets/Script/module/Storage/Storage');
require('./assets/Script/module/Tool/GameTool');
require('./assets/TmoDemo/Script/TmoGame');

View File

@ -1,6 +1,6 @@
(function () {
var scripts = [{"deps":{"./assets/Script/ControlManager":1,"./tiledmap-optimize-resource/Script/TmoTiledMap":2,"./assets/TmoDemo/Script/TmoGame":3,"./assets/migration/use_v2.1-2.2.1_cc.Toggle_event":4,"./assets/Script/DynamicAtlasManager":5,"./assets/Script/GameManager":6,"./assets/Script/Load":7,"./assets/Script/GameScene":8,"./assets/Script/RankManager":9,"./assets/Script/GameOver":10,"./assets/Script/Map":11,"./assets/Script/Block":12,"./tiledmap-optimize-resource/Script/TmoSprite":13,"./tiledmap-optimize-resource/Script/TmoTiledLayer":14,"./tiledmap-optimize-resource/Script/TmoObjectGroup":15,"./tiledmap-optimize-resource/Script/TmoAssembler":16,"./assets/Script/module/Music/AudioManager":17,"./assets/Script/module/Notification/Notification":18,"./assets/Script/module/Crypto/HttpUtil":19,"./assets/Script/module/Storage/Storage":20,"./assets/Script/module/RankList/ItemRender":21,"./assets/Script/module/Tool/GameTool":22,"./assets/Script/module/GameStart/GameAppStart":23,"./assets/Script/module/Config/GameConfig":24,"./assets/Script/module/Crypto/crypto-js.min":25,"./assets/Script/module/RankList/List":26},"path":"preview-scripts/__qc_index__.js"},{"deps":{},"path":"preview-scripts/assets/Script/ControlManager.js"},{"deps":{"./TmoTiledLayer":14,"./TmoObjectGroup":15},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoTiledMap.js"},{"deps":{},"path":"preview-scripts/assets/TmoDemo/Script/TmoGame.js"},{"deps":{},"path":"preview-scripts/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js"},{"deps":{},"path":"preview-scripts/assets/Script/DynamicAtlasManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/GameManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/Load.js"},{"deps":{},"path":"preview-scripts/assets/Script/GameScene.js"},{"deps":{"./module/RankList/List":26},"path":"preview-scripts/assets/Script/RankManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/GameOver.js"},{"deps":{},"path":"preview-scripts/assets/Script/Map.js"},{"deps":{},"path":"preview-scripts/assets/Script/Block.js"},{"deps":{"./TmoAssembler":16},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoSprite.js"},{"deps":{},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoTiledLayer.js"},{"deps":{"./TmoSprite":13},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoObjectGroup.js"},{"deps":{},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoAssembler.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Music/AudioManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Notification/Notification.js"},{"deps":{"./crypto-js.min.js":25},"path":"preview-scripts/assets/Script/module/Crypto/HttpUtil.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Storage/Storage.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/RankList/ItemRender.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Tool/GameTool.js"},{"deps":{"../Config/GameConfig":24,"../Crypto/HttpUtil":19,"../Music/AudioManager":17,"../Notification/Notification":18,"../Storage/Storage":20,"../Tool/GameTool":22},"path":"preview-scripts/assets/Script/module/GameStart/GameAppStart.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Config/GameConfig.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Crypto/crypto-js.min.js"},{"deps":{"./ItemRender":21},"path":"preview-scripts/assets/Script/module/RankList/List.js"}];
var scripts = [{"deps":{"./assets/Script/DynamicAtlasManager":3,"./assets/Script/GameManager":5,"./assets/Script/GameOver":7,"./assets/Script/GameScene":8,"./assets/Script/Load":9,"./assets/Script/Map":12,"./assets/Script/RankManager":6,"./assets/Script/Block":15,"./assets/migration/use_v2.1-2.2.1_cc.Toggle_event":4,"./assets/Script/ControlManager":14,"./tiledmap-optimize-resource/Script/TmoSprite":1,"./tiledmap-optimize-resource/Script/TmoTiledLayer":16,"./tiledmap-optimize-resource/Script/TmoTiledMap":17,"./tiledmap-optimize-resource/Script/TmoAssembler":11,"./tiledmap-optimize-resource/Script/TmoObjectGroup":13,"./assets/TmoDemo/Script/TmoGame":2,"./assets/Script/module/Crypto/crypto-js.min":26,"./assets/Script/module/Crypto/HttpUtil":10,"./assets/Script/module/GameStart/GameAppStart":19,"./assets/Script/module/Music/AudioManager":18,"./assets/Script/module/Notification/Notification":24,"./assets/Script/module/RankList/List":27,"./assets/Script/module/RankList/ItemRender":20,"./assets/Script/module/Share/share":21,"./assets/Script/module/Storage/Storage":23,"./assets/Script/module/Tool/GameTool":22,"./assets/Script/module/Config/GameConfig":25},"path":"preview-scripts/__qc_index__.js"},{"deps":{"./TmoAssembler":11},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoSprite.js"},{"deps":{},"path":"preview-scripts/assets/TmoDemo/Script/TmoGame.js"},{"deps":{},"path":"preview-scripts/assets/Script/DynamicAtlasManager.js"},{"deps":{},"path":"preview-scripts/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js"},{"deps":{"./Block":15},"path":"preview-scripts/assets/Script/GameManager.js"},{"deps":{"./module/RankList/List":27},"path":"preview-scripts/assets/Script/RankManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/GameOver.js"},{"deps":{},"path":"preview-scripts/assets/Script/GameScene.js"},{"deps":{},"path":"preview-scripts/assets/Script/Load.js"},{"deps":{"./crypto-js.min.js":26},"path":"preview-scripts/assets/Script/module/Crypto/HttpUtil.js"},{"deps":{},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoAssembler.js"},{"deps":{},"path":"preview-scripts/assets/Script/Map.js"},{"deps":{"./TmoSprite":1},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoObjectGroup.js"},{"deps":{},"path":"preview-scripts/assets/Script/ControlManager.js"},{"deps":{},"path":"preview-scripts/assets/Script/Block.js"},{"deps":{},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoTiledLayer.js"},{"deps":{"./TmoTiledLayer":16,"./TmoObjectGroup":13},"path":"preview-scripts/tiledmap-optimize-resource/Script/TmoTiledMap.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Music/AudioManager.js"},{"deps":{"../Config/GameConfig":25,"../Crypto/HttpUtil":10,"../Music/AudioManager":18,"../Notification/Notification":24,"../Storage/Storage":23,"../Tool/GameTool":22},"path":"preview-scripts/assets/Script/module/GameStart/GameAppStart.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/RankList/ItemRender.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Share/share.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Tool/GameTool.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Storage/Storage.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Notification/Notification.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Config/GameConfig.js"},{"deps":{},"path":"preview-scripts/assets/Script/module/Crypto/crypto-js.min.js"},{"deps":{"./ItemRender":20},"path":"preview-scripts/assets/Script/module/RankList/List.js"}];
var entries = ["preview-scripts/__qc_index__.js"];
var bundleScript = 'preview-scripts/__qc_bundle__.js';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -47,7 +47,7 @@ var NewClass = /** @class */ (function (_super) {
NewClass.prototype.start = function () {
window.initMgr();
cc.fx.GameConfig.init(this.localTest);
cc.fx.AudioManager.Instance.init();
// cc.fx.AudioManager.Instance.init();
this.testVersion.string = this.clientTestVersion;
};
//开始游戏,跳转至引导页面
@ -93,4 +93,4 @@ cc._RF.pop();
});
}
})();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFzc2V0c1xcU2NyaXB0XFxMb2FkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUNNLElBQUEsS0FBd0MsRUFBRSxDQUFDLFVBQVUsRUFBcEQsT0FBTyxhQUFBLEVBQUUsUUFBUSxjQUFBLEVBQUUsZ0JBQWdCLHNCQUFpQixDQUFDO0FBRzVEO0lBQXNDLDRCQUFZO0lBQWxEO1FBQUEscUVBbUNDO1FBaENHLGVBQVMsR0FBWSxLQUFLLENBQUM7UUFHM0IsdUJBQWlCLEdBQVcsT0FBTyxDQUFDO1FBR3BDLGlCQUFXLEdBQWEsSUFBSSxDQUFDOztJQTBCakMsQ0FBQztJQXhCRyx3QkFBSyxHQUFMO1FBQ0ksTUFBTSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ2pCLEVBQUUsQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDdEMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxZQUFZLENBQUMsUUFBUSxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ25DLElBQUksQ0FBQyxXQUFXLENBQUMsTUFBTSxHQUFHLElBQUksQ0FBQyxpQkFBaUIsQ0FBQztJQUNyRCxDQUFDO0lBRUQsY0FBYztJQUNkLDRCQUFTLEdBQVQ7UUFDSSxFQUFFLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxXQUFXLENBQUMsQ0FBQztRQUNuQyx1Q0FBdUM7SUFDM0MsQ0FBQztJQUNELGdCQUFnQjtJQUNoQiwyQkFBUSxHQUFSLFVBQVMsS0FBSyxFQUFDLElBQUk7UUFDZixFQUFFLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsTUFBTSxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNqRCxFQUFFLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUN2QyxDQUFDO0lBQ0QsT0FBTztJQUNQLDJCQUFRLEdBQVI7UUFDSSxFQUFFLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUN2QyxDQUFDO0lBRVMseUJBQU0sR0FBaEIsVUFBaUIsRUFBVTtJQUMzQixDQUFDO0lBL0JEO1FBREMsUUFBUSxDQUFDLEtBQUssQ0FBQzsrQ0FDVztJQUczQjtRQURDLFFBQVEsQ0FBQyxFQUFFLENBQUM7dURBQ3VCO0lBR3BDO1FBREMsUUFBUSxDQUFDLEVBQUUsQ0FBQyxLQUFLLENBQUM7aURBQ1U7SUFUWixRQUFRO1FBRDVCLE9BQU87T0FDYSxRQUFRLENBbUM1QjtJQUFELGVBQUM7Q0FuQ0QsQUFtQ0MsQ0FuQ3FDLEVBQUUsQ0FBQyxTQUFTLEdBbUNqRDtrQkFuQ29CLFFBQVEiLCJmaWxlIjoiIiwic291cmNlUm9vdCI6Ii8iLCJzb3VyY2VzQ29udGVudCI6WyJcclxuY29uc3Qge2NjY2xhc3MsIHByb3BlcnR5LCByZXF1aXJlQ29tcG9uZW50fSA9IGNjLl9kZWNvcmF0b3I7XHJcblxyXG5AY2NjbGFzc1xyXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBOZXdDbGFzcyBleHRlbmRzIGNjLkNvbXBvbmVudCB7XHJcblxyXG4gICAgQHByb3BlcnR5KGZhbHNlKVxyXG4gICAgbG9jYWxUZXN0OiBib29sZWFuID0gZmFsc2U7XHJcblxyXG4gICAgQHByb3BlcnR5KFwiXCIpXHJcbiAgICBjbGllbnRUZXN0VmVyc2lvbjogc3RyaW5nID0gXCIxLjAuMFwiO1xyXG5cclxuICAgIEBwcm9wZXJ0eShjYy5MYWJlbClcclxuICAgIHRlc3RWZXJzaW9uOiBjYy5MYWJlbCA9IG51bGw7XHJcblxyXG4gICAgc3RhcnQgKCkge1xyXG4gICAgICAgIHdpbmRvdy5pbml0TWdyKCk7XHJcbiAgICAgICAgY2MuZnguR2FtZUNvbmZpZy5pbml0KHRoaXMubG9jYWxUZXN0KTtcclxuICAgICAgICBjYy5meC5BdWRpb01hbmFnZXIuSW5zdGFuY2UuaW5pdCgpO1xyXG4gICAgICAgIHRoaXMudGVzdFZlcnNpb24uc3RyaW5nID0gdGhpcy5jbGllbnRUZXN0VmVyc2lvbjtcclxuICAgIH1cclxuXHJcbiAgICAvL+W8gOWni+a4uOaIj++8jOi3s+i9rOiHs+W8leWvvOmhtemdolxyXG4gICAgc3RhcnRHYW1lKCl7XHJcbiAgICAgICAgY2MuZGlyZWN0b3IubG9hZFNjZW5lKFwiR2FtZVNjZW5lXCIpO1xyXG4gICAgICAgIC8vIGNjLmRpcmVjdG9yLmxvYWRTY2VuZShcIkd1aWRlU2NlbmVcIik7XHJcbiAgICB9XHJcbiAgICAvL+Wkh+eUqO+8jOeUqOadpea1i+ivlei3s+i9rCDmjIflrprlhbPljaFcclxuICAgIGNsaWNrQnRuKGV2ZW50LGRhdGEpe1xyXG4gICAgICAgIGNjLmZ4LkdhbWVDb25maWcuR01fSU5GTy5jdXN0b20gPSBwYXJzZUludChkYXRhKTtcclxuICAgICAgICBjYy5kaXJlY3Rvci5sb2FkU2NlbmUoXCJHYW1lU2NlbmVcIik7XHJcbiAgICB9ICAgXHJcbiAgICAvL+aJk+W8gOaOkuihjOamnFxyXG4gICAgb3BlblJhbmsoKXtcclxuICAgICAgICBjYy5kaXJlY3Rvci5sb2FkU2NlbmUoXCJSYW5rU2NlbmVcIik7XHJcbiAgICB9XHJcbiAgICBcclxuICAgIHByb3RlY3RlZCB1cGRhdGUoZHQ6IG51bWJlcik6IHZvaWQge1xyXG4gICAgfVxyXG59XHJcbiJdfQ==
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFzc2V0c1xcU2NyaXB0XFxMb2FkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUNNLElBQUEsS0FBd0MsRUFBRSxDQUFDLFVBQVUsRUFBcEQsT0FBTyxhQUFBLEVBQUUsUUFBUSxjQUFBLEVBQUUsZ0JBQWdCLHNCQUFpQixDQUFDO0FBRzVEO0lBQXNDLDRCQUFZO0lBQWxEO1FBQUEscUVBbUNDO1FBaENHLGVBQVMsR0FBWSxLQUFLLENBQUM7UUFHM0IsdUJBQWlCLEdBQVcsT0FBTyxDQUFDO1FBR3BDLGlCQUFXLEdBQWEsSUFBSSxDQUFDOztJQTBCakMsQ0FBQztJQXhCRyx3QkFBSyxHQUFMO1FBQ0ksTUFBTSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ2pCLEVBQUUsQ0FBQyxFQUFFLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDdEMsc0NBQXNDO1FBQ3RDLElBQUksQ0FBQyxXQUFXLENBQUMsTUFBTSxHQUFHLElBQUksQ0FBQyxpQkFBaUIsQ0FBQztJQUNyRCxDQUFDO0lBRUQsY0FBYztJQUNkLDRCQUFTLEdBQVQ7UUFDSSxFQUFFLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxXQUFXLENBQUMsQ0FBQztRQUNuQyx1Q0FBdUM7SUFDM0MsQ0FBQztJQUNELGdCQUFnQjtJQUNoQiwyQkFBUSxHQUFSLFVBQVMsS0FBSyxFQUFDLElBQUk7UUFDZixFQUFFLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxPQUFPLENBQUMsTUFBTSxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUNqRCxFQUFFLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUN2QyxDQUFDO0lBQ0QsT0FBTztJQUNQLDJCQUFRLEdBQVI7UUFDSSxFQUFFLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUN2QyxDQUFDO0lBRVMseUJBQU0sR0FBaEIsVUFBaUIsRUFBVTtJQUMzQixDQUFDO0lBL0JEO1FBREMsUUFBUSxDQUFDLEtBQUssQ0FBQzsrQ0FDVztJQUczQjtRQURDLFFBQVEsQ0FBQyxFQUFFLENBQUM7dURBQ3VCO0lBR3BDO1FBREMsUUFBUSxDQUFDLEVBQUUsQ0FBQyxLQUFLLENBQUM7aURBQ1U7SUFUWixRQUFRO1FBRDVCLE9BQU87T0FDYSxRQUFRLENBbUM1QjtJQUFELGVBQUM7Q0FuQ0QsQUFtQ0MsQ0FuQ3FDLEVBQUUsQ0FBQyxTQUFTLEdBbUNqRDtrQkFuQ29CLFFBQVEiLCJmaWxlIjoiIiwic291cmNlUm9vdCI6Ii8iLCJzb3VyY2VzQ29udGVudCI6WyJcclxuY29uc3Qge2NjY2xhc3MsIHByb3BlcnR5LCByZXF1aXJlQ29tcG9uZW50fSA9IGNjLl9kZWNvcmF0b3I7XHJcblxyXG5AY2NjbGFzc1xyXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBOZXdDbGFzcyBleHRlbmRzIGNjLkNvbXBvbmVudCB7XHJcblxyXG4gICAgQHByb3BlcnR5KGZhbHNlKVxyXG4gICAgbG9jYWxUZXN0OiBib29sZWFuID0gZmFsc2U7XHJcblxyXG4gICAgQHByb3BlcnR5KFwiXCIpXHJcbiAgICBjbGllbnRUZXN0VmVyc2lvbjogc3RyaW5nID0gXCIxLjAuMFwiO1xyXG5cclxuICAgIEBwcm9wZXJ0eShjYy5MYWJlbClcclxuICAgIHRlc3RWZXJzaW9uOiBjYy5MYWJlbCA9IG51bGw7XHJcblxyXG4gICAgc3RhcnQgKCkge1xyXG4gICAgICAgIHdpbmRvdy5pbml0TWdyKCk7XHJcbiAgICAgICAgY2MuZnguR2FtZUNvbmZpZy5pbml0KHRoaXMubG9jYWxUZXN0KTtcclxuICAgICAgICAvLyBjYy5meC5BdWRpb01hbmFnZXIuSW5zdGFuY2UuaW5pdCgpO1xyXG4gICAgICAgIHRoaXMudGVzdFZlcnNpb24uc3RyaW5nID0gdGhpcy5jbGllbnRUZXN0VmVyc2lvbjtcclxuICAgIH1cclxuXHJcbiAgICAvL+W8gOWni+a4uOaIj++8jOi3s+i9rOiHs+W8leWvvOmhtemdolxyXG4gICAgc3RhcnRHYW1lKCl7XHJcbiAgICAgICAgY2MuZGlyZWN0b3IubG9hZFNjZW5lKFwiR2FtZVNjZW5lXCIpO1xyXG4gICAgICAgIC8vIGNjLmRpcmVjdG9yLmxvYWRTY2VuZShcIkd1aWRlU2NlbmVcIik7XHJcbiAgICB9XHJcbiAgICAvL+Wkh+eUqO+8jOeUqOadpea1i+ivlei3s+i9rCDmjIflrprlhbPljaFcclxuICAgIGNsaWNrQnRuKGV2ZW50LGRhdGEpe1xyXG4gICAgICAgIGNjLmZ4LkdhbWVDb25maWcuR01fSU5GTy5jdXN0b20gPSBwYXJzZUludChkYXRhKTtcclxuICAgICAgICBjYy5kaXJlY3Rvci5sb2FkU2NlbmUoXCJHYW1lU2NlbmVcIik7XHJcbiAgICB9ICAgXHJcbiAgICAvL+aJk+W8gOaOkuihjOamnFxyXG4gICAgb3BlblJhbmsoKXtcclxuICAgICAgICBjYy5kaXJlY3Rvci5sb2FkU2NlbmUoXCJSYW5rU2NlbmVcIik7XHJcbiAgICB9XHJcbiAgICBcclxuICAgIHByb3RlY3RlZCB1cGRhdGUoZHQ6IG51bWJlcik6IHZvaWQge1xyXG4gICAgfVxyXG59XHJcbiJdfQ==

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@ require('./assets/Script/module/Music/AudioManager');
require('./assets/Script/module/Notification/Notification');
require('./assets/Script/module/RankList/ItemRender');
require('./assets/Script/module/RankList/List');
require('./assets/Script/module/Share/share');
require('./assets/Script/module/Storage/Storage');
require('./assets/Script/module/Tool/GameTool');
require('./assets/TmoDemo/Script/TmoGame');

View File

@ -29,25 +29,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockType = void 0;
exports.PathType = exports.BlockType = void 0;
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var BlockType;
(function (BlockType) {
/*起点地块 */
BlockType[BlockType["Start"] = 0] = "Start";
/*普通地块 */
BlockType[BlockType["Nomal"] = 1] = "Nomal";
BlockType[BlockType["Nomal"] = 0] = "Nomal";
/*起点地块 */
BlockType[BlockType["Start"] = 1] = "Start";
/*湿地 */
BlockType[BlockType["Nunja"] = 2] = "Nunja";
/*山峰 */
BlockType[BlockType["Peak"] = 3] = "Peak";
/*息壤 */
BlockType[BlockType["Xi_Soil"] = 4] = "Xi_Soil";
/*息壤 */
BlockType[BlockType["Construct"] = 5] = "Construct";
/*终点地块 */
BlockType[BlockType["End"] = 5] = "End";
BlockType[BlockType["End"] = 4] = "End";
/*息壤 */
BlockType[BlockType["Xi_Soil"] = 5] = "Xi_Soil";
/*加固 */
BlockType[BlockType["Reinforce"] = 6] = "Reinforce";
})(BlockType = exports.BlockType || (exports.BlockType = {}));
var PathType;
(function (PathType) {
PathType["err"] = "err";
PathType["up"] = "up";
PathType["down"] = "down";
PathType["left"] = "left";
PathType["right"] = "right";
PathType["up_left"] = "up_left";
PathType["up_right"] = "up_right";
PathType["down_left"] = "down_left";
PathType["down_right"] = "down_right";
PathType["left_up"] = "left_up";
PathType["left_down"] = "left_down";
PathType["right_up"] = "right_up";
PathType["right_down"] = "right_down";
})(PathType = exports.PathType || (exports.PathType = {}));
var NewClass = /** @class */ (function (_super) {
__extends(NewClass, _super);
function NewClass() {
@ -59,7 +75,7 @@ var NewClass = /** @class */ (function (_super) {
NewClass.prototype.start = function () {
};
NewClass.prototype.initData = function (type) {
this.block_type = type;
this.block_Type = type;
if (type == cc.Enum(BlockType).Start) {
this.node.color = cc.color(245, 70, 70);
}
@ -67,6 +83,79 @@ var NewClass = /** @class */ (function (_super) {
this.node.color = cc.color(20, 255, 0);
}
};
NewClass.prototype.setPath = function (type) {
this.path_Type = type;
};
//洪峰执行
NewClass.prototype.runWater = function (data) {
var target = null;
var progress = 1;
var time = data.time;
var order = data.order + 1;
target = this.node.getChildByName("vertical");
console.log(this.path_Type);
if (this.path_Type == cc.Enum(PathType).up) {
}
else if (this.path_Type == cc.Enum(PathType).down) {
target.angle = 180;
}
else if (this.path_Type == cc.Enum(PathType).left) {
target.angle = 90;
}
else if (this.path_Type == cc.Enum(PathType).right) {
target.angle = 270;
}
else {
target = this.node.getChildByName("turn");
progress = 0.25;
if (this.path_Type == cc.Enum(PathType).up_left) {
target.setPosition(-9, -9);
}
else if (this.path_Type == cc.Enum(PathType).up_right) {
target.scaleX = -1;
target.setPosition(9, -9);
}
else if (this.path_Type == cc.Enum(PathType).down_left) {
target.angle = 180;
target.scaleX = -1;
target.setPosition(-9, 9);
}
else if (this.path_Type == cc.Enum(PathType).down_right) {
target.angle = 180;
target.scaleX = 1;
target.setPosition(9, 9);
}
else if (this.path_Type == cc.Enum(PathType).left_up) {
target.angle = -90;
target.scaleY = -1;
target.setPosition(9, 9);
}
else if (this.path_Type == cc.Enum(PathType).left_down) {
target.angle = 90;
target.scaleY = -1;
target.setPosition(-9, -9);
}
else if (this.path_Type == cc.Enum(PathType).right_up) {
target.angle = -90;
// target.scaleY = -1;
target.setPosition(-9, 9);
}
else if (this.path_Type == cc.Enum(PathType).right_down) {
target.angle = -90;
target.scaleX = -1;
target.setPosition(-9, -9);
}
}
target.active = true;
target.getComponent(cc.Sprite).fillRange = 0;
cc.tween(target.getComponent(cc.Sprite))
.to(time, { fillRange: progress })
.call(function () {
if (data.circulate)
cc.fx.Notifications.emit(cc.fx.Message.next, order);
})
.start();
};
NewClass = __decorate([
ccclass
], NewClass);

File diff suppressed because one or more lines are too long

View File

@ -45,6 +45,7 @@ var NewClass = /** @class */ (function (_super) {
// onLoad () {}
NewClass.prototype.start = function () {
this.tipArray = [];
this.controlArray = [];
this.canTouch = true;
};
NewClass.prototype.setPosition = function (tip) {
@ -70,6 +71,7 @@ var NewClass = /** @class */ (function (_super) {
tip.removeFromParent(this.Map);
tip = null;
this.tipArray.pop();
this.controlArray.pop();
}
};
NewClass.prototype.btn_Click = function (target, data) {
@ -88,13 +90,14 @@ var NewClass = /** @class */ (function (_super) {
tip.parent = this.Map;
this.setPosition(tip);
this.tipArray.push(tip);
this.controlArray.push(data);
cc.fx.Notifications.emit(cc.fx.Message.control, data);
};
NewClass.prototype.start_Click = function () {
if (!this.canTouch)
return;
this.canTouch = false;
cc.fx.Notifications.emit(cc.fx.Message.startGame, null);
cc.fx.Notifications.emit(cc.fx.Message.startGame, this.controlArray);
};
__decorate([
property(cc.Node)

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var Block_1 = require("./Block");
// 主游戏控制类
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var GameManager = /** @class */ (function (_super) {
@ -43,19 +44,59 @@ var GameManager = /** @class */ (function (_super) {
GameManager.prototype.init = function () {
this.initMap();
};
//初始化地图
GameManager.prototype.initMap = function () {
this.block_Array = [];
var map = cc.fx.GameConfig.LEVEL_INFO[0].map;
for (var i = 0; i < map.length; i++) {
for (var j = 0; j < map[i].length; j++) {
this.path_Array = [];
this.map_Array = [];
this.map_Array = cc.fx.GameConfig.LEVEL_INFO[0][0].map;
//将地图x,y轴切换
for (var m = 0; m < Math.floor(this.map_Array.length / 2); m++) {
for (var n = 0; n < this.map_Array[m].length; n++) {
var temp = this.map_Array[m][n];
this.map_Array[m][n] = this.map_Array[n][m];
this.map_Array[n][m] = temp;
}
}
for (var i = 0; i < this.map_Array.length; i++) {
for (var j = 0; j < this.map_Array[i].length; j++) {
var block = cc.instantiate(this.Block);
block.parent = this.Map;
block.getComponent("Block").initData(map[i][j]);
block.setPosition(cc.v2(-block.width * 1.5 + j * block.width, -block.height * 1.5 + i * block.height));
block.getComponent("Block").initData(this.map_Array[i][j]);
if (this.map_Array[i][j] == cc.Enum(Block_1.BlockType).Start)
this.path_Array.push(cc.v3(i, j, cc.Enum(Block_1.BlockType).Nomal));
block.setPosition(cc.v2(-block.width * 1.5 + i * block.width, block.height * 1.5 - j * block.height));
this.block_Array.push(block);
}
}
};
//开始后,按玩家操作,将路径中地图块放入数组中
GameManager.prototype.setMap = function (data) {
for (var i = 0; i < data.length; i++) {
var start = this.path_Array[this.path_Array.length - 1];
switch (data[i]) {
case "up":
this.path_Array.push(cc.v3(start.x, start.y - 1, cc.Enum(Block_1.BlockType).Nomal));
break;
case "down":
this.path_Array.push(cc.v3(start.x, start.y + 1, cc.Enum(Block_1.BlockType).Nomal));
break;
case "left":
this.path_Array.push(cc.v3(start.x - 1, start.y, cc.Enum(Block_1.BlockType).Nomal));
break;
case "right":
this.path_Array.push(cc.v3(start.x + 1, start.y, cc.Enum(Block_1.BlockType).Nomal));
break;
case "reinforce":
this.path_Array.push(cc.v3(0, 0, cc.Enum(Block_1.BlockType).Reinforce));
break;
case "soil":
this.path_Array.push(cc.v3(0, 0, cc.Enum(Block_1.BlockType).Xi_Soil));
break;
}
}
this.runWater(0);
};
GameManager.prototype.setModel = function () {
var time = 0.3;
var block2 = this.node.getChildByName("Block1").getChildByName("icon").getComponent(cc.Sprite);
@ -85,6 +126,161 @@ var GameManager = /** @class */ (function (_super) {
.to(time, { fillRange: 0.25 })
.start();
};
//开始执行洪峰来了的动画
GameManager.prototype.runWater = function (order) {
order = parseInt(order);
if (order <= this.path_Array.length - 1) {
var i = this.path_Array[order].x * this.map_Array[0].length + this.path_Array[order].y;
var direction = "";
var circulate = true;
if (order == this.path_Array.length - 1) {
circulate = false;
direction = this.getDirection(order - 1);
if (direction == "up" || direction == "right_up" || direction == "left_up") {
direction = "up";
}
else if (direction == "down" || direction == "left_down" || direction == "right_down") {
direction = "down";
}
else if (direction == "left" || direction == "up_left" || direction == "down_left") {
direction = "left";
}
else if (direction == "right" || direction == "up_right" || direction == "down_right") {
direction = "right";
}
}
else {
direction = this.getDirection(order);
}
var target = this.block_Array[i].getComponent("Block");
target.setPath(direction);
var data = {
order: order,
time: 0.3,
type: this.path_Array[order].z,
circulate: circulate
};
target.runWater(data);
}
};
//获取洪峰方向
GameManager.prototype.getDirection = function (order) {
var name = "";
//入海口比较复杂单独判断
if (order == 0) {
var nextX = this.path_Array[order + 1].x - this.path_Array[order].x;
var nextY = this.path_Array[order].y - this.path_Array[order + 1].y;
//在底边
if (this.path_Array[order].y == this.map_Array.length - 1) {
if (nextX == 0) {
if (nextY == 1)
name = "up";
else if (nextY == -1)
name = "err";
}
else if (nextX == 1)
name = "up_right";
else if (nextX == -1)
name = "up_left";
}
//在顶边
else if (this.path_Array[order].y == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "err";
else if (nextY == -1)
name = "down";
}
else if (nextX == 1)
name = "down_right";
else if (nextX == -1)
name = "down_left";
}
//在左边
else if (this.path_Array[order].x == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "right_up";
else if (nextY == -1)
name = "right_down";
}
else if (nextX == 1)
name = "right";
else if (nextX == -1)
name = "err";
}
//在右边
else if (this.path_Array[order].x == this.map_Array[0].length - 1) {
if (nextX == 0) {
if (nextY == 1)
name = "left_up";
else if (nextY == -1)
name = "left_down";
}
else if (nextX == 1)
name = "err";
else if (nextX == -1)
name = "left";
}
}
//不是第一步,已经走过一步
else if (order > 0) {
//用于判断此点的上一个点,是为了判断当前方块洪水七点,以及下一个移动方向,判断洪终点方向
var nextX = this.path_Array[order + 1].x - this.path_Array[order].x;
var nextY = this.path_Array[order].y - this.path_Array[order + 1].y;
var previousX = this.path_Array[order].x - this.path_Array[order - 1].x;
var previousY = this.path_Array[order - 1].y - this.path_Array[order].y;
if (previousX == 0 && previousY == 1) {
if (nextX == 0) {
if (nextY == 1)
name = "up";
else if (nextY == -1)
name = "err";
}
else if (nextX == 1)
name = "up_right";
else if (nextX == -1)
name = "up_left";
}
else if (previousX == 0 && previousY == -1) {
if (nextX == 0) {
if (nextY == 1)
name = "err";
else if (nextY == -1)
name = "down";
}
else if (nextX == 1)
name = "down_right";
else if (nextX == -1)
name = "down_left";
}
else if (previousX == 1 && previousY == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "right_up";
else if (nextY == -1)
name = "right_down";
}
else if (nextX == 1)
name = "right";
else if (nextX == -1)
name = "err";
}
else if (previousX == -1 && previousY == 0) {
if (nextX == 0) {
if (nextY == 1)
name = "left_up";
else if (nextY == -1)
name = "left_down";
}
else if (nextX == 1)
name = "err";
else if (nextX == -1)
name = "left";
}
}
return name;
};
//根据是否全面屏,做独立适配方面
GameManager.prototype.fit = function () {
var jg = this.setFit();
@ -133,7 +329,8 @@ var GameManager = /** @class */ (function (_super) {
//5: 694
};
//开始游戏
GameManager.prototype.startGame = function () {
GameManager.prototype.startGame = function (data) {
this.setMap(data);
};
//如果是倒计时 调用此方法
GameManager.prototype.updateCountDownTime = function () {
@ -141,10 +338,6 @@ var GameManager = /** @class */ (function (_super) {
this.countTime -= 1;
// this.time.string = cc.fx.GameTool.getTimeMargin(this.countTime);
if (this.countTime < 5) {
// cc.tween(this.time.node)
// .to(0.25,{scale:1.5,color:cc.color(255,0,0)})
// .to(0.25,{scale:1,color:cc.color(255,255,255)})
// .start()
var over = this.node.getChildByName("Over");
cc.tween(over)
.to(0.2, { opacity: 255 })
@ -179,11 +372,17 @@ var GameManager = /** @class */ (function (_super) {
};
GameManager.prototype.clickSun = function (data) {
};
GameManager.prototype.nextWater = function () {
};
GameManager.prototype.onEnable = function () {
cc.fx.Notifications.on(cc.fx.Message.control, this.clickSun, this);
cc.fx.Notifications.on(cc.fx.Message.next, this.runWater, this);
cc.fx.Notifications.on(cc.fx.Message.startGame, this.startGame, this);
};
GameManager.prototype.onDisable = function () {
cc.fx.Notifications.off(cc.fx.Message.control, this.clickSun);
cc.fx.Notifications.off(cc.fx.Message.next, this.runWater);
cc.fx.Notifications.off(cc.fx.Message.startGame, this.startGame);
};
GameManager.prototype.update = function (dt) {
};

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@ var NewClass = /** @class */ (function (_super) {
NewClass.prototype.start = function () {
window.initMgr();
cc.fx.GameConfig.init(this.localTest);
cc.fx.AudioManager.Instance.init();
// cc.fx.AudioManager.Instance.init();
this.testVersion.string = this.clientTestVersion;
};
//开始游戏,跳转至引导页面

View File

@ -1 +1 @@
{"version":3,"sources":["assets\\Script\\Load.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACM,IAAA,KAAwC,EAAE,CAAC,UAAU,EAApD,OAAO,aAAA,EAAE,QAAQ,cAAA,EAAE,gBAAgB,sBAAiB,CAAC;AAG5D;IAAsC,4BAAY;IAAlD;QAAA,qEAmCC;QAhCG,eAAS,GAAY,KAAK,CAAC;QAG3B,uBAAiB,GAAW,OAAO,CAAC;QAGpC,iBAAW,GAAa,IAAI,CAAC;;IA0BjC,CAAC;IAxBG,wBAAK,GAAL;QACI,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACrD,CAAC;IAED,cAAc;IACd,4BAAS,GAAT;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACnC,uCAAuC;IAC3C,CAAC;IACD,gBAAgB;IAChB,2BAAQ,GAAR,UAAS,KAAK,EAAC,IAAI;QACf,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjD,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IACD,OAAO;IACP,2BAAQ,GAAR;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAES,yBAAM,GAAhB,UAAiB,EAAU;IAC3B,CAAC;IA/BD;QADC,QAAQ,CAAC,KAAK,CAAC;+CACW;IAG3B;QADC,QAAQ,CAAC,EAAE,CAAC;uDACuB;IAGpC;QADC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC;iDACU;IATZ,QAAQ;QAD5B,OAAO;OACa,QAAQ,CAmC5B;IAAD,eAAC;CAnCD,AAmCC,CAnCqC,EAAE,CAAC,SAAS,GAmCjD;kBAnCoB,QAAQ","file":"","sourceRoot":"/","sourcesContent":["\r\nconst {ccclass, property, requireComponent} = cc._decorator;\r\n\r\n@ccclass\r\nexport default class NewClass extends cc.Component {\r\n\r\n @property(false)\r\n localTest: boolean = false;\r\n\r\n @property(\"\")\r\n clientTestVersion: string = \"1.0.0\";\r\n\r\n @property(cc.Label)\r\n testVersion: cc.Label = null;\r\n\r\n start () {\r\n window.initMgr();\r\n cc.fx.GameConfig.init(this.localTest);\r\n cc.fx.AudioManager.Instance.init();\r\n this.testVersion.string = this.clientTestVersion;\r\n }\r\n\r\n //开始游戏,跳转至引导页面\r\n startGame(){\r\n cc.director.loadScene(\"GameScene\");\r\n // cc.director.loadScene(\"GuideScene\");\r\n }\r\n //备用,用来测试跳转 指定关卡\r\n clickBtn(event,data){\r\n cc.fx.GameConfig.GM_INFO.custom = parseInt(data);\r\n cc.director.loadScene(\"GameScene\");\r\n } \r\n //打开排行榜\r\n openRank(){\r\n cc.director.loadScene(\"RankScene\");\r\n }\r\n \r\n protected update(dt: number): void {\r\n }\r\n}\r\n"]}
{"version":3,"sources":["assets\\Script\\Load.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACM,IAAA,KAAwC,EAAE,CAAC,UAAU,EAApD,OAAO,aAAA,EAAE,QAAQ,cAAA,EAAE,gBAAgB,sBAAiB,CAAC;AAG5D;IAAsC,4BAAY;IAAlD;QAAA,qEAmCC;QAhCG,eAAS,GAAY,KAAK,CAAC;QAG3B,uBAAiB,GAAW,OAAO,CAAC;QAGpC,iBAAW,GAAa,IAAI,CAAC;;IA0BjC,CAAC;IAxBG,wBAAK,GAAL;QACI,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtC,sCAAsC;QACtC,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC;IACrD,CAAC;IAED,cAAc;IACd,4BAAS,GAAT;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;QACnC,uCAAuC;IAC3C,CAAC;IACD,gBAAgB;IAChB,2BAAQ,GAAR,UAAS,KAAK,EAAC,IAAI;QACf,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;QACjD,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IACD,OAAO;IACP,2BAAQ,GAAR;QACI,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;IAES,yBAAM,GAAhB,UAAiB,EAAU;IAC3B,CAAC;IA/BD;QADC,QAAQ,CAAC,KAAK,CAAC;+CACW;IAG3B;QADC,QAAQ,CAAC,EAAE,CAAC;uDACuB;IAGpC;QADC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC;iDACU;IATZ,QAAQ;QAD5B,OAAO;OACa,QAAQ,CAmC5B;IAAD,eAAC;CAnCD,AAmCC,CAnCqC,EAAE,CAAC,SAAS,GAmCjD;kBAnCoB,QAAQ","file":"","sourceRoot":"/","sourcesContent":["\r\nconst {ccclass, property, requireComponent} = cc._decorator;\r\n\r\n@ccclass\r\nexport default class NewClass extends cc.Component {\r\n\r\n @property(false)\r\n localTest: boolean = false;\r\n\r\n @property(\"\")\r\n clientTestVersion: string = \"1.0.0\";\r\n\r\n @property(cc.Label)\r\n testVersion: cc.Label = null;\r\n\r\n start () {\r\n window.initMgr();\r\n cc.fx.GameConfig.init(this.localTest);\r\n // cc.fx.AudioManager.Instance.init();\r\n this.testVersion.string = this.clientTestVersion;\r\n }\r\n\r\n //开始游戏,跳转至引导页面\r\n startGame(){\r\n cc.director.loadScene(\"GameScene\");\r\n // cc.director.loadScene(\"GuideScene\");\r\n }\r\n //备用,用来测试跳转 指定关卡\r\n clickBtn(event,data){\r\n cc.fx.GameConfig.GM_INFO.custom = parseInt(data);\r\n cc.director.loadScene(\"GameScene\");\r\n } \r\n //打开排行榜\r\n openRank(){\r\n cc.director.loadScene(\"RankScene\");\r\n }\r\n \r\n protected update(dt: number): void {\r\n }\r\n}\r\n"]}

View File

@ -17,6 +17,7 @@ var GameConfig = /** @class */ (function () {
}
GameConfig_1 = GameConfig;
Object.defineProperty(GameConfig, "Instance", {
//游戏内信息
get: function () {
if (this._instance == null) {
this._instance = new GameConfig_1();
@ -26,38 +27,100 @@ var GameConfig = /** @class */ (function () {
enumerable: false,
configurable: true
});
//getSeedRandom
GameConfig.init = function (Authentication) {
this.GM_INFO_init();
this.CLICK_init();
this.LEVEL_INFO_init();
// cc.resources.load('Json/GM_INFO', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.GM_INFO_init();
// if(!Authentication) this.Authentication();
// return;
// }
// let jsonData: object = res.json!;
// this.GM_INFO = jsonData["data"];
// if(!Authentication) this.Authentication();
// })
this.GM_INFO_init();
var self = this;
// cc.resources.load('Json/CLICK_DATA', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.CLICK_init();
// return;
// }
// let jsonData: object = res.json!;
// this.CLICK_DATA = jsonData["data"];
// self.CLICK_DATA = jsonData["data"];
// })
// cc.resources.load('Json/LEVEL_INFO', (err: any, res: cc.JsonAsset) => {
// if (err) {
// this.LEVEL_INFO_init();
// return;
// }
// let jsonData: object = res.json!;
// this.LEVEL_INFO = jsonData["data"];
// 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 //最短路径
}
];
};
//数据备用
GameConfig.GM_INFO_init = function () {
@ -65,54 +128,142 @@ var GameConfig = /** @class */ (function () {
// isEnd: false,
mean_Time: 0,
total: 0,
currSeed: 203213,
gameId: '100009',
userId: 0,
currSeed: 200000,
gameId: "100010",
userId: 200139,
guide: true,
url: "http://api.sparkus.cn",
url: "https://api.sparkus.cn",
success: false,
matchId: null,
custom: 0 //用于测试跳关卡
custom: 0,
level: 0,
stepTimeList: 0,
successList: [],
gameTime: 5,
igniteCount: 0,
};
};
GameConfig.GM_INFO_SET = function (key, value) {
this.GM_INFO[key] = value;
};
GameConfig.CLICK_init = function () {
this.CLICK_DATA =
{
type: 1,
success: false,
round: 0,
totalSunCount: 0,
movedSunCount: 0,
sunSpeed: 0,
overlapSunCount: 0,
colorList: [],
duration: 0,
difficultyLevel: 0,
sunList: [],
stepTimeList: [],
remainder: 120 //游戏剩余时间
choice: 0,
rightChoice: 0,
item: "",
roundType: 0,
stepTime: 0,
levelConfig: 0,
ignite: false,
igniteCount: 0,
};
};
GameConfig.CLICK_SET = function (key, value) {
this.CLICK_DATA[key] = value;
};
GameConfig.LEVEL_INFO_init = function () {
/*
moveSpeed: 0, //洪峰移动速度
waitTime: 20, //洪峰冲击倒计时
fastPath: 5 //最短路径
*/
this.LEVEL_INFO = [
{
map: [
[
1, 0, 1, 1
],
[
1, 1, 1, 1
],
[
1, 1, 1, 1
],
[
1, 1, 1, 5
[
{
"id": 1001,
"map": [
[0, 0, 0, 4],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 1, 0, 0]
]
],
opacity: 0.9,
moveSpeed: 0.3,
}
},
{
"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]
]
}
],
];
};
GameConfig.Authentication = function () {

File diff suppressed because one or more lines are too long

View File

@ -61,20 +61,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
Object.defineProperty(exports, "__esModule", { value: true });
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var CryptoJS = require("./crypto-js.min.js"); //引用AES源码js
var BASE_URL = "http://api.sparkus.cn";
var BASE_URL = "https://api.sparkus.cn";
//只负责网络接口 次类只负责和后端交互,不负责处理数据 数据处理在GameTool
var HttpUtil = /** @class */ (function (_super) {
__extends(HttpUtil, _super);
function HttpUtil() {
return _super !== null && _super.apply(this, arguments) || this;
}
HttpUtil_1 = HttpUtil;
HttpUtil.getShareInfo = function (shareUrl) {
return __awaiter(this, void 0, Promise, function () {
var time, url;
return __generator(this, function (_a) {
console.log("设置分享链接:", shareUrl);
time = Math.floor((new Date().getTime()) / 1000);
url = HttpUtil_1.apiSign("/api/share/cfg?gameId=" + config.gameId + "&time=" + time + "&url=" + shareUrl, {});
return [2 /*return*/, this.post(url, null, null)];
});
});
};
//排行榜
HttpUtil.rankData = function (type, callback, data) {
return __awaiter(this, void 0, Promise, function () {
var time, url;
return __generator(this, function (_a) {
time = Math.floor((new Date().getTime()) / 1000);
url = apiSign("/api/get/rank/data?gameId=" + config.gameId + "&dataType=" + type + "&time=" + time, data);
url = HttpUtil_1.apiSign("/api/get/rank/data?gameId=" + config.gameId + "&dataType=" + type + "&time=" + time, data);
this.post(url, data, callback);
return [2 /*return*/];
});
@ -96,7 +108,7 @@ var HttpUtil = /** @class */ (function (_super) {
var time, url;
return __generator(this, function (_a) {
time = Math.floor((new Date().getTime()) / 1000);
url = apiSign("/api/get/user/data?gameId=" + config.gameId + "&time=" + time, data);
url = HttpUtil_1.apiSign("/api/get/user/data?gameId=" + config.gameId + "&time=" + time, data);
this.post(url, data, callback);
return [2 /*return*/];
});
@ -163,7 +175,27 @@ var HttpUtil = /** @class */ (function (_super) {
});
});
};
HttpUtil = __decorate([
/**
*
* @param url {string} 接口地址
* @param params {object} 需要加密的参数对象
*/
HttpUtil.apiSign = function (url, params) {
if (params === void 0) { params = {}; }
var convertUrl = url.trim();
if (convertUrl.indexOf('?') === -1) {
convertUrl += '?';
}
// 传入参数转换拼接字符串
var postStr = getQueryString(params);
var signedStr = genSignStr(convertUrl, postStr);
var encryptStr = "sign=" + signedStr;
var encryptSignStr = fxCry.encryptByDES(encryptStr, config.secretKey);
encryptSignStr = encodeURIComponent(encryptSignStr);
return urlencode(convertUrl) + "&_p=" + encryptSignStr;
};
var HttpUtil_1;
HttpUtil = HttpUtil_1 = __decorate([
ccclass
], HttpUtil);
return HttpUtil;
@ -175,8 +207,8 @@ function responseHandler(response) {
// 响应拦截器
// Rq.interceptors.response.use(responseHandler)
var config = {
gameId: "100009",
secretKey: "CMNhOzBA",
gameId: "100010",
secretKey: "wozrGKsL",
EK: "hui231%1"
};
var Crypoto = /** @class */ (function () {
@ -289,24 +321,5 @@ function urlencode(url) {
var params = new URLSearchParams(queryString);
return baseUrl + "?" + params.toString();
}
/**
*
* @param url {string} 接口地址
* @param params {object} 需要加密的参数对象
*/
function apiSign(url, params) {
if (params === void 0) { params = {}; }
var convertUrl = url.trim();
if (convertUrl.indexOf('?') === -1) {
convertUrl += '?';
}
// 传入参数转换拼接字符串
var postStr = getQueryString(params);
var signedStr = genSignStr(convertUrl, postStr);
var encryptStr = "sign=" + signedStr;
var encryptSignStr = fxCry.encryptByDES(encryptStr, config.secretKey);
encryptSignStr = encodeURIComponent(encryptSignStr);
return urlencode(convertUrl) + "&_p=" + encryptSignStr;
}
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ window.initMgr = function () {
return;
}
cc.fx = {};
console.log("初始化");
console.log("1初始化");
//基础状态信息
cc.fx.StateInfo = {
debugMode: true,
@ -23,23 +23,22 @@ window.initMgr = function () {
networkType: 'none',
isOnForeground: true //当前是否是在前台
};
cc.fx.Message = {
control: "操作控制",
mapDsetory: "2",
mapCreate: "3",
startGame: "4"
};
//应用系统信息
//配置文件
cc.fx.GameConfig = GameConfig_1.GameConfig;
cc.fx.HttpUtil = HttpUtil_1.default;
cc.fx.GameTool = GameTool_1.GameTool;
cc.fx.AudioManager = AudioManager_1.AudioManager;
cc.fx.AudioManager = AudioManager_1.default;
cc.fx.Notifications = Notification_1.Notifications;
cc.fx.StorageMessage = Storage_1.StorageMessage;
cc.fx.ShareInfo = {
queryId: -1 //分享id
};
cc.fx.Message = {
control: "10001",
startGame: "10002",
next: "10003" //传递执行下一个格子洪水流过
};
/*
* 客户端埋点分享类型
*/
@ -74,31 +73,20 @@ window.initMgr = function () {
Friend: "friend",
All: "all",
};
//暂时不用
cc.fx.clickStatEventType = {
clickStatEventTypeVideoAD: 20173201,
clickStatEventTypeClickAdVideo: 20173202,
clickStatEventTypeBannerAD: 20173203,
clickStatEventTypeUserFrom: 99990001,
clickStatEventTypeShare: 99990002,
clickStatEventTypeClickAdBtn: 99990007,
clickStatEventTypeBannerAD2: 67890033,
clickStatEventTypeSubmitVersionInfo: 9999,
clickStatEventTypeClickFirstAd: 99990003,
clickStatEventTypeClickSecondAd: 99990004,
clickStatEventTypeWxLoginStart: 10001,
clickStatEventTypeWxLoginSuccess: 10002,
clickStatEventTypeWxLoginFailed: 10003,
clickStatEventTypeAuthorizationStart: 10003,
clickStatEventTypeAuthorizationSuccess: 10004,
clickStatEventTypeAuthorizationFailed: 10005,
clickStatEventTypeLoginSDKStart: 10007,
clickStatEventTypeLoginSDKSuccess: 10008,
clickStatEventTypeLoginSDKFailed: 10009,
clickStatEventTypeTCP_Start: 10009,
clickStatEventTypeTCP_Success: 10010,
clickStatEventTypeTCP_Failed: 10011,
};
//用于存储消息的ID
cc.fx.storageType = cc.Enum({
storageTypeCustom: 1000101,
});
//用于存储提示语 按照步骤提示
cc.fx.tipType = cc.Enum({
tipOne: '神农氏回到家中,开始整理今天收集来的物品。当他第一次拿出或说出一种植物时,请告诉他这是新植物。',
tipTwo: '如果他拿出或说出的植物你今天看到过,请告诉他上次是看到的;如果你听他说过,则请告诉他上次是听到的。',
tipErrNew: '这是这局游戏第一次出现{植物}',
tipErrOld: '{植物}刚才出现过呢',
tipErrHear: '上次遇到{植物}时,似乎不是听到的吧',
tipErrSee: '上次遇到{植物}时,似乎不是看到的吧',
tipErrLast: '之前确实看到过{植物},但最近一次似乎不是看到的呢',
});
};
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,19 @@ cc._RF.push(module, '58403/n16JCa5sZhNMjZzGo', 'AudioManager');
// Script/module/Music/AudioManager.ts
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@ -10,22 +23,54 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AudioManager = void 0;
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var AudioManager = /** @class */ (function () {
var AudioManager = /** @class */ (function (_super) {
__extends(AudioManager, _super);
function AudioManager() {
var _this = _super !== null && _super.apply(this, arguments) || this;
//背景音乐
this.audioGameBgm0 = null;
//跳跃
this.audioButtonClick = null;
//落地上
this.audioWarning = null;
//碰撞
this.audioWin = null;
_this.audioGameBgm0 = null;
_this.baishao_audio = null;
_this.cha_audio = null;
_this.chixiaodou_audio = null;
_this.danggui_audio = null;
_this.danshen_audio = null;
_this.dazao_audio = null;
_this.gancao_audio = null;
_this.ganjiang_audio = null;
_this.gouqi_audio = null;
_this.jingjie_audio = null;
_this.jinju_audio = null;
_this.lizhi_audio = null;
_this.lizi_audio = null;
_this.longyan_audio = null;
_this.moli_audio = null;
_this.muchai_audio = null;
_this.mudan_audio = null;
_this.mulan_audio = null;
_this.pugongying_audio = null;
_this.putao_audio = null;
_this.renshen_audio = null;
_this.taozi_audio = null;
_this.zhuye_audio = null;
_this.err = null;
_this.yes = null;
return _this;
}
AudioManager_1 = AudioManager;
AudioManager.playWarning = function () {
throw new Error('Method not implemented.');
AudioManager.prototype.onLoad = function () {
if (AudioManager_1._instance == null) {
AudioManager_1._instance = this;
cc.game.addPersistRootNode(this.node);
}
else {
return;
}
this.reward = false;
this.finish = false;
this.rewardCount = 0;
this.ctor();
this.preload();
};
AudioManager.prototype.ctor = function () {
this.mAudioMap = {};
@ -39,51 +84,41 @@ var AudioManager = /** @class */ (function () {
this.mEffectSwitch = 1;
};
AudioManager.prototype.play = function (audioSource, loop, callback, isBgMusic) {
if (isBgMusic && !this.mMusicSwitch)
return;
if (!isBgMusic && !this.mEffectSwitch)
return;
// if (isBgMusic && !this.mMusicSwitch) return;
// if (!isBgMusic && !this.mEffectSwitch) return;
var volume = isBgMusic ? this.bgMusicVolume : this.effectMusicVolume;
if (cc.sys.isBrowser) {
if (audioSource == this.brickSound) {
volume = 0.1;
}
volume = 1;
var context = cc.audioEngine.play(audioSource, loop, volume);
if (callback) {
cc.audioEngine.setFinishCallback(context, function () {
callback.call(this);
}.bind(this));
}
// cc.wwx.OutPut.log('play audio effect isBrowser: ' + context.src);
this.mAudioMap[audioSource] = context;
return audioSource;
}
else {
return audioSource;
// if (cc.sys.isBrowser) {
// if(audioSource == this.brickSound){
// volume = 0.1;
// }
volume = 1;
cc.audioEngine.setEffectsVolume(1);
cc.audioEngine.setMusicVolume(1);
var context = cc.audioEngine.playEffect(audioSource, loop);
if (callback) {
cc.audioEngine.setFinishCallback(context, function () {
callback.call(this);
}.bind(this));
}
// cc.wwx.OutPut.log('play audio effect isBrowser: ' + context.src);
this.mAudioMap[audioSource] = context;
return audioSource;
// } else {
// return audioSource;
// }
};
AudioManager.prototype.save = function () {
// cc.wwx.Storage.setItem(cc.wwx.Storage.Key_Setting_Music_Volume, this.mMusicSwitch);
// cc.wwx.Storage.setItem(cc.wwx.Storage.Key_Setting_Effect_Volume, this.mEffectSwitch);
};
Object.defineProperty(AudioManager, "Instance", {
get: function () {
if (this._instance == null) {
this._instance = new AudioManager_1();
}
return this._instance;
},
enumerable: false,
configurable: true
});
AudioManager.prototype.init = function () {
this.reward = false;
this.finish = false;
this.rewardCount = 0;
this.ctor();
this.preload();
};
// static get Instance()
// {
// if (this._instance == null)
// {
// this._instance = new AudioManager();
// }
// return this._instance;
// }
AudioManager.prototype.preload = function () {
if (!(cc.sys.platform === cc.sys.WECHAT_GAME)) {
return;
@ -128,6 +163,11 @@ var AudioManager = /** @class */ (function () {
AudioManager.prototype.onShow = function () {
cc.audioEngine.resumeAll();
};
//播放音效
AudioManager.prototype.playEffect = function (name, callback) {
if (this[name])
return this.play(this[name], false, callback, this.mEffectSwitch);
};
AudioManager.prototype.playMusic = function (key, callback, loop) {
loop = typeof loop == 'undefined' || loop ? true : false;
this.stopMusic();
@ -155,14 +195,6 @@ var AudioManager = /** @class */ (function () {
cc.audioEngine.stop(context);
}
};
// 炸弹、火箭爆炸音效
AudioManager.prototype.playWin = function () {
return this.play(this.audioWin, false, null, this.mEffectSwitch);
};
//激光音效
AudioManager.prototype.playWarning = function () {
return this.play(this.audioWarning, false, null, this.mEffectSwitch);
};
/*
* 游戏开始音效
*
@ -191,28 +223,93 @@ var AudioManager = /** @class */ (function () {
* 按钮
*/
AudioManager.prototype.playAudioButton = function () {
return this.play(this.audioButtonClick, false, null, this.mEffectSwitch);
// return this.play(this.audioButtonClick, false,null,this.mEffectSwitch);
};
var AudioManager_1;
AudioManager._instance = null;
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioGameBgm0", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioButtonClick", void 0);
], AudioManager.prototype, "baishao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioWarning", void 0);
], AudioManager.prototype, "cha_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "audioWin", void 0);
], AudioManager.prototype, "chixiaodou_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "danggui_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "danshen_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "dazao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "gancao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "ganjiang_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "gouqi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "jingjie_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "jinju_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "lizhi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "lizi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "longyan_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "moli_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "muchai_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "mudan_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "mulan_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "pugongying_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "putao_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "renshen_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "taozi_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "zhuye_audio", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "err", void 0);
__decorate([
property(cc.AudioClip)
], AudioManager.prototype, "yes", void 0);
AudioManager = AudioManager_1 = __decorate([
ccclass('AudioManager')
ccclass
], AudioManager);
return AudioManager;
}());
exports.AudioManager = AudioManager;
}(cc.Component));
exports.default = AudioManager;
;
// export { AudioManager };

File diff suppressed because one or more lines are too long

View File

@ -39,7 +39,9 @@ var ItemRender = /** @class */ (function (_super) {
cc.fx.GameTool.subName(this.data.name, 6);
this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
this.node.getChildByName("nameLab").getComponent(cc.Label).string = this.data.name + "";
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "";
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "%";
var timeTemp = cc.fx.GameTool.getTimeShenNong(this.data.time);
this.node.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
this.node.getChildByName("rank").getChildByName("one").active = false;
this.node.getChildByName("rank").getChildByName("two").active = false;
this.node.getChildByName("rank").getChildByName("three").active = false;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,130 @@
"use strict";
cc._RF.push(module, '7290caA39xMWZc2phTMKovP', 'share');
// Script/module/Share/share.ts
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WeChat = void 0;
var shareConfig = {
gameId: "100010",
shareLine: "zDLsruVI",
EK: "hui231%1"
};
// 微信操作类
var WeChat = /** @class */ (function () {
function WeChat() {
}
WeChat.setShare = function (url) {
var urlTemp = this.removeQueryParams(url);
shareConfig.shareLine = urlTemp;
WeChat.getSignature(url);
};
WeChat.getResult = function (res) {
if (res) {
var data = res.data;
wx.config({
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: ['onMenuShareTimeline', 'updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage']
});
wx.checkJsApi({
jsApiList: ['updateAppMessageShareData'],
success: function (res) {
setTimeout(function () {
WeChat.changeShare();
}, 100);
setTimeout(function () {
WeChat.changeShare();
}, 200);
}
});
}
};
WeChat.changeShare = function () {
wx.ready(function () {
wx.updateAppMessageShareData({
title: '记忆力认知测评',
desc: '你的认知灵活性和选择注意有问题吗',
link: shareConfig.shareLine,
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg',
success: function () {
// 设置成功
console.log("分享好友成功回调");
}
});
wx.updateTimelineShareData({
title: '记忆力认知测评',
link: shareConfig.shareLine,
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg',
success: function () {
// 设置成功
console.log("分享朋友圈成功回调");
}
});
});
};
WeChat.getSignature = function (url) {
return new Promise(function (resolve) {
WeChat.getShareInfo((encodeURIComponent(url)), WeChat.getResult);
});
};
WeChat.getShareInfo = function (shareUrl, callback) {
return __awaiter(this, void 0, Promise, function () {
var time, url;
return __generator(this, function (_a) {
time = Math.floor((new Date().getTime()) / 1000);
url = cc.fx.HttpUtil.apiSign("/api/share/cfg?gameId=" + shareConfig.gameId + "&time=" + time + "&url=" + shareUrl, {});
return [2 /*return*/, cc.fx.HttpUtil.get(url, callback)];
});
});
};
WeChat.containsNanana = function (str) {
return /test/i.test(str);
};
WeChat.removeQueryParams = function (url) {
return url.replace(/\?.*$/, '');
};
return WeChat;
}());
exports.WeChat = WeChat;
cc._RF.pop();

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ var GameTool = {
var name = "user_" + cc.fx.GameConfig.GM_INFO.gameId;
var data = JSON.parse(localStorage.getItem(name));
if (data == "undifend" || data == null || data == "") {
var url = "http://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback=" + location.href;
var url = "https://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback=" + location.href;
window.location.href = url;
}
else {
@ -37,7 +37,7 @@ var GameTool = {
"matchId": matchId,
"data": data
};
// console.log("上传数据:")
console.log("上传数据:");
cc.fx.HttpUtil.uploadUserLogData(postData, function () { });
},
//上传排行榜 type为1
@ -47,8 +47,8 @@ var GameTool = {
"gameId": cc.fx.GameConfig.GM_INFO.gameId,
"userId": cc.fx.GameConfig.GM_INFO.userId,
"type": 1,
"reactionTime": data,
"totalSunCount": cc.fx.GameConfig.GM_INFO.total,
"totleTimes": data.totleTimes,
"accuracy": data.accuracy,
"success": cc.fx.GameConfig.GM_INFO.success
};
cc.fx.HttpUtil.rankData(1, function () { }, postData);
@ -68,6 +68,7 @@ var GameTool = {
//获取matchId 用于上传每次点击数据里面记录id方便查询
getMatchId: function () {
var matchId = cc.sys.localStorage.getItem("matchId");
var tempId = matchId;
if (matchId == "undifend" || matchId == null) {
matchId = this.setMatchId();
}
@ -76,15 +77,20 @@ var GameTool = {
matchId = this.setMatchId();
}
else {
var char = parseInt(matchId[10]);
if (this.level == 1) {
var char = parseInt(tempId.substring(10, tempId.length));
if (cc.fx.GameConfig.GM_INFO.level == 1) {
char += 1;
matchId = tempId.slice(0, 10) + char + "";
if (this.containsNanana(matchId))
matchId = this.setMatchId();
cc.fx.GameConfig.GM_INFO.matchId = matchId;
cc.sys.localStorage.setItem("matchId", matchId);
}
matchId = matchId.slice(0, 10) + char + "";
cc.fx.GameConfig.GM_INFO.matchId = matchId;
cc.sys.localStorage.setItem("matchId", matchId);
}
}
if (this.containsNanana(matchId) == true) {
matchId = this.setMatchId();
}
return matchId;
},
//检测matchId 如果有缓存以前的nanana数据清除
@ -156,7 +162,7 @@ var GameTool = {
var self = false;
cc.fx.GameTool.setPic(target.selfNode.getChildByName("pic").getChildByName("icon"), target.selfData.pic);
for (var i = 0; i <= target.listData.length - 1; i++) {
rankData.push({ rank: (i + 1), name: target.listData[i].nickName, total: target.listData[i].totalSunCount, pic: target.listData[i].pic });
rankData.push({ rank: (i + 1), name: target.listData[i].nickName, total: target.listData[i].accuracy, time: target.listData[i].totleTimes, pic: target.listData[i].pic });
if (cc.fx.GameConfig.GM_INFO.userId == target.listData[i].userId) {
self = true;
target.rankNumber = i;
@ -169,7 +175,9 @@ var GameTool = {
}
cc.fx.GameTool.subName(target.selfData.nickName, nameLength);
target.selfNode.getChildByName("nameLab").getComponent(cc.Label).string = target.selfData.nickName;
target.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = target.selfData.totalSunCount;
target.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = target.selfData.accuracy + "%";
var timeTemp = cc.fx.GameTool.getTimeShenNong(target.selfData.totleTimes);
target.selfNode.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
switch (target.selfNode.getChildByName("rankLab").getComponent(cc.Label).string) {
case "1":
target.selfNode.getChildByName("rank").getChildByName("one").active = true;
@ -189,6 +197,120 @@ var GameTool = {
target.selfNode.opacity = 0;
}
},
getSeedRandom: function (min, max) {
console.log("随机数:", cc.fx.GameConfig.GM_INFO.currSeed);
max = max || 1;
min = min || 0;
cc.fx.GameConfig.GM_INFO.currSeed = (cc.fx.GameConfig.GM_INFO.currSeed * 9301 + 49297) % 233280;
var rnd = cc.fx.GameConfig.GM_INFO.currSeed / 233280.0;
var tmp = min + rnd * (max - min);
return parseInt(tmp);
},
//获取关卡配置的那个关卡数
getCustom: function (type) {
var custom = cc.fx.StorageMessage.getStorage(cc.fx.storageType.storageTypeCustom);
if (custom == "undifend" || custom == null || custom == "") {
this.setCustom();
}
else {
cc.fx.GameConfig.GM_INFO_SET("custom", custom[0]);
if (custom[0] != 0 || type == true) {
custom.shift();
if (custom.length == 0) {
this.setCustom();
}
else
cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom, custom);
}
}
},
//本地没有存储到配置,或者配置用完,重新创建配置
setCustom: function () {
var arrayLength = cc.fx.GameConfig.LEVEL_INFO.length;
var arrayList = [];
for (var i = 1; i < arrayLength; i++) {
arrayList.push(i);
}
arrayList.sort(function () { return Math.random() - 0.5; });
arrayList.unshift(0);
cc.fx.GameConfig.GM_INFO_SET("custom", arrayList[0]);
cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom, arrayList);
},
getFoodName: function (food) {
var name = "葡萄";
switch (food) {
case "baishao":
name = "白芍";
break;
case "jingjie":
name = "荆芥";
break;
case "renshen":
name = "人参";
break;
case "danshen":
name = "丹参";
break;
case "danggui":
name = "当归";
break;
case "gouqi":
name = "枸杞";
break;
case "mudan":
name = "牡丹";
break;
case "mulan":
name = "木兰";
break;
case "pugongying":
name = "蒲公英";
break;
case "moli":
name = "茉莉";
break;
case "jinju":
name = "金桔";
break;
case "dazao":
name = "大枣";
break;
case "lizi":
name = "李子";
break;
case "lizhi":
name = "荔枝";
break;
case "taozi":
name = "桃子";
break;
case "putao":
name = "葡萄";
break;
case "muchai":
name = "木柴";
break;
case "ganjiang":
name = "干姜";
break;
case "zhuye":
name = "竹叶";
break;
case "longyan":
name = "龙眼";
break;
case "chixiaodou":
name = "赤小豆";
break;
case "gancao":
name = "甘草";
break;
case "cha":
name = "茶";
break;
}
return name;
},
getSetScreenResolutionFlag: function () {
var size = cc.winSize;
var width = size.width;
@ -216,6 +338,23 @@ var GameTool = {
//设置游戏信息
setGameInfo: function (pd) {
},
//打字机效果
typingAni: function (label, text, cb, target) {
var self = target;
var html = '';
var arr = text.split('');
var len = arr.length;
var step = 0;
self.func = function () {
html += arr[step];
label.string = html;
if (++step == len) {
self.unschedule(self.func);
cb && cb();
}
};
self.schedule(self.func, 0.1, cc.macro.REPEAT_FOREVER, 0);
},
//输入秒,返回需要展示时间格式
getTimeMargin: function (second) {
var total = 0;
@ -233,6 +372,20 @@ var GameTool = {
miao = "0" + afterMin;
return m + ':' + miao;
},
//输入秒,返回需要展示时间格式
getTimeShenNong: function (second) {
second = parseInt(second / 1000 + "");
var total = 0;
total = second;
var min = 0;
if (total > 60) {
min = parseInt((total / 60) + ""); //计算整数分
}
var m = min + "'";
var afterMin = total - min * 60; //取得算出分后剩余的秒数
var miao = afterMin + "''";
return m + miao;
},
//获取时间戳
getTime: function () {
var timestamp = new Date().getTime();

File diff suppressed because one or more lines are too long

1
temp/startup.json Normal file
View File

@ -0,0 +1 @@
{"pid":18680}