Commit 63a78773 authored by 范雪寒's avatar 范雪寒

feat: 荷叶位置随屏幕适配

parent b92949cb
......@@ -17,10 +17,10 @@
"__id__": 2
},
{
"__id__": 85
"__id__": 84
},
{
"__id__": 96
"__id__": 95
}
],
"_active": true,
......@@ -96,13 +96,13 @@
"_active": true,
"_components": [
{
"__id__": 82
"__id__": 81
},
{
"__id__": 83
"__id__": 82
},
{
"__id__": 84
"__id__": 83
}
],
"_prefab": null,
......@@ -1066,7 +1066,7 @@
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 41,
"_alignFlags": 17,
"_left": 340.5,
"_right": 340.5,
"_top": -200,
......@@ -2463,14 +2463,10 @@
"__id__": 79
}
],
"_active": false,
"_components": [
{
"__id__": 81
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_opacity": 0,
"_color": {
"__type__": "cc.Color",
"r": 255,
......@@ -3833,33 +3829,6 @@
"_atlas": null,
"_id": "5ctIMxaJpCPqDnXZ5q9xOm"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 52
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "10zhMcFZhLa5A3dmjvWI0q"
},
{
"__type__": "cc.Canvas",
"_name": "",
......@@ -3923,19 +3892,19 @@
},
"_children": [
{
"__id__": 86
"__id__": 85
},
{
"__id__": 88
"__id__": 87
},
{
"__id__": 89
"__id__": 88
}
],
"_active": true,
"_components": [
{
"__id__": 95
"__id__": 94
}
],
"_prefab": null,
......@@ -3991,13 +3960,13 @@
"_name": "OptionBg",
"_objFlags": 0,
"_parent": {
"__id__": 85
"__id__": 84
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 87
"__id__": 86
}
],
"_prefab": null,
......@@ -4053,7 +4022,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
"__id__": 85
},
"_enabled": true,
"_materials": [
......@@ -4085,7 +4054,7 @@
"_name": "OptionDragonBoneBaseNode",
"_objFlags": 0,
"_parent": {
"__id__": 85
"__id__": 84
},
"_children": [],
"_active": true,
......@@ -4143,20 +4112,20 @@
"_name": "OptionSpeakerBtn",
"_objFlags": 0,
"_parent": {
"__id__": 85
"__id__": 84
},
"_children": [
{
"__id__": 90
"__id__": 89
},
{
"__id__": 92
"__id__": 91
}
],
"_active": true,
"_components": [
{
"__id__": 94
"__id__": 93
}
],
"_prefab": null,
......@@ -4212,13 +4181,13 @@
"_name": "BtnFlower",
"_objFlags": 0,
"_parent": {
"__id__": 89
"__id__": 88
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 91
"__id__": 90
}
],
"_prefab": null,
......@@ -4274,7 +4243,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 90
"__id__": 89
},
"_enabled": true,
"_materials": [
......@@ -4306,13 +4275,13 @@
"_name": "BtnFlower_P",
"_objFlags": 0,
"_parent": {
"__id__": 89
"__id__": 88
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 93
"__id__": 92
}
],
"_prefab": null,
......@@ -4368,7 +4337,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 92
"__id__": 91
},
"_enabled": true,
"_materials": [
......@@ -4400,7 +4369,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 89
"__id__": 88
},
"_enabled": true,
"_normalMaterial": null,
......@@ -4468,7 +4437,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 85
"__id__": 84
},
"_enabled": true,
"_normalMaterial": null,
......@@ -4540,19 +4509,19 @@
},
"_children": [
{
"__id__": 97
"__id__": 96
},
{
"__id__": 99
"__id__": 98
},
{
"__id__": 100
"__id__": 99
}
],
"_active": true,
"_components": [
{
"__id__": 106
"__id__": 105
}
],
"_prefab": null,
......@@ -4608,13 +4577,13 @@
"_name": "OptionBg",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 95
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 98
"__id__": 97
}
],
"_prefab": null,
......@@ -4670,7 +4639,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 97
"__id__": 96
},
"_enabled": true,
"_materials": [
......@@ -4702,7 +4671,7 @@
"_name": "OptionDragonBoneBaseNode",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 95
},
"_children": [],
"_active": true,
......@@ -4760,20 +4729,20 @@
"_name": "OptionSpeakerBtn",
"_objFlags": 0,
"_parent": {
"__id__": 96
"__id__": 95
},
"_children": [
{
"__id__": 101
"__id__": 100
},
{
"__id__": 103
"__id__": 102
}
],
"_active": true,
"_components": [
{
"__id__": 105
"__id__": 104
}
],
"_prefab": null,
......@@ -4829,13 +4798,13 @@
"_name": "BtnFlower",
"_objFlags": 0,
"_parent": {
"__id__": 100
"__id__": 99
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 102
"__id__": 101
}
],
"_prefab": null,
......@@ -4891,7 +4860,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 101
"__id__": 100
},
"_enabled": true,
"_materials": [
......@@ -4923,13 +4892,13 @@
"_name": "BtnFlower_P",
"_objFlags": 0,
"_parent": {
"__id__": 100
"__id__": 99
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 104
"__id__": 103
}
],
"_prefab": null,
......@@ -4985,7 +4954,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 103
"__id__": 102
},
"_enabled": true,
"_materials": [
......@@ -5017,7 +4986,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 100
"__id__": 99
},
"_enabled": true,
"_normalMaterial": null,
......@@ -5085,7 +5054,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 96
"__id__": 95
},
"_enabled": true,
"_normalMaterial": null,
......
......@@ -106,6 +106,12 @@ cc.Class({
initNodes() {
const tittleLabelNode = cc.find('Canvas/bgFrount/leef/TittleLabelNode');
tittleLabelNode.getComponent(cc.Label).string = this.data.tittleTxt;
const canvas = cc.find('Canvas');
const optionPosListBase = cc.find('Canvas/OptionPosListBase');
optionPosListBase.scaleX = canvas.width / optionPosListBase.width;
optionPosListBase.scaleY = canvas.height / optionPosListBase.height;
},
initListeners() {
......@@ -176,8 +182,12 @@ cc.Class({
this.onOptionClicked(optionNode, idx);
});
const optionPosListBase = cc.find('Canvas/OptionPosListBase');
optionNode.scaleX = Math.min(optionPosListBase.scaleX, optionPosListBase.scaleY, 1);
optionNode.scaleY = Math.min(optionPosListBase.scaleX, optionPosListBase.scaleY, 1);
const posNode = cc.find(`Canvas/OptionPosListBase/Option_${optionList.length}_${idx}`)
optionNode.x = posNode.x;
optionNode.x = posNode.x * optionPosListBase.scaleX;
optionNode.y = posNode.y;
const animeNode = await asyncLoadDragonBoneAnime(cc.find('OptionDragonBoneBaseNode', optionNode), data.optionDragonBone);
......@@ -193,7 +203,7 @@ cc.Class({
addButtonListener(cc.find('OptionSpeakerBtn', optionNode), async () => {
blinkNode(optionNode, btnFlowerP, btnFlower);
await asyncPlayEffectByUrl(data.optionAudio);
// asyncPlayDragonBoneAnimation(animeNode, 'smoke', 1);
asyncPlayDragonBoneAnimation(animeNode, 'normal', 1);
stopBlinkNode(optionNode, btnFlowerP, btnFlower);
......
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