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