12345678910111213141516171819202122232425262728293031323334 |
- cc.Class({
- extends: cc.Component,
- properties: {
- button: cc.Button,
- },
- // 存储数据:cc.sys.localStorage.setItem(“key”,”value”)
- // 获取数据:cc.sys.localStorage.getItem(“key”)
-
- // 移除数据:cc.sys.localStorage.removeItem(“key”)
-
- // 清除所有:cc.sys.localStorage.clear()
- // use this for initialization
- onLoad: function () {
- this.button.node.on('click', this.callback, this);
- },
- // called every frame
- update: function (dt) {
- },
- callback: function (event) {
- if(Storage.GetCoin() < 200){
- //弹出金币不足的商店页面
- }else{
- Audio.playeffect('resources/audio/sound_refresh.ogg');
- Util.ReCreateMap();
- Storage.ChangeCoin(-200);
- }
-
- }
- });
|