宠物上阵

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-16 02:44:43 +08:00
parent 391ce959cb
commit 1683ec01a0
27 changed files with 5227 additions and 187 deletions

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "a4864ef2-ad5e-48a7-8882-e5c04a634d81",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,93 @@
import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
import { Label } from 'cc';
import { Button } from 'cc';
import { app } from '../../../App';
const { ccclass, property } = _decorator;
export interface SelectionBoxInfo{
cancelText?:string, //取消按钮文字
cancel?:Function, //取消事件
confirmText?:string, //确认按钮文字
confirm?:Function, //确认事件
isHideMake?:boolean, //是否隐藏遮罩
isMaskClose?:boolean, //是否点击遮罩关闭
tigText?:string, //提示内容
titleText?:string, //标题内容
}
@ccclass('SelectionBox')
export class SelectionBox extends JNLayerBase {
//标题
@property(Label)
titleLabel:Label;
//提示文字
@property(Label)
tigLabel:Label;
//取消按钮
@property(Button)
cancalBtn:Button;
//确认按钮
@property(Button)
confirmBtn:Button;
//按钮列表
@property(Node)
btns:Node;
data:SelectionBoxInfo;
onJNLoad(data?: SelectionBoxInfo): void {
this.data = data;
//默认不可以
data.isMaskClose = !!data.isMaskClose;
data.tigText = data.tigText || "这是一个提示选择框";
data.titleText = data.titleText || "标 题";
data.cancelText = data.cancelText || "取 消";
data.confirmText = data.confirmText || "确 认";
this.mask = !data.isHideMake;
this.isClickMaskeClose = data.isMaskClose;
this.tigLabel.string = data.tigText;
this.titleLabel.string = data.titleText;
//没有事件则不显示
this.cancalBtn.node.active = !!data.cancel;
this.confirmBtn.node.active = !!data.confirm;
//显示按钮文字
this.cancalBtn.getComponentInChildren(Label).string = data.cancelText;
this.confirmBtn.getComponentInChildren(Label).string = data.confirmText;
//如果都没有则隐藏按钮列表
if(!data.cancel && data.confirm)
this.btns.active = false;
super.onJNLoad();
}
//点击确认
async onClickConfirm(){
this.data.confirm && await this.data.confirm();
//关闭页面
app.layer.CloseNode(this.node);
}
//点击取消
async onClickCancel(){
this.data.cancel && await this.data.cancel();
//关闭页面
app.layer.CloseNode(this.node);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "637d2a9d-964e-41f2-b96b-2bfd7e7dc686",
"files": [],
"subMetas": {},
"userData": {}
}