Merge branch 'main' of 47.107.44.202:xionglijia/18xchat

# Conflicts:
#	assets/Scripts/Sub/UI/PreloadUI.ts
#	assets/Scripts/chat18x/ui/panels/GirlDetailPanel.ts
#	assets/Scripts/chat18x/uiitems/DetailImageItem.ts
This commit is contained in:
2025-09-09 14:50:51 +08:00
70 changed files with 15763 additions and 6106 deletions
@@ -19,12 +19,14 @@ import { SimpleToggle } from "../components/SimpleToggle";
import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import proto from 'db://assets/Scripts/proto/proto.pb.js';
const { ccclass, property } = _decorator;
@ccclass("GirlDetailPanel")
export class GirlDetailPanel extends li_BaseView {
@property(Sprite)
avatar: Sprite;
@property(VideoPlayer)
avatarVideo: VideoPlayer;
@property(Label)
@@ -107,7 +109,7 @@ export class GirlDetailPanel extends li_BaseView {
const videoTransform = this.avatarVideo.node.getComponent(UITransform);
if (parentTransform && videoTransform && videoTransform.height > 0) {
const scale = parentTransform.width / videoTransform.width;
const scale = parentTransform.height / videoTransform.height;
this.avatarVideo.node.setScale(scale, scale, 1);
console.log(
`Video scaled to: ${scale}, parent height: ${parentTransform.height}, video height: ${videoTransform.height}`
@@ -143,14 +145,11 @@ export class GirlDetailPanel extends li_BaseView {
let res = await GirlService.I.reqGetGirlDetail(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
// 保存数据
girlData.setGirlDetails(this.category.toString(), res.data);
girlData.setGirlDetailData(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
);
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.toString(), this.id);
@@ -166,51 +165,49 @@ export class GirlDetailPanel extends li_BaseView {
let age = girlData.getGrilAge(this.category.toString(), this.id);
this.descAge.string =
LanguageUtils.getText("girldetailpanel.age") + age.toString();
const firstPath = girlData.getGrilVideoPath(
this.category.toString(),
this.id,
0
const firstPath = girlData.getFirstGrilVideoPath(this.category.toString(), this.id);
ResManager.I.changeBundleVideo(
this.avatarVideo,
firstPath,
"Chat18x"
);
ResManager.I.changeBundleVideo(this.avatarVideo, firstPath, "Chat18x");
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(
this.category.toString(),
this.id
);
let resIds = girlData.getAllGrilPhotoDataId(this.category.toString(), this.id);
// 也立即尝试调整(以防已经加载完成)
this.adjustVideoScale();
this.refreshImgs(1, this.category, this.id, allPhotoDataCount);
}
this.refreshImgs(1, this.category, this.id, resIds);
}
}
bindImgToggle() {
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);
let resIds = girlData.getAllGrilPhotoDataId(this.category.toString(), this.id);
this.refreshImgs(1, this.category, this.id, resIds);
}
bindVideoToggle() {
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);
let resIds = girlData.getAllGrilVideoDataId(this.category.toString(), this.id);
this.refreshImgs(2, this.category, this.id, resIds);
}
refreshImgs(type: number, category: number, id: number, count: number) {
refreshImgs(
type: number,
category: number,
id: number,
resIds: number[]
) {
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
this.imgsLayout.children[i].destroy();
}
let count = resIds.length;
for (let i = 0; i < count; i++) {
let newNode = instantiate(this.imgItemInst.node);
let item = newNode.getComponent(DetailImageItem);
item.refresh(this, type, category, id, i);
let resId = resIds[i];
item.refresh(this, type, category, id, resId);
newNode.active = true;
this.imgsLayout.addChild(newNode);
}
@@ -51,7 +51,7 @@ export class GirlListPanel extends li_BaseView {
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
// 保存数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setGirlBriefs(category.toString(), res.data);
girlData.setGirlList(category.toString(), res.data);
// 根据数据,刷新界面
const allId = girlData.getGirlIds(category.toString());
for (let id of allId) {
@@ -95,10 +95,10 @@ export class ThemePanel extends li_BaseView {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setDailyRecommend(res2.data);
// 根据数据,刷新界面
this.recId = girlData.getRecommendGrilId(0);
this.rectNameKey = girlData.getRecommendGrilName(0);
let avatarPath = girlData.getRecommendGrilAvatar(0);
//this.recName.string = LanguageUtils.getText(this.rectNameKey);
this.recId = girlData.getRecommendGirlId();
this.rectNameKey = girlData.getRecommendGrilName();
let avatarPath = girlData.getRecommendGrilAvatar();
this.recName.string = LanguageUtils.getText(this.rectNameKey);
ResManager.I.changeBundleSpriteFrame(
this.recSprite,
avatarPath,