Commit fed2ff90 authored by LMZ's avatar LMZ

feat: 文本题干大小自适应

parent b7d4d480
No preview for this file type
......@@ -29,6 +29,12 @@
"__uuid__": "7b2bd629-77ac-4fc8-9ee7-569ed0ed3a59"
}
},
{
"frame": 0.21666666666666667,
"value": {
"__uuid__": "1c70d9eb-1034-4997-a6fb-aea058d39beb"
}
},
{
"frame": 0.25,
"value": {
......
......@@ -3671,7 +3671,7 @@
},
{
"__type__": "cc.Node",
"_name": "op_audio",
"_name": "audio_big",
"_objFlags": 0,
"_parent": {
"__id__": 78
......@@ -3697,8 +3697,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 150,
"height": 121
"width": 162,
"height": 167
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -3732,7 +3732,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "13wtibWSNMQInAQ/g3MFTt"
"_id": "92NG4ZT41A4YX0tvaD/vXD"
},
{
"__type__": "cc.Sprite",
......@@ -3750,10 +3750,10 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "1c70d9eb-1034-4997-a6fb-aea058d39beb"
"__uuid__": "62f365b3-09fd-40b6-8227-f0cc48d2ca4a"
},
"_type": 0,
"_sizeMode": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -3762,9 +3762,9 @@
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": false,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "71HSIsBolFrJOK7rXouo50"
"_id": "54QmgQQcpA96m1O45r/mOe"
},
{
"__type__": "cc.Animation",
......@@ -3775,19 +3775,19 @@
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "990c93ef-ffbd-4d38-8e32-a403d2f4ff97"
"__uuid__": "0dab7b62-6bff-451d-bce3-55f0509129f9"
},
"_clips": [
{
"__uuid__": "990c93ef-ffbd-4d38-8e32-a403d2f4ff97"
"__uuid__": "0dab7b62-6bff-451d-bce3-55f0509129f9"
}
],
"playOnLoad": false,
"_id": "66vjUZXOtHXZNofJii2ngE"
"_id": "afC2aWSHZA+ofwj0Y+LxNm"
},
{
"__type__": "cc.Node",
"_name": "audio_big",
"_name": "laba",
"_objFlags": 0,
"_parent": {
"__id__": 78
......@@ -3813,8 +3813,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 162,
"height": 167
"width": 63,
"height": 68
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -3848,7 +3848,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "92NG4ZT41A4YX0tvaD/vXD"
"_id": "36jqJaPshOybRv41u1ph8l"
},
{
"__type__": "cc.Sprite",
......@@ -3866,7 +3866,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "62f365b3-09fd-40b6-8227-f0cc48d2ca4a"
"__uuid__": "07a58438-24ac-46ef-acad-275a36ecd8ab"
},
"_type": 0,
"_sizeMode": 1,
......@@ -3880,7 +3880,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "54QmgQQcpA96m1O45r/mOe"
"_id": "ccXw+b0FlH6KHYtLRHJgHS"
},
{
"__type__": "cc.Animation",
......@@ -3891,19 +3891,19 @@
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "0dab7b62-6bff-451d-bce3-55f0509129f9"
"__uuid__": "e01464cd-bf75-4d4a-8243-a4604d675fec"
},
"_clips": [
{
"__uuid__": "0dab7b62-6bff-451d-bce3-55f0509129f9"
"__uuid__": "e01464cd-bf75-4d4a-8243-a4604d675fec"
}
],
"playOnLoad": false,
"_id": "afC2aWSHZA+ofwj0Y+LxNm"
"_id": "20R/cP75NCJbIGZ9xqVfnM"
},
{
"__type__": "cc.Node",
"_name": "laba",
"_name": "ques_audio",
"_objFlags": 0,
"_parent": {
"__id__": 78
......@@ -3929,8 +3929,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 63,
"height": 68
"width": 105,
"height": 126
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -3964,7 +3964,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "36jqJaPshOybRv41u1ph8l"
"_id": "c2YU5UVV5NxY3GK4+9OodG"
},
{
"__type__": "cc.Sprite",
......@@ -3982,7 +3982,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "07a58438-24ac-46ef-acad-275a36ecd8ab"
"__uuid__": "0bf14665-ae47-49d9-8b19-1a0f3b38036e"
},
"_type": 0,
"_sizeMode": 1,
......@@ -3996,7 +3996,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "ccXw+b0FlH6KHYtLRHJgHS"
"_id": "8a3N1fGmVImZF94uHtfZDM"
},
{
"__type__": "cc.Animation",
......@@ -4007,19 +4007,19 @@
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "e01464cd-bf75-4d4a-8243-a4604d675fec"
"__uuid__": "802d460c-c4c2-4976-bbf0-14feb3750881"
},
"_clips": [
{
"__uuid__": "e01464cd-bf75-4d4a-8243-a4604d675fec"
"__uuid__": "802d460c-c4c2-4976-bbf0-14feb3750881"
}
],
"playOnLoad": false,
"_id": "20R/cP75NCJbIGZ9xqVfnM"
"_id": "ccXISv1kxHBo8gjzYkcfVt"
},
{
"__type__": "cc.Node",
"_name": "ques_audio",
"_name": "op_audio",
"_objFlags": 0,
"_parent": {
"__id__": 78
......@@ -4045,8 +4045,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 105,
"height": 126
"width": 150,
"height": 121
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -4080,7 +4080,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "c2YU5UVV5NxY3GK4+9OodG"
"_id": "13wtibWSNMQInAQ/g3MFTt"
},
{
"__type__": "cc.Sprite",
......@@ -4098,7 +4098,7 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "0bf14665-ae47-49d9-8b19-1a0f3b38036e"
"__uuid__": "1c70d9eb-1034-4997-a6fb-aea058d39beb"
},
"_type": 0,
"_sizeMode": 1,
......@@ -4112,7 +4112,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "8a3N1fGmVImZF94uHtfZDM"
"_id": "71HSIsBolFrJOK7rXouo50"
},
{
"__type__": "cc.Animation",
......@@ -4123,15 +4123,15 @@
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "802d460c-c4c2-4976-bbf0-14feb3750881"
"__uuid__": "990c93ef-ffbd-4d38-8e32-a403d2f4ff97"
},
"_clips": [
{
"__uuid__": "802d460c-c4c2-4976-bbf0-14feb3750881"
"__uuid__": "990c93ef-ffbd-4d38-8e32-a403d2f4ff97"
}
],
"playOnLoad": false,
"_id": "ccXISv1kxHBo8gjzYkcfVt"
"_id": "66vjUZXOtHXZNofJii2ngE"
},
{
"__type__": "cc.Canvas",
......
......@@ -1142,7 +1142,16 @@ cc.Class({
const label = this.curQuesBg.label;
const size = 80;
label.string = `<size=${size}><color=#fff4b6>${this.curQuestionData.text}</color></size>`
label.string = `<size=${size}><color=#fff4b6>${this.curQuestionData.text + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'}</color></size>`
const maxH = this.curQuesBg.height * 0.98;
if (label.node.height > maxH) {
label.node.scale = maxH / label.node.height
} else {
label.node.scale = 1;
}
const audioNode = this.curQuesBg.audioNode;
audioNode.active = false;
......@@ -1308,7 +1317,7 @@ cc.Class({
},
setOptionText(arr, isBig=false) {
setOptionText(options, isBig=false) {
console.log(' in setOptionText, isBig: ', isBig);
......@@ -1322,13 +1331,13 @@ cc.Class({
const disH = 120 * this._mapScaleMin;
const baseX = - disW ;
let baseY = -235 * this._mapScaleMin;
if (arr.length > 2) {
if (options.length > 2) {
baseY = -170 * this._mapScaleMin;
}
let count = 0;
for (let i=0; i<arr.length; i++) {
for (let i=0; i<options.length; i++) {
if (i == 2) {
if ( i == 2 ) {
baseY -= disH;
count = 0;
}
......@@ -1339,8 +1348,9 @@ cc.Class({
opItemArr[i].y = baseY;
}
const data = options[i];
opItemArr[i].label.string = arr[i].text;
opItemArr[i].label.string = data.text;
opItemArr[i].label["_forceUpdateRenderData"](true);
if (opItemArr[i].label.node.width > opItemArr[i].width * 0.9) {
opItemArr[i].label.node.scale = opItemArr[i].width * 0.9 / opItemArr[i].label.node.width;
......@@ -1348,7 +1358,6 @@ cc.Class({
opItemArr[i].label.node.scale = 1;
}
const data = arr[i];
const soundIcon = opItemArr[i].soundIcon;
soundIcon.active = false;
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment