mirror of
				https://github.com/Gongxh0901/kunpolibrary
				synced 2025-10-31 03:15:45 +00:00 
			
		
		
		
	仓库中添加内置的demo
This commit is contained in:
		
							
								
								
									
										9
									
								
								demo/assets/script/UI/Basics.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Basics.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "eae449a2-8b5c-42ff-8917-888937877f85", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Basics/Common.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Basics/Common.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "e7f088c6-38b1-4278-8ba4-4f7de40afb3d", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										126
									
								
								demo/assets/script/UI/Basics/Common/AlertWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								demo/assets/script/UI/Basics/Common/AlertWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,126 @@ | ||||
| import { cc, fgui, kunpo } from '../../../header'; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| interface WindowData { | ||||
|     content: string; | ||||
|     title?: string; | ||||
|     okTitle?: string; | ||||
|     cancelTitle?: string; | ||||
|     showClose?: boolean; // 显示关闭按钮 | ||||
|     emptyAreaClose?: boolean; // 点击空白区域关闭 | ||||
|     align?: cc.HorizontalTextAlignment; // 内容文本水平对齐方式  default:居中对齐 | ||||
|     leading?: number;//行距 | ||||
|     okNotClose?: boolean; // 点击OK按钮时不关闭本界面 | ||||
|     cancelNotClose?: boolean; // 点击取消按钮时不关闭本界面 | ||||
|     complete?: () => void; // 确定按钮的回调 | ||||
|     cancel?: () => void; // 取消按钮的回调 | ||||
|     close?: () => void; // 关闭界面的回调 (只有点击关闭按钮和空白位置关闭时才会触发) | ||||
| } | ||||
|  | ||||
|  | ||||
| @uiclass("Window", "Basics", "AlertWindow") | ||||
| export class AlertWindow extends kunpo.Window { | ||||
|     @uiprop private bg: fgui.GLoader; | ||||
|     @uiprop private lab_title: fgui.GTextField; | ||||
|     @uiprop private lab_content: fgui.GTextField; | ||||
|     @uiprop private btn_close: fgui.GButton; | ||||
|     @uiprop private btn_ok: fgui.GButton; | ||||
|     @uiprop private btn_cancel: fgui.GButton; | ||||
|  | ||||
|     private _isEmptyAreaClose: boolean = false; | ||||
|     private _window_data: WindowData = null; | ||||
|  | ||||
|     private _complete: () => void; | ||||
|     private _cancel: () => void; | ||||
|     private _closeFunc: () => void; | ||||
|  | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Full; | ||||
|         this.type = kunpo.WindowType.Normal; | ||||
|     } | ||||
|  | ||||
|     protected onAdapted() { | ||||
|     } | ||||
|  | ||||
|     protected onShow(data: WindowData): void { | ||||
|         this._complete = data.complete; | ||||
|         this._cancel = data.cancel; | ||||
|         this._closeFunc = data.close; | ||||
|         this._window_data = data; | ||||
|  | ||||
|         // 标题 | ||||
|         if (data.title) { | ||||
|             this.lab_title.text = data.title; | ||||
|         } else { | ||||
|             this.lab_title.visible = false; | ||||
|         } | ||||
|  | ||||
|         // 关闭按钮 | ||||
|         this.btn_close.visible = !!data.showClose; | ||||
|  | ||||
|         // 空白位置关闭标记 | ||||
|         this._isEmptyAreaClose = !!data.emptyAreaClose; | ||||
|  | ||||
|         // 确定按钮 | ||||
|         if (data.okTitle) { | ||||
|             this.btn_ok.title = data.okTitle; | ||||
|         } else { | ||||
|             this.btn_ok.visible = false; | ||||
|         } | ||||
|  | ||||
|         // 取消按钮 | ||||
|         if (data.cancelTitle) { | ||||
|             this.btn_cancel.text = data.cancelTitle; | ||||
|         } else { | ||||
|             this.btn_cancel.visible = false; | ||||
|         } | ||||
|  | ||||
|         this.lab_content.text = data.content; | ||||
|         let align = typeof data.align == "number" ? data.align : cc.Label.HorizontalAlign.CENTER; | ||||
|         let leading = typeof data.leading == "number" ? data.leading : this.lab_content.leading; | ||||
|         this.lab_content.align = align; | ||||
|         this.lab_content.leading = leading; | ||||
|         this.lab_content.ensureSizeCorrect(); | ||||
|  | ||||
|         // 限制背景框高度 | ||||
|         if (this.bg.height < 500) { | ||||
|             this.bg.height = 500; | ||||
|         } | ||||
|  | ||||
|         // 确定取消按钮位置调整 | ||||
|         if (this.btn_ok.visible && !this.btn_cancel.visible) { | ||||
|             this.btn_ok.x = this.bg.x + (this.bg.width - this.btn_ok.width) * 0.5; | ||||
|         } else if (this.btn_cancel.visible && !this.btn_ok.visible) { | ||||
|             this.btn_cancel.x = this.bg.x + (this.bg.width - this.btn_cancel.width) * 0.5; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     protected onEmptyAreaClick(): void { | ||||
|         if (this._isEmptyAreaClose) { | ||||
|             kunpo.WindowManager.closeWindow(this.name); | ||||
|             this._closeFunc && this._closeFunc(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|         this._closeFunc && this._closeFunc(); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnOk(): void { | ||||
|         !this._window_data.okNotClose && kunpo.WindowManager.closeWindow(this.name); | ||||
|         this._complete && this._complete(); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCancel(): void { | ||||
|         !this._window_data.cancelNotClose && kunpo.WindowManager.closeWindow(this.name); | ||||
|         this._cancel && this._cancel(); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Basics/Common/AlertWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Basics/Common/AlertWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "434791ba-2680-4643-aea0-ecf8bebc2ff9", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										13
									
								
								demo/assets/script/UI/Basics/Common/LoadUIWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								demo/assets/script/UI/Basics/Common/LoadUIWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
|  | ||||
|  | ||||
| import { kunpo } from '../../../header'; | ||||
| const { uiclass, uiprop } = kunpo._uidecorator; | ||||
|  | ||||
| /** UI界面资源加载等待界面 */ | ||||
| @uiclass("Wait", "Basics", "LoadUIWindow") | ||||
| export class LoadUIWindow extends kunpo.Window { | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Full; | ||||
|         this.type = kunpo.WindowType.Normal; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Basics/Common/LoadUIWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Basics/Common/LoadUIWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "0b7e1ba3-9877-45ea-9d1b-71115f04744b", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										86
									
								
								demo/assets/script/UI/Basics/Common/ToastWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								demo/assets/script/UI/Basics/Common/ToastWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,86 @@ | ||||
| /* | ||||
|  * @Description: 通用Toast提示 | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2021-04-27 09:20:14 | ||||
|  */ | ||||
|  | ||||
| import { cc, fgui, kunpo } from "../../../header"; | ||||
| interface ToastData { | ||||
|     text: string, // 文本 | ||||
|     duration?: number, // 持续时间 | ||||
|     swallowTouch?: boolean, // 吞噬touch事件 | ||||
|     showMask?: boolean, // 显示遮罩 | ||||
|     align?: cc.HorizontalTextAlignment // 对齐方式 | ||||
| } | ||||
|  | ||||
| const { uiclass, uiprop } = kunpo._uidecorator; | ||||
| @uiclass("Toast", "Basics", "ToastWindow") | ||||
| export class ToastWindow extends kunpo.Window { | ||||
|     @uiprop private toast: fgui.GComponent; | ||||
|     @uiprop private labTips: fgui.GTextField; | ||||
|     @uiprop private bgMask: fgui.GGraph; | ||||
|  | ||||
|     private _showTransition: fgui.Transition; | ||||
|     private _hideTransition: fgui.Transition; | ||||
|  | ||||
|     private _swallowTouch: boolean = false; // 吞噬touch事件 | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Full; | ||||
|         this.type = kunpo.WindowType.Normal; | ||||
|         this.bgAlpha = 0; | ||||
|  | ||||
|         this._showTransition = this.toast.getTransition("show"); | ||||
|         this._hideTransition = this.toast.getTransition("hide"); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 参数说明 | ||||
|      * @param {string} data.text toast文本 | ||||
|      * @param {number} data.duration 存在时间( < 0)为常驻 default 2秒 | ||||
|      * @param {boolean} data.swallowTouch 吞噬touch事件 default 不吞噬 | ||||
|      * @param {boolean} data.showMask 是否显示半透明遮罩 (当显示遮罩时,必定吞噬touch事件) default 不显示 | ||||
|      * @param {cc.HorizontalTextAlignment} data.align 横向文本对齐方式 default 居中对齐 | ||||
|      */ | ||||
|     protected onShow(data: ToastData): void { | ||||
|         this.bgMask.visible = data.showMask; | ||||
|         this._swallowTouch = data.showMask ? true : (data.swallowTouch || false); | ||||
|         this.opaque = this._swallowTouch; | ||||
|         // if (this._swallowTouch) { | ||||
|         //     this.node.on(cc.Node.EventType.TOUCH_END, () => { }, this.node); | ||||
|         // } else { | ||||
|         //     this.node.targetOff(this.node); | ||||
|         // } | ||||
|  | ||||
|         this.labTips.text = data.text; | ||||
|  | ||||
|         let align = data.align || cc.HorizontalTextAlignment.CENTER; | ||||
|         this.labTips.align = align; | ||||
|         this.labTips.autoSize = fgui.AutoSizeType.Both; | ||||
|         this.labTips.ensureSizeCorrect(); | ||||
|         // 调整文本尺寸 | ||||
|         let maxWidht = 504; | ||||
|         if (this.labTips.width > maxWidht) { | ||||
|             this.labTips.autoSize = fgui.AutoSizeType.Height; | ||||
|             this.labTips.width = maxWidht; | ||||
|             this.labTips.ensureSizeCorrect(); | ||||
|         } else { | ||||
|             this.labTips.autoSize = fgui.AutoSizeType.Both; | ||||
|         } | ||||
|  | ||||
|  | ||||
|         this._showTransition.stop(true); | ||||
|         this._hideTransition.stop(true); | ||||
|         this._showTransition.play(() => { | ||||
|             let duration = data.duration || 2.0 | ||||
|             if (duration > 0) { | ||||
|                 this._hideTransition.play(() => { | ||||
|                     kunpo.WindowManager.closeWindow(this.name); | ||||
|                 }, 1, duration); | ||||
|             } | ||||
|         }, 1, 0); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Basics/Common/ToastWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Basics/Common/ToastWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "993ce544-0214-4132-ba2c-2d464aa39257", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Basics/Header.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Basics/Header.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "d53b1983-3f1e-4e89-8114-88dfcc95075f", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										31
									
								
								demo/assets/script/UI/Basics/Header/WindowHeader.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								demo/assets/script/UI/Basics/Header/WindowHeader.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-01-12 | ||||
|  * @Description:  | ||||
|  */ | ||||
| import { fgui, kunpo } from '../../../header'; | ||||
| const { uiheader, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiheader("Basics", "WindowHeader") | ||||
| export class WindowHeader extends kunpo.WindowHeader { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|  | ||||
|         this.btn_close.onClick(() => { | ||||
|             kunpo.log("WindowHeader btn_close"); | ||||
|         }, this); | ||||
|     } | ||||
|  | ||||
|     protected onShow(window: kunpo.Window, userdata?: any): void { | ||||
|         kunpo.log("WindowHeader onShow:"); | ||||
|     } | ||||
|  | ||||
|     protected onHide(): void { | ||||
|         kunpo.log("WindowHeader onHide"); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("WindowHeader onClose"); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Basics/Header/WindowHeader.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Basics/Header/WindowHeader.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "bcb15a03-27d3-46b7-9f6b-53040cd6bbcb", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										32
									
								
								demo/assets/script/UI/Basics/Header/WindowHeader2.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								demo/assets/script/UI/Basics/Header/WindowHeader2.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,32 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-01-12 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { fgui, kunpo } from '../../../header'; | ||||
| const { uiheader, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiheader("Basics", "WindowHeader2") | ||||
| export class WindowHeader2 extends kunpo.WindowHeader { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|  | ||||
|         this.btn_close.onClick(() => { | ||||
|             kunpo.log("WindowHeader btn_close"); | ||||
|         }, this); | ||||
|     } | ||||
|  | ||||
|     protected onShow(window: kunpo.Window, userdata?: any): void { | ||||
|         kunpo.log("WindowHeader onShow:"); | ||||
|     } | ||||
|  | ||||
|     protected onHide(): void { | ||||
|         kunpo.log("WindowHeader onHide"); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("WindowHeader onClose"); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "2a956cae-8688-40b9-89d3-86407a1f3631", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/CloseAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/CloseAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "c59e1239-0afc-4df7-b1e9-b7b968b48709", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/CloseOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/CloseOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "ecbe9481-c878-4ffd-863c-d9db4641ef2a", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Components.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Components.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "3896f27e-b6e5-4757-a872-8a1b925a24f3", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Condition.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Condition.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "aa136c25-aeef-4b18-9051-246cf5cd1176", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										82
									
								
								demo/assets/script/UI/Condition/ConditionWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								demo/assets/script/UI/Condition/ConditionWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,82 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-02-17 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { ConditionType } from "../../condition/ConditionType"; | ||||
| import { DataHelper } from "../../Data/DataHelper"; | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Condition", "ConditionWindow") | ||||
| export class ConditionWindow extends kunpo.Window { | ||||
|     @uiprop reddot1: fgui.GComponent; | ||||
|     @uiprop reddot2: fgui.GComponent; | ||||
|  | ||||
|     @uiprop btn_condition1: fgui.GButton; | ||||
|     @uiprop btn_condition2: fgui.GButton; | ||||
|     @uiprop btn_condition3: fgui.GButton; | ||||
|     @uiprop btn_condition4: fgui.GButton; | ||||
|  | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.HideOne; | ||||
|  | ||||
|         /** 初始化注册的所有条件 (临时写到这里,应该放到项目数据初始化之后 调用这个方法)  */ | ||||
|         kunpo.ConditionManager.initCondition(); | ||||
|  | ||||
|         this.btn_condition1.title = `条件1: ${DataHelper.getValue("condition1", true)}`; | ||||
|         this.btn_condition2.title = `条件2: ${DataHelper.getValue("condition2", true)}`; | ||||
|         this.btn_condition3.title = `条件3: ${DataHelper.getValue("condition3", true)}`; | ||||
|         this.btn_condition4.title = `条件4: ${DataHelper.getValue("condition4", true)}`; | ||||
|  | ||||
|         /** 任意一个满足 显示节点 */ | ||||
|         new kunpo.ConditionAnyNode(this.reddot1, ConditionType.Condition1, ConditionType.Condition2, ConditionType.Condition3, ConditionType.Condition4); | ||||
|  | ||||
|         /** 所有条件都满足 显示节点 */ | ||||
|         new kunpo.ConditionAllNode(this.reddot2, ConditionType.Condition1, ConditionType.Condition2, ConditionType.Condition3, ConditionType.Condition4); | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCondition1(): void { | ||||
|         const value = DataHelper.getValue("condition1", true); | ||||
|         DataHelper.setValue("condition1", !value); | ||||
|  | ||||
|         this.btn_condition1.title = `条件1: ${!value}`; | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCondition2(): void { | ||||
|         const value = DataHelper.getValue("condition2", true); | ||||
|         DataHelper.setValue("condition2", !value); | ||||
|         this.btn_condition2.title = `条件2: ${!value}`; | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCondition3(): void { | ||||
|         const value = DataHelper.getValue("condition3", true); | ||||
|         DataHelper.setValue("condition3", !value); | ||||
|         this.btn_condition3.title = `条件3: ${!value}`; | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCondition4(): void { | ||||
|         const value = DataHelper.getValue("condition4", true); | ||||
|         DataHelper.setValue("condition4", !value); | ||||
|         this.btn_condition4.title = `条件4: ${!value}`; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Condition/ConditionWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Condition/ConditionWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "addf31f0-70a4-4238-8b2f-c9971873eaa9", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/ConditionWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/ConditionWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "d73deef4-cfcf-4381-8ff4-afee0930c850", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Game.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Game.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "d0871aff-1fb9-4f5b-96d6-dc008b804d82", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/HideAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/HideAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "1a445c8e-e43f-46b8-8483-c721a76d716e", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/HideOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/HideOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "34d16557-9a49-4995-8331-123fe8e47e79", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										103
									
								
								demo/assets/script/UI/HomeWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								demo/assets/script/UI/HomeWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2024-12-11 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { AssetPool } from "kunpocc-assets"; | ||||
| import { cc, fgui, kunpo, KunpoAssets } from "../header"; | ||||
| const { uiclass, uiprop, uiclick, uicontrol, uitransition } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Home", "HomeWindow") | ||||
| export class HomeWindow extends kunpo.Window { | ||||
|     @uicontrol private status: fgui.Controller; | ||||
|     @uicontrol private sta2: fgui.Controller; | ||||
|  | ||||
|     @uitransition private t0: fgui.Transition; | ||||
|     @uitransition private t1: fgui.Transition; | ||||
|  | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.CloseAll; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         kunpo.log("HomeWindow onShow:", userdata); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickUI(): void { | ||||
|         kunpo.WindowManager.showWindow("UIBaseWindow"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onSocketWindow(): void { | ||||
|         kunpo.WindowManager.showWindow("SocketTestWindow"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCondition(): void { | ||||
|         kunpo.WindowManager.showWindow("ConditionWindow"); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickMiniGame(): void { | ||||
|         if (kunpo.Platform.isWX || kunpo.Platform.isAlipay || kunpo.Platform.isBytedance) { | ||||
|             kunpo.WindowManager.showWindow("MiniGameWindow"); | ||||
|         } else { | ||||
|             kunpo.WindowManager.showWindowIm("ToastWindow", { text: "当前平台不是 微信/阿里/抖音小游戏" }) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnHotUpdate(): void { | ||||
|         if (kunpo.Platform.isNativeMobile) { | ||||
|             kunpo.WindowManager.showWindow("HotUpdateWindow"); | ||||
|         } else { | ||||
|             kunpo.WindowManager.showWindowIm("ToastWindow", { text: "只有原生平台才支持热更新" }) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickLoadBuffer(): void { | ||||
|         let paths: KunpoAssets.IAssetConfig[] = [ | ||||
|             { path: "config/buffer", type: cc.BufferAsset }, | ||||
|         ]; | ||||
|         let loader = new KunpoAssets.AssetLoader("load"); | ||||
|         loader.start({ | ||||
|             configs: paths, | ||||
|             complete: () => { | ||||
|                 kunpo.log("加载成功"); | ||||
|  | ||||
|                 let basic = AssetPool.get<cc.BufferAsset>("config/buffer/basic"); | ||||
|                 kunpo.log("basic", JSON.stringify(kunpo.Binary.toJson(basic.buffer()))); | ||||
|  | ||||
|                 let dict = AssetPool.get<cc.BufferAsset>("config/buffer/dict"); | ||||
|                 kunpo.log("dict", JSON.stringify(kunpo.Binary.toJson(dict.buffer()))); | ||||
|  | ||||
|                 let listDict = AssetPool.get<cc.BufferAsset>("config/buffer/list_dict"); | ||||
|                 kunpo.log("list_dict", JSON.stringify(kunpo.Binary.toJson(listDict.buffer()))); | ||||
|  | ||||
|                 let aaa = { | ||||
|                     a: 1, | ||||
|                     b: 2, | ||||
|                     c: 3, | ||||
|                     d: 4, | ||||
|                     e: 5, | ||||
|                 }; | ||||
|                 kunpo.log("aaa", JSON.stringify(kunpo.Binary.toJson(aaa))); | ||||
|             }, | ||||
|             fail: (msg: string, err: Error) => { | ||||
|                 kunpo.log("加载失败", msg, err); | ||||
|             }, | ||||
|             progress: (percent: number) => { | ||||
|  | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     public getHeaderInfo(): kunpo.WindowHeaderInfo { | ||||
|         return kunpo.WindowHeaderInfo.create("WindowHeader", "aaa"); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/HomeWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/HomeWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "a82b56f3-6cfa-4fd1-a090-44137d7e62d4", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/HotUpdate.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/HotUpdate.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "d1a31574-d301-493b-9a96-b3bfcba60ba9", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										139
									
								
								demo/assets/script/UI/HotUpdate/HotUpdateWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										139
									
								
								demo/assets/script/UI/HotUpdate/HotUpdateWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,139 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-04-18 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { HotUpdateCode, log } from "kunpocc"; | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| import { SDKHelper } from "../../Helper/SDKHelper"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "HotUpdate", "HotUpdateWindow") | ||||
| export class HotUpdateWindow extends kunpo.Window { | ||||
|     @uiprop lab_version: fgui.GTextField = null; | ||||
|     @uiprop lab_desc: fgui.GTextField = null; | ||||
|  | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.HideAll; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         let version = KunpoSDK.SDKHelper.getInstance().getVersionCode() | ||||
|         kunpo.HotUpdateManager.getInstance().init(SDKHelper.manifestUrl, version); | ||||
|         this.lab_version.text = `当前资源版本号:` + kunpo.HotUpdateManager.getInstance().resVersion; | ||||
|  | ||||
|         this.lab_desc.text = "点击检查更新按钮,检查是否有新版本 或者 点击更新按钮,直接更新 hahaha"; | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("CloseAllWindow onClose"); | ||||
|     } | ||||
|  | ||||
|     private refreshTips(tips: string, touchable: boolean = false): void { | ||||
|         this.lab_desc.text = tips; | ||||
|         this.touchable = touchable; | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onCheckUpdate(): void { | ||||
|         this.refreshTips("正在检查更新...  请稍后", false); | ||||
|  | ||||
|         kunpo.HotUpdateManager.getInstance().checkUpdate().then((res: kunpo.ICheckUpdatePromiseResult) => { | ||||
|             kunpo.log("发现热更新:", JSON.stringify(res)); | ||||
|             this.refreshTips(`发现热更新 需更新大小:${Math.floor(res.size / 1024 * 1000) * 0.001}MB`, true); | ||||
|             kunpo.WindowManager.showWindowIm("AlertWindow", { | ||||
|                 title: "提示", | ||||
|                 content: `发现热更新 需更新大小:${Math.floor(res.size / 1024 * 1000) * 0.001}MB`, | ||||
|                 okTitle: "更新", | ||||
|                 cancelTitle: "取消", | ||||
|                 complete: () => { | ||||
|                     this.startUpdate(true); | ||||
|                 }, | ||||
|                 cancel: () => { | ||||
|                     kunpo.log("取消"); | ||||
|                 }, | ||||
|             }); | ||||
|         }).catch((res: any) => { | ||||
|             log("检查热更新出错了", JSON.stringify(res)); | ||||
|             if (res.code == HotUpdateCode.LatestVersion) { | ||||
|                 this.refreshTips(`已经是最新版本了`, true); | ||||
|                 kunpo.WindowManager.showWindowIm("AlertWindow", { | ||||
|                     title: "提示", | ||||
|                     content: `已经是最新版本了`, | ||||
|                     okTitle: "知道了", | ||||
|                 }); | ||||
|             } else { | ||||
|                 this.refreshTips(`出错了 code:${res.code} message:${res.message}`, true); | ||||
|                 kunpo.WindowManager.showWindowIm("AlertWindow", { | ||||
|                     title: "提示", | ||||
|                     content: `出错了 code:${res.code} message:${res.message}`, | ||||
|                     okTitle: "知道了", | ||||
|                 }); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onStartUpdate(): void { | ||||
|         this.startUpdate(false); | ||||
|     } | ||||
|  | ||||
|     private startUpdate(skipCheck: boolean = false): void { | ||||
|         this.refreshTips(`正在更新...  请稍后`, false); | ||||
|  | ||||
|         kunpo.HotUpdateManager.getInstance().startUpdate({ | ||||
|             skipCheck: skipCheck, | ||||
|             progress: (kb: number, total: number) => { | ||||
|                 kunpo.log("热更新进度", kb, total); | ||||
|                 this.refreshTips(`正在更新...  请稍后  ${Math.floor(kb / total * 100)}% `, false); | ||||
|             }, | ||||
|             complete: (code: HotUpdateCode, message: string) => { | ||||
|                 kunpo.log("热更新完成", code, message); | ||||
|                 if (code == HotUpdateCode.LatestVersion) { | ||||
|                     this.refreshTips(`已经是最新版了 不需要更新`, true); | ||||
|                     // 已经是最新版了 | ||||
|                     kunpo.WindowManager.showWindowIm("AlertWindow", { | ||||
|                         title: "提示", | ||||
|                         content: `已经是最新版了 不需要更新`, | ||||
|                         okTitle: "知道了", | ||||
|                     }); | ||||
|                 } else if (code == HotUpdateCode.UpdateFailed) { | ||||
|                     this.refreshTips(`更新失败了 code:${code} message:${message}`, true); | ||||
|                     kunpo.WindowManager.showWindowIm("AlertWindow", { | ||||
|                         title: "提示", | ||||
|                         content: `热更新失败了 是否重试失败的资源 message:${message}`, | ||||
|                         okTitle: "重试", | ||||
|                         cancelTitle: "取消", | ||||
|                         complete: () => { | ||||
|                             kunpo.HotUpdateManager.getInstance().retryUpdate(); | ||||
|                         }, | ||||
|                         cancel: () => { | ||||
|                             kunpo.log("取消"); | ||||
|                         }, | ||||
|                     }); | ||||
|                 } else if (code == HotUpdateCode.LoadVersionFailed || code == HotUpdateCode.ParseVersionFailed) { | ||||
|                     this.refreshTips(`更新失败了 code:${code} message:${message}`, true); | ||||
|                     kunpo.WindowManager.showWindowIm("AlertWindow", { | ||||
|                         title: "提示", | ||||
|                         content: `更新失败了 code:${code} message:${message} 可以选择跳过热更新`, | ||||
|                         okTitle: "知道了", | ||||
|                     }); | ||||
|                 } else { | ||||
|                     this.refreshTips(`更新失败了 code:${code} message:${message}`, true); | ||||
|                     kunpo.WindowManager.showWindowIm("AlertWindow", { | ||||
|                         title: "提示", | ||||
|                         content: `热更新失败了, 根据code的值,看是重启游戏,还是跳过更新 message:${message}`, | ||||
|                         okTitle: "知道了", | ||||
|                     }); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/HotUpdate/HotUpdateWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/HotUpdate/HotUpdateWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "25c11bf0-c7a2-4b27-8172-22a0fba89114", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/MiniGame.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/MiniGame.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "fc664f7f-0b4b-406b-8240-8c6b974b3c38", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										122
									
								
								demo/assets/script/UI/MiniGame/MiniGameWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								demo/assets/script/UI/MiniGame/MiniGameWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,122 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-04-12 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
|  | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| let IsInitAds = false; | ||||
| let AdId = ""; | ||||
|  | ||||
| let IsInitPay = false; | ||||
|  | ||||
| // private static readonly wechat_ads_id: string = "adunit-c9b71a32c0fb3d3d"; | ||||
| // private static readonly byte_ads_id: string = "592b3kadh11b27p317"; | ||||
| // private static readonly aliy_ads_id: string = "ad_tiny_2021004170666283_202410082200196957"; | ||||
|  | ||||
| @uiclass("Window", "MiniGame", "MiniGameWindow") | ||||
| export class MiniGameWindow extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     @uiprop lab_adid: fgui.GTextInput; | ||||
|     @uiprop lab_payQuantity: fgui.GTextInput; | ||||
|  | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.HideAll; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         kunpo.log("MiniGameWindow onShow:", userdata); | ||||
|         this.lab_adid.text = "592b3kadh11b27p317"; | ||||
|  | ||||
|         if (IsInitAds) { | ||||
|             this.lab_adid.text = AdId; | ||||
|             this.lab_adid.touchable = false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("CloseAllWindow onClose"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnInitAds(): void { | ||||
|         if (!IsInitAds) { | ||||
|             if (this.lab_adid.text) { | ||||
|                 kunpo.MiniHelper.ad().init(this.lab_adid.text); | ||||
|                 IsInitAds = true; | ||||
|  | ||||
|                 kunpo.MiniHelper.ad().showAds({ | ||||
|                     success: () => { | ||||
|                         kunpo.log("广告显示成功"); | ||||
|                     }, | ||||
|                     fail: (errCode, errMsg) => { | ||||
|                         kunpo.log("广告显示失败", errCode, errMsg); | ||||
|                     } | ||||
|                 }); | ||||
|             } | ||||
|         } else { | ||||
|             kunpo.MiniHelper.ad().showAds({ | ||||
|                 success: () => { | ||||
|                     kunpo.log("广告显示成功"); | ||||
|                 }, | ||||
|                 fail: (errCode, errMsg) => { | ||||
|                     kunpo.log("广告显示失败", errCode, errMsg); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
|     @uiclick | ||||
|     private onClickBtnPay(): void { | ||||
|         if (!IsInitPay) { | ||||
|             let payQuantity = parseInt(this.lab_payQuantity.text); | ||||
|             if (isNaN(payQuantity) || payQuantity <= 0) { | ||||
|                 kunpo.log("请输入正确的值"); | ||||
|                 return; | ||||
|             } else { | ||||
|                 console.log("初始化支付", payQuantity); | ||||
|                 kunpo.MiniHelper.pay().init("1450135093", payQuantity); | ||||
|                 IsInitPay = true; | ||||
|             } | ||||
|             kunpo.MiniHelper.pay().pay({ | ||||
|                 rmb: 1, | ||||
|                 orderId: `order_${kunpo.Time.now()}`, | ||||
|                 shopId: "1234", | ||||
|                 shopName: "测试商品", | ||||
|                 extraInfo: { | ||||
|                     "test": "test" | ||||
|                 }, | ||||
|                 success: () => { | ||||
|                     kunpo.log("支付调用成功"); | ||||
|                 }, | ||||
|                 fail: (res) => { | ||||
|                     kunpo.log("支付调用失败", res.errCode, res.errMsg); | ||||
|                 } | ||||
|             }); | ||||
|         } else { | ||||
|             kunpo.MiniHelper.pay().pay({ | ||||
|                 rmb: 1, | ||||
|                 orderId: kunpo.Time.now() + "", | ||||
|                 shopId: "1234", | ||||
|                 shopName: "测试商品", | ||||
|                 extraInfo: { | ||||
|                     "test": "test" | ||||
|                 }, | ||||
|                 success: () => { | ||||
|                     kunpo.log("支付调用成功"); | ||||
|                 }, | ||||
|                 fail: (res) => { | ||||
|                     kunpo.log("支付调用失败", res.errCode, res.errMsg); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/MiniGame/MiniGameWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/MiniGame/MiniGameWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "1b9f360b-3ad4-4eb1-9092-1fdab6270a16", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/PopWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/PopWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "5377ee34-e10a-4312-9e6e-d4c3e242a880", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/PopWindowHeader1.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/PopWindowHeader1.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "a7ecfd55-c16b-4dbf-9451-e11dd2bbdb40", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/PopWindowHeader2.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/PopWindowHeader2.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "d2f063c7-ff7e-44c7-85bb-9ca5f4f452e4", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Socket.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Socket.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "dd0d6cdf-59a4-446e-840b-ddd9c17db824", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										83
									
								
								demo/assets/script/UI/Socket/SocketTestWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								demo/assets/script/UI/Socket/SocketTestWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-03-29 | ||||
|  * @Description:  | ||||
|  */ | ||||
| import { Socket } from "kunpocc-net"; | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| import { ProtoInfos } from "../../Socket/ProtoInfos"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Socket", "SocketTestWindow") | ||||
| export class SocketTestWindow extends kunpo.Window { | ||||
|     @uiprop private text_input: fgui.GTextInput; | ||||
|     @uiprop private text_input_message: fgui.GTextInput; | ||||
|  | ||||
|     private _status: fgui.Controller; | ||||
|     private socket: Socket; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.Normal; | ||||
|  | ||||
|         this._status = this.getController("status"); | ||||
|  | ||||
|         this.text_input.text = "ws://10.8.36.142:8080"; | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onCloseWindow(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onConnection(): void { | ||||
|         if (this.socket) { | ||||
|             kunpo.WindowManager.showWindowIm("ToastWindow", { text: "已经存在一个连接" }); | ||||
|             return; | ||||
|         } | ||||
|         this.socket = new Socket(this.text_input.text, { binaryType: "arraybuffer" }); | ||||
|         this.socket.onopen = () => { | ||||
|             kunpo.log("连接成功"); | ||||
|             kunpo.WindowManager.showWindowIm("ToastWindow", { text: "连接成功" }); | ||||
|             this._status.setSelectedIndex(1); | ||||
|         } | ||||
|         this.socket.onmessage = (data: any) => { | ||||
|             kunpo.log("收到消息", data); | ||||
|         } | ||||
|  | ||||
|         this.socket.onclose = (code: number, reason: string) => { | ||||
|             kunpo.log("连接关闭", code, reason); | ||||
|             this._status.setSelectedIndex(0); | ||||
|             kunpo.WindowManager.showWindowIm("ToastWindow", { text: `连接断开 code:${code} reason:${reason}` }); | ||||
|             this.socket = null; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onDisconnect(): void { | ||||
|         this.socket?.close(3001, "主动断开"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onSendText(): void { | ||||
|         if (!this.text_input_message.text) { | ||||
|             kunpo.WindowManager.showWindowIm("ToastWindow", { text: "请输入要发送的消息" }); | ||||
|             return; | ||||
|         } | ||||
|         this.socket?.send(this.text_input_message.text); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 发送二进制这里使用 protobuf | ||||
|      */ | ||||
|     @uiclick | ||||
|     private onSendBinary(): void { | ||||
|         if (!this.text_input_message.text) { | ||||
|             kunpo.WindowManager.showWindowIm("ToastWindow", { text: "请输入要发送的消息" }); | ||||
|             return; | ||||
|         } | ||||
|         let protoInfos = new ProtoInfos(); | ||||
|         let buffer = protoInfos.encodeData(1, this.text_input_message.text); | ||||
|         this.socket?.sendBuffer(buffer); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Socket/SocketTestWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Socket/SocketTestWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "bf8b0dec-aa56-401f-bec1-f9200ac1042d", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/SocketTestWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/SocketTestWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.23", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "f4e808a7-37da-486d-b371-35f2d4f4918b", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "151a2b6f-f082-4e0f-bf54-718c31f777af", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										49
									
								
								demo/assets/script/UI/Window/CloseAllWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								demo/assets/script/UI/Window/CloseAllWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2024-12-21 | ||||
|  * @Description:  | ||||
|  */ | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "CloseAllWindow") | ||||
| export class CloseAllWindow extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.CloseAll; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         kunpo.log("CloseAllWindow onShow:", userdata); | ||||
|     } | ||||
|  | ||||
|     protected onHide(): void { | ||||
|         kunpo.log("CloseAllWindow onHide"); | ||||
|     } | ||||
|  | ||||
|     protected onCover(): void { | ||||
|         kunpo.log("CloseAllWindow onCover"); | ||||
|     } | ||||
|  | ||||
|     protected onRecover(): void { | ||||
|         kunpo.log("CloseAllWindow onRecover"); | ||||
|     } | ||||
|  | ||||
|     protected onShowFromHide(): void { | ||||
|         kunpo.log("CloseAllWindow onShowFromHide"); | ||||
|     } | ||||
|  | ||||
|     protected onEmptyAreaClick(): void { | ||||
|         kunpo.log("CloseAllWindow 点击空白区域"); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("CloseAllWindow onClose"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/CloseAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/CloseAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "323b9ed8-0b74-4c65-99d4-a9e46e33cd6a", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										50
									
								
								demo/assets/script/UI/Window/CloseOneWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								demo/assets/script/UI/Window/CloseOneWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2024-12-21 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "CloseOneWindow") | ||||
| export class CloseOneWindow extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.CloseOne; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         kunpo.log("CloseOneWindow onShow:", userdata); | ||||
|     } | ||||
|  | ||||
|     protected onHide(): void { | ||||
|         kunpo.log("CloseOneWindow onHide"); | ||||
|     } | ||||
|  | ||||
|     protected onCover(): void { | ||||
|         kunpo.log("CloseOneWindow onCover"); | ||||
|     } | ||||
|  | ||||
|     protected onRecover(): void { | ||||
|         kunpo.log("CloseOneWindow onRecover"); | ||||
|     } | ||||
|  | ||||
|     protected onShowFromHide(): void { | ||||
|         kunpo.log("CloseOneWindow onShowFromHide"); | ||||
|     } | ||||
|  | ||||
|     protected onEmptyAreaClick(): void { | ||||
|         kunpo.log("CloseOneWindow 点击空白区域"); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("CloseOneWindow onClose"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/CloseOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/CloseOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "f107c3dc-ff92-4b78-8384-b8908fa51bd8", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/Components.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/Components.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "1.2.0", | ||||
|   "importer": "directory", | ||||
|   "imported": true, | ||||
|   "uuid": "179bd030-c5da-4803-a8aa-999bc7106a35", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										17
									
								
								demo/assets/script/UI/Window/Components/CustomComponents.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								demo/assets/script/UI/Window/Components/CustomComponents.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2024-12-26 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { fgui, kunpo } from "../../../header"; | ||||
| const { uiheader, uiprop, uicom, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uicom("Window", "CustomComponents") | ||||
| export class CustomComponents extends fgui.GComponent { | ||||
|     @uiprop n1: fgui.GTextField; | ||||
|  | ||||
|     public onInit(): void { | ||||
|         kunpo.log("CustomComponents onInit"); | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "a8d4cfe1-8b55-4d01-8a17-fddb82a3c035", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										49
									
								
								demo/assets/script/UI/Window/HideAllWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								demo/assets/script/UI/Window/HideAllWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,49 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2024-12-21 | ||||
|  * @Description:  | ||||
|  */ | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "HideAllWindow") | ||||
| export class HideAllWindow extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.HideAll; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         kunpo.log("HideAllWindow onShow:", userdata); | ||||
|     } | ||||
|  | ||||
|     protected onHide(): void { | ||||
|         kunpo.log("HideAllWindow onHide"); | ||||
|     } | ||||
|  | ||||
|     protected onCover(): void { | ||||
|         kunpo.log("HideAllWindow onCover"); | ||||
|     } | ||||
|  | ||||
|     protected onRecover(): void { | ||||
|         kunpo.log("HideAllWindow onRecover"); | ||||
|     } | ||||
|  | ||||
|     protected onShowFromHide(): void { | ||||
|         kunpo.log("HideAllWindow onShowFromHide"); | ||||
|     } | ||||
|  | ||||
|     protected onEmptyAreaClick(): void { | ||||
|         kunpo.log("HideAllWindow 点击空白区域"); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("HideAllWindow onClose"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/HideAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/HideAllWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "c9f63827-cffb-45c8-9bde-6580385ef829", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										50
									
								
								demo/assets/script/UI/Window/HideOneWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								demo/assets/script/UI/Window/HideOneWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2024-12-21 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "HideOneWindow") | ||||
| export class HideOneWindow extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.HideOne; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         kunpo.log("HideOneWindow onShow:", userdata); | ||||
|     } | ||||
|  | ||||
|     protected onHide(): void { | ||||
|         kunpo.log("HideOneWindow onHide"); | ||||
|     } | ||||
|  | ||||
|     protected onCover(): void { | ||||
|         kunpo.log("HideOneWindow onCover"); | ||||
|     } | ||||
|  | ||||
|     protected onRecover(): void { | ||||
|         kunpo.log("HideOneWindow onRecover"); | ||||
|     } | ||||
|  | ||||
|     protected onShowFromHide(): void { | ||||
|         kunpo.log("HideOneWindow onShowFromHide"); | ||||
|     } | ||||
|  | ||||
|     protected onEmptyAreaClick(): void { | ||||
|         kunpo.log("HideOneWindow 点击空白区域"); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("HideOneWindow onClose"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/HideOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/HideOneWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "3735a1a5-aa89-42a5-b71d-07b405970080", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										22
									
								
								demo/assets/script/UI/Window/PopWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								demo/assets/script/UI/Window/PopWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-01-12 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "PopWindow") | ||||
| export class PopWindow extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.Normal; | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onCloseWindow(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/PopWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/PopWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "3f040196-71f3-4af5-af01-ca1c2ed874b8", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										26
									
								
								demo/assets/script/UI/Window/PopWindowHeader1.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								demo/assets/script/UI/Window/PopWindowHeader1.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2024-12-14 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "PopWindowHeader1") | ||||
| export class PopWindowHeader1 extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.Normal; | ||||
|     } | ||||
|  | ||||
|     getHeaderInfo(): kunpo.WindowHeaderInfo { | ||||
|         return kunpo.WindowHeaderInfo.create("WindowHeader", "aaa"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onCloseWindow(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/PopWindowHeader1.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/PopWindowHeader1.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "0760d294-bd0b-4749-b644-0cfe78c3e5d9", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										26
									
								
								demo/assets/script/UI/Window/PopWindowHeader2.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								demo/assets/script/UI/Window/PopWindowHeader2.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-01-12 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { fgui, kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "PopWindowHeader2") | ||||
| export class PopWindowHeader2 extends kunpo.Window { | ||||
|     @uiprop btn_close: fgui.GButton; | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.Normal; | ||||
|     } | ||||
|  | ||||
|     getHeaderInfo(): kunpo.WindowHeaderInfo { | ||||
|         return kunpo.WindowHeaderInfo.create("WindowHeader2", "aaa"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onCloseWindow(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/PopWindowHeader2.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/PopWindowHeader2.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "28191db1-d974-4911-9fe5-2104cfc45050", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
							
								
								
									
										88
									
								
								demo/assets/script/UI/Window/UIBaseWindow.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								demo/assets/script/UI/Window/UIBaseWindow.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| /** | ||||
|  * @Author: Gongxh | ||||
|  * @Date: 2025-04-19 | ||||
|  * @Description:  | ||||
|  */ | ||||
|  | ||||
| import { kunpo } from "../../header"; | ||||
| const { uiclass, uiprop, uiclick } = kunpo._uidecorator; | ||||
|  | ||||
| @uiclass("Window", "Window", "UIBaseWindow") | ||||
| export class UIBaseWindow extends kunpo.Window { | ||||
|     protected onInit(): void { | ||||
|         this.adapterType = kunpo.AdapterType.Bang; | ||||
|         this.type = kunpo.WindowType.HideAll; | ||||
|     } | ||||
|  | ||||
|     protected onShow(userdata?: any): void { | ||||
|         kunpo.log("UIBaseWindow onShow:", userdata); | ||||
|     } | ||||
|  | ||||
|     protected onHide(): void { | ||||
|         kunpo.log("UIBaseWindow onHide"); | ||||
|     } | ||||
|  | ||||
|     protected onCover(): void { | ||||
|         kunpo.log("UIBaseWindow onCover"); | ||||
|     } | ||||
|  | ||||
|     protected onRecover(): void { | ||||
|         kunpo.log("UIBaseWindow onRecover"); | ||||
|     } | ||||
|  | ||||
|     protected onShowFromHide(): void { | ||||
|         kunpo.log("UIBaseWindow onShowFromHide"); | ||||
|     } | ||||
|  | ||||
|     protected onEmptyAreaClick(): void { | ||||
|         kunpo.log("UIBaseWindow 点击空白区域"); | ||||
|     } | ||||
|  | ||||
|     protected onClose(): void { | ||||
|         kunpo.log("UIBaseWindow onClose"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnClose(): void { | ||||
|         kunpo.WindowManager.closeWindow(this.name); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnHeader1(): void { | ||||
|         kunpo.WindowManager.showWindow("PopWindowHeader1"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnHeader2(): void { | ||||
|         kunpo.WindowManager.showWindow("PopWindowHeader2"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnEmpty(): void { | ||||
|         kunpo.WindowManager.showWindow("PopWindow"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCloseOne(): void { | ||||
|         kunpo.WindowManager.showWindow("CloseOneWindow"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnCloseAll(): void { | ||||
|         kunpo.WindowManager.showWindow("CloseAllWindow"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnHideOne(): void { | ||||
|         kunpo.WindowManager.showWindow("HideOneWindow"); | ||||
|     } | ||||
|  | ||||
|     @uiclick | ||||
|     private onClickBtnHideAll(): void { | ||||
|         kunpo.WindowManager.showWindow("HideAllWindow"); | ||||
|     } | ||||
|  | ||||
|     public getHeaderInfo(): kunpo.WindowHeaderInfo { | ||||
|         return kunpo.WindowHeaderInfo.create("WindowHeader", "aaa"); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										9
									
								
								demo/assets/script/UI/Window/UIBaseWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								demo/assets/script/UI/Window/UIBaseWindow.ts.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| { | ||||
|   "ver": "4.0.24", | ||||
|   "importer": "typescript", | ||||
|   "imported": true, | ||||
|   "uuid": "95f0b543-53f1-416e-a789-d1cc9de0e2a8", | ||||
|   "files": [], | ||||
|   "subMetas": {}, | ||||
|   "userData": {} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user