模拟数据:技师的简要数据

This commit is contained in:
chen wei bo
2025-09-02 16:38:38 +08:00
parent cf32944f64
commit 29554bb0c8
4 changed files with 88 additions and 27 deletions
+19 -11
View File
@@ -7,6 +7,8 @@ import { NavigationManager } from "../manager/NavigationManager";
import { Girl, PriceType } from "../../schema/schema";
import LanguageUtils from "../../Main/Common/LanguageUtils";
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData";
const { ccclass, property } = _decorator;
@@ -33,6 +35,7 @@ export class GirlListItem extends Component {
nameKey: string;
tagKey: string;
category: number;
private onLanguageChangeCallback = () => {
if (!this.girlName || !this.tags) return;
@@ -64,26 +67,31 @@ export class GirlListItem extends Component {
}
baseNode: Node;
refreshData(data: Girl, baseNode: Node) {
refreshData(category: number, girlId: number, baseNode: Node) {
this.category = category;
this.baseNode = baseNode;
this.id = data.id;
this.nameKey = data.nameKey;
this.girlName.string = LanguageUtils.getText(data.nameKey);
this.tagKey = data.tagKey;
this.id = girlId;
// 数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
this.nameKey = girlData.getGrilName(this.category.toString(), this.id);
this.girlName.string = LanguageUtils.getText(this.nameKey);
this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id);
let desc = "";
const tags = LanguageUtils.getText(data.tagKey).split("|");
const tags = LanguageUtils.getText(this.tagKey).split("|");
for (let i = 0; i < tags.length; i++) {
if (i != 0) desc += "|";
desc += tags[i];
}
this.tags.string = desc;
this.price.node.active = data.priceType == PriceType.pay;
this.freeNode.active = data.priceType == PriceType.free;
this.tryNode.active = data.priceType == PriceType.first_time_free;
let priceType = girlData.getGrilPriceType(this.category.toString(), this.id);
this.price.node.active = priceType == PriceType.pay;
this.freeNode.active = priceType == PriceType.free;
this.tryNode.active = priceType == PriceType.first_time_free;
// TODO,先用 AvatarPath 代替着 listAvatarPath
let listAvatarPath = girlData.getGrilAvatar(this.category.toString(), this.id);
ResManager.I.changeBundleSpriteFrame(
this.avatar,
data.listAvatarPath,
listAvatarPath,
"Chat18x",
() => {
let sizeTran = this.avatar.node.parent.getComponent(UITransform);