@cc-component/cc-ex-component 1.7.7 → 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/ex/ExCommon.ts +30 -1
- package/package.json +1 -1
package/assets/ex/ExCommon.ts
CHANGED
|
@@ -171,6 +171,16 @@ declare module 'cc' {
|
|
|
171
171
|
* 确保组件存在 不存在则添加
|
|
172
172
|
*/
|
|
173
173
|
ensureComponent<T extends Component>(className: string): T;
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
interface Button {
|
|
178
|
+
/**
|
|
179
|
+
* 禁用按钮
|
|
180
|
+
* @param enable
|
|
181
|
+
* @param time 禁用后xx秒后恢复,不传一直禁用
|
|
182
|
+
*/
|
|
183
|
+
enable(enable: boolean, time?: number): void;
|
|
174
184
|
}
|
|
175
185
|
|
|
176
186
|
interface Animation {
|
|
@@ -642,6 +652,25 @@ Node.prototype.enable = function (this: Node, enable: boolean, time?: number): v
|
|
|
642
652
|
}
|
|
643
653
|
};
|
|
644
654
|
|
|
655
|
+
Button.prototype.enable = function (this: Button, enable: boolean, time?: number): void {
|
|
656
|
+
if (this.isValid) {
|
|
657
|
+
const btn = this
|
|
658
|
+
if (btn) {
|
|
659
|
+
if (time) {
|
|
660
|
+
btn.interactable = enable;
|
|
661
|
+
if (!enable) {
|
|
662
|
+
setTimeout(() => {
|
|
663
|
+
if (btn && btn.isValid)
|
|
664
|
+
btn.interactable = true;
|
|
665
|
+
}, time)
|
|
666
|
+
}
|
|
667
|
+
} else {
|
|
668
|
+
btn.interactable = enable;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
|
|
645
674
|
Node.prototype.touchStartAnim = function (this: Node, scale?: number, time?: number): void {
|
|
646
675
|
if (this.isValid) {
|
|
647
676
|
const btn = this
|
|
@@ -772,7 +801,7 @@ const originalOnTouchEnded = Button.prototype["_onTouchEnded"];
|
|
|
772
801
|
Button.prototype["_onTouchEnded"] = function (event: EventTouch) {
|
|
773
802
|
// 播放点击音效
|
|
774
803
|
ExComponentModule.Emit(this);
|
|
775
|
-
this.node.emit('click', this)
|
|
804
|
+
// this.node.emit('click', this)
|
|
776
805
|
// 调用原始逻辑
|
|
777
806
|
// EventHandler.emitEvents(this.clickEvents, event);
|
|
778
807
|
return originalOnTouchEnded.call(this, event);
|