Merge branch 'main' into new_shop
# Conflicts: # assets/res/shop.meta
This commit is contained in:
commit
8b0510e7ef
|
|
@ -193,6 +193,9 @@
|
||||||
"fontPassCheck": {
|
"fontPassCheck": {
|
||||||
"__uuid__": "4ed6cebc-e4de-4fe9-9f9b-502ecfa21a7b"
|
"__uuid__": "4ed6cebc-e4de-4fe9-9f9b-502ecfa21a7b"
|
||||||
},
|
},
|
||||||
|
"publicFont": {
|
||||||
|
"__uuid__": "48e7a52f-b3c2-4b03-9786-d8d6615850b8"
|
||||||
|
},
|
||||||
"_id": "c3AiXtGJZFdrghEYzCHK0O"
|
"_id": "c3AiXtGJZFdrghEYzCHK0O"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,15 @@ export default class NumberToImage extends cc.Component {
|
||||||
@property(cc.SpriteAtlas)
|
@property(cc.SpriteAtlas)
|
||||||
fontPassCheck: cc.SpriteAtlas = null;
|
fontPassCheck: cc.SpriteAtlas = null;
|
||||||
|
|
||||||
|
@property(cc.SpriteAtlas)
|
||||||
|
publicFont: cc.SpriteAtlas = null;
|
||||||
|
|
||||||
static font: any = null;
|
static font: any = null;
|
||||||
static font2: any = null;
|
static font2: any = null;
|
||||||
static font3: any = null;
|
static font3: any = null;
|
||||||
static font4: any = null;
|
static font4: any = null;
|
||||||
static fontPassCheck: any = null;
|
static fontPassCheck: any = null;
|
||||||
|
static publicFont: any = null;
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
@ -38,6 +42,8 @@ export default class NumberToImage extends cc.Component {
|
||||||
NumberToImage.font2 = this.fontUI2;
|
NumberToImage.font2 = this.fontUI2;
|
||||||
NumberToImage.font3 = this.fontUI3;
|
NumberToImage.font3 = this.fontUI3;
|
||||||
NumberToImage.font4 = this.fontUI4;
|
NumberToImage.font4 = this.fontUI4;
|
||||||
|
NumberToImage.publicFont = this.publicFont;
|
||||||
|
|
||||||
NumberToImage.fontPassCheck = this.fontPassCheck;
|
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) {
|
static numberToImageNodesShop(number, width, posX, name, targetNode: cc.Node, middle: boolean = false) {
|
||||||
const numStr = number.toString();
|
const numStr = number.toString();
|
||||||
let cha = 0;
|
let cha = 0;
|
||||||
|
|
|
||||||
|
|
@ -137,14 +137,14 @@ export default class Reward extends cc.Component {
|
||||||
}
|
}
|
||||||
let label = rewardNode.getChildByName('label')
|
let label = rewardNode.getChildByName('label')
|
||||||
if (rewardData.type == 'coin')
|
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') {
|
else if (rewardData.type == 'infinite_health') {
|
||||||
NumberToImage.getTimeMargin2(rewardData.count, 45, "coins", label, true);
|
NumberToImage.getTimeMargin2(rewardData.count, 45, "coins", label, true);
|
||||||
if (rewardData.count > 3600) label.x -= 10;
|
if (rewardData.count > 3600) label.x -= 10;
|
||||||
rewardNode.getChildByName('xnode').opacity = 1;
|
rewardNode.getChildByName('xnode').opacity = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NumberToImage.numberToImageNodes(rewardData.count, 50, 15, "coins", label, true);
|
NumberToImage.numberToImageNodesNumber(rewardData.count, 50, 15, "big_", label, true);
|
||||||
rewardNode.getChildByName('xnode').opacity = 0;
|
rewardNode.getChildByName('xnode').opacity = 0;
|
||||||
label.x += 20;
|
label.x += 20;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -757,7 +757,7 @@ export class GameConfig {
|
||||||
vibrateOpen: true, //震动
|
vibrateOpen: true, //震动
|
||||||
coinnum: 0, //每局的金币数
|
coinnum: 0, //每局的金币数
|
||||||
paid_user: false, //是否是付费用户
|
paid_user: false, //是否是付费用户
|
||||||
version: "1.0.70", //版本号
|
version: "1.0.71", //版本号
|
||||||
shushu_DistinctId: "", //数数访客ID
|
shushu_DistinctId: "", //数数访客ID
|
||||||
shushu_AccountId: "", //数数账号ID
|
shushu_AccountId: "", //数数账号ID
|
||||||
uid: "", //用户和后端唯一id
|
uid: "", //用户和后端唯一id
|
||||||
|
|
|
||||||
|
|
@ -740,8 +740,8 @@
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 139,
|
"width": 290,
|
||||||
"height": 122
|
"height": 246
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
|
|
@ -1293,15 +1293,15 @@
|
||||||
"__type__": "TypedArray",
|
"__type__": "TypedArray",
|
||||||
"ctor": "Float64Array",
|
"ctor": "Float64Array",
|
||||||
"array": [
|
"array": [
|
||||||
20,
|
23.272,
|
||||||
-121.815,
|
-121.815,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
0.8,
|
1,
|
||||||
0.8,
|
1,
|
||||||
1
|
1
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -1356,8 +1356,8 @@
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
"width": 43,
|
"width": 36,
|
||||||
"height": 49
|
"height": 34
|
||||||
},
|
},
|
||||||
"_anchorPoint": {
|
"_anchorPoint": {
|
||||||
"__type__": "cc.Vec2",
|
"__type__": "cc.Vec2",
|
||||||
|
|
@ -1375,8 +1375,8 @@
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
0.8,
|
1,
|
||||||
0.8,
|
1,
|
||||||
1
|
1
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -1409,7 +1409,7 @@
|
||||||
"_srcBlendFactor": 770,
|
"_srcBlendFactor": 770,
|
||||||
"_dstBlendFactor": 771,
|
"_dstBlendFactor": 771,
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "ee1f756f-b070-44b1-a415-4809b2634490"
|
"__uuid__": "fafa9ef2-f250-47c7-b198-49971d3a380d"
|
||||||
},
|
},
|
||||||
"_type": 0,
|
"_type": 0,
|
||||||
"_sizeMode": 1,
|
"_sizeMode": 1,
|
||||||
|
|
@ -1423,7 +1423,7 @@
|
||||||
"_fillRange": 0,
|
"_fillRange": 0,
|
||||||
"_isTrimmedMode": true,
|
"_isTrimmedMode": true,
|
||||||
"_atlas": {
|
"_atlas": {
|
||||||
"__uuid__": "fa9a438e-1f24-47fe-bbcd-b75abcff2ea8"
|
"__uuid__": "48e7a52f-b3c2-4b03-9786-d8d6615850b8"
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"ver": "1.1.3",
|
"ver": "1.1.3",
|
||||||
"uuid": "e0297b18-3b68-4df4-a605-5cc81d16e30d",
|
"uuid": "d0d45606-9a70-4a8b-a213-540cc0100e9d",
|
||||||
"importer": "folder",
|
"importer": "folder",
|
||||||
"isBundle": false,
|
"isBundle": false,
|
||||||
"bundleName": "",
|
"bundleName": "",
|
||||||
|
|
|
||||||
|
|
@ -4995,7 +4995,7 @@
|
||||||
"__id__": 165
|
"__id__": 165
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": false,
|
"_active": true,
|
||||||
"_components": [],
|
"_components": [],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 168
|
"__id__": 168
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user