提交 修改声音界面bug,界面ui细调

This commit is contained in:
computer\尼卡 2025-07-03 18:22:33 +08:00
parent dda758bc4c
commit 5514fec884
7 changed files with 105 additions and 113 deletions

View File

@ -7402,8 +7402,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-4.385, -13.529,
-62.29, -60,
0, 0,
0, 0,
0, 0,
@ -7553,7 +7553,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-103.331, -103.331,
-60.197, -60,
0, 0,
0, 0,
0, 0,
@ -7865,8 +7865,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 200, "width": 0,
"height": 200 "height": 0
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -7877,7 +7877,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
14.787, 3.388,
7.421, 7.421,
0, 0,
0, 0,
@ -7943,7 +7943,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
125.9, 125.9,
1.555, 3.914,
0, 0,
0, 0,
0, 0,
@ -15267,7 +15267,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
15.137, 15.137,
738.462, 753.348,
0, 0,
0, 0,
0, 0,

View File

@ -1268,8 +1268,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 180, "width": 188,
"height": 180 "height": 198
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -1321,7 +1321,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "e21bf9e2-2981-4ab4-8d7a-b3f339a27122" "__uuid__": "4ce61e08-eb3f-4797-86f7-d0c318f4174c"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
@ -1335,7 +1335,7 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": { "_atlas": {
"__uuid__": "d2adfa00-68ea-4d63-97a0-44fca153a2d7" "__uuid__": "52d3eb5b-948f-403a-aafa-1c8f1a40a8c8"
}, },
"_id": "9142E2UEJG1J5fb8i3cywI" "_id": "9142E2UEJG1J5fb8i3cywI"
}, },
@ -1650,7 +1650,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
147.114, 147.114,
0.31, -3,
0, 0,
0, 0,
0, 0,
@ -2346,7 +2346,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
147.114, 147.114,
0.31, -3,
0, 0,
0, 0,
0, 0,
@ -2425,8 +2425,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 200, "width": 0,
"height": 200 "height": 0
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -2437,7 +2437,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
24.546, 14.792,
1.584, 1.584,
0, 0,
0, 0,
@ -3315,8 +3315,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 200, "width": 0,
"height": 200 "height": 0
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -3327,7 +3327,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-12, -13,
13.122, 13.122,
0, 0,
0, 0,
@ -3999,7 +3999,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
409.721, 409.721,
-250.086, -290.226,
0, 0,
0, 0,
0, 0,
@ -4373,7 +4373,7 @@
"__id__": 89 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 91 "__id__": 91
@ -4654,7 +4654,7 @@
"_id": "f7UVr5raRF/5HTo3KzPhgp" "_id": "f7UVr5raRF/5HTo3KzPhgp"
}, },
{ {
"__type__": "cc.Toggle", "__type__": "cc.Button",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
@ -4665,7 +4665,11 @@
"_grayMaterial": null, "_grayMaterial": null,
"duration": 0.1, "duration": 0.1,
"zoomScale": 1.2, "zoomScale": 1.2,
"clickEvents": [], "clickEvents": [
{
"__id__": 97
}
],
"_N$interactable": true, "_N$interactable": true,
"_N$enableAutoGrayEffect": false, "_N$enableAutoGrayEffect": false,
"_N$transition": 0, "_N$transition": 0,
@ -4719,19 +4723,9 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": { "_N$target": {
"__id__": 89 "__id__": 82
}, },
"_N$isChecked": false, "_id": "79tUVBW9xFPb+dmSkpT9w2"
"toggleGroup": null,
"checkMark": {
"__id__": 93
},
"checkEvents": [
{
"__id__": 97
}
],
"_id": "c09/yHVMJDoam/VbhBXxcH"
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
@ -4823,7 +4817,7 @@
"__id__": 98 "__id__": 98
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 100 "__id__": 100
@ -5104,7 +5098,7 @@
"_id": "feBIgKuQtF5pWUBQIXgVjQ" "_id": "feBIgKuQtF5pWUBQIXgVjQ"
}, },
{ {
"__type__": "cc.Toggle", "__type__": "cc.Button",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
@ -5115,7 +5109,11 @@
"_grayMaterial": null, "_grayMaterial": null,
"duration": 0.1, "duration": 0.1,
"zoomScale": 1.2, "zoomScale": 1.2,
"clickEvents": [], "clickEvents": [
{
"__id__": 106
}
],
"_N$interactable": true, "_N$interactable": true,
"_N$enableAutoGrayEffect": false, "_N$enableAutoGrayEffect": false,
"_N$transition": 0, "_N$transition": 0,
@ -5168,20 +5166,8 @@
"_N$hoverSprite": null, "_N$hoverSprite": null,
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": { "_N$target": null,
"__id__": 98 "_id": "d85Ek7cJFJ2L0mYerW0Bdj"
},
"_N$isChecked": false,
"toggleGroup": null,
"checkMark": {
"__id__": 102
},
"checkEvents": [
{
"__id__": 106
}
],
"_id": "b9cAW4AvdAXZdGsjzb8ZZf"
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
@ -5273,7 +5259,7 @@
"__id__": 107 "__id__": 107
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 109 "__id__": 109
@ -5554,7 +5540,7 @@
"_id": "6cLP2TnU5DW7CA+QvhiObw" "_id": "6cLP2TnU5DW7CA+QvhiObw"
}, },
{ {
"__type__": "cc.Toggle", "__type__": "cc.Button",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
@ -5565,7 +5551,11 @@
"_grayMaterial": null, "_grayMaterial": null,
"duration": 0.1, "duration": 0.1,
"zoomScale": 1.2, "zoomScale": 1.2,
"clickEvents": [], "clickEvents": [
{
"__id__": 115
}
],
"_N$interactable": true, "_N$interactable": true,
"_N$enableAutoGrayEffect": false, "_N$enableAutoGrayEffect": false,
"_N$transition": 0, "_N$transition": 0,
@ -5618,20 +5608,8 @@
"_N$hoverSprite": null, "_N$hoverSprite": null,
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": { "_N$target": null,
"__id__": 107 "_id": "63z7O+tLZH2pQprPCKMvCp"
},
"_N$isChecked": false,
"toggleGroup": null,
"checkMark": {
"__id__": 111
},
"checkEvents": [
{
"__id__": 115
}
],
"_id": "f9H3N/MqVI0ZJ6D1GMBA4u"
}, },
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
@ -5755,7 +5733,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
409.721, 409.721,
-646.335, -686.475,
0, 0,
0, 0,
0, 0,

View File

@ -109,7 +109,7 @@ private heathScheduleCallback: Function = null;
cc.fx.GameTool.getHealth(null); cc.fx.GameTool.getHealth(null);
// cc.fx.GameConfig.LEVEL_INFO_init(false,0); // cc.fx.GameConfig.LEVEL_INFO_init(false,0);
setTimeout(() => { setTimeout(() => {
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 25, 15, "level_", this.level, false); NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 30, 15, "level_", this.level, false);
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true); NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
this.setHealthInfo(); this.setHealthInfo();
}, 0); }, 0);
@ -140,7 +140,6 @@ private heathScheduleCallback: Function = null;
//打开heath弹窗,创建预制体 //打开heath弹窗,创建预制体
// 打开heath弹窗创建预制体并启动自己的倒计时 // 打开heath弹窗创建预制体并启动自己的倒计时
openHeath() { openHeath() {
debugger;
let health = cc.instantiate(this.health); let health = cc.instantiate(this.health);
this.node.addChild(health); this.node.addChild(health);
let heathPop = health.getComponent("heathnum").heatht; let heathPop = health.getComponent("heathnum").heatht;
@ -151,8 +150,9 @@ openHeath() {
let switchButtons = health.getComponent("heathnum").switchButtons; let switchButtons = health.getComponent("heathnum").switchButtons;
let coin = health.getComponent("heathnum").coin; let coin = health.getComponent("heathnum").coin;
// 启动弹窗自己的倒计时 // 启动弹窗自己的倒计时
if( cc.fx.GameConfig.GM_INFO.hp < 5) {
this.startHeathTimeCutDown(timeNode); this.startHeathTimeCutDown(timeNode);
}
if (cc.fx.GameConfig.GM_INFO.hp == 0) { if (cc.fx.GameConfig.GM_INFO.hp == 0) {
// 体力为0显示spriteFrames[1],只显示第二个按钮 // 体力为0显示spriteFrames[1],只显示第二个按钮
@ -162,7 +162,7 @@ openHeath() {
// 体力小于5但大于0显示spriteFrames[1],只显示第一个按钮 // 体力小于5但大于0显示spriteFrames[1],只显示第一个按钮
if (switchButtons[0]) {switchButtons[0].active = true; swichs[0].active = false;} if (switchButtons[0]) {switchButtons[0].active = true; swichs[0].active = false;}
if (switchButtons[1]) {switchButtons[1].active = false;swichs[1].active = true;} if (switchButtons[1]) {switchButtons[1].active = false;swichs[1].active = true;}
} else if (cc.fx.GameConfig.GM_INFO.hp == 5) { } else if (cc.fx.GameConfig.GM_INFO.hp >= 5) {
// 体力为5显示spriteFrames[0],只显示第一个按钮 // 体力为5显示spriteFrames[0],只显示第一个按钮
if (switchButtons[0]) {switchButtons[0].active = true;swichs[0].active = true;} if (switchButtons[0]) {switchButtons[0].active = true;swichs[0].active = true;}
@ -171,7 +171,7 @@ openHeath() {
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 40, 20, "time_", heathPop, true); NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.hp, 40, 20, "time_", heathPop, true);
// 设置金币花费数 // 设置金币花费数
NumberToImage.numberToImageNodes(900, 35, 15, "button_", coin, true); NumberToImage.numberToImageNodes(1000, 35, 15, "button_", coin, true);
} }

View File

@ -29,16 +29,25 @@ export default class setUi extends cc.Component {
musicState: boolean = true; musicState: boolean = true;
effectState: boolean = true; effectState: boolean = true;
vibrateState: boolean = true; vibrateState: boolean = true;
private _isSyncing = false;
onLoad() { onLoad() {
this.musicState = cc.fx.GameConfig.GM_INFO.musicOpen; this.musicState = cc.fx.GameConfig.GM_INFO.musicOpen;
this.effectState = cc.fx.GameConfig.GM_INFO.effectOpen; this.effectState = cc.fx.GameConfig.GM_INFO.effectOpen;
this.vibrateState = cc.fx.GameConfig.GM_INFO.vibrateOpen; this.vibrateState = cc.fx.GameConfig.GM_INFO.vibrateOpen;
console.log("音乐状态", cc.fx.GameConfig.GM_INFO.musicOpen); if(this.musicState == true) {
console.log("音效状态", cc.fx.GameConfig.GM_INFO.effectOpen); this.music.children[0].active = true;
console.log("震动状态", cc.fx.GameConfig.GM_INFO.vibrateOpen); }else {
this.syncToggleState(); this.music.children[1].active = true;
}
if(this.effectState == true) {
this.effect.children[0].active = true;
}else {
this.effect.children[1].active = true;
}
if(this.vibrateState == true) {
this.vibrate.children[0].active = true;
}else {
this.vibrate.children[1].active = true;
}
} }
start() { start() {
@ -49,13 +58,13 @@ private _isSyncing = false;
} }
clickMusic() { clickMusic() {
if (this._isSyncing) return;
if (this.musicState) { if (this.musicState) {
this.musicState = false; this.musicState = false;
cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState; cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
this.setMusicConfig(); this.setMusicConfig();
this.music.children[0].active = false;
this.music.children[1].active = true;
//如果音乐关闭了,则停止音乐 //如果音乐关闭了,则停止音乐
cc.fx.AudioManager._instance.stopMusic(); cc.fx.AudioManager._instance.stopMusic();
} }
@ -63,6 +72,8 @@ private _isSyncing = false;
this.musicState = true; this.musicState = true;
cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState; cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
this.setMusicConfig(); this.setMusicConfig();
this.music.children[0].active = true;
this.music.children[1].active = false;
cc.fx.AudioManager._instance.playMusicGame(); cc.fx.AudioManager._instance.playMusicGame();
} }
} }
@ -77,42 +88,45 @@ private _isSyncing = false;
} }
clickEffect() { clickEffect() {
if (this._isSyncing) return;
if (this.effectState) { if (this.effectState) {
this.effectState = false; this.effectState = false;
cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState; cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
this.setMusicConfig(); this.setMusicConfig();
this.effect.children[0].active = false;
this.effect.children[1].active = true;
} }
else { else {
this.effectState = true; this.effectState = true;
cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState; cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
this.setMusicConfig(); this.setMusicConfig();
this.effect.children[0].active = true;
this.effect.children[1].active = false;
} }
} }
clickVibrate() { clickVibrate() {
if (this._isSyncing) return;
if (this.vibrateState) { if (this.vibrateState) {
this.vibrateState = false; this.vibrateState = false;
cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState; cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
this.setMusicConfig(); this.setMusicConfig();
this.vibrate.children[0].active = false;
this.vibrate.children[1].active = true;
} }
else { else {
this.vibrateState = true; this.vibrateState = true;
cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState; cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
this.setMusicConfig(); this.setMusicConfig();
this.vibrate.children[0].active = true;
this.vibrate.children[1].active = false;
} }
} }
syncToggleState() { syncToggleState() {
this._isSyncing = true;
this.music.getComponent(cc.Toggle).isChecked = cc.fx.GameConfig.GM_INFO.musicOpen;
this.effect.getComponent(cc.Toggle).isChecked = cc.fx.GameConfig.GM_INFO.effectOpen;
this.vibrate.getComponent(cc.Toggle).isChecked = cc.fx.GameConfig.GM_INFO.vibrateOpen;
} }
//关闭ui //关闭ui

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 575 KiB

View File

@ -2374,7 +2374,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-449.112, -449.112,
5, 0,
0, 0,
0, 0,
0, 0,

View File

@ -903,8 +903,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, -7.506,
-86, -101.868,
0, 0,
0, 0,
0, 0,
@ -1035,7 +1035,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-351.5, -351.5,
-384, -415.736,
0, 0,
0, 0,
0, 0,
@ -1105,8 +1105,8 @@
0, 0,
0, 0,
1, 1,
1, 2,
1, 2,
1 1
] ]
}, },
@ -1139,7 +1139,7 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "36f63644-d9f3-4223-aee9-bc771717015d" "__uuid__": "639e99e1-c8c1-4891-b07e-5a08962d0193"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 0, "_sizeMode": 0,
@ -1731,7 +1731,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0.5, 0.5,
-384, -415.736,
0, 0,
0, 0,
0, 0,
@ -1801,8 +1801,8 @@
0, 0,
0, 0,
1, 1,
1, 2,
1, 2,
1 1
] ]
}, },
@ -2427,7 +2427,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
352.5, 352.5,
-384, -415.736,
0, 0,
0, 0,
0, 0,
@ -2497,8 +2497,8 @@
0, 0,
0, 0,
1, 1,
1, 2,
1, 2,
1 1
] ]
}, },
@ -3123,7 +3123,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-351.5, -351.5,
-878, -909.736,
0, 0,
0, 0,
0, 0,
@ -3193,8 +3193,8 @@
0, 0,
0, 0,
1, 1,
1, 2,
1, 2,
1 1
] ]
}, },
@ -3819,7 +3819,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0.5, 0.5,
-878, -909.736,
0, 0,
0, 0,
0, 0,
@ -3889,8 +3889,8 @@
0, 0,
0, 0,
1, 1,
1, 2.5,
1, 2.5,
1 1
] ]
}, },
@ -4515,7 +4515,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
352.5, 352.5,
-878, -909.736,
0, 0,
0, 0,
0, 0,
@ -4585,8 +4585,8 @@
0, 0,
0, 0,
1, 1,
1, 2.5,
1, 2.5,
1 1
] ]
}, },
@ -7141,7 +7141,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
466.136, 424.853,
909.389, 909.389,
0, 0,
0, 0,