Files
18xchat/assets/Scripts/test/GirlDetailPanel.ts
T

73 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-07-22 16:43:10 +08:00
import { _decorator, Component, Label, Node, Sprite } from "cc";
import { DemoManager } from "./DemoManager";
2025-07-25 18:27:30 +08:00
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
2025-07-30 21:52:26 +08:00
import {characters, girlDetailInfo} from "db://assets/Scripts/Main/Config/cfg/characters";
2025-07-22 16:43:10 +08:00
const { ccclass, property } = _decorator;
@ccclass("GirlDetailPanel")
2025-07-25 18:27:30 +08:00
export class GirlDetailPanel extends li_BaseView {
2025-07-22 16:43:10 +08:00
@property(Sprite)
avatar: Sprite;
@property(Label)
girlName: Label;
2025-07-30 21:52:26 +08:00
@property(Node)
starParent: Node;
@property(Label)
tags: Label;
@property(Label)
descName: Label;
@property(Label)
descAge: Label;
2025-07-22 16:43:10 +08:00
@property(Label)
desc: Label;
@property(Node)
chatBtn: Node;
id = 0;
2025-07-25 15:20:02 +08:00
2025-07-25 18:27:30 +08:00
openUIDataCT(data)
{
this.id = data;
2025-07-30 21:52:26 +08:00
}
onLoadCT() {
super.onLoadCT();
2025-07-25 18:27:30 +08:00
this.refresh(this.id);
2025-07-30 21:52:26 +08:00
2025-07-25 18:27:30 +08:00
}
2025-07-25 15:20:02 +08:00
refresh(index:number)
{
2025-07-30 21:52:26 +08:00
console.log(index);
const data = girlDetailInfo.find(v=>v.baseInfo.id === index);
this.girlName.string=this.descName.string = data.baseInfo.name;
this.desc.string = data.detailDesc;
let desc = '';
for (let i = 0; i < data.baseInfo.tag.length; i++) {
desc += data.baseInfo.tag[i]+"/";
}
this.tags.string = desc;
for (let i = 0; i <5; i++) {
this.starParent.children[i].active =(i<data.baseInfo.starCount);
}
this.descAge.string = data.baseInfo.age.toString();
this.desc.string = data.detailDesc;
this.id = data.baseInfo.id;
2025-07-22 16:43:10 +08:00
}
OnClickChatBtn() {
DemoManager.getInstance().EnterChat(this.id);
2025-07-25 18:27:30 +08:00
this.onClose();
}
returnBtn()
{
this.onClose();
//ViewManager.I.openBundlesView("GirlListPanel");
2025-07-22 16:43:10 +08:00
}
}