12345678910111213141516171819202122232425262728293031323334353637383940 |
- // Learn cc.Class:
- // - https://docs.cocos.com/creator/manual/en/scripting/class.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
- cc.Class({
- extends: cc.Component,
- properties: {
-
- },
- onLoad() {
- this.node.on('click', this.openphb,this);
- // console.log('跳转一笔画');
- this.initbmg();
- },
- openphb() {
- if (Storage.Get_storage('BGM') == 1){
- Global.BGM = 0;
- Storage.Set_storage('BGM',0)
- this.node.color = cc.Color.GRAY;
- }else{
- Global.BGM = 1;
- Storage.Set_storage('BGM', 1);
- this.node.color = cc.Color.WHITE;
- }
- },
- initbmg(){
- if (Storage.Get_storage('BGM') == 1) {
- Global.BGM = 1;
- this.node.color = cc.Color.WHITE;
- } else {
- Global.BGM = 0;
- this.node.color = cc.Color.GRAY;
- }
- }
- });
|