1: Avatar头像调整一张特殊的大小 GameTool 修改finishi_stage上传不对问题, Win获胜分包单独加一个cat图片
This commit is contained in:
+91
-91
@@ -20,7 +20,7 @@
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 716
|
||||
"__id__": 718
|
||||
}
|
||||
],
|
||||
"_active": false,
|
||||
@@ -246,19 +246,19 @@
|
||||
"__id__": 658
|
||||
},
|
||||
{
|
||||
"__id__": 720
|
||||
"__id__": 713
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 713
|
||||
},
|
||||
{
|
||||
"__id__": 714
|
||||
},
|
||||
{
|
||||
"__id__": 715
|
||||
},
|
||||
{
|
||||
"__id__": 716
|
||||
},
|
||||
{
|
||||
"__id__": 717
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -30339,6 +30339,78 @@
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "sevenDayGift",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 714
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"_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": "f6jRhIHhRJHbv8/OnSu2fQ"
|
||||
},
|
||||
{
|
||||
"__type__": "9cbb94nzQtN9rF7RQfETigx",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 713
|
||||
},
|
||||
"_enabled": true,
|
||||
"_id": "27mZkVdCJGxYd6nUeS0QfP"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Canvas",
|
||||
"_name": "",
|
||||
@@ -30440,14 +30512,14 @@
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 717
|
||||
},
|
||||
{
|
||||
"__id__": 718
|
||||
},
|
||||
{
|
||||
"__id__": 719
|
||||
},
|
||||
{
|
||||
"__id__": 720
|
||||
},
|
||||
{
|
||||
"__id__": 721
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
@@ -30503,7 +30575,7 @@
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 716
|
||||
"__id__": 718
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
@@ -30536,7 +30608,7 @@
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 716
|
||||
"__id__": 718
|
||||
},
|
||||
"_enabled": true,
|
||||
"alignMode": 1,
|
||||
@@ -30563,84 +30635,12 @@
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 716
|
||||
"__id__": 718
|
||||
},
|
||||
"_enabled": true,
|
||||
"uid_Number": {
|
||||
"__id__": 717
|
||||
"__id__": 719
|
||||
},
|
||||
"_id": "67zCbKKV9PvYlB9x+eob0L"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "sevenDayGift",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 721
|
||||
}
|
||||
],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 0,
|
||||
"height": 0
|
||||
},
|
||||
"_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": "f6jRhIHhRJHbv8/OnSu2fQ"
|
||||
},
|
||||
{
|
||||
"__type__": "9cbb94nzQtN9rF7RQfETigx",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 720
|
||||
},
|
||||
"_enabled": true,
|
||||
"_id": "27mZkVdCJGxYd6nUeS0QfP"
|
||||
}
|
||||
]
|
||||
]
|
||||
@@ -388,9 +388,11 @@ var GameTool = {
|
||||
|
||||
//增加关卡数
|
||||
addLevel(time1, time2, callBack) {
|
||||
if (cc.fx.GameTool.maxLevel()) {
|
||||
|
||||
} else {
|
||||
const isMaxLevel = cc.fx.GameTool.maxLevel();
|
||||
// 结算记录本局关卡,避免进度自增后变成下一关或误判为无尽模式。
|
||||
const endLevel = isMaxLevel && cc.fx.GameConfig.GM_INFO.GameplayType == 1;
|
||||
const stageId = endLevel ? cc.fx.GameConfig.GM_INFO.randomLevel : cc.fx.GameConfig.GM_INFO.level + 1;
|
||||
if (!isMaxLevel) {
|
||||
cc.fx.GameConfig.GM_INFO.level += 1;
|
||||
}
|
||||
|
||||
@@ -411,11 +413,8 @@ var GameTool = {
|
||||
use_frenzy = MapConroler._instance.use_frenzy;
|
||||
}
|
||||
if (time1 != null && time2 != null) {
|
||||
let endLevel = false;
|
||||
if (cc.fx.GameTool.maxLevel() && cc.fx.GameConfig.GM_INFO.GameplayType == 1) {
|
||||
endLevel = true;
|
||||
}
|
||||
let data = {
|
||||
stage_id: stageId,
|
||||
time: time1,
|
||||
add_Time: time2,
|
||||
is_frenzy: is_frenzy,
|
||||
@@ -1396,9 +1395,12 @@ var GameTool = {
|
||||
}
|
||||
break;
|
||||
case "finish_stage":
|
||||
let userLevel2 = (cc.fx.GameConfig.GM_INFO.level + 1);
|
||||
if (cc.fx.GameTool.maxLevel() && cc.fx.GameConfig.GM_INFO.GameplayType == 1) {
|
||||
userLevel2 = cc.fx.GameConfig.GM_INFO.randomLevel;
|
||||
let userLevel2 = data.stage_id;
|
||||
if (userLevel2 == null) {
|
||||
userLevel2 = cc.fx.GameConfig.GM_INFO.level + 1;
|
||||
if (cc.fx.GameTool.maxLevel() && cc.fx.GameConfig.GM_INFO.GameplayType == 1) {
|
||||
userLevel2 = cc.fx.GameConfig.GM_INFO.randomLevel;
|
||||
}
|
||||
}
|
||||
eventData = {
|
||||
stage_id: userLevel2,
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 29 KiB |
@@ -8,8 +8,8 @@
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 186,
|
||||
"height": 173,
|
||||
"width": 417,
|
||||
"height": 388,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"cat": {
|
||||
@@ -24,10 +24,10 @@
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 186,
|
||||
"height": 173,
|
||||
"rawWidth": 186,
|
||||
"rawHeight": 173,
|
||||
"width": 417,
|
||||
"height": 388,
|
||||
"rawWidth": 417,
|
||||
"rawHeight": 388,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
|
||||
+1416
-1416
File diff suppressed because it is too large
Load Diff
@@ -2637,7 +2637,7 @@
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
49.628,
|
||||
50.547,
|
||||
91.915,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -2946,8 +2946,8 @@
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 395,
|
||||
"height": 402
|
||||
"width": 392,
|
||||
"height": 399
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
@@ -2959,7 +2959,7 @@
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
11.564,
|
||||
-200,
|
||||
-196.188,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -2999,7 +2999,7 @@
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "43a66e64-aeca-44fb-8322-ec56eabd543c"
|
||||
"__uuid__": "a18073a3-11b7-4fd1-a043-814b30a83b82"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
@@ -10976,10 +10976,10 @@
|
||||
"catUI": {
|
||||
"__uuid__": "ff580ec5-b05e-404f-b9f2-3e6a0fd2863c"
|
||||
},
|
||||
"_id": "",
|
||||
"cat12": {
|
||||
"__uuid__": "7d090003-0209-4a00-8b00-000000000209"
|
||||
}
|
||||
"__uuid__": "cbd01a77-0102-4324-a1aa-bcbc6f816850"
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
@@ -14488,4 +14488,4 @@
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
||||
]
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "ab6fdc88-7163-4370-bd1d-23792f25c591",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 417,
|
||||
"height": 388,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"cat": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "cbd01a77-0102-4324-a1aa-bcbc6f816850",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "ab6fdc88-7163-4370-bd1d-23792f25c591",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 417,
|
||||
"height": 388,
|
||||
"rawWidth": 417,
|
||||
"rawHeight": 388,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// Run: node --test tools/test-finish-stage.cjs
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const vm = require('node:vm');
|
||||
const ts = require('typescript');
|
||||
|
||||
const file = path.join(__dirname, '../assets/Script/module/Tool/GameTool.ts');
|
||||
const source = ts.createSourceFile(file, fs.readFileSync(file, 'utf8'), ts.ScriptTarget.Latest, true);
|
||||
const declaration = source.statements.filter(ts.isVariableStatement)
|
||||
.flatMap(statement => [...statement.declarationList.declarations])
|
||||
.find(node => node.name.getText(source) === 'GameTool');
|
||||
const members = declaration.initializer.properties.filter(node =>
|
||||
['MAX_NORMAL_LEVEL', 'addLevel', 'maxLevel', 'shushu_Track'].includes(node.name?.getText(source)));
|
||||
const code = ts.transpileModule('({' + members.map(node => node.getText(source)).join(',\n') + '})', {
|
||||
compilerOptions: { target: ts.ScriptTarget.ES2017 },
|
||||
}).outputText;
|
||||
|
||||
function fixture(overrides = {}) {
|
||||
const info = { level: 0, GameplayType: 1, randomLevel: 321, otherLevel: 0, addLevel: 0,
|
||||
winStreak: 2, address: 'test', ...overrides };
|
||||
const events = [], progress = [], gravity = [], storage = new Map();
|
||||
const cc = { fx: { GameConfig: { GM_INFO: info }, StorageMessage: {
|
||||
setStorage: (key, value) => storage.set(key, value),
|
||||
} } };
|
||||
const api = {
|
||||
setNewCloudlevel: () => progress.push({ target: 'cloud', level: info.level }),
|
||||
shushu_SetSuperProperties() {},
|
||||
shushu_Track: (name, data) => events.push({ name, data }),
|
||||
yinli_FinishiStage: () => gravity.push(info.level),
|
||||
};
|
||||
const tool = vm.runInNewContext(code, { cc, MiniGameSdk: { API: api },
|
||||
MapConroler: { _instance: { is_frenzy: true, use_frenzy: true, total_steps_count: 7 } },
|
||||
Utils: { setUserLevel(done, infinity) {
|
||||
progress.push({ target: 'server', level: info.level, infinity });
|
||||
done({ code: 1, data: {} });
|
||||
} },
|
||||
});
|
||||
cc.fx.GameTool = tool;
|
||||
return { info, tool, events, progress, gravity, storage };
|
||||
}
|
||||
|
||||
const maxLevel = fixture().tool.MAX_NORMAL_LEVEL;
|
||||
for (const scenario of [
|
||||
{ name: 'first stage', level: 0, stage: 1 },
|
||||
{ name: 'ordinary stage', level: 41, stage: 42 },
|
||||
{ name: 'last normal stage', level: maxLevel - 1, stage: maxLevel },
|
||||
{ name: 'endless stage', level: maxLevel, stage: 321, infinity: true },
|
||||
]) {
|
||||
test(`${scenario.name}: success reports the entered stage and saves advanced progress`, () => {
|
||||
const f = fixture({ level: scenario.level });
|
||||
f.tool.shushu_Track('enter_stage', { infinity: !!scenario.infinity });
|
||||
let completed = false;
|
||||
f.tool.addLevel(1200, 0, () => { completed = true; });
|
||||
const entered = f.events.find(event => event.name === 'enter_stage').data;
|
||||
const finished = f.events.find(event => event.name === 'finish_stage').data;
|
||||
assert.equal(finished.stage_id, scenario.stage);
|
||||
assert.equal(finished.stage_id, entered.stage_id);
|
||||
assert.equal(finished.infinity, !!scenario.infinity);
|
||||
assert.equal(finished.result, 'success');
|
||||
assert.equal(finished.stage_duration, 1200);
|
||||
assert.equal(finished.added_time, 0);
|
||||
assert.equal(finished.use_frenzy, true);
|
||||
assert.equal(finished.total_steps_count, 7);
|
||||
const nextLevel = Math.min(scenario.level + 1, maxLevel);
|
||||
assert.equal(f.info.level, nextLevel);
|
||||
assert.equal(f.storage.get('level').level, nextLevel);
|
||||
assert.deepEqual(f.progress, [
|
||||
{ target: 'cloud', level: nextLevel },
|
||||
{ target: 'server', level: nextLevel, infinity: nextLevel === maxLevel },
|
||||
]);
|
||||
assert.deepEqual(f.gravity, [nextLevel]);
|
||||
assert.equal(completed, true);
|
||||
});
|
||||
}
|
||||
|
||||
for (const result of ['failreason: time', 'give_up']) {
|
||||
for (const scenario of [
|
||||
{ name: 'normal', level: 41, stage: 42 },
|
||||
{ name: 'endless', level: maxLevel, stage: 321 },
|
||||
{ name: 'shared', level: 41, otherLevel: 88, stage: 88 },
|
||||
]) {
|
||||
test(`${scenario.name}: ${result} keeps its current stage without advancing progress`, () => {
|
||||
const f = fixture(scenario);
|
||||
f.tool.shushu_Track('finish_stage', { result, time: 1200, add_Time: 0 });
|
||||
assert.equal(f.events[0].data.stage_id, scenario.stage);
|
||||
assert.equal(f.events[0].data.result, result);
|
||||
assert.equal(f.info.level, scenario.level);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
test('skipping a missing level advances progress without a success event', () => {
|
||||
const f = fixture();
|
||||
f.tool.addLevel(null, null, null);
|
||||
assert.equal(f.info.level, 1);
|
||||
assert.equal(f.events.length, 0);
|
||||
});
|
||||
Reference in New Issue
Block a user