优化更新弹窗奖励窗口数字
This commit is contained in:
parent
6a4990bb35
commit
ad047b618a
|
|
@ -193,6 +193,9 @@
|
|||
"fontPassCheck": {
|
||||
"__uuid__": "4ed6cebc-e4de-4fe9-9f9b-502ecfa21a7b"
|
||||
},
|
||||
"publicFont": {
|
||||
"__uuid__": "48e7a52f-b3c2-4b03-9786-d8d6615850b8"
|
||||
},
|
||||
"_id": "c3AiXtGJZFdrghEYzCHK0O"
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,11 +25,15 @@ export default class NumberToImage extends cc.Component {
|
|||
@property(cc.SpriteAtlas)
|
||||
fontPassCheck: cc.SpriteAtlas = null;
|
||||
|
||||
@property(cc.SpriteAtlas)
|
||||
publicFont: cc.SpriteAtlas = null;
|
||||
|
||||
static font: any = null;
|
||||
static font2: any = null;
|
||||
static font3: any = null;
|
||||
static font4: any = null;
|
||||
static fontPassCheck: any = null;
|
||||
static publicFont: any = null;
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
onLoad() {
|
||||
|
|
@ -38,6 +42,8 @@ export default class NumberToImage extends cc.Component {
|
|||
NumberToImage.font2 = this.fontUI2;
|
||||
NumberToImage.font3 = this.fontUI3;
|
||||
NumberToImage.font4 = this.fontUI4;
|
||||
NumberToImage.publicFont = this.publicFont;
|
||||
|
||||
NumberToImage.fontPassCheck = this.fontPassCheck;
|
||||
}
|
||||
}
|
||||
|
|
@ -327,6 +333,50 @@ export default class NumberToImage extends cc.Component {
|
|||
|
||||
}
|
||||
|
||||
|
||||
static numberToImageNodesNumber(number, width, posX, name, targetNode: cc.Node, middle: boolean = false) {
|
||||
const numStr = number.toString();
|
||||
let cha = 0;
|
||||
if (number > 99) cha = -posX
|
||||
else if (number < 10) cha = posX
|
||||
if (targetNode) {
|
||||
if (targetNode.children) {
|
||||
if (targetNode.children.length > 0)
|
||||
targetNode.removeAllChildren();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const digitNodes: cc.Node[] = [];
|
||||
for (let i = 0; i < numStr.length; i++) {
|
||||
const digit = parseInt(numStr[i], 10);
|
||||
const node = new cc.Node();
|
||||
const sprite = node.addComponent(cc.Sprite);
|
||||
sprite.spriteFrame = this.publicFont._spriteFrames[name + digit + ""];
|
||||
digitNodes.push(node);
|
||||
}
|
||||
|
||||
// 计算总宽度
|
||||
const totalWidth = (numStr.length - 1) * width + (digitNodes[0]?.width || 0);
|
||||
|
||||
if (middle) {
|
||||
// 计算居中的起始位置
|
||||
const startX = -totalWidth / 2;
|
||||
for (let i = 0; i < digitNodes.length; i++) {
|
||||
const node = digitNodes[i];
|
||||
node.x = startX + i * width;
|
||||
if (targetNode) node.parent = targetNode;
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < digitNodes.length; i++) {
|
||||
const node = digitNodes[i];
|
||||
node.x = i * width + cha;
|
||||
if (targetNode) node.parent = targetNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static numberToImageNodesShop(number, width, posX, name, targetNode: cc.Node, middle: boolean = false) {
|
||||
const numStr = number.toString();
|
||||
let cha = 0;
|
||||
|
|
|
|||
|
|
@ -137,14 +137,14 @@ export default class Reward extends cc.Component {
|
|||
}
|
||||
let label = rewardNode.getChildByName('label')
|
||||
if (rewardData.type == 'coin')
|
||||
NumberToImage.numberToImageNodes(rewardData.count, 45, 5, "coins", label, true);
|
||||
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;
|
||||
rewardNode.getChildByName('xnode').opacity = 1;
|
||||
}
|
||||
else {
|
||||
NumberToImage.numberToImageNodes(rewardData.count, 50, 15, "coins", label, true);
|
||||
NumberToImage.numberToImageNodesNumber(rewardData.count, 50, 15, "big_", label, true);
|
||||
rewardNode.getChildByName('xnode').opacity = 0;
|
||||
label.x += 20;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ export class GameConfig {
|
|||
vibrateOpen: true, //震动
|
||||
coinnum: 0, //每局的金币数
|
||||
paid_user: false, //是否是付费用户
|
||||
version: "1.0.70", //版本号
|
||||
version: "1.0.71", //版本号
|
||||
shushu_DistinctId: "", //数数访客ID
|
||||
shushu_AccountId: "", //数数账号ID
|
||||
uid: "", //用户和后端唯一id
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 782,
|
||||
"height": 1024,
|
||||
"width": 993,
|
||||
"height": 814,
|
||||
"platformSettings": {
|
||||
"minigame": {
|
||||
"formats": []
|
||||
|
|
|
|||
|
|
@ -742,8 +742,8 @@
|
|||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 139,
|
||||
"height": 122
|
||||
"width": 290,
|
||||
"height": 246
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
|
@ -1297,15 +1297,15 @@
|
|||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
20,
|
||||
23.272,
|
||||
-121.815,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0.8,
|
||||
0.8,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
|
|
@ -1360,8 +1360,8 @@
|
|||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 43,
|
||||
"height": 49
|
||||
"width": 36,
|
||||
"height": 34
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
|
|
@ -1379,8 +1379,8 @@
|
|||
0,
|
||||
0,
|
||||
1,
|
||||
0.8,
|
||||
0.8,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
|
|
@ -1413,7 +1413,7 @@
|
|||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "ee1f756f-b070-44b1-a415-4809b2634490"
|
||||
"__uuid__": "fafa9ef2-f250-47c7-b198-49971d3a380d"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
|
|
@ -1427,7 +1427,7 @@
|
|||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": {
|
||||
"__uuid__": "fa9a438e-1f24-47fe-bbcd-b75abcff2ea8"
|
||||
"__uuid__": "48e7a52f-b3c2-4b03-9786-d8d6615850b8"
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user