73 lines
1.7 KiB
TypeScript
73 lines
1.7 KiB
TypeScript
import { _decorator, Component, Label, Node, Sprite } from "cc";
|
|
import { DemoManager } from "./DemoManager";
|
|
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
|
|
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
|
|
import {characters, girlDetailInfo} from "db://assets/Scripts/Main/Config/cfg/characters";
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass("GirlDetailPanel")
|
|
export class GirlDetailPanel extends li_BaseView {
|
|
@property(Sprite)
|
|
avatar: Sprite;
|
|
@property(Label)
|
|
girlName: Label;
|
|
|
|
@property(Node)
|
|
starParent: Node;
|
|
|
|
@property(Label)
|
|
tags: Label;
|
|
|
|
@property(Label)
|
|
descName: Label;
|
|
@property(Label)
|
|
descAge: Label;
|
|
@property(Label)
|
|
desc: Label;
|
|
|
|
@property(Node)
|
|
chatBtn: Node;
|
|
id = 0;
|
|
|
|
openUIDataCT(data)
|
|
{
|
|
this.id = data;
|
|
}
|
|
|
|
onLoadCT() {
|
|
super.onLoadCT();
|
|
this.refresh(this.id);
|
|
|
|
}
|
|
|
|
refresh(index:number)
|
|
{
|
|
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;
|
|
}
|
|
OnClickChatBtn() {
|
|
DemoManager.getInstance().EnterChat(this.id);
|
|
this.onClose();
|
|
}
|
|
|
|
returnBtn()
|
|
{
|
|
this.onClose();
|
|
//ViewManager.I.openBundlesView("GirlListPanel");
|
|
}
|
|
}
|