Commit 1cda4f1d authored by haiyoucuv's avatar haiyoucuv

init

parent a1a04361
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"_active": true, "_active": true,
"_components": [], "_components": [],
"_prefab": { "_prefab": {
"__id__": 119 "__id__": 126
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
}, },
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_globals": { "_globals": {
"__id__": 123 "__id__": 130
}, },
"_id": "53947ca7-3484-4b53-800d-509405063d68" "_id": "53947ca7-3484-4b53-800d-509405063d68"
}, },
...@@ -92,16 +92,16 @@ ...@@ -92,16 +92,16 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 115 "__id__": 122
}, },
{ {
"__id__": 116 "__id__": 123
}, },
{ {
"__id__": 117 "__id__": 124
}, },
{ {
"__id__": 118 "__id__": 125
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
"_priority": 40000, "_priority": 40000,
"_fov": 45, "_fov": 45,
"_fovAxis": 0, "_fovAxis": 0,
"_orthoHeight": 505.24444444444447, "_orthoHeight": 582.5777777777778,
"_near": 0, "_near": 0,
"_far": 2000, "_far": 2000,
"_color": { "_color": {
...@@ -1803,10 +1803,10 @@ ...@@ -1803,10 +1803,10 @@
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
"handle": { "handle": {
"__id__": 109 "__id__": 116
}, },
"bg": { "bg": {
"__id__": 113 "__id__": 120
}, },
"normalSp": { "normalSp": {
"__uuid__": "7f413237-4b73-4bae-bca7-7ab9e9742ebc@f9941", "__uuid__": "7f413237-4b73-4bae-bca7-7ab9e9742ebc@f9941",
...@@ -1828,22 +1828,22 @@ ...@@ -1828,22 +1828,22 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 109 "__id__": 116
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 112 "__id__": 119
}, },
{ {
"__id__": 113 "__id__": 120
}, },
{ {
"__id__": 51 "__id__": 51
}, },
{ {
"__id__": 114 "__id__": 121
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1904,19 +1904,19 @@ ...@@ -1904,19 +1904,19 @@
"__id__": 87 "__id__": 87
}, },
{ {
"__id__": 99 "__id__": 106
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 106 "__id__": 113
}, },
{ {
"__id__": 107 "__id__": 114
}, },
{ {
"__id__": 108 "__id__": 115
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2008,7 +2008,7 @@ ...@@ -2008,7 +2008,7 @@
"_priority": 50000, "_priority": 50000,
"_fov": 45, "_fov": 45,
"_fovAxis": 0, "_fovAxis": 0,
"_orthoHeight": 505.24444444444447, "_orthoHeight": 582.5777777777778,
"_near": 1, "_near": 1,
"_far": 2000, "_far": 2000,
"_color": { "_color": {
...@@ -2486,7 +2486,7 @@ ...@@ -2486,7 +2486,7 @@
"_prefab": null, "_prefab": null,
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 99.56, "x": 94.55999755859375,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
...@@ -2525,8 +2525,8 @@ ...@@ -2525,8 +2525,8 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 99.56, "width": 94.55999755859375,
"height": 62 "height": 75.6
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -2571,11 +2571,11 @@ ...@@ -2571,11 +2571,11 @@
"_isSystemFontUsed": false, "_isSystemFontUsed": false,
"_spacingX": 0, "_spacingX": 0,
"_isItalic": false, "_isItalic": false,
"_isBold": false, "_isBold": true,
"_isUnderline": false, "_isUnderline": false,
"_underlineHeight": 2, "_underlineHeight": 2,
"_cacheMode": 2, "_cacheMode": 1,
"_enableOutline": true, "_enableOutline": false,
"_outlineColor": { "_outlineColor": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 0, "r": 0,
...@@ -2625,7 +2625,7 @@ ...@@ -2625,7 +2625,7 @@
"_prefab": null, "_prefab": null,
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 107.56, "x": 102.55999755859375,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
...@@ -2902,8 +2902,8 @@ ...@@ -2902,8 +2902,8 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 14.17, "width": 12.67,
"height": 23 "height": 22
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -2952,7 +2952,7 @@ ...@@ -2952,7 +2952,7 @@
"_isUnderline": false, "_isUnderline": false,
"_underlineHeight": 2, "_underlineHeight": 2,
"_cacheMode": 2, "_cacheMode": 2,
"_enableOutline": true, "_enableOutline": false,
"_outlineColor": { "_outlineColor": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 255,
...@@ -2989,7 +2989,7 @@ ...@@ -2989,7 +2989,7 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 63.17, "width": 61.67,
"height": 27.72 "height": 27.72
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -3200,7 +3200,7 @@ ...@@ -3200,7 +3200,7 @@
"__prefab": null, "__prefab": null,
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 204.83999877929688, "width": 199.83999633789062,
"height": 75.6 "height": 75.6
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -3288,13 +3288,13 @@ ...@@ -3288,13 +3288,13 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 96 "__id__": 103
}, },
{ {
"__id__": 97 "__id__": 104
}, },
{ {
"__id__": 98 "__id__": 105
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3372,6 +3372,21 @@ ...@@ -3372,6 +3372,21 @@
}, },
{ {
"__id__": 95 "__id__": 95
},
{
"__id__": 96
},
{
"__id__": 98
},
{
"__id__": 100
},
{
"__id__": 101
},
{
"__id__": 102
} }
], ],
"removedComponents": [] "removedComponents": []
...@@ -3438,6 +3453,72 @@ ...@@ -3438,6 +3453,72 @@
"z": 0 "z": 0
} }
}, },
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 97
},
"propertyPath": [
"_enableOutline"
],
"value": false
},
{
"__type__": "cc.TargetInfo",
"localID": [
"83JFgtWhhPp65JtsWzacKf"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 99
},
"propertyPath": [
"_contentSize"
],
"value": {
"__type__": "cc.Size",
"width": 8.271987915039062,
"height": 27.72
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"8bUrMCxWlMTLSd91dV1ErQ"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 97
},
"propertyPath": [
"_isItalic"
],
"value": false
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 97
},
"propertyPath": [
"_isBold"
],
"value": true
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 97
},
"propertyPath": [
"_cacheMode"
],
"value": 1
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
...@@ -3523,19 +3604,19 @@ ...@@ -3523,19 +3604,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 100 "__id__": 107
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 103 "__id__": 110
}, },
{ {
"__id__": 104 "__id__": 111
}, },
{ {
"__id__": 105 "__id__": 112
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3574,16 +3655,16 @@ ...@@ -3574,16 +3655,16 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 99 "__id__": 106
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 101 "__id__": 108
}, },
{ {
"__id__": 102 "__id__": 109
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3622,7 +3703,7 @@ ...@@ -3622,7 +3703,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 100 "__id__": 107
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
...@@ -3644,7 +3725,7 @@ ...@@ -3644,7 +3725,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 100 "__id__": 107
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
...@@ -3709,7 +3790,7 @@ ...@@ -3709,7 +3790,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 99 "__id__": 106
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
...@@ -3731,7 +3812,7 @@ ...@@ -3731,7 +3812,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 99 "__id__": 106
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
...@@ -3770,7 +3851,7 @@ ...@@ -3770,7 +3851,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 99 "__id__": 106
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
...@@ -3874,10 +3955,10 @@ ...@@ -3874,10 +3955,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 110 "__id__": 117
}, },
{ {
"__id__": 111 "__id__": 118
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3916,7 +3997,7 @@ ...@@ -3916,7 +3997,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 109 "__id__": 116
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
...@@ -3938,7 +4019,7 @@ ...@@ -3938,7 +4019,7 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 109 "__id__": 116
}, },
"_enabled": true, "_enabled": true,
"__prefab": null, "__prefab": null,
...@@ -4174,7 +4255,7 @@ ...@@ -4174,7 +4255,7 @@
"__id__": 77 "__id__": 77
}, },
"luckyNum": { "luckyNum": {
"__id__": 102 "__id__": 109
}, },
"_id": "212vDeP7dNBZXi0fJjPuCy" "_id": "212vDeP7dNBZXi0fJjPuCy"
}, },
...@@ -4186,7 +4267,7 @@ ...@@ -4186,7 +4267,7 @@
"instance": null, "instance": null,
"targetOverrides": [ "targetOverrides": [
{ {
"__id__": 120 "__id__": 127
} }
], ],
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
...@@ -4204,7 +4285,7 @@ ...@@ -4204,7 +4285,7 @@
"__id__": 39 "__id__": 39
}, },
"sourceInfo": { "sourceInfo": {
"__id__": 121 "__id__": 128
}, },
"propertyPath": [ "propertyPath": [
"head" "head"
...@@ -4213,7 +4294,7 @@ ...@@ -4213,7 +4294,7 @@
"__id__": 39 "__id__": 39
}, },
"targetInfo": { "targetInfo": {
"__id__": 122 "__id__": 129
} }
}, },
{ {
...@@ -4231,28 +4312,28 @@ ...@@ -4231,28 +4312,28 @@
{ {
"__type__": "cc.SceneGlobals", "__type__": "cc.SceneGlobals",
"ambient": { "ambient": {
"__id__": 124 "__id__": 131
}, },
"shadows": { "shadows": {
"__id__": 125 "__id__": 132
}, },
"_skybox": { "_skybox": {
"__id__": 126 "__id__": 133
}, },
"fog": { "fog": {
"__id__": 127 "__id__": 134
}, },
"octree": { "octree": {
"__id__": 128 "__id__": 135
}, },
"skin": { "skin": {
"__id__": 129 "__id__": 136
}, },
"lightProbeInfo": { "lightProbeInfo": {
"__id__": 130 "__id__": 137
}, },
"postSettings": { "postSettings": {
"__id__": 131 "__id__": 138
}, },
"bakedWithStationaryMainLight": false, "bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false "bakedWithHighpLightmap": false
......
import { sendWebNet, WebNetName } from "./Utils/WebNet/WebNet";
import { changeScene, hideWaiting, showPanel, showToast, showWaiting } from "db://assets/Module/UIFast";
import { AESDecrypt, AESEncrypt } from "./Utils/Crypto";
import store from "./store/store";
import { HomeScene } from "./Scenes/HomeScene";
export default class GameMgr {
private static _ins: GameMgr = null;
public static get ins() {
!GameMgr._ins && (GameMgr._ins = new GameMgr());
return GameMgr._ins;
}
gameInfo: {
recordId: number,
} = {
recordId: 0,
};
/**
* 开始游戏
*/
async start() {
showWaiting();
const { success, data, code } = await sendWebNet(WebNetName.start);
hideWaiting();
const decrypt = JSON.parse(AESDecrypt(data, "FDF817451A60EB6F", "cDOiBC1n2QrkAY2P"));
const { recordId } = decrypt;
this.gameInfo = {
recordId,
}
return true;
}
/**
* 提交游戏结果
*/
async submit(score: number) {
showWaiting();
const params = {
recordId: this.gameInfo.recordId,
score: score,
level: 1,
timestamp: Date.now(),
}
const encrypt = AESEncrypt(JSON.stringify(params), "FDF817451A60EB6F", "cDOiBC1n2QrkAY2P");
const { success, data } = await sendWebNet(WebNetName.submit, {
encryptedData: encrypt,
}, {
// isGet: false,
});
hideWaiting();
if (!success) {
changeScene(HomeScene);
return false;
}
}
}
...@@ -7,6 +7,7 @@ import { observer, render } from "../store/decorators"; ...@@ -7,6 +7,7 @@ import { observer, render } from "../store/decorators";
import { _asyncThrottle } from "../Utils/Utils"; import { _asyncThrottle } from "../Utils/Utils";
import RankPanel from "../Panels/RankPanel"; import RankPanel from "../Panels/RankPanel";
import { UIMgr } from "../../Module/UIMgr"; import { UIMgr } from "../../Module/UIMgr";
import gameStore from "../store/gameStore";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -45,6 +46,7 @@ export class HomeScene extends Scene { ...@@ -45,6 +46,7 @@ export class HomeScene extends Scene {
} }
clickStart = _asyncThrottle(async () => { clickStart = _asyncThrottle(async () => {
await gameStore.startGame();
changeScene(MainGame); changeScene(MainGame);
}); });
......
...@@ -15,7 +15,6 @@ export enum FoodType { ...@@ -15,7 +15,6 @@ export enum FoodType {
ccenum(FoodType); ccenum(FoodType);
// 移动方向枚举 // 移动方向枚举
export enum DirectionType { export enum DirectionType {
DEFAULT = 0, // 默认方向 DEFAULT = 0, // 默认方向
...@@ -29,18 +28,6 @@ export enum GameState { ...@@ -29,18 +28,6 @@ export enum GameState {
PLAY = 1, // 游戏中 PLAY = 1, // 游戏中
PAUSE = 2, // 暂停 PAUSE = 2, // 暂停
OVER = 3, // 游戏结束 OVER = 3, // 游戏结束
WIN = 4, // 游戏胜利
QUIT = 5 // 退出游戏
}
export enum FlagType {
SHIELD = 0,
MAGNET = 1,
SPEED_UP = 2,
DOUBLE_SCORE = 3
} }
export enum EBodyTag {
Player
}
...@@ -76,9 +76,7 @@ export class MainGame extends Scene { ...@@ -76,9 +76,7 @@ export class MainGame extends Scene {
return this._killNum; return this._killNum;
} }
private state: GameState = GameState.READY; private state: GameState = GameState.READY;
private rebirthSum: number = 0;
private static _ins: MainGame = null; private static _ins: MainGame = null;
static get ins(): MainGame { static get ins(): MainGame {
...@@ -191,35 +189,17 @@ export class MainGame extends Scene { ...@@ -191,35 +189,17 @@ export class MainGame extends Scene {
// } // }
// } // }
onPause() {
this.setGameState(GameState.PAUSE);
console.log("pause");
}
setGameState(state: GameState) { setGameState(state: GameState) {
this.state = Number(state); this.state = Number(state);
switch (this.state) { switch (this.state) {
case GameState.READY: case GameState.READY:
break; break;
case GameState.PLAY: case GameState.PLAY:
director.resume();
break;
case GameState.PAUSE:
director.pause();
break; break;
case GameState.OVER: case GameState.OVER:
this.rebirthSum++; this.showGOver();
if (this.rebirthSum > 2) return this.showGOver();
showToast("你已死亡!"); showToast("你已死亡!");
break; break;
case GameState.WIN:
director.pause();
console.log("win", this.player.getSnakeLen());
break;
case GameState.QUIT:
director.resume();
director.loadScene("GameMain");
break;
default: default:
console.log("err"); console.log("err");
} }
......
...@@ -20,6 +20,12 @@ export enum WebNetName { ...@@ -20,6 +20,12 @@ export enum WebNetName {
getFrontVariable = 'coop_frontVariable.query', getFrontVariable = 'coop_frontVariable.query',
buriedPoint = 'buriedPoint', buriedPoint = 'buriedPoint',
startGame = "game/startGame.do",
submitOne = "game/submitOne.do",
submitTwo = "game/submitTwo.do",
finalSubmit = "game/finalSubmit.do",
/** /**
* 排行榜 * 排行榜
*/ */
...@@ -98,6 +104,7 @@ let dataRecord: { ...@@ -98,6 +104,7 @@ let dataRecord: {
interface IWebConfig { interface IWebConfig {
token?: string;
callback?: (success: boolean, res?: dataOut) => void, callback?: (success: boolean, res?: dataOut) => void,
hideMsg?: boolean, hideMsg?: boolean,
isGet?: boolean,//这两个参数基本不设置,放后面吧 isGet?: boolean,//这两个参数基本不设置,放后面吧
...@@ -138,7 +145,6 @@ export function sendWebNet( ...@@ -138,7 +145,6 @@ export function sendWebNet(
res.success = res.success || res.ok; res.success = res.success || res.ok;
if (!res.success) { if (!res.success) {
if (!hideMsg) { if (!hideMsg) {
showToast(ERR_MESSAGE[res.code] || res.message || "网络异常,请稍后再试~"); showToast(ERR_MESSAGE[res.code] || res.message || "网络异常,请稍后再试~");
...@@ -182,12 +188,17 @@ export function sendWebNet( ...@@ -182,12 +188,17 @@ export function sendWebNet(
url = "mock/" + netName + ".json"; url = "mock/" + netName + ".json";
} }
let data = parameter || {}; let data = parameter || {};
if (data.token) {
url += "?token=" + data.token;
delete data.token;
}
if (!isGet) { if (!isGet) {
data = JSON.stringify(data); data = JSON.stringify(data);
} }
//网络请求 //网络请求
$.ajax({ $.ajax({
url, //请求地址 url, //请求地址
...@@ -218,7 +229,7 @@ export function sendWebNetWithToken( ...@@ -218,7 +229,7 @@ export function sendWebNetWithToken(
const res = await sendWebNet( const res = await sendWebNet(
netName, netName,
{ token, ...parameter }, { token, ...parameter },
config config,
); );
r(res); r(res);
} catch (e) { } catch (e) {
......
import mobx from "mobx";
import { sendWebNet, sendWebNetWithToken, WebNetName } from "../Utils/WebNet/WebNet";
import { AESDecrypt } from "../Utils/Crypto";
import { hideWaiting, showWaiting } from "../../Module/UIFast";
import { startNecCaptcha } from "../Utils/ecaptcha/ecaptcha";
const { makeAutoObservable } = mobx;
export enum ESpType {
bag_silver = "sp_bag_silver", // 银福袋
revival_card = "sp_revival_card", // 复活卡
shield_card = "sp_shield_card", // 护盾卡
agility_card = "sp_agility_card", // 移速卡
experience_card = "sp_experience_card", // 双倍卡
add_length = "sp_add_length", // 加长卡
decoration_1 = "sp_decoration_1", // 蛇皮肤
}
export interface IStartInfo {
barrierFlag: boolean, // 本局游戏难度是否上升
firstGameFlag: boolean, // 本局是否第一局,为true则有一,二,无尽模式三个阶段的区别
accumulateLuckNum: number, // 当局累计获得福袋数量
initScore: number, // 当局初始分数值
limitLuckNum: number, // 当日上限可获得福袋数
downArea: string[], // 掉落分布,集合,比如每日上限6个,这里配置返回1、2、3
currentAcquireNum: number, // 当局剩余可获得福袋数,不包含accumulateLuckNum,当局累计获得福袋数量
currentStage: 1 | 2 | 3, // 当前应该进入的阶段(1-一阶段 2-二阶段 3-无尽模式)
spCardList: [{ spId: ESpType, num: string }], // 道具卡集合
currentDressUp: "sp_decoration_default" | "sp_skin_snake_year", // sp_decoration_default装扮默认皮肤,sp_skin_snake_year装扮蛇皮肤
startId: number, // 游戏记录ID
slideScore: number, // 校验滑块的分数值
}
class GameStore {
startInfo: IStartInfo = null;
async startGame() {
showWaiting();
const { success, data } = await sendWebNetWithToken(WebNetName.startGame);
hideWaiting();
if (!success) {
return false;
}
const decrypt: IStartInfo = JSON.parse(AESDecrypt(data, "6FDCE02EBB43C3A8", "cDOiBC1n2QrkAY2P"));
console.log(decrypt);
this.startInfo = decrypt;
return success;
}
async submitOne(score: number) {
const params = {
startId: this.startInfo.startId,
score,
};
showWaiting();
const { success, data } = await sendWebNetWithToken(WebNetName.submitOne, params);
hideWaiting();
if (!success) {
return false;
}
return success;
}
async submitTwo(score: number) {
const params = {
startId: this.startInfo.startId,
score,
};
showWaiting();
const { success, data } = await sendWebNetWithToken(WebNetName.submitTwo, params);
hideWaiting();
if (!success) {
return false;
}
return success;
}
async finalSubmit(score: number, finalKill: number) {
const param: any = {
startId: this.startInfo.startId,
score,
finalKill,
composeSpList: [],
};
if (score >= this.startInfo.slideScore) {
param.slideValue = await startNecCaptcha("1ee4615751874cbeaea4dd4681930f61", 3);
}
showWaiting();
const { success, data } = await sendWebNetWithToken(WebNetName.finalSubmit, { param }, {
isGet: false,
});
hideWaiting();
if (!success) {
return false;
}
return success;
}
}
const gameStore: GameStore = makeAutoObservable(new GameStore());
export default gameStore;
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"ver": "4.0.24", "ver": "4.0.24",
"importer": "typescript", "importer": "typescript",
"imported": true, "imported": true,
"uuid": "81ea2780-52ff-45dc-8fa1-ed314e321790", "uuid": "69f78ea4-685a-4330-b18e-8409c08704bf",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}
......
...@@ -13,26 +13,6 @@ export interface IHomeInfo { ...@@ -13,26 +13,6 @@ export interface IHomeInfo {
class Store { class Store {
miniAppQuery: any = {};
async getMiniQuery() {
return new Promise<void>((resolve) => {
window["my"].onMessage = (e: any = {}) => {
const {query, type} = e;
if (type == "getMiniAppQuery") {
this.miniAppQuery = query || {};
resolve();
}
}
try {
window["my"].postMessage({type: "getMiniAppQuery"});
} catch (e) {
console.error(e);
}
});
}
frontVariable: { [key in string]: any } = {} frontVariable: { [key in string]: any } = {}
async updateFrontVariable() { async updateFrontVariable() {
......
...@@ -6,6 +6,7 @@ import { HomeScene } from "db://assets/Scripts/Scenes/HomeScene"; ...@@ -6,6 +6,7 @@ import { HomeScene } from "db://assets/Scripts/Scenes/HomeScene";
import { AudioMgr } from "../core_tgx/base/AudioMgr"; import { AudioMgr } from "../core_tgx/base/AudioMgr";
import { MusicBtn } from "../Component/MusicBtn/MusicBtn"; import { MusicBtn } from "../Component/MusicBtn/MusicBtn";
import ZipLoader from "./ZipLoader"; import ZipLoader from "./ZipLoader";
import store from "../Scripts/store/store";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -42,6 +43,8 @@ export class Start extends Component { ...@@ -42,6 +43,8 @@ export class Start extends Component {
MusicBtn.open = localStorage.getItem("MusicStatus") != "false"; MusicBtn.open = localStorage.getItem("MusicStatus") != "false";
// MusicBtn.open = false; // MusicBtn.open = false;
store.updateFrontVariable();
} }
onDestroy() { onDestroy() {
......
{
"success": true,
"code": "",
"message": "",
"data": "P3mmQEAWoW8YQIDomgCRHDxeHF1lz7GrxKgwZQG/fezdjnKg4bRnWIjmEG3HGfhr9PIuFwN8XgWsZ9Mkw9QkpLyJ2n+0XVdu5v6I/6Fwiig="
}
\ No newline at end of file
{
"success": true,
"code": "",
"message": "",
"data": "Dn22D8mkVmDOfP4ajNWcqtUT2BWK7hLAEHSofRAnITI23/h6M5dk9MJ+cY56DvHjlsXFGC8q3BgSsz56SCAcO6LiZx8tbmrjStn4UcGZq6/W+ZIm0IEma+v0iYkjGBT6bqBnMhA+9JKPvWXKnFJiNR2b8kEDC1Mjt2MH2penAaujIPcM6SAvaaZuTB04+Jtkg598ulZEVdSadszHW0WSzCDjzyl9pUo3ai58aja/O6OPNCmasxQ2HN3MhUZceEZHYRQUj2wA4OgIbGAl86/PLgcfqBnXV2NFox1DfZ4aKKTJxlYOJCrfKM2nx8RaONLCeCqVn3U1bzFqJ1Upn8vKObxrVTSrMYASXNC27cTuH9bGK3lkY+rfXa0jRKAuxSnQRC0SkOJyFz+ZuXZxqKGVhPG5Pnh3iLaYvhyTvYuLynmU7PO4shaMtAaGi6nOlRz0Rd1agq4+8RfQW6PUkemr0Zn2pR4otRBTZw6odXswdwp1mZgl82nZzIwi5NiXaKTCzMDTfBVaeczzUpZLnXt/rPBh4Zn4qyzhNVLBq5/dbt6Minb+7gbX3xMYqpSUiiZD0zfGA25L+dGBa5EjC0/Pkac4Q1mUiVY6CkmqqbRVVC/pxBYdTd7O/xfwfSz5GLrDePkIIE/IsMYx5ovf9DueVQ=="
}
\ No newline at end of file
// export enum ESpType {
// bag_silver = "sp_bag_silver", // 银福袋
// revival_card = "sp_revival_card", // 复活卡
// shield_card = "sp_shield_card", // 护盾卡
// agility_card = "sp_agility_card", // 移速卡
// experience_card = "sp_experience_card", // 双倍卡
// add_length = "sp_add_length", // 加长卡
// decoration_1 = "sp_decoration_1", // 蛇皮肤
// }
import * as fs from "fs";
import CryptoJS from "crypto-js";
import "crypto-js/aes.js";
import "crypto-js/pad-zeropadding.js";
const { AES, enc, mode, pad } = CryptoJS;
const getOptions = (iv) => {
return {
iv: enc.Utf8.parse(iv),
mode: mode.CBC,
padding: pad.ZeroPadding,
};
};
/** 加密 */
const AESEncrypt = (str, key, iv) => {
const options = getOptions(iv);
return AES.encrypt(str, enc.Utf8.parse(key), options).toString();
};
/** 解密 */
const AESDecrypt = (cipherText, key, iv) => {
const options = getOptions(iv);
return AES.decrypt(cipherText, enc.Utf8.parse(key), options)
.toString(enc.Utf8)
.trim()
.replace(//g, "")
.replace(//g, "")
.replace(/\v/g, "")
.replace(/\x00/g, "");
};
const startInfo = {
barrierFlag: true, // 本局游戏难度是否上升
firstGameFlag: true, // 本局是否第一局,为true则有一,二,无尽模式三个阶段的区别
accumulateLuckNum: 2, // 当局累计获得福袋数量
initScore: 30, // 当局初始分数值
limitLuckNum: 5, // 当日上限可获得福袋数
downArea: [3, 2, 1], // 掉落分布,集合,比如每日上限6个,这里配置返回1、2、3
currentAcquireNum: 3, // 当局剩余可获得福袋数,不包含accumulateLuckNum,当局累计获得福袋数量
currentStage: 1, // 当前应该进入的阶段(1-一阶段 2-二阶段 3-无尽模式)
spCardList: [ // 道具卡集合
{ spId: "sp_bag_silver", num: 1 },
{ spId: "sp_revival_card", num: 2 },
{ spId: "sp_shield_card", num: 13 },
{ spId: "sp_agility_card", num: 9 },
{ spId: "sp_experience_card", num: 5 },
{ spId: "sp_add_length", num: 6 },
{ spId: "sp_decoration_1", num: 1 },
],
// sp_decoration_default装扮默认皮肤,sp_skin_snake_year装扮蛇皮肤
currentDressUp: "sp_decoration_default",
// currentDressUp: "sp_skin_snake_year",
startId: 12312, // 游戏记录ID
slideScore: 100, // 校验滑块的分数值
};
const encrypt = AESEncrypt(JSON.stringify(startInfo), "6FDCE02EBB43C3A8", "cDOiBC1n2QrkAY2P");
const json = {
success: true,
code: "",
message: "",
data: encrypt
};
fs.writeFileSync("./startGame.do.json", JSON.stringify(json, null, 4));
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"width": 1624, "width": 1624,
"height": 750, "height": 750,
"fitHeight": true, "fitHeight": true,
"fitWidth": true "fitWidth": false
}, },
"downloadMaxConcurrency": 20, "downloadMaxConcurrency": 20,
"renderPipeline": "c7e748e8-be82-4f6f-b2c0-085b604e40e5" "renderPipeline": "c7e748e8-be82-4f6f-b2c0-085b604e40e5"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment