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

This commit is contained in:
chen wei bo
2025-09-10 16:03:44 +08:00
1563 changed files with 101784 additions and 256 deletions
+18 -19
View File
@@ -41,8 +41,8 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
@property(Label)
girlName: Label = null;
@property(Sprite)
girlImg: Sprite = null;
// @property(Sprite)
// girlImg: Sprite = null;
@property(VideoPlayer)
girlVideo: VideoPlayer = null;
@@ -188,19 +188,19 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.nameKey = data.nameKey;
this.girlName.string = LanguageUtils.getText(data.nameKey);
ResManager.I.changeBundleSpriteFrame(
this.girlImg,
data.avatarPath,
"Chat18x",
() => {
let sizeTran = this.girlImg.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(
sizeTran.contentSize,
this.girlImg.node,
2
);
}
);
// ResManager.I.changeBundleSpriteFrame(
// this.girlImg,
// data.avatarPath,
// "Girls",
// () => {
// let sizeTran = this.girlImg.node.parent.getComponent(UITransform);
// Utils.adjustBgPixelRatioToSize(
// sizeTran.contentSize,
// this.girlImg.node,
// 2
// );
// }
// );
// 通过ChatController获取商业视频数据
const chatModel = this.chatController.getChatModel();
@@ -238,7 +238,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
ResManager.I.changeBundleVideo(
this.girlVideo,
initialVideo.path,
"Chat18x"
"Girls"
);
// Also immediately try to adjust scale (in case already loaded)
this.adjustVideoScale();
@@ -335,7 +335,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
ResManager.I.changeBundleVideo(
this.girlVideo,
matchingVideo.path,
"Chat18x"
"Girls"
);
// Update current emotion state
@@ -401,7 +401,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
protected onEnable(): void {
if (!this.manager) this.manager = DialogManager.getInstance();
}
public async OnClickSend() {
@@ -451,7 +450,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
console.error("Chat error:", error);
// 出错时加载动画会被自动移除,可以在这里显示错误提示给用户
}
onChatLimitReached(): void {
this.payToTalkPanel.show();
}
@@ -19,7 +19,7 @@ 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;
@@ -76,6 +76,7 @@ export class GirlDetailPanel extends li_BaseView {
desc += tags[i];
}
this.tags.string = desc;
this.desc.string = LanguageUtils.getText(this.descKey);
});
this.imgToggle.callback = this.bindImgToggle.bind(this);
@@ -134,6 +135,7 @@ export class GirlDetailPanel extends li_BaseView {
}
nameKey: string;
tagKey: string;
descKey: string;
category: number;
async refresh(index: number) {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
@@ -148,14 +150,15 @@ export class GirlDetailPanel extends li_BaseView {
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.descKey = girlData.getGrilDesc(this.category.toString(), this.id);
this.desc.string = LanguageUtils.getText(this.descKey);
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 += "|";
if (i != 0) desc += "\n";
desc += tags[i];
}
this.tags.string = desc;
@@ -165,38 +168,61 @@ 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.getFirstGrilVideoPath(this.category.toString(), this.id);
ResManager.I.changeBundleVideo(
this.avatarVideo,
firstPath,
"Chat18x"
);
let resIds = girlData.getAllDisplayGrilPhotoId(this.category.toString(), this.id);
const firstPath = girlData.getFirstGrilVideoPath(
this.category.toString(),
this.id
);
ResManager.I.changeBundleVideo(this.avatarVideo, firstPath, "Girls");
let resIds = girlData.getAllDisplayGrilPhotoId(
this.category.toString(),
this.id
);
// 也立即尝试调整(以防已经加载完成)
this.adjustVideoScale();
this.refreshImgs(proto.cs.EnmResType.ERT_Image, this.category, this.id, resIds);
}
this.refreshImgs(
proto.cs.EnmResType.ERT_Image,
this.category,
this.id,
resIds
);
}
}
bindImgToggle() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let resIds = girlData.getAllDisplayGrilPhotoId(this.category.toString(), this.id);
this.refreshImgs(proto.cs.EnmResType.ERT_Image, this.category, this.id, resIds);
let resIds = girlData.getAllDisplayGrilPhotoId(
this.category.toString(),
this.id
);
this.refreshImgs(
proto.cs.EnmResType.ERT_Image,
this.category,
this.id,
resIds
);
}
bindVideoToggle() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let resIds = girlData.getAllDisplayGrilVideoId(this.category.toString(), this.id);
this.refreshImgs(proto.cs.EnmResType.ERT_Video, this.category, this.id, resIds);
let resIds = girlData.getAllDisplayGrilVideoId(
this.category.toString(),
this.id
);
this.refreshImgs(
proto.cs.EnmResType.ERT_Video,
this.category,
this.id,
resIds
);
}
refreshImgs(
type: proto.cs.EnmResType,
category: number,
id: number,
resIds: number[]
resIds: number[]
) {
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
this.imgsLayout.children[i].destroy();
@@ -66,11 +66,11 @@ export class ShowPanel extends li_BaseView {
show(path: string) {
if (this.isImg) {
ResManager.I.changeBundleSpriteFrame(this.image, path, "Chat18x", () => {
ResManager.I.changeBundleSpriteFrame(this.image, path, "Girls", () => {
Utils.adjustBgPixelRatio(this.image.node, 3);
});
} else {
ResManager.I.changeBundleVideo(this.videoPlayer, path, "Chat18x", () => {
ResManager.I.changeBundleVideo(this.videoPlayer, path, "Girls", () => {
this.adjustVideoScale();
});
}