模拟数据:技师的详细数据
This commit is contained in:
@@ -135,7 +135,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
}
|
||||
nameKey: string;
|
||||
tagKey: string;
|
||||
category;
|
||||
category: number;
|
||||
async refresh(index: number) {
|
||||
// TODO,暂时这样获取,修改后从GirlData获取
|
||||
const girlConfig = ConfigManager.tables.TbGirls.get(this.id);
|
||||
@@ -144,109 +144,71 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
const reqData = {
|
||||
id: this.id,
|
||||
};
|
||||
// let res = await GirlService.I.reqGetGirlDetail(reqData);
|
||||
// console.log("看看响应数据:", res);
|
||||
// if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||
// // 保存数据
|
||||
// const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
// girlData.setGirlDetails(this.category.toString(), res.data);
|
||||
// // 根据数据,刷新界面
|
||||
// this.nameKey = girlData.getGrilName(this.category, this.id);
|
||||
// this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
// this.desc.string = girlData.getGrilDesc(this.category, this.id);
|
||||
let res = await GirlService.I.reqGetGirlDetail(reqData);
|
||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||
// 保存数据
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
girlData.setGirlDetails(this.category.toString(), res.data);
|
||||
// 根据数据,刷新界面
|
||||
this.nameKey = girlData.getGrilName(this.category.toString(), this.id);
|
||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
this.desc.string = girlData.getGrilDesc(this.category.toString(), this.id);
|
||||
|
||||
// let desc = "";
|
||||
// this.tagKey = girlData.getGrilTagKey(this.category, this.id);
|
||||
// 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;
|
||||
// for (let i = 0; i < 5; i++) {
|
||||
// this.starParent.children[i].active = i < 5;
|
||||
// }
|
||||
// let age = girlData.getGrilAge(this.category, this.id);
|
||||
// this.descAge.string =
|
||||
// LanguageUtils.getText("girldetailpanel.age") + age.toString();
|
||||
let desc = "";
|
||||
this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id);
|
||||
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;
|
||||
for (let i = 0; i < 5; i++) {
|
||||
this.starParent.children[i].active = i < 5;
|
||||
}
|
||||
let age = girlData.getGrilAge(this.category.toString(), this.id);
|
||||
this.descAge.string =
|
||||
LanguageUtils.getText("girldetailpanel.age") + age.toString();
|
||||
|
||||
// // TODO
|
||||
// const dataDetail = ConfigManager.tables.TbGirlsDetail.get(this.id);
|
||||
const firstPath = girlData.getGrilVideoPath(this.category.toString(), this.id, 0);
|
||||
ResManager.I.changeBundleVideo(
|
||||
this.avatarVideo,
|
||||
firstPath,
|
||||
"Chat18x"
|
||||
);
|
||||
|
||||
// ResManager.I.changeBundleVideo(
|
||||
// this.avatarVideo,
|
||||
// dataDetail.commercialVideos[0].path,
|
||||
// "Chat18x"
|
||||
// );
|
||||
|
||||
// // 也立即尝试调整(以防已经加载完成)
|
||||
// this.adjustVideoScale();
|
||||
// this.vids = dataDetail.commercialVideos.slice(0);
|
||||
// this.refreshImgs(dataDetail.commercialImages);
|
||||
|
||||
|
||||
// }
|
||||
|
||||
|
||||
const dataDetail = ConfigManager.tables.TbGirlsDetail.get(this.id);
|
||||
console.log(dataDetail);
|
||||
|
||||
const data = ConfigManager.tables.TbGirls.get(this.id);
|
||||
this.nameKey = data.nameKey;
|
||||
this.girlName.string = LanguageUtils.getText(data.nameKey);
|
||||
|
||||
this.desc.string = dataDetail.detailDesc;
|
||||
let desc = "";
|
||||
this.tagKey = data.tagKey;
|
||||
const tags = LanguageUtils.getText(data.tagKey).split("|");
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
if (i != 0) desc += "|";
|
||||
desc += tags[i];
|
||||
}
|
||||
this.tags.string = desc;
|
||||
for (let i = 0; i < 5; i++) {
|
||||
this.starParent.children[i].active = i < 5;
|
||||
}
|
||||
this.descAge.string =
|
||||
LanguageUtils.getText("girldetailpanel.age") + data.age.toString();
|
||||
this.desc.string = dataDetail.detailDesc;
|
||||
|
||||
ResManager.I.changeBundleVideo(
|
||||
this.avatarVideo,
|
||||
dataDetail.commercialVideos[0].path,
|
||||
"Chat18x"
|
||||
);
|
||||
|
||||
// 也立即尝试调整(以防已经加载完成)
|
||||
this.adjustVideoScale();
|
||||
this.vids = dataDetail.commercialVideos.slice(0);
|
||||
this.refreshImgs(dataDetail.commercialImages);
|
||||
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(this.category.toString(), this.id);
|
||||
// 也立即尝试调整(以防已经加载完成)
|
||||
this.adjustVideoScale();
|
||||
this.refreshImgs(1, this.category, this.id, allPhotoDataCount);
|
||||
}
|
||||
}
|
||||
|
||||
vids: purchase.CommercialVideo[];
|
||||
bindImgToggle() {
|
||||
const dataDetail = ConfigManager.tables.TbGirlsDetail.get(this.id);
|
||||
const images = dataDetail.commercialImages;
|
||||
|
||||
this.refreshImgs(images);
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(this.category.toString(), this.id);
|
||||
this.refreshImgs(1, this.category, this.id, allPhotoDataCount);
|
||||
}
|
||||
|
||||
bindVideoToggle() {
|
||||
this.refreshImgs(this.vids);
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let allVideoDataCount = girlData.getAllGrilVideoDataCount(this.category.toString(), this.id);
|
||||
this.refreshImgs(2, this.category, this.id, allVideoDataCount);
|
||||
}
|
||||
|
||||
refreshImgs(
|
||||
resouces: purchase.CommercialImage[] | purchase.CommercialVideo[]
|
||||
type: number,
|
||||
category: number,
|
||||
id: number,
|
||||
count: number
|
||||
) {
|
||||
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
|
||||
this.imgsLayout.children[i].destroy();
|
||||
}
|
||||
|
||||
for (let i = 1; i < resouces.length; i++) {
|
||||
const resource = resouces[i];
|
||||
for (let i = 0; i < count; i++) {
|
||||
let newNode = instantiate(this.imgItemInst.node);
|
||||
let item = newNode.getComponent(DetailImageItem);
|
||||
item.refresh(resource, this);
|
||||
item.refresh(this, type, category, id, i);
|
||||
newNode.active = true;
|
||||
this.imgsLayout.addChild(newNode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user