更新游戏到1980关,新增添加我的小程序和添加到桌面的埋点
This commit is contained in:
parent
480d1af18b
commit
c44064852d
|
|
@ -282,12 +282,12 @@ export default class MapConroler extends cc.Component {
|
|||
// 7. 获取城市排行榜数据
|
||||
// ============================================
|
||||
onLoad() {
|
||||
this.initBottomLayout();
|
||||
// 测试开关开启时,每次进关都从十连胜开始。
|
||||
if (cc.fx.GameConfig.forceRainbowWinStreakB) {
|
||||
cc.fx.GameConfig.GM_INFO.winStreak = 10;
|
||||
cc.fx.GameConfig.GM_INFO.winState = true;
|
||||
}
|
||||
this.initBottomLayout();
|
||||
this.winDisposed = false;
|
||||
this.winLoading = false;
|
||||
this.winLoadCallbacks = [];
|
||||
|
|
@ -434,7 +434,11 @@ export default class MapConroler extends cc.Component {
|
|||
const bottleBg = bottom.getChildByName("rainbowBg");
|
||||
// 彩虹水量仍由十连胜奖励初始化时显示,A/C 连瓶子背景也隐藏。
|
||||
if (bottle) bottle.active = false;
|
||||
if (bottleBg) bottleBg.active = rainbowVariant;
|
||||
if (bottleBg) {
|
||||
bottleBg.active = rainbowVariant;
|
||||
const sprite = bottleBg.getComponent(cc.Sprite);
|
||||
if (sprite) sprite.setState(cc.fx.GameConfig.isRainbowRewardActive() ? cc.Sprite.State.NORMAL : cc.Sprite.State.GRAY);
|
||||
}
|
||||
|
||||
if (!rainbowVariant) {
|
||||
const slots = [
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ export class GameConfig {
|
|||
vibrateOpen: true, //震动
|
||||
coinnum: 0, //每局的金币数
|
||||
paid_user: false, //是否是付费用户
|
||||
version: "1.0.60", //版本号
|
||||
version: "1.0.62", //版本号
|
||||
shushu_DistinctId: "", //数数访客ID
|
||||
shushu_AccountId: "", //数数账号ID
|
||||
uid: "", //用户和后端唯一id
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
//@ts-ignore
|
||||
//最大工具类 各种公共方法,以及处理上传,获取后端接口数据
|
||||
var GameTool = {
|
||||
MAX_NORMAL_LEVEL: 1960,
|
||||
MAX_NORMAL_LEVEL: 1980,
|
||||
starterPackReactivationUid: "",
|
||||
starterPackQueuedReason: "",
|
||||
MEMORY_WARNING_EVENT: "game-memory-warning",
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ function inflate(data, id) {
|
|||
if (raw._trs) node.setPosition(raw._trs.array[0], raw._trs.array[1]);
|
||||
for (const ref of raw._components || []) {
|
||||
const component = data[ref.__id__];
|
||||
node.components[component.__type__] = { ...component, updateAlignment() {} };
|
||||
node.components[component.__type__] = { ...component, updateAlignment() {}, setState() {} };
|
||||
}
|
||||
for (const ref of raw._children || []) inflate(data, ref.__id__).parent = node;
|
||||
return node;
|
||||
|
|
@ -84,7 +84,7 @@ function fixture(level, group = 'A') {
|
|||
const info = { level: level - 1, otherLevel: 0, hammerAmount: 3, freezeAmount: 3, magicAmount: 3,
|
||||
tasks: { useProp: { value: 0, target: 0 } } };
|
||||
info.abTestAssignments = { layer_1: { name: 'new1_50', group } };
|
||||
const cc = { Node, Button: 'cc.Button', Widget: 'cc.Widget', Sprite: 'cc.Sprite',
|
||||
const cc = { Node, Button: 'cc.Button', Widget: 'cc.Widget', Sprite: { toString: () => 'cc.Sprite', State: { NORMAL: 0, GRAY: 1 } },
|
||||
v2: (x = 0, y = 0) => ({ x, y }),
|
||||
find: (path, node) => path.split('/').reduce((parent, name) => parent.getChildByName(name), node),
|
||||
Component: { EventHandler: class {} }, js: { getClassName: () => 'MapConroler' },
|
||||
|
|
@ -165,6 +165,7 @@ for (const group of [1, 2, 3]) {
|
|||
const { cc, map, gameNode } = fixture(level);
|
||||
cc.fx.GameConfig.GM_INFO.abTests = { layer_two: group };
|
||||
cc.fx.GameConfig.isRainbowWinStreak = loadClass('assets/Script/module/Config/GameConfig.ts', ['isRainbowWinStreak'], {}).isRainbowWinStreak;
|
||||
cc.fx.GameConfig.isRainbowRewardActive = loadClass('assets/Script/module/Config/GameConfig.ts', ['isRainbowRewardActive'], {}).isRainbowRewardActive;
|
||||
const Layout = loadClass('assets/Script/Map.ts', ['initBottomLayout'], { cc });
|
||||
Layout.prototype.initBottomLayout.call(map);
|
||||
const mainBottom = gameNode.getChildByName('Bottom');
|
||||
|
|
|
|||
|
|
@ -221,7 +221,11 @@ class Node {
|
|||
convertToNodeSpaceAR(p) { return p.clone(); }
|
||||
convertToWorldSpaceAR(p) { return p.clone(); }
|
||||
}
|
||||
class Sprite { constructor() { this.fillRange = 1; } }
|
||||
class Sprite {
|
||||
constructor() { this.fillRange = 1; }
|
||||
setState(state) { this.state = state; }
|
||||
}
|
||||
Sprite.State = { NORMAL: 0, GRAY: 1 };
|
||||
Sprite.SizeMode = { CUSTOM: 0 };
|
||||
class Texture2D {
|
||||
initWithData(pixels, format, width, height) { Object.assign(this, { pixels, format, width, height }); }
|
||||
|
|
@ -832,13 +836,16 @@ for (const [variant, group, forced] of [['A', 1, false], ['B', 2, false], ['C',
|
|||
}
|
||||
const gameNode = copyNode(scene.find(o => o._name === 'GameNode'));
|
||||
const bottom = gameNode.getChildByName('Bottom');
|
||||
const bottleSprite = bottom.getChildByName('rainbowBg').addComponent(Sprite);
|
||||
const find = (path, root) => path.split('/').reduce((node, name) => node.getChildByName(name), root);
|
||||
const before = Object.fromEntries(bottom.children.map(node => [node.name, { x: node.x, y: node.y, active: node.active }]));
|
||||
const config = {
|
||||
GM_INFO: { abTests: { layer_two: group } }, forceRainbowWinStreakB: forced,
|
||||
isRainbowWinStreak: method('assets/Script/module/Config/GameConfig.ts', 'isRainbowWinStreak'),
|
||||
isRainbowRewardActive: method('assets/Script/module/Config/GameConfig.ts', 'isRainbowRewardActive'),
|
||||
isWinStreakUnlocked: () => true,
|
||||
};
|
||||
const layout = method(mapFile, 'initBottomLayout', { cc: { fx: { GameConfig: config }, find } });
|
||||
const layout = method(mapFile, 'initBottomLayout', { cc: { fx: { GameConfig: config }, find, Sprite } });
|
||||
const map = { node: gameNode.getChildByName('Map') };
|
||||
layout.call(map);
|
||||
const rainbow = group === 2 || forced;
|
||||
|
|
@ -868,10 +875,13 @@ for (const [variant, group, forced] of [['A', 1, false], ['B', 2, false], ['C',
|
|||
}
|
||||
assert.equal(bottom.getChildByName('rainbow').active, false, 'water waits for eligible reward');
|
||||
assert.equal(bottom.getChildByName('rainbowBg').active, rainbow);
|
||||
assert.equal(bottleSprite.state, Sprite.State.GRAY);
|
||||
const cancel = find('Mask/bottom/destroyBtn', gameNode);
|
||||
assert.deepEqual(plain(cancel.position), plain(bottom.getChildByName('destroyBtn').position));
|
||||
const after = bottom.children.map(node => [node.x, node.y]);
|
||||
config.GM_INFO.winStreak = 10;
|
||||
layout.call(map);
|
||||
assert.equal(bottleSprite.state, rainbow ? Sprite.State.NORMAL : Sprite.State.GRAY);
|
||||
assert.deepEqual(bottom.children.map(node => [node.x, node.y]), after, 'reinitialization must not drift');
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user