1234567891011121314151617181920212223242526272829303132333435363738394041 |
- var GamePause = cc.Class({
- extends: cc.Component,
- properties: {
- btn: {
- title: "按钮",
- type: cc.Node,
- default:[],
- },
- btnCallFunc: null,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad() {
- this.node.on(cc.Node.EventType.TOUCH_START, this.touchBegin.bind(this), this);
- if (!Module.GamePauseLayer) Module.GamePauseLayer = this;
- for (var i in this.btn){
- this.btn[i].on('click', function (event) {
- this.node.destroy();
- Module.GamePauseLayer = null;
- console.log("------click", event.node.name);
- if (this.btnCallFunc) this.btnCallFunc(event.node.name);
- }.bind(this));
- }
- },
- start() {
- },
- call: function (func) {
- this.btnCallFunc = func;
- },
- touchBegin: function (touch, event) {
- this.node.destroy();
- },
- // update (dt) {},
- });
|