更新商城最新版本支付,并且优化弹窗奖励和部分UI

This commit is contained in:
COMPUTER\EDY 2026-09-30 10:10:34 +08:00
parent 50f024c969
commit 4fc9298686
27 changed files with 6851 additions and 5859 deletions

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "dd78e1cd-c2d5-44cf-8baf-af49ae0a8c47",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -982,8 +982,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 93,
"height": 104
"width": 78,
"height": 94
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -994,8 +994,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
167,
47,
176.908,
72.76,
0,
0,
0,
@ -11950,7 +11950,7 @@
"__id__": 251
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 254
@ -12029,8 +12029,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 403,
"height": 94
"width": 566,
"height": 155
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -12126,8 +12126,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 50.49,
"height": 56.4
"width": 94.98,
"height": 106.8
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -12138,8 +12138,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
20,
20,
30.88,
45.332,
0,
0,
0,
@ -12180,8 +12180,8 @@
"_dstBlendFactor": 771,
"_string": "10",
"_N$string": "10",
"_fontSize": 40,
"_lineHeight": 40,
"_fontSize": 80,
"_lineHeight": 80,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
@ -12189,8 +12189,8 @@
"_batchAsBitmap": false,
"_styleFlags": 1,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 1,
@ -12206,7 +12206,7 @@
"_enabled": true,
"_color": {
"__type__": "cc.Color",
"r": 0,
"r": 255,
"g": 0,
"b": 0,
"a": 255

View File

@ -223,8 +223,7 @@ export default class CloudRiseView extends cc.Component {
if (!item && !CloudRiseService.unseenResult()) return;
}
this.overlay = cc.instantiate(prefab);
// Settings and other dynamic popups use MAX_ZINDEX - 2; settlement must cover them.
this.host.addChild(this.overlay); this.overlay.zIndex = cc.macro.MAX_ZINDEX - 1;
this.host.addChild(this.overlay); this.overlay.zIndex = 99;
this.panel = this.overlay.getComponent("CloudRisePanel");
}
await this.panel.preparePage(item ? "elimination" : "result", item && item.after.stage);
@ -287,7 +286,7 @@ export default class CloudRiseView extends cc.Component {
if (!cc.isValid(this.node, true) || !canOpen()) return;
if (locked()) return;
this.overlay = cc.instantiate(prefab);
this.host.addChild(this.overlay); this.overlay.zIndex = cc.macro.MAX_ZINDEX - 1;
this.host.addChild(this.overlay); this.overlay.zIndex = 99;
this.panel = this.overlay.getComponent("CloudRisePanel");
await this.panel.preparePage(pageMode);
if (!cc.isValid(this.node, true)) return;

View File

@ -618,6 +618,39 @@ export default class NumberToImage extends cc.Component {
}
}
static durationToImageNodes(seconds: number, targetNode: cc.Node) {
const totalMinutes = Math.max(0, Math.floor(seconds / 60));
const hours = Math.floor(totalMinutes / 60);
const minutes = totalMinutes % 60;
const frameNames: string[] = [];
const append = (value: number, unit: string) => {
for (const digit of String(value)) frameNames.push("big_" + digit);
frameNames.push(unit);
};
if (hours > 0) append(hours, "big_xiaoshi");
if (minutes > 0 || hours === 0) append(minutes, "big_fenzhong");
targetNode.removeAllChildren();
const glyphs: cc.Node[] = [];
const spacing = 2;
let totalWidth = 0;
for (const frameName of frameNames) {
const glyph = new cc.Node(frameName);
const sprite = glyph.addComponent(cc.Sprite);
sprite.sizeMode = cc.Sprite.SizeMode.TRIMMED;
sprite.spriteFrame = this.publicFont._spriteFrames[frameName];
targetNode.addChild(glyph);
glyphs.push(glyph);
totalWidth += glyph.width;
}
totalWidth += spacing * (glyphs.length - 1);
let x = -totalWidth / 2;
for (const glyph of glyphs) {
glyph.x = x + glyph.width / 2;
x += glyph.width + spacing;
}
}
static numberToImageNodesPublic(UI, number, width, posX, name, targetNode: cc.Node, middle: boolean = false) {
const numStr = number.toString();
let cha = 0;

View File

@ -139,14 +139,21 @@ export default class Reward extends cc.Component {
if (rewardData.type == 'coin')
NumberToImage.numberToImageNodesNumber(rewardData.count, 45, 5, "big_", label, true);
else if (rewardData.type == 'infinite_health') {
NumberToImage.getTimeMargin2(rewardData.count, 45, "coins", label, true);
if (rewardData.count > 3600) label.x -= 10;
NumberToImage.durationToImageNodes(rewardData.count, label);
label.x = 0;
rewardNode.getChildByName('xnode').opacity = 1;
}
else {
NumberToImage.numberToImageNodesNumber(rewardData.count, 50, 15, "big_", label, true);
rewardNode.getChildByName('xnode').opacity = 0;
const xnode = rewardNode.getChildByName('xnode');
xnode.opacity = 0;
label.x += 20;
if (rewardData.count >= 10 && rewardData.type != 'pass_key') {
const firstDigit = label.children[0];
const digitLeft = label.x + (firstDigit.x - firstDigit.width * firstDigit.anchorX) * label.scaleX;
const plusRight = xnode.x + xnode.width * (1 - xnode.anchorX) * xnode.scaleX;
label.x += Math.max(0, plusRight + 6 - digitLeft);
}
}
if (data[index].type == 'pass_key') {
const firstDigit = label.children[0];
@ -165,9 +172,6 @@ export default class Reward extends cc.Component {
rewardNode.getChildByName('label').active = true;
if (rewardNode.getChildByName('xnode').opacity == 1) {
rewardNode.getChildByName('xnode').opacity = 0;
let name = "icon1";
if (rewardNode.getChildByName('label').children.length > 4) name = "icon2";
iconNode.getChildByName('infinite_health').getChildByName(name).active = true;
}
else if (rewardNode.getChildByName('xnode').opacity != 255) {
rewardNode.getChildByName('xnode').active = true;

View File

@ -2,6 +2,9 @@ import NumberToImage from "./NumberToImage";
import JiaZai from "./JiaZai";
import { MiniGameSdk } from "./Sdk/MiniGameSdk";
const HEALTH_REFILL_PRICES = [1000, 2000, 4000, 8000];
const HEALTH_REFILL_STORAGE_PREFIX = "home_health_refill_";
const { ccclass, property } = cc._decorator;
@ -38,8 +41,41 @@ export default class NewClass extends cc.Component {
//打开商店界面
openPop() {
// console.log("打开heath弹窗", cc.fx.GameConfig.GM_INFO.hp);
NumberToImage.numberToImageNodes(this.getHealthRefillPrice(), 35, 15, "button_", this.coin, true);
}
//NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 30, 15, "tili_x_", this.coin, true);
private getTodayKey(): string {
const now = new Date();
const month = (now.getMonth() + 1).toString().padStart(2, "0");
const day = now.getDate().toString().padStart(2, "0");
return `${now.getFullYear()}-${month}-${day}`;
}
private getHealthRefillStorageKey(): string {
const uid = cc.fx.GameConfig.GM_INFO.uid || "guest";
return HEALTH_REFILL_STORAGE_PREFIX + uid;
}
private getHealthRefillRecord(): { date: string, count: number } {
const today = this.getTodayKey();
const saved = cc.fx.StorageMessage.getStorage(this.getHealthRefillStorageKey());
if (!saved || saved.date !== today) {
return { date: today, count: 0 };
}
const count = Math.max(0, Math.floor(Number(saved.count) || 0));
return { date: today, count };
}
private getHealthRefillPrice(count: number = this.getHealthRefillRecord().count): number {
return HEALTH_REFILL_PRICES[Math.min(count, HEALTH_REFILL_PRICES.length - 1)];
}
private recordHealthRefill(record: { date: string, count: number }) {
cc.fx.StorageMessage.setStorage(this.getHealthRefillStorageKey(), {
date: record.date,
count: record.count + 1
});
}
startGame() {
// 获取场景中的 JiaZai 组件
@ -67,17 +103,20 @@ export default class NewClass extends cc.Component {
let curHeath = cc.fx.GameConfig.GM_INFO.hp;
//获取当前金币
let curCoin = cc.fx.GameConfig.GM_INFO.coin;
if (curCoin >= 1000) {
const refillRecord = this.getHealthRefillRecord();
const refillPrice = this.getHealthRefillPrice(refillRecord.count);
if (curCoin >= refillPrice) {
this.switchButtons[1].active = false;
cc.fx.GameTool.changeCoin(-1000);
cc.fx.GameTool.changeCoin(-refillPrice);
const data = {
change_reason: "首页购买体力",
id: (1001 + ""),
num: -1000
num: -refillPrice
}
cc.fx.GameTool.shushu_Track("resource_cost", data);
cc.fx.GameConfig.GM_INFO.hp = cc.fx.GameConfig.GM_INFO.hp_Max;
cc.fx.GameConfig.GM_INFO.min_Time = 0;
this.recordHealthRefill(refillRecord);
const parentNode = cc.find("Canvas"); // 假设 JiaZai 挂在 Canvas 节点
if (parentNode) {
const jiazaiComp = parentNode.getComponent(JiaZai);
@ -93,7 +132,7 @@ export default class NewClass extends cc.Component {
const buyData = {
item_id: "refill_health",
item_num: 3,
item_price: 1000,
item_price: refillPrice,
cost_type: "gold"
}
// console.log("____________即将上传Shop_buy", buyData);

View File

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

View File

@ -10,8 +10,8 @@ export default class Utils {
static outTradeNo: string = "";
// static httpip: string = `https://laf.nika4games.com/`; //五彩消消乐
static httpip: string = `https://q6rvwvtnga.sealoshzh.site/`; //消消王者
static testHttpip: string = `https://sor779u2w8.sealoshzh.site/`; //测试服务器
// static testHttpip: string = `https://q6rvwvtnga.sealoshzh.site/`; //消消王者测试服暂替
// static testHttpip: string = `https://sor779u2w8.sealoshzh.site/`; //测试服务器
static testHttpip: string = `https://q6rvwvtnga.sealoshzh.site/`; //消消王者测试服暂替
//#region 安卓支付
/**获取用户信息*/
static getUserInfo(callBack, from?: string) {

View File

@ -1030,14 +1030,16 @@ var GameTool = {
if (doubleKey && doubleInfo && doubleInfo[doubleKey] === false) {
coin *= 2;
doubleInfo[doubleKey] = true;
Utils.setShopDouble(() => {}, doubleInfo);
Utils.setShopDouble(() => { }, doubleInfo);
MiniGameSdk.API.showToast("充值成功,获得双倍金币");
}
this.changeCoin(coin);
rewardData = [{ type: "coin", count: coin }];
if (newProduct.hammer) {
this.getShopProp({ hammer: newProduct.hammer, freeze: newProduct.freeze,
magic_wand: newProduct.magic, price }, compensate);
this.getShopProp({
hammer: newProduct.hammer, freeze: newProduct.freeze,
magic_wand: newProduct.magic, price
}, compensate);
rewardData.push({ type: "hammer", count: newProduct.hammer },
{ type: "freeze", count: newProduct.freeze }, { type: "magic", count: newProduct.magic });
}
@ -1928,9 +1930,6 @@ var GameTool = {
const home = canvas && canvas.getComponent(JiaZai);
if (home) {
home.onStarterPackReactivated();
} else {
const scene = canvas && canvas.getComponent(SceneManager);
if (scene) scene.openStarterPack();
}
});
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -24,10 +24,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 403,
"height": 94,
"rawWidth": 403,
"rawHeight": 94,
"width": 566,
"height": 155,
"rawWidth": 566,
"rawHeight": 155,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -24,10 +24,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 93,
"height": 104,
"rawWidth": 93,
"rawHeight": 104,
"width": 78,
"height": 94,
"rawWidth": 78,
"rawHeight": 94,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "39ea0f59-ba7a-472f-a668-63d3f45ff918",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "fd98e25e-0cbd-4142-a7b7-d7eb08d19e33",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "f51fad62-0a04-4667-a925-76ddd000be03",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "c0a6ec69-38a9-42fa-8418-beb64b0d84cc",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -58,8 +58,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
540,
960,
0,
0,
0,
@ -577,8 +577,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 282,
"height": 250
"width": 300,
"height": 209
},
"_anchorPoint": {
"__type__": "cc.Vec2",

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "7f05c607-dd28-4357-a9f5-ce471876a0f0",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -19,22 +19,25 @@
"_children": [
{
"__id__": 2
},
{
"__id__": 6
}
],
"_active": true,
"_components": [
{
"__id__": 6
"__id__": 9
},
{
"__id__": 7
"__id__": 10
},
{
"__id__": 8
"__id__": 11
}
],
"_prefab": {
"__id__": 9
"__id__": 12
},
"_opacity": 255,
"_color": {
@ -220,6 +223,113 @@
"fileId": "bcCjyvB1tKmZrkzvzwccI3",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Sprite",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
}
],
"_prefab": {
"__id__": 8
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 564,
"height": 179
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
647.922,
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__": 6
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b3eec6d8-eb45-4a1e-ba18-2f55751f9d6c"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_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": "fdqYBLBnhNe7QffbrKMY/k",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",

View File

@ -740,8 +740,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 290,
"height": 246
"width": 203,
"height": 172.2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -804,8 +804,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 56
"width": 16,
"height": 46
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -917,8 +917,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 56
"width": 16,
"height": 46
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -981,8 +981,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 56
"width": 16,
"height": 46
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@ -1127,7 +1127,7 @@
"__uuid__": "419e6dd8-8ab5-4910-bf94-b82afe18191b"
},
"_type": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",

13
assets/res/shop.meta Normal file
View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "135c72a2-cfe9-4c42-a3d8-b4ac04a5da4f",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -8,8 +8,8 @@
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1522,
"height": 2042,
"width": 2046,
"height": 1531,
"platformSettings": {},
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.3",
"uuid": "aa573fb9-de70-4287-90f2-59aa3b3033bd",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}