mirror of
https://gitee.com/dgflash/oops-plugin-framework.git
synced 2026-09-03 04:03:46 +08:00
2. TimeUtili添加将秒数格式化为时间格式 3. 修复时间管理从后台恢复时计算错误问题 4. 修复DateExt时间格式化转化错误问题 5. 修复StorageSecuritySimple在真机上解码错误问题 6. 修复音效循环播放功能无效问题 7. 优化加载模块 8. 优化CCEntity.addUi错误提示信息 9. CommonPrompt对象修改为PromptBase,并优化代码,适合继承使用
89 lines
2.6 KiB
TypeScript
89 lines
2.6 KiB
TypeScript
import { _decorator } from "cc";
|
|
import { GameComponent } from "db://oops-framework/module/common/GameComponent";
|
|
import { LanguageLabel } from "../language/LanguageLabel";
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
/**
|
|
* 基础提示窗口
|
|
* 1. 自定义提示标题、按钮名
|
|
* 2. 自定义确认、取消事件回调
|
|
* 3. 自定义提示内容
|
|
* 4. 支持文本多语言
|
|
*/
|
|
@ccclass("PromptBase")
|
|
export class PromptBase extends GameComponent {
|
|
/** 窗口标题多语言组件 */
|
|
@property(LanguageLabel)
|
|
private labTitle: LanguageLabel = null!;
|
|
|
|
/** 提示内容多语言组件 */
|
|
@property(LanguageLabel)
|
|
private labContent: LanguageLabel = null!;
|
|
|
|
/** 确认按钮文本多语言组件 */
|
|
@property(LanguageLabel)
|
|
private labOk: LanguageLabel = null!;
|
|
|
|
/** 取消按钮文本多语言组件 */
|
|
@property(LanguageLabel)
|
|
private labCancel: LanguageLabel = null!;
|
|
|
|
/** 窗口配置 */
|
|
protected config: any = null!;
|
|
|
|
/**
|
|
* 窗口打开事件
|
|
* @param params 参数
|
|
* {
|
|
* title: 标题
|
|
* content: 内容
|
|
* okWord: ok按钮上的文字
|
|
* okFunc: 确认时执行的方法
|
|
* cancelWord: 取消按钮的文字
|
|
* cancelFunc: 取消时执行的方法
|
|
* needCancel: 是否需要取消按钮
|
|
* }
|
|
*/
|
|
onAdded(params: any): boolean {
|
|
this.config = params;
|
|
if (this.config == null) return false;
|
|
|
|
this.labTitle.dataID = this.config.title; // 窗口标题
|
|
this.labContent.dataID = this.config.content; // 提示内容
|
|
this.labOk.dataID = this.config.okWord; // 确定按钮文字
|
|
if (this.labCancel) {
|
|
this.labCancel.dataID = this.config.cancelWord || ""; // 取消按钮文字
|
|
this.labCancel.node.parent!.active = this.config.needCancel || false;
|
|
}
|
|
this.node.active = true;
|
|
return true;
|
|
}
|
|
|
|
protected onLoad(): void {
|
|
this.setButton();
|
|
}
|
|
|
|
private btnOk() {
|
|
if (typeof this.config.onOk == "function") {
|
|
this.config.onOk();
|
|
}
|
|
this.remove();
|
|
}
|
|
|
|
private btnCancel() {
|
|
if (typeof this.config.onCancel == "function") {
|
|
this.config.onCancel();
|
|
}
|
|
this.remove();
|
|
}
|
|
|
|
private btnClose() {
|
|
this.remove();
|
|
}
|
|
|
|
onDestroy() {
|
|
this.config = null!;
|
|
super.onDestroy();
|
|
}
|
|
} |