修复每日任务和小鱼干入口 显示异常,关卡上限调整为1960

This commit is contained in:
COMPUTER\EDY 2026-09-14 13:33:18 +08:00
parent ca6b7b4b56
commit dafc275bf0
4 changed files with 68 additions and 8 deletions

View File

@ -1079,8 +1079,15 @@ export default class JiaZai extends cc.Component {
}
private refreshNewPlayerActivityButtons(): void {
if (!cc.fx.GameConfig.isNewPlayerB()) return;
const top = this.node.getChildByName("Load").getChildByName("Top");
if (!cc.fx.GameConfig.isNewPlayerB()) {
const day = top.getChildByName("day");
day.active = true;
day.getComponent(cc.Button).interactable = true;
const mask = day.getChildByName("mask");
if (mask) mask.active = false;
return;
}
for (const [name, level] of [["day", 36], ["hammer", 51]] as [string, number][]) {
const button = top.getChildByName(name);
button.active = cc.fx.GameConfig.GM_INFO.level >= 20;
@ -3138,12 +3145,10 @@ export default class JiaZai extends cc.Component {
private setJungleTreasureHomeButtonVisible(visible: boolean): void {
let button = this.getJungleTreasureHomeButton();
if (button) {
if (cc.fx.GameConfig.isNewPlayerB()) {
if (cc.fx.GameConfig.GM_INFO.level < 40) {
visible = cc.fx.GameConfig.GM_INFO.level >= 20;
}
this.setNewPlayerActivityLock(button, 41);
if (cc.fx.GameConfig.isNewPlayerB() && cc.fx.GameConfig.GM_INFO.level < 40) {
visible = cc.fx.GameConfig.GM_INFO.level >= 20;
}
this.setNewPlayerActivityLock(button, 41);
button.active = visible;
}
this.refreshHomeActivityEntryLayout();

View File

@ -718,7 +718,7 @@ export class GameConfig {
vibrateOpen: true, //震动
coinnum: 0, //每局的金币数
paid_user: false, //是否是付费用户
version: "1.0.55", //版本号
version: "1.0.56", //版本号
shushu_DistinctId: "", //数数访客ID
shushu_AccountId: "", //数数账号ID
uid: "", //用户和后端唯一id

View File

@ -12,7 +12,7 @@ import {
//@ts-ignore
//最大工具类 各种公共方法,以及处理上传,获取后端接口数据
var GameTool = {
MAX_NORMAL_LEVEL: 1940,
MAX_NORMAL_LEVEL: 1960,
starterPackReactivationUid: "",
starterPackQueuedReason: "",
MEMORY_WARNING_EVENT: "game-memory-warning",

View File

@ -91,6 +91,28 @@ function runtime(c) {
return cc;
}
test('daily quests stay visible and unlocked for A and users without AB assignments', () => {
const c = config(), cc = runtime(c);
const data = json('assets/Scene/HomeScene.fire');
const topId = data.findIndex(n => n._name === 'Top' && n.__type__ === 'cc.Node');
const Home = loadMembers(homeFile, ['refreshNewPlayerActivityButtons'], { cc });
for (const [group, raw] of [['A', assignment('A')], ['1', assignment(1)], ['empty', {}], ['missing', undefined]]) {
c.GM_INFO.abTestAssignments = raw;
for (const level of [0, 19, 20, 34, 35, 100]) {
c.GM_INFO.level = level;
const top = inflate(data, topId);
const home = Object.assign(new Home(), {
node: { getChildByName: () => ({ getChildByName: () => top }) },
});
home.refreshNewPlayerActivityButtons();
const day = top.getChildByName('day'), context = `${group}, cleared ${level}`;
assert.equal(day.active, true, `${context}: visible`);
assert.equal(day.getComponent(cc.Button).interactable, true, `${context}: clickable`);
assert.equal(day.getChildByName('mask').active, false, `${context}: unlocked`);
}
}
});
test('home entries are hidden before 20, locked with labels at 20 and unlock at 35/40/50', () => {
const c = config(), cc = runtime(c);
const data = json('assets/Scene/HomeScene.fire');
@ -120,6 +142,39 @@ test('home entries are hidden before 20, locked with labels at 20 and unlock at
assert.equal(top.getChildByName('jungle').active, false, 'unlocked activity still follows the original visibility result');
});
test('unlocked Jungle login clears the scene mask for every AB group', () => {
const c = config(), cc = runtime(c);
c.getJungleTreasureUnlockLevel = () => 40;
const data = json('assets/Scene/HomeScene.fire');
const topId = data.findIndex(n => n._name === 'Top' && n.__type__ === 'cc.Node');
const Home = loadMembers(homeFile, ['initializeJungleTreasureEntryFromLogin', 'canOpenJungleTreasure',
'getJungleTreasureHomeButton', 'setJungleTreasureHomeButtonVisible', 'setNewPlayerActivityLock',
'refreshJungleTreasureHomeButton'], { cc });
for (const [group, raw] of [['A', assignment('A')], ['empty', {}], ['missing', undefined], ['B', assignment('B')]]) {
c.GM_INFO.abTestAssignments = raw;
for (const level of [65, 40, '65']) {
c.GM_INFO.level = level;
const top = inflate(data, topId);
let requests = 0;
const home = Object.assign(new Home(), {
node: { getChildByName: () => ({ getChildByName: () => top }) },
deferHomePopupWhileTransfer: () => false,
refreshHomeActivityEntryLayout() {}, refreshJungleTreasureHomeRedDot() {},
requestJungleTreasureData() { requests++; this.refreshJungleTreasureHomeButton([0]); },
});
home.initializeJungleTreasureEntryFromLogin();
const jungle = top.getChildByName('jungle'), context = `${group}, cleared ${level}`;
assert.equal(requests, 1, `${context}: activity loaded`);
assert.equal(jungle.active, true, `${context}: visible`);
assert.equal(jungle.getChildByName('mask').active, false, `${context}: unlocked`);
assert.equal(jungle.getComponent(cc.Button).interactable, true, `${context}: clickable`);
for (const name of ['time', 'timeBg']) assert.equal(jungle.getChildByName(name).active, true);
home.refreshJungleTreasureHomeButton([2]);
assert.equal(jungle.active, false, `${context}: completed activity hidden`);
}
}
});
test('displaying a locked Jungle entry does not request or start the activity', () => {
const c = config(20), cc = runtime(c);
c.getJungleTreasureUnlockLevel = () => 40;