mirror of
https://github.com/Leo501/CocosCreatorTutorial.git
synced 2026-05-07 22:27:22 +08:00
添加一个设置蒙板的component
This commit is contained in:
25
CreatorUtils/UI/MaskLayer.js
Normal file
25
CreatorUtils/UI/MaskLayer.js
Normal file
@@ -0,0 +1,25 @@
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
isBlockInput: true,
|
||||
},
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
onLoad() {
|
||||
//获取运行场景的可见大小。
|
||||
let visiSize = cc.view.getVisibleSize();
|
||||
this.node.width = visiSize.width;
|
||||
this.node.height = visiSize.height;
|
||||
this.node.color = cc.hexToColor('#000000');
|
||||
this.node.opacity = 150;
|
||||
if (this.isBlockInput) {
|
||||
this.node.addComponent(cc.BlockInputEvents);
|
||||
}
|
||||
},
|
||||
|
||||
start() {},
|
||||
|
||||
// update (dt) {},
|
||||
});
|
||||
Reference in New Issue
Block a user