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

This commit is contained in:
2025-09-09 21:32:14 +08:00
7 changed files with 72 additions and 33 deletions
+2 -21
View File
@@ -399,6 +399,7 @@ export class GirlData extends BaseData {
let price = oneData.getGrilPhotoPrice(id);
return price / 100;
}
/** 获取技师图片的价格 */
public getGrilPhotoPrice(
categoryId: string,
@@ -440,27 +441,7 @@ export class GirlData extends BaseData {
categoryId: string,
girlId: number
): number[] {
let oneData = this.getGrilDetail(categoryId, girlId);
if (!oneData) return [];
// 所有id
let allId = oneData.getAllGrilVideoId();
// 用来展示的id
let displayIds = [];
for (let id of allId) {
let price = oneData.getGrilVideoPrice(id);
if (price <= 0) {
// 价格为0,代表免费
displayIds.push(id);
} else {
// 价格大于0,代表付费
let isUnlock = this.isVideoUnlock(categoryId, girlId, id);
if (isUnlock) {
// 已经解锁
displayIds.push(id);
}
}
}
return displayIds;
return this.getAllGrilVideoId(categoryId, girlId);
}
/** 获取第一个技师视频的资源路径 */
@@ -34,6 +34,11 @@ export class WalletData extends BaseData {
Utils.sendInnerMsg(InnerMsgCode.BalanceChange, this._balance);
}
/** 获取原来的余额,除100 */
public getOriginalBalance(): number {
return this._balance / 100;
}
/** 获取余额 */
public get balance(): number {
return this._balance;
@@ -188,7 +188,7 @@ export class GirlDetailPanel extends li_BaseView {
bindVideoToggle() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let ids = girlData.getAllGrilVideoId(this.category.toString(), this.id);
let ids = girlData.getAllDisplayGrilVideoId(this.category.toString(), this.id);
this.refreshImgs(2, this.category, this.id, ids);
}
@@ -1,24 +1,35 @@
import { _decorator, Component, Node } from "cc";
import { _decorator, Component, Node, Label } from "cc";
import li_BaseView from "../../../Main/Common/li_BaseView";
import { GButton } from "../../../Main/Common/GButton";
import Utils from "../../../Main/Common/Utils";
import { DetailImageItem } from "../../uiitems/DetailImageItem";
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
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";
const { ccclass, property } = _decorator;
@ccclass("PopupGirlDetailPanel")
export class PopupGirlDetailPanel extends li_BaseView {
private _nodeTab: any = {};
private priceLabel: Label;
private category: number;
private girlId: number;
private resId: number;
private base: DetailImageItem;
openUIDataCT(data) {
this.category = data.category;
this.resId = data.resId;
this.girlId = data.girlId;
this.base = data.base;
}
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 价格
this.priceLabel = this._nodeTab.Price.getComponent(Label);
this.priceLabel.string = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
this.registerListener();
}
registerListener() {
+31 -4
View File
@@ -22,6 +22,8 @@ import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlSe
import { DataManager, DataId } from "../../data/DataManager";
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';
const { ccclass, property } = _decorator;
@@ -31,6 +33,7 @@ export class ThemePanel extends li_BaseView {
private _nodeTab: any = {};
coinNum: Label;
uid: Label;
itemInst: GirlListItem;
content: Node;
@@ -44,6 +47,7 @@ export class ThemePanel extends li_BaseView {
Utils.parseNode(this.node, this._nodeTab);
this.coinNum = this._nodeTab.coinNum.getComponent(Label);
this.uid = this._nodeTab.uid.getComponent(Label);
this.recName = this._nodeTab.characterNameText.getComponent(Label);
this.recSprite = this._nodeTab.recPicSlot.getComponent(Sprite);
@@ -58,7 +62,9 @@ export class ThemePanel extends li_BaseView {
rectNameKey: string;
async Show() {
//some temp data
this.coinNum.string = (50.0).toString();
this.refreshCoinNum();
const accountData = DataManager.I.getDataById<AccountData>(DataId.Account);
this.uid.string = "uid: " + accountData.accId;
this.recId = 1;
if (this.cache) {
for (let i = this.cache.length - 1; i >= 0; i--) {
@@ -127,10 +133,10 @@ export class ThemePanel extends li_BaseView {
this.recName.string = LanguageUtils.getText(this.rectNameKey);
});
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, () => {
});
this.refreshCoinNum();
});
Utils.addInnerEL(InnerMsgCode.VipExpireChange, this, () => {
this.refreshVipExpire();
});
}
@@ -150,9 +156,30 @@ export class ThemePanel extends li_BaseView {
console.log("打开信箱");
}
// 刷新余额
private refreshCoinNum() {
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
const balance = walletData.getOriginalBalance();
this.coinNum.string = balance.toString();
}
// 刷新 vip失效时间戳
private refreshVipExpire() {
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
const vipExpire = walletData.vipExpire;
// TODO
}
onDestroy(): void {
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.recName.string = LanguageUtils.getText(this.rectNameKey);
});
Utils.removeInnerEL(InnerMsgCode.BalanceChange, this, () => {
});
Utils.removeInnerEL(InnerMsgCode.VipExpireChange, this, () => {
});
}
}
@@ -60,7 +60,16 @@ export class DetailImageItem extends Component {
this.base.setVideEnable(true);
},
};
const isRelease = randomRange(0, 1) > 0.5;
// 数据
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let isRelease = false;
if (this.type === 1) {
// 图片
isRelease = girlData.isImageUnlock(this.category.toString(), this.girlId, this.resId);
} else if (this.type === 2) {
// 视频
isRelease = girlData.isVideoUnlock(this.category.toString(), this.girlId, this.resId);
}
if (isRelease) {
if (this.url) {
ViewManager.I.openBundlesView("ShowPanel", data);
@@ -68,6 +77,7 @@ export class DetailImageItem extends Component {
}
} else {
ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
category: this.category,
resId: this.resId,
girlId: this.girlId,
base: this,
@@ -142,8 +152,11 @@ export class DetailImageItem extends Component {
let imgPath = "";
this.video.enabled = type === 2;
this.priceFrame.active = type === 2;
let price = 0;
let isUnlock = false;
if (type === 1) {
// 图片
price = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId);
this.url = girlData.getGrilPhotoPic(
this.category.toString(),
this.girlId,
@@ -151,8 +164,10 @@ export class DetailImageItem extends Component {
);
imgPath = this.url;
this.isImage = true;
isUnlock = girlData.isImageUnlock(this.category.toString(), this.girlId, this.resId);
} else if (type === 2) {
// 视频
price = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId);
this.isImage = false;
this.url = girlData.getGrilVideoPath(
this.category.toString(),
@@ -165,7 +180,7 @@ export class DetailImageItem extends Component {
this.resId
);
const isUnlock = girlData.isVideoUnlock(
isUnlock = girlData.isVideoUnlock(
this.category.toString(),
this.girlId,
this.resId
@@ -175,9 +190,9 @@ export class DetailImageItem extends Component {
} else {
imgPath = this.url + "_thumbnail";
}
this.priceFrame.active = data.price > 0;
this.priceFrame.active = price > 0;
this.videoPrice.string = data.price.toString();
this.videoPrice.string = price.toString();
}
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Chat18x", () => {