145 lines
5.4 KiB
TypeScript
145 lines
5.4 KiB
TypeScript
// // 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;
|
|
|
|
|
|
// @ccclass
|
|
// export default class Pause extends cc.Component {
|
|
// static _instance: any;
|
|
// time: number = 0;
|
|
|
|
// @property(cc.Node)
|
|
// music: cc.Node = null;
|
|
|
|
// @property(cc.Node)
|
|
// effect: cc.Node = null;
|
|
|
|
// @property(cc.Node)
|
|
// vibrate: cc.Node = null;
|
|
|
|
// @property(cc.SpriteFrame)
|
|
// open: cc.SpriteFrame = null;
|
|
|
|
// @property(cc.SpriteFrame)
|
|
// close: cc.SpriteFrame = null;
|
|
|
|
// // mapInfo: number[][] = [];
|
|
|
|
// 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;
|
|
// }
|
|
|
|
// start () {
|
|
// }
|
|
|
|
// 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();
|
|
// }
|
|
// }
|
|
|
|
// 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)))
|
|
// }
|
|
// }
|
|
|
|
// 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) {}
|
|
// }
|