设置页面资源
This commit is contained in:
2025-09-10 18:12:26 +08:00
parent cb2b8e76ea
commit 24c2a946a3
64 changed files with 7534 additions and 1023 deletions
@@ -102,15 +102,19 @@ export class ChatContentsLayout extends Component {
newBubble.node.position = new Vec3(pos.x, initPosY, pos.z);
pendingUpdates++;
newBubble.updateBubbleContent(dialog.content, (actualHeight: number) => {
initPosY += actualHeight + 20;
pendingUpdates--;
newBubble.updateBubbleContent(
dialog.content,
(actualHeight: number) => {
initPosY += actualHeight + 40;
pendingUpdates--;
// 当当前气泡更新完成后,处理下一个
if (pendingUpdates === 0) {
updateNextBubble(index - 1);
}
}, dialog.isLoading || false);
// 当当前气泡更新完成后,处理下一个
if (pendingUpdates === 0) {
updateNextBubble(index - 1);
}
},
dialog.isLoading || false
);
this.bubbles.push(newBubble);
};
@@ -31,12 +31,16 @@ export class DialogBubble extends Component {
}
}
updateBubbleContent(str: string, callback?: (actualHeight: number) => void, isLoading: boolean = false) {
updateBubbleContent(
str: string,
callback?: (actualHeight: number) => void,
isLoading: boolean = false
) {
// 停止之前的加载动画
this.stopLoadingAnimation();
this.content.overflow = Overflow.NONE;
// 如果是加载状态,使用固定的"..."
if (isLoading && str === "...") {
this.content.string = "...";
@@ -44,13 +48,13 @@ export class DialogBubble extends Component {
const contentWidth = 60;
this.contentT.setContentSize(new Size(contentWidth, 40));
this.bg.setContentSize(new Size(contentWidth + 30, 50));
if (callback) {
callback(40); // 返回固定高度
}
return;
}
// 设置文本内容
this.content.string = str;
@@ -75,7 +79,7 @@ export class DialogBubble extends Component {
// 设置内容区域宽度,让Label自动计算高度
this.contentT.setContentSize(new Size(contentWidth, 0));
this.bg.setContentSize(new Size(contentWidth + 17, 0));
this.bg.setContentSize(new Size(contentWidth + 37, 0));
// 强制更新Label的渲染数据以获取正确的高度
this.content.updateRenderData(true);
@@ -90,7 +94,7 @@ export class DialogBubble extends Component {
// 根据内容大小调整背景大小,添加适当的内边距
//const bgHeight = actualHeight + 17;
this.bg.setContentSize(new Size(actualSize.x + 30, actualSize.y + 10));
this.bg.setContentSize(new Size(actualSize.x + 40, actualSize.y + 30));
// 回调通知实际高度
if (callback) {
@@ -9,6 +9,7 @@ import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import { WalletData } from "../../data/WalletData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
const { ccclass, property } = _decorator;
@ccclass("GirlListPopupPanel")
@@ -18,6 +19,9 @@ export class GirlListPopupPanel extends li_BaseView {
private category: number;
private girlId: number;
private girlName: Label;
private girlTag: Label;
base: GirlListItem;
openUIDataCT(data) {
this.category = data.category;
@@ -26,11 +30,22 @@ export class GirlListPopupPanel extends li_BaseView {
}
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
this.girlName = this._nodeTab.Name.getComponent(Label);
this.girlTag = this._nodeTab.Tag.getComponent(Label);
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 价格
this.priceLabel = this._nodeTab.Price.getComponent(Label);
this.priceLabel.string = girlData.getGrilOriginalPrice(this.category.toString(), this.girlId).toString();
this.priceLabel.string = girlData
.getGrilOriginalPrice(this.category.toString(), this.girlId)
.toString();
this.registerListener();
this.girlName.string = LanguageUtils.getText(
girlData.getGrilName(this.category.toString(), this.girlId)
);
this.girlTag.string = LanguageUtils.getText(
girlData.getGrilTagKey(this.category.toString(), this.girlId)
);
}
registerListener() {
GButton.BandClick(this._nodeTab.BuyBtn, this.buyCharacter, this);
@@ -58,7 +73,7 @@ export class GirlListPopupPanel extends li_BaseView {
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.base.refreshBuy(true);
this.close();
this.close();
}
}
}
@@ -8,6 +8,7 @@ import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import { WalletData } from "../../data/WalletData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
const { ccclass, property } = _decorator;
@ccclass("PopupGirlDetailPanel")
@@ -19,6 +20,8 @@ export class PopupGirlDetailPanel extends li_BaseView {
private resId: number;
private type: proto.cs.EnmResType;
private base: DetailImageItem;
private desc: Label;
openUIDataCT(data) {
this.category = data.category;
this.resId = data.resId;
@@ -28,16 +31,35 @@ export class PopupGirlDetailPanel extends li_BaseView {
}
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
this.desc = this._nodeTab.content.getComponent(Label);
let descText = LanguageUtils.getText("popupgirldetailpanel.content");
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 价格
this.priceLabel = this._nodeTab.Price.getComponent(Label);
if (this.type === proto.cs.EnmResType.ERT_Image) {
// 图片
this.priceLabel.string = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
this.priceLabel.string = girlData
.getGrilPhotoOriginalPrice(
this.category.toString(),
this.girlId,
this.resId
)
.toString();
} else if (this.type === proto.cs.EnmResType.ERT_Video) {
// 视频
this.priceLabel.string = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
this.priceLabel.string = girlData
.getGrilVideoOriginalPrice(
this.category.toString(),
this.girlId,
this.resId
)
.toString();
}
this.desc.string = descText.replace("{price}", this.priceLabel.string);
this.registerListener();
}
registerListener() {
@@ -75,7 +97,7 @@ export class PopupGirlDetailPanel extends li_BaseView {
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.base.refreshVideoBuy(true);
this.close();
this.close();
}
}
}
+33 -19
View File
@@ -24,7 +24,7 @@ import { ThemeData } from "../../data/ThemeData";
import { GirlData } from "../../data/GirlData";
import { WalletData } from "../../data/WalletData";
import { AccountData } from "../../data/AccountData";
import proto from 'db://assets/Scripts/proto/proto.pb.js';
import proto from "db://assets/Scripts/proto/proto.pb.js";
const { ccclass, property } = _decorator;
@@ -74,9 +74,7 @@ export class ThemePanel extends li_BaseView {
}
}
// 请求主题数据
const reqData = {
};
const reqData = {};
let res = await ThemeService.I.reqHallTheme(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
// 保存数据
@@ -90,14 +88,12 @@ export class ThemePanel extends li_BaseView {
item.refresh(id);
newNode.active = true;
this.cache.push(item);
this.content.addChild(newNode);
this.content.addChild(newNode);
}
}
// 请求每日推荐
const reqData2 = {
};
const reqData2 = {};
let res2 = await GirlService.I.reqDailyRecommend(reqData2);
if (res2 && res2.code === proto.cs.EnmRetCode.SUCCESS) {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
@@ -136,10 +132,10 @@ export class ThemePanel extends li_BaseView {
});
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, () => {
this.refreshCoinNum();
});
});
Utils.addInnerEL(InnerMsgCode.VipExpireChange, this, () => {
this.refreshVipExpire();
});
});
}
enterShop() {
@@ -147,7 +143,29 @@ export class ThemePanel extends li_BaseView {
}
chatWithRec() {
NavigationManager.Instance.navigateToChat(this.recId);
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 是否已经解锁
const isRelease = girlData.getIsRelease(
girlData.getGrilCategoryById(this.recId).toString(),
this.recId
);
const isFree =
girlData.getGrilPrice(
girlData.getGrilCategoryById(this.recId).toString(),
this.recId
) == 0;
if (isRelease || isFree) {
NavigationManager.Instance.navigateToGirlDetail(this.recId);
ViewManager.I.closeView(this.node);
} else {
//未解锁
ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
base: this,
category: girlData.getGrilCategoryById(this.recId),
id: this.recId,
});
}
}
openSetting() {
@@ -172,18 +190,14 @@ export class ThemePanel extends li_BaseView {
const leftTime = Utils.formatVipLeftTime(vipExpire);
this.vipLeftTime.string = LanguageUtils.getText(
"purchasepanel.vip_left"
).replace("${leftTime}", leftTime);
}
).replace("${leftTime}", leftTime);
}
onDestroy(): void {
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.recName.string = LanguageUtils.getText(this.rectNameKey);
});
Utils.removeInnerEL(InnerMsgCode.BalanceChange, this, () => {
});
Utils.removeInnerEL(InnerMsgCode.VipExpireChange, this, () => {
});
Utils.removeInnerEL(InnerMsgCode.BalanceChange, this, () => {});
Utils.removeInnerEL(InnerMsgCode.VipExpireChange, this, () => {});
}
}
@@ -53,19 +53,18 @@ export class DetailImageItem extends Component {
}
isVisible: boolean;
onClickThis() {
let data = {
url: this.url,
isImg: this.isImage,
closeFunc: () => {
this.base.setVideEnable(true);
},
};
// 数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 是否可见,不可见代表需要解锁
if (this.isVisible) {
let data = {
url: this.url,
isImg: this.isImage,
closeFunc: () => {
this.base.setVideEnable(true);
},
};
if (this.url) {
ViewManager.I.openBundlesView("ShowPanel", data);
this.base.setVideEnable(false);
@@ -199,12 +198,13 @@ export class DetailImageItem extends Component {
if (this.isVisible) {
imgPath = this.url + "_thumbnail";
this.priceFrame.active = false;
} else {
this.priceFrame.active = true;
this.videoPrice.string = price.toString();
imgPath = this.url + "_thumbnail_blur";
}
this.priceFrame.active = price > 0;
this.videoPrice.string = price.toString();
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Girls", () => {
this.question.active = false; // 图片加载成功后隐藏问号
@@ -214,6 +214,8 @@ export class DetailImageItem extends Component {
refreshVideoBuy(success: boolean) {
if (success) {
this.priceFrame.active = false;
this.isVisible = true;
const imgPath = this.url + "_thumbnail";
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Girls", () => {
this.question.active = false; // 图片加载成功后隐藏问号
@@ -106,6 +106,9 @@ export class GirlListItem extends Component {
this.category.toString(),
this.id
);
this.price.string = girlData
.getGrilOriginalPrice(this.category.toString(), this.id)
.toString();
if (isRelease) {
this.price.node.active = false;
@@ -150,11 +153,8 @@ export class GirlListItem extends Component {
}
);
//虚假好感度
const star = girlData.getStar(this.category.toString(), this.id);
// this.starParent.active = ratio != 0;
// this.chatIcon.active = ratio != 0;
// this.price.node.active = ratio == 0;
for (let i = 0; i < this.stars.length; i++) {
const element = this.stars[i];
if (star > i) {