暂停界面功能修复
This commit is contained in:
parent
3127af522f
commit
7701ae8bbf
|
@ -10940,11 +10940,11 @@
|
|||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": {
|
||||
"__id__": 2
|
||||
"__id__": 13
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "80998T1AYNNRZdRxsVvXR65",
|
||||
"handler": "",
|
||||
"_componentId": "2234assp7RIvpDgrnqljp2R",
|
||||
"handler": "homeBtn",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
|
@ -11012,7 +11012,7 @@
|
|||
"__id__": 299
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_active": false,
|
||||
"_components": [],
|
||||
"_prefab": null,
|
||||
"_opacity": 255,
|
||||
|
@ -15527,11 +15527,11 @@
|
|||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": {
|
||||
"__id__": 13
|
||||
"__id__": 2
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "2234assp7RIvpDgrnqljp2R",
|
||||
"handler": "homeBtn",
|
||||
"_componentId": "80998T1AYNNRZdRxsVvXR65",
|
||||
"handler": "returnHome",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
|
@ -17709,11 +17709,11 @@
|
|||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": {
|
||||
"__id__": 2
|
||||
"__id__": 13
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "80998T1AYNNRZdRxsVvXR65",
|
||||
"handler": "returnHome",
|
||||
"_componentId": "2234assp7RIvpDgrnqljp2R",
|
||||
"handler": "homeBtn",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,144 +1,144 @@
|
|||
// Learn TypeScript:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
||||
// Learn Attribute:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
|
||||
// Learn life-cycle callbacks:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
// // Learn TypeScript:
|
||||
// // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
||||
// // Learn Attribute:
|
||||
// // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
|
||||
// // Learn life-cycle callbacks:
|
||||
// // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
// const {ccclass, property} = cc._decorator;
|
||||
|
||||
|
||||
@ccclass
|
||||
export default class Pause extends cc.Component {
|
||||
static _instance: any;
|
||||
time: number = 0;
|
||||
// @ccclass
|
||||
// export default class Pause extends cc.Component {
|
||||
// static _instance: any;
|
||||
// time: number = 0;
|
||||
|
||||
@property(cc.Node)
|
||||
music: cc.Node = null;
|
||||
// @property(cc.Node)
|
||||
// music: cc.Node = null;
|
||||
|
||||
@property(cc.Node)
|
||||
effect: cc.Node = null;
|
||||
// @property(cc.Node)
|
||||
// effect: cc.Node = null;
|
||||
|
||||
@property(cc.Node)
|
||||
vibrate: cc.Node = null;
|
||||
// @property(cc.Node)
|
||||
// vibrate: cc.Node = null;
|
||||
|
||||
@property(cc.SpriteFrame)
|
||||
open: cc.SpriteFrame = null;
|
||||
// @property(cc.SpriteFrame)
|
||||
// open: cc.SpriteFrame = null;
|
||||
|
||||
@property(cc.SpriteFrame)
|
||||
close: cc.SpriteFrame = null;
|
||||
// @property(cc.SpriteFrame)
|
||||
// close: cc.SpriteFrame = null;
|
||||
|
||||
// mapInfo: number[][] = [];
|
||||
// // mapInfo: number[][] = [];
|
||||
|
||||
musicState: boolean = true;
|
||||
effectState: boolean = true;
|
||||
vibrateState: boolean = true;
|
||||
// musicState: boolean = true;
|
||||
// effectState: boolean = true;
|
||||
// vibrateState: boolean = true;
|
||||
|
||||
onLoad () {
|
||||
if(cc.fx.GameConfig.GM_INFO.musicOpen){
|
||||
this.music.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
this.music.x = 278;
|
||||
}
|
||||
else{
|
||||
this.music.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
this.music.x = 161;
|
||||
}
|
||||
if(cc.fx.GameConfig.GM_INFO.effectOpen){
|
||||
this.effect.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
this.effect.x = 278;
|
||||
}
|
||||
else{
|
||||
this.effect.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
this.effect.x = 161;
|
||||
}
|
||||
if(cc.fx.GameConfig.GM_INFO.vibrateOpen){
|
||||
this.vibrate.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
this.vibrate.x = 278;
|
||||
}
|
||||
else{
|
||||
this.vibrate.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
this.vibrate.x = 161;
|
||||
}
|
||||
this.musicState = cc.fx.GameConfig.GM_INFO.musicOpen;
|
||||
this.effectState = cc.fx.GameConfig.GM_INFO.effectOpen;
|
||||
this.vibrateState = cc.fx.GameConfig.GM_INFO.vibrateOpen;
|
||||
}
|
||||
// onLoad () {
|
||||
// if(cc.fx.GameConfig.GM_INFO.musicOpen){
|
||||
// this.music.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
// this.music.x = 278;
|
||||
// }
|
||||
// else{
|
||||
// this.music.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
// this.music.x = 161;
|
||||
// }
|
||||
// if(cc.fx.GameConfig.GM_INFO.effectOpen){
|
||||
// this.effect.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
// this.effect.x = 278;
|
||||
// }
|
||||
// else{
|
||||
// this.effect.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
// this.effect.x = 161;
|
||||
// }
|
||||
// if(cc.fx.GameConfig.GM_INFO.vibrateOpen){
|
||||
// this.vibrate.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
// this.vibrate.x = 278;
|
||||
// }
|
||||
// else{
|
||||
// this.vibrate.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
// this.vibrate.x = 161;
|
||||
// }
|
||||
// this.musicState = cc.fx.GameConfig.GM_INFO.musicOpen;
|
||||
// this.effectState = cc.fx.GameConfig.GM_INFO.effectOpen;
|
||||
// this.vibrateState = cc.fx.GameConfig.GM_INFO.vibrateOpen;
|
||||
// }
|
||||
|
||||
start () {
|
||||
}
|
||||
// start () {
|
||||
// }
|
||||
|
||||
init(time){
|
||||
// init(time){
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
clickMusic(){
|
||||
if(this.musicState){
|
||||
this.musicState = false;
|
||||
cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
|
||||
this.setMusicConfig();
|
||||
this.music.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(161,this.music.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
this.music.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
}),cc.fadeIn(0.1)))
|
||||
cc.fx.AudioManager._instance.stopMusic();
|
||||
}
|
||||
else{
|
||||
this.musicState = true;
|
||||
cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
|
||||
this.setMusicConfig();
|
||||
this.music.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(278,this.music.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
this.music.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
}),cc.fadeIn(0.1)))
|
||||
cc.fx.AudioManager._instance.playMusicGame();
|
||||
}
|
||||
}
|
||||
// clickMusic(){
|
||||
// if(this.musicState){
|
||||
// this.musicState = false;
|
||||
// cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
|
||||
// this.setMusicConfig();
|
||||
// this.music.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(161,this.music.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
// this.music.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
// }),cc.fadeIn(0.1)))
|
||||
// cc.fx.AudioManager._instance.stopMusic();
|
||||
// }
|
||||
// else{
|
||||
// this.musicState = true;
|
||||
// cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
|
||||
// this.setMusicConfig();
|
||||
// this.music.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(278,this.music.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
// this.music.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
// }),cc.fadeIn(0.1)))
|
||||
// cc.fx.AudioManager._instance.playMusicGame();
|
||||
// }
|
||||
// }
|
||||
|
||||
setMusicConfig(){
|
||||
let audioInfo = {
|
||||
"musicOpen": cc.fx.GameConfig.GM_INFO.musicOpen, //音乐
|
||||
"effectOpen": cc.fx.GameConfig.GM_INFO.effectOpen, //音效
|
||||
"vibrateOpen": cc.fx.GameConfig.GM_INFO.vibrateOpen, //震动
|
||||
}
|
||||
cc.fx.StorageMessage.setStorage("music",audioInfo);
|
||||
}
|
||||
// setMusicConfig(){
|
||||
// let audioInfo = {
|
||||
// "musicOpen": cc.fx.GameConfig.GM_INFO.musicOpen, //音乐
|
||||
// "effectOpen": cc.fx.GameConfig.GM_INFO.effectOpen, //音效
|
||||
// "vibrateOpen": cc.fx.GameConfig.GM_INFO.vibrateOpen, //震动
|
||||
// }
|
||||
// cc.fx.StorageMessage.setStorage("music",audioInfo);
|
||||
// }
|
||||
|
||||
clickEffect(){
|
||||
if(this.effectState){
|
||||
this.effectState = false;
|
||||
cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
|
||||
this.setMusicConfig();
|
||||
this.effect.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(161,this.effect.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
this.effect.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
}),cc.fadeIn(0.1)))
|
||||
}
|
||||
else{
|
||||
this.effectState = true;
|
||||
cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
|
||||
this.setMusicConfig();
|
||||
this.effect.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(278,this.effect.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
this.effect.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
}),cc.fadeIn(0.1)))
|
||||
}
|
||||
}
|
||||
// clickEffect(){
|
||||
// if(this.effectState){
|
||||
// this.effectState = false;
|
||||
// cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
|
||||
// this.setMusicConfig();
|
||||
// this.effect.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(161,this.effect.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
// this.effect.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
// }),cc.fadeIn(0.1)))
|
||||
// }
|
||||
// else{
|
||||
// this.effectState = true;
|
||||
// cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
|
||||
// this.setMusicConfig();
|
||||
// this.effect.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(278,this.effect.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
// this.effect.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
// }),cc.fadeIn(0.1)))
|
||||
// }
|
||||
// }
|
||||
|
||||
clickVibrate(){
|
||||
if(this.vibrateState){
|
||||
this.vibrateState = false;
|
||||
cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
|
||||
this.setMusicConfig();
|
||||
this.vibrate.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(161,this.vibrate.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
this.vibrate.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
}),cc.fadeIn(0.1)))
|
||||
}
|
||||
else{
|
||||
this.vibrateState = true;
|
||||
cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
|
||||
this.setMusicConfig();
|
||||
this.vibrate.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(278,this.vibrate.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
this.vibrate.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
}),cc.fadeIn(0.1)))
|
||||
}
|
||||
}
|
||||
// clickVibrate(){
|
||||
// if(this.vibrateState){
|
||||
// this.vibrateState = false;
|
||||
// cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
|
||||
// this.setMusicConfig();
|
||||
// this.vibrate.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(161,this.vibrate.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
// this.vibrate.getComponent(cc.Sprite).spriteFrame = this.close;
|
||||
// }),cc.fadeIn(0.1)))
|
||||
// }
|
||||
// else{
|
||||
// this.vibrateState = true;
|
||||
// cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
|
||||
// this.setMusicConfig();
|
||||
// this.vibrate.runAction(cc.sequence(cc.spawn(cc.moveTo(0.05, cc.v2(278,this.vibrate.y)), cc.fadeOut(0.05)),cc.callFunc(()=>{
|
||||
// this.vibrate.getComponent(cc.Sprite).spriteFrame = this.open;
|
||||
// }),cc.fadeIn(0.1)))
|
||||
// }
|
||||
// }
|
||||
|
||||
// update (dt) {}
|
||||
}
|
||||
// // update (dt) {}
|
||||
// }
|
||||
|
|
|
@ -169,6 +169,7 @@ export default class SceneManager extends cc.Component {
|
|||
|
||||
returnHome() {
|
||||
if (this.node.getChildByName("Pause").getChildByName("btn").getComponent("btnControl")._touch) {
|
||||
this.closePause();
|
||||
if (MapConroler._instance.gameStart == true) {
|
||||
MiniGameSdk.API.showToast("体力值减少");
|
||||
cc.fx.GameTool.setUserHealth(-1, (data) => {
|
||||
|
@ -195,6 +196,7 @@ export default class SceneManager extends cc.Component {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
cc.director.loadScene("HomeScene");
|
||||
}, 1200);
|
||||
|
|
|
@ -251,7 +251,7 @@ export class GameConfig {
|
|||
cc.fx.GameConfig.GM_INFO.level = 204;
|
||||
}
|
||||
let name = "Json/level" + (cc.fx.GameConfig.GM_INFO.level+1);
|
||||
debugger;
|
||||
// debugger;
|
||||
// //console.log("关卡名称:",name);
|
||||
// name = "Json/level" + 68;
|
||||
// cc.fx.StorageMessage.setStorage("level",cc.fx.GameConfig.GM_INFO.level.toString());
|
||||
|
|
|
@ -29,16 +29,16 @@ export default class setUi extends cc.Component {
|
|||
musicState: boolean = true;
|
||||
effectState: boolean = true;
|
||||
vibrateState: boolean = true;
|
||||
|
||||
private _isSyncing = false;
|
||||
onLoad() {
|
||||
|
||||
this.musicState = cc.fx.GameConfig.GM_INFO.musicOpen;
|
||||
this.effectState = cc.fx.GameConfig.GM_INFO.effectOpen;
|
||||
this.vibrateState = cc.fx.GameConfig.GM_INFO.vibrateOpen;
|
||||
console.log("音乐状态", this.musicState);
|
||||
console.log("音效状态", this.effectState);
|
||||
console.log("震动状态", this.vibrateState);
|
||||
this.syncToggleState();
|
||||
console.log("音乐状态", cc.fx.GameConfig.GM_INFO.musicOpen);
|
||||
console.log("音效状态", cc.fx.GameConfig.GM_INFO.effectOpen);
|
||||
console.log("震动状态", cc.fx.GameConfig.GM_INFO.vibrateOpen);
|
||||
this.syncToggleState();
|
||||
}
|
||||
|
||||
start() {
|
||||
|
@ -49,6 +49,7 @@ export default class setUi extends cc.Component {
|
|||
}
|
||||
|
||||
clickMusic() {
|
||||
if (this._isSyncing) return;
|
||||
if (this.musicState) {
|
||||
this.musicState = false;
|
||||
cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
|
||||
|
@ -76,6 +77,7 @@ export default class setUi extends cc.Component {
|
|||
}
|
||||
|
||||
clickEffect() {
|
||||
if (this._isSyncing) return;
|
||||
if (this.effectState) {
|
||||
this.effectState = false;
|
||||
cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
|
||||
|
@ -88,10 +90,10 @@ export default class setUi extends cc.Component {
|
|||
|
||||
|
||||
}
|
||||
console.log("音效状态", this.effectState);
|
||||
}
|
||||
|
||||
clickVibrate() {
|
||||
if (this._isSyncing) return;
|
||||
if (this.vibrateState) {
|
||||
this.vibrateState = false;
|
||||
cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
|
||||
|
@ -105,12 +107,12 @@ export default class setUi extends cc.Component {
|
|||
|
||||
|
||||
}
|
||||
console.log("震动状态", this.vibrateState);
|
||||
}
|
||||
syncToggleState() {
|
||||
this.music.getComponent(cc.Toggle).isChecked = this.musicState;
|
||||
this.effect.getComponent(cc.Toggle).isChecked = this.effectState;
|
||||
this.vibrate.getComponent(cc.Toggle).isChecked = this.vibrateState;
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user