Merge branch 'main' of 47.107.44.202:xionglijia/18xchat
This commit is contained in:
@@ -399,6 +399,7 @@ export class GirlData extends BaseData {
|
|||||||
let price = oneData.getGrilPhotoPrice(id);
|
let price = oneData.getGrilPhotoPrice(id);
|
||||||
return price / 100;
|
return price / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取技师图片的价格 */
|
/** 获取技师图片的价格 */
|
||||||
public getGrilPhotoPrice(
|
public getGrilPhotoPrice(
|
||||||
categoryId: string,
|
categoryId: string,
|
||||||
@@ -440,27 +441,7 @@ export class GirlData extends BaseData {
|
|||||||
categoryId: string,
|
categoryId: string,
|
||||||
girlId: number
|
girlId: number
|
||||||
): number[] {
|
): number[] {
|
||||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
return this.getAllGrilVideoId(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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取第一个技师视频的资源路径 */
|
/** 获取第一个技师视频的资源路径 */
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ export class WalletData extends BaseData {
|
|||||||
Utils.sendInnerMsg(InnerMsgCode.BalanceChange, this._balance);
|
Utils.sendInnerMsg(InnerMsgCode.BalanceChange, this._balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取原来的余额,除100 */
|
||||||
|
public getOriginalBalance(): number {
|
||||||
|
return this._balance / 100;
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取余额 */
|
/** 获取余额 */
|
||||||
public get balance(): number {
|
public get balance(): number {
|
||||||
return this._balance;
|
return this._balance;
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ export class GirlDetailPanel extends li_BaseView {
|
|||||||
|
|
||||||
bindVideoToggle() {
|
bindVideoToggle() {
|
||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
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);
|
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 li_BaseView from "../../../Main/Common/li_BaseView";
|
||||||
import { GButton } from "../../../Main/Common/GButton";
|
import { GButton } from "../../../Main/Common/GButton";
|
||||||
import Utils from "../../../Main/Common/Utils";
|
import Utils from "../../../Main/Common/Utils";
|
||||||
import { DetailImageItem } from "../../uiitems/DetailImageItem";
|
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;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass("PopupGirlDetailPanel")
|
@ccclass("PopupGirlDetailPanel")
|
||||||
export class PopupGirlDetailPanel extends li_BaseView {
|
export class PopupGirlDetailPanel extends li_BaseView {
|
||||||
private _nodeTab: any = {};
|
private _nodeTab: any = {};
|
||||||
|
private priceLabel: Label;
|
||||||
|
private category: number;
|
||||||
private girlId: number;
|
private girlId: number;
|
||||||
private resId: number;
|
private resId: number;
|
||||||
private base: DetailImageItem;
|
private base: DetailImageItem;
|
||||||
openUIDataCT(data) {
|
openUIDataCT(data) {
|
||||||
|
this.category = data.category;
|
||||||
this.resId = data.resId;
|
this.resId = data.resId;
|
||||||
this.girlId = data.girlId;
|
this.girlId = data.girlId;
|
||||||
this.base = data.base;
|
this.base = data.base;
|
||||||
}
|
}
|
||||||
onLoadCT() {
|
onLoadCT() {
|
||||||
Utils.parseNode(this.node, this._nodeTab);
|
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();
|
this.registerListener();
|
||||||
}
|
}
|
||||||
registerListener() {
|
registerListener() {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlSe
|
|||||||
import { DataManager, DataId } from "../../data/DataManager";
|
import { DataManager, DataId } from "../../data/DataManager";
|
||||||
import { ThemeData } from "../../data/ThemeData";
|
import { ThemeData } from "../../data/ThemeData";
|
||||||
import { GirlData } from "../../data/GirlData";
|
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;
|
const { ccclass, property } = _decorator;
|
||||||
@@ -31,6 +33,7 @@ export class ThemePanel extends li_BaseView {
|
|||||||
private _nodeTab: any = {};
|
private _nodeTab: any = {};
|
||||||
|
|
||||||
coinNum: Label;
|
coinNum: Label;
|
||||||
|
uid: Label;
|
||||||
itemInst: GirlListItem;
|
itemInst: GirlListItem;
|
||||||
content: Node;
|
content: Node;
|
||||||
|
|
||||||
@@ -44,6 +47,7 @@ export class ThemePanel extends li_BaseView {
|
|||||||
Utils.parseNode(this.node, this._nodeTab);
|
Utils.parseNode(this.node, this._nodeTab);
|
||||||
|
|
||||||
this.coinNum = this._nodeTab.coinNum.getComponent(Label);
|
this.coinNum = this._nodeTab.coinNum.getComponent(Label);
|
||||||
|
this.uid = this._nodeTab.uid.getComponent(Label);
|
||||||
this.recName = this._nodeTab.characterNameText.getComponent(Label);
|
this.recName = this._nodeTab.characterNameText.getComponent(Label);
|
||||||
this.recSprite = this._nodeTab.recPicSlot.getComponent(Sprite);
|
this.recSprite = this._nodeTab.recPicSlot.getComponent(Sprite);
|
||||||
|
|
||||||
@@ -58,7 +62,9 @@ export class ThemePanel extends li_BaseView {
|
|||||||
rectNameKey: string;
|
rectNameKey: string;
|
||||||
async Show() {
|
async Show() {
|
||||||
//some temp data
|
//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;
|
this.recId = 1;
|
||||||
if (this.cache) {
|
if (this.cache) {
|
||||||
for (let i = this.cache.length - 1; i >= 0; i--) {
|
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);
|
this.recName.string = LanguageUtils.getText(this.rectNameKey);
|
||||||
});
|
});
|
||||||
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, () => {
|
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, () => {
|
||||||
|
this.refreshCoinNum();
|
||||||
});
|
});
|
||||||
Utils.addInnerEL(InnerMsgCode.VipExpireChange, this, () => {
|
Utils.addInnerEL(InnerMsgCode.VipExpireChange, this, () => {
|
||||||
|
this.refreshVipExpire();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,9 +156,30 @@ export class ThemePanel extends li_BaseView {
|
|||||||
console.log("打开信箱");
|
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 {
|
onDestroy(): void {
|
||||||
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
|
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
|
||||||
this.recName.string = LanguageUtils.getText(this.rectNameKey);
|
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);
|
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 (isRelease) {
|
||||||
if (this.url) {
|
if (this.url) {
|
||||||
ViewManager.I.openBundlesView("ShowPanel", data);
|
ViewManager.I.openBundlesView("ShowPanel", data);
|
||||||
@@ -68,6 +77,7 @@ export class DetailImageItem extends Component {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
|
ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
|
||||||
|
category: this.category,
|
||||||
resId: this.resId,
|
resId: this.resId,
|
||||||
girlId: this.girlId,
|
girlId: this.girlId,
|
||||||
base: this,
|
base: this,
|
||||||
@@ -142,8 +152,11 @@ export class DetailImageItem extends Component {
|
|||||||
let imgPath = "";
|
let imgPath = "";
|
||||||
this.video.enabled = type === 2;
|
this.video.enabled = type === 2;
|
||||||
this.priceFrame.active = type === 2;
|
this.priceFrame.active = type === 2;
|
||||||
|
let price = 0;
|
||||||
|
let isUnlock = false;
|
||||||
if (type === 1) {
|
if (type === 1) {
|
||||||
// 图片
|
// 图片
|
||||||
|
price = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId);
|
||||||
this.url = girlData.getGrilPhotoPic(
|
this.url = girlData.getGrilPhotoPic(
|
||||||
this.category.toString(),
|
this.category.toString(),
|
||||||
this.girlId,
|
this.girlId,
|
||||||
@@ -151,8 +164,10 @@ export class DetailImageItem extends Component {
|
|||||||
);
|
);
|
||||||
imgPath = this.url;
|
imgPath = this.url;
|
||||||
this.isImage = true;
|
this.isImage = true;
|
||||||
|
isUnlock = girlData.isImageUnlock(this.category.toString(), this.girlId, this.resId);
|
||||||
} else if (type === 2) {
|
} else if (type === 2) {
|
||||||
// 视频
|
// 视频
|
||||||
|
price = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId);
|
||||||
this.isImage = false;
|
this.isImage = false;
|
||||||
this.url = girlData.getGrilVideoPath(
|
this.url = girlData.getGrilVideoPath(
|
||||||
this.category.toString(),
|
this.category.toString(),
|
||||||
@@ -165,7 +180,7 @@ export class DetailImageItem extends Component {
|
|||||||
this.resId
|
this.resId
|
||||||
);
|
);
|
||||||
|
|
||||||
const isUnlock = girlData.isVideoUnlock(
|
isUnlock = girlData.isVideoUnlock(
|
||||||
this.category.toString(),
|
this.category.toString(),
|
||||||
this.girlId,
|
this.girlId,
|
||||||
this.resId
|
this.resId
|
||||||
@@ -175,9 +190,9 @@ export class DetailImageItem extends Component {
|
|||||||
} else {
|
} else {
|
||||||
imgPath = this.url + "_thumbnail";
|
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", () => {
|
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Chat18x", () => {
|
||||||
|
|||||||
+1
-1
Submodule proto_cs updated: f055100cf0...9ec1d4f077
Reference in New Issue
Block a user