协议调试
This commit is contained in:
@@ -317,7 +317,10 @@ export class GirlData extends BaseData {
|
||||
return oneData.getAllGrilPhotoId();
|
||||
}
|
||||
|
||||
/** 获取所有用来展示在列表的技师图片的id */
|
||||
/** 获取所有用来展示在列表的技师图片的id,可展示的有以下几种情况
|
||||
* 1,图片类型为在详情页展示的(不管免费,付费,是否解锁)
|
||||
* 2,图片类型为在聊天触发的,并且已经达到了触发次数的(不管是否已经解锁)
|
||||
*/
|
||||
public getAllDisplayGrilPhotoId(
|
||||
categoryId: string,
|
||||
girlId: number
|
||||
@@ -331,28 +334,58 @@ export class GirlData extends BaseData {
|
||||
// 用来展示的id
|
||||
let displayIds = [];
|
||||
for (let id of allId) {
|
||||
let unlockCounts = oneData.getGrilPhotoUnlockCounts(id);
|
||||
let price = oneData.getGrilPhotoPrice(id);
|
||||
if (price <= 0) {
|
||||
// 价格为0,代表免费
|
||||
displayIds.push(id);
|
||||
} else {
|
||||
// 价格大于0,代表付费
|
||||
let isUnlock = this.isImageUnlock(categoryId, girlId, id);
|
||||
if (isUnlock) {
|
||||
// 已经解锁
|
||||
const unlockCounts = oneData.getGrilPhotoUnlockCounts(id);
|
||||
// 免费
|
||||
const isFreeType = this.isGirlPhotoFreeType(categoryId, girlId, id);
|
||||
// 付费
|
||||
const isPayType = this.isGirlPhotoPayType(categoryId, girlId, id);
|
||||
// 在详情页展示
|
||||
const isShowInList = this.isGirlPhotoShowInList(categoryId, girlId, id);
|
||||
// 在聊天触发
|
||||
const isShowInChat = this.isGirlPhotoShowInChat(categoryId, girlId, id);
|
||||
|
||||
if (isShowInList) {
|
||||
displayIds.push(id);
|
||||
} else if (isShowInChat) {
|
||||
// 总聊天次数 大于等于 触发次数
|
||||
if (chatTotalCount >= unlockCounts) {
|
||||
displayIds.push(id);
|
||||
} else {
|
||||
// 总聊天次数 大于等于 触发次数
|
||||
if (chatTotalCount >= unlockCounts) {
|
||||
displayIds.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return displayIds;
|
||||
}
|
||||
|
||||
/** 用来展示在列表的技师图片是否可见 */
|
||||
public isGirlPhotoVisible(categoryId: string, girlId: number, id: number): boolean {
|
||||
// 免费
|
||||
const isFreeType = this.isGirlPhotoFreeType(categoryId, girlId, id);
|
||||
// 付费
|
||||
const isPayType = this.isGirlPhotoPayType(categoryId, girlId, id);
|
||||
// 在详情页展示
|
||||
const isShowInList = this.isGirlPhotoShowInList(categoryId, girlId, id);
|
||||
// 在聊天触发
|
||||
const isShowInChat = this.isGirlPhotoShowInChat(categoryId, girlId, id);
|
||||
|
||||
if (isShowInList) {
|
||||
if (isFreeType) {
|
||||
// 免费,可见
|
||||
return true;
|
||||
} else if (isPayType) {
|
||||
// 付费,并且已经解锁,可见
|
||||
const isUnlock = this.isImageUnlock(categoryId, girlId, id);
|
||||
if (isUnlock) return true;
|
||||
}
|
||||
} else if (isShowInChat) {
|
||||
// 总聊天次数 大于等于 触发次数
|
||||
const isUnlock = this.isImageUnlock(categoryId, girlId, id);
|
||||
// 已经解锁,可见
|
||||
if (isUnlock) return true;
|
||||
}
|
||||
// 其他情况,不可见
|
||||
return false;
|
||||
}
|
||||
|
||||
/** 获取第一个技师图片的资源路径 */
|
||||
public getFirstGrilPhotoPath(categoryId: string, girlId: number): string {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
@@ -365,6 +398,42 @@ export class GirlData extends BaseData {
|
||||
return oneData.getGrilPhotoPath(ids[0]);
|
||||
}
|
||||
|
||||
/** 图片展示类型:在详情页展示 */
|
||||
public isGirlPhotoShowInList(categoryId: string, girlId: number, id: number): boolean {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData) return false;
|
||||
// 展示类型
|
||||
const showType = oneData.getGrilPhotoType(id);
|
||||
return showType === 1;
|
||||
}
|
||||
|
||||
/** 图片展示类型:在聊天触发 */
|
||||
public isGirlPhotoShowInChat(categoryId: string, girlId: number, id: number): boolean {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData) return false;
|
||||
// 展示类型
|
||||
const showType = oneData.getGrilPhotoType(id);
|
||||
return showType === 2;
|
||||
}
|
||||
|
||||
/** 图片是否免费 */
|
||||
public isGirlPhotoFreeType(categoryId: string, girlId: number, id: number): boolean {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData) return false;
|
||||
// 价格
|
||||
const price = oneData.getGrilPhotoPrice(id);
|
||||
return price <= 0;
|
||||
}
|
||||
|
||||
/** 图片是否需要付费 */
|
||||
public isGirlPhotoPayType(categoryId: string, girlId: number, id: number): boolean {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData) return true;
|
||||
// 价格
|
||||
const price = oneData.getGrilPhotoPrice(id);
|
||||
return price > 0;
|
||||
}
|
||||
|
||||
/** 获取技师图片的类型 */
|
||||
public getGrilPhotoType(
|
||||
categoryId: string,
|
||||
@@ -399,7 +468,7 @@ export class GirlData extends BaseData {
|
||||
let price = oneData.getGrilPhotoPrice(id);
|
||||
return price / 100;
|
||||
}
|
||||
|
||||
|
||||
/** 获取技师图片的价格 */
|
||||
public getGrilPhotoPrice(
|
||||
categoryId: string,
|
||||
@@ -444,6 +513,43 @@ export class GirlData extends BaseData {
|
||||
return this.getAllGrilVideoId(categoryId, girlId);
|
||||
}
|
||||
|
||||
/** 用来展示在列表的技师视频是否可见 */
|
||||
public isGirlVideoVisible(categoryId: string, girlId: number, id: number): boolean {
|
||||
// 免费
|
||||
const isFreeType = this.isGirlVideoFreeType(categoryId, girlId, id);
|
||||
// 付费
|
||||
const isPayType = this.isGirlVideoPayType(categoryId, girlId, id);
|
||||
|
||||
if (isFreeType) {
|
||||
// 免费,可见
|
||||
return true;
|
||||
} else if (isPayType) {
|
||||
// 付费,并且已经解锁,可见
|
||||
const isUnlock = this.isVideoUnlock(categoryId, girlId, id);
|
||||
if (isUnlock) return true;
|
||||
}
|
||||
// 其他情况,不可见
|
||||
return false;
|
||||
}
|
||||
|
||||
/** 视频是否免费 */
|
||||
public isGirlVideoFreeType(categoryId: string, girlId: number, id: number): boolean {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData) return false;
|
||||
// 价格
|
||||
const price = oneData.getGrilVideoPrice(id);
|
||||
return price <= 0;
|
||||
}
|
||||
|
||||
/** 视频是否需要付费 */
|
||||
public isGirlVideoPayType(categoryId: string, girlId: number, id: number): boolean {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
if (!oneData) return true;
|
||||
// 价格
|
||||
const price = oneData.getGrilVideoPrice(id);
|
||||
return price > 0;
|
||||
}
|
||||
|
||||
/** 获取第一个技师视频的资源路径 */
|
||||
public getFirstGrilVideoPath(categoryId: string, girlId: number): string {
|
||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||
|
||||
@@ -188,26 +188,26 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
|
||||
bindVideoToggle() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let ids = girlData.getAllDisplayGrilVideoId(this.category.toString(), this.id);
|
||||
this.refreshImgs(2, this.category, this.id, ids);
|
||||
let resIds = girlData.getAllDisplayGrilVideoId(this.category.toString(), this.id);
|
||||
this.refreshImgs(2, this.category, this.id, resIds);
|
||||
}
|
||||
|
||||
refreshImgs(
|
||||
type: number,
|
||||
category: number,
|
||||
id: number,
|
||||
datas: number[]
|
||||
resIds: number[]
|
||||
) {
|
||||
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
|
||||
this.imgsLayout.children[i].destroy();
|
||||
}
|
||||
|
||||
let count = datas.length;
|
||||
let count = resIds.length;
|
||||
for (let i = 0; i < count; i++) {
|
||||
let newNode = instantiate(this.imgItemInst.node);
|
||||
let item = newNode.getComponent(DetailImageItem);
|
||||
let data = datas[i];
|
||||
item.refresh(this, type, category, id, data);
|
||||
let resId = resIds[i];
|
||||
item.refresh(this, type, category, id, resId);
|
||||
newNode.active = true;
|
||||
this.imgsLayout.addChild(newNode);
|
||||
}
|
||||
|
||||
@@ -17,19 +17,27 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
private category: number;
|
||||
private girlId: number;
|
||||
private resId: number;
|
||||
private type: number;
|
||||
private base: DetailImageItem;
|
||||
openUIDataCT(data) {
|
||||
this.category = data.category;
|
||||
this.resId = data.resId;
|
||||
this.girlId = data.girlId;
|
||||
this.base = data.base;
|
||||
this.type = data.type;
|
||||
}
|
||||
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();
|
||||
if (this.type === 1) {
|
||||
// 图片
|
||||
this.priceLabel.string = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
|
||||
} else if (this.type === 2) {
|
||||
// 视频
|
||||
this.priceLabel.string = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId).toString();
|
||||
}
|
||||
this.registerListener();
|
||||
}
|
||||
registerListener() {
|
||||
|
||||
@@ -62,15 +62,16 @@ export class DetailImageItem extends Component {
|
||||
};
|
||||
// 数据
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let isRelease = false;
|
||||
// 是否可见,不可见代表需要解锁
|
||||
let isVisible = false;
|
||||
if (this.type === 1) {
|
||||
// 图片
|
||||
isRelease = girlData.isImageUnlock(this.category.toString(), this.girlId, this.resId);
|
||||
isVisible = girlData.isGirlPhotoVisible(this.category.toString(), this.girlId, this.resId);
|
||||
} else if (this.type === 2) {
|
||||
// 视频
|
||||
isRelease = girlData.isVideoUnlock(this.category.toString(), this.girlId, this.resId);
|
||||
isVisible = girlData.isGirlVideoVisible(this.category.toString(), this.girlId, this.resId);
|
||||
}
|
||||
if (isRelease) {
|
||||
if (isVisible) {
|
||||
if (this.url) {
|
||||
ViewManager.I.openBundlesView("ShowPanel", data);
|
||||
this.base.setVideEnable(false);
|
||||
@@ -81,6 +82,7 @@ export class DetailImageItem extends Component {
|
||||
resId: this.resId,
|
||||
girlId: this.girlId,
|
||||
base: this,
|
||||
type: this.type,
|
||||
});
|
||||
}
|
||||
// if (!this.isImage) {
|
||||
@@ -144,7 +146,6 @@ export class DetailImageItem extends Component {
|
||||
this.type = type;
|
||||
this.category = category;
|
||||
this.girlId = id;
|
||||
|
||||
this.resId = resId;
|
||||
this.question.active = true; // 显示问号,表示加载中
|
||||
|
||||
@@ -153,7 +154,8 @@ export class DetailImageItem extends Component {
|
||||
this.video.enabled = type === 2;
|
||||
this.priceFrame.active = type === 2;
|
||||
let price = 0;
|
||||
let isUnlock = false;
|
||||
// 是否可见,不可见代表需要解锁
|
||||
let isVisible = false;
|
||||
if (type === 1) {
|
||||
// 图片
|
||||
price = girlData.getGrilPhotoOriginalPrice(this.category.toString(), this.girlId, this.resId);
|
||||
@@ -164,7 +166,7 @@ export class DetailImageItem extends Component {
|
||||
);
|
||||
imgPath = this.url;
|
||||
this.isImage = true;
|
||||
isUnlock = girlData.isImageUnlock(this.category.toString(), this.girlId, this.resId);
|
||||
isVisible = girlData.isGirlPhotoVisible(this.category.toString(), this.girlId, this.resId);
|
||||
} else if (type === 2) {
|
||||
// 视频
|
||||
price = girlData.getGrilVideoOriginalPrice(this.category.toString(), this.girlId, this.resId);
|
||||
@@ -180,12 +182,8 @@ export class DetailImageItem extends Component {
|
||||
this.resId
|
||||
);
|
||||
|
||||
isUnlock = girlData.isVideoUnlock(
|
||||
this.category.toString(),
|
||||
this.girlId,
|
||||
this.resId
|
||||
);
|
||||
if (isUnlock) {
|
||||
isVisible = girlData.isGirlVideoVisible(this.category.toString(), this.girlId, this.resId);
|
||||
if (isVisible) {
|
||||
imgPath = this.url + "_thumbnail_blur";
|
||||
} else {
|
||||
imgPath = this.url + "_thumbnail";
|
||||
|
||||
+1
-1
Submodule proto_cs updated: f055100cf0...9ec1d4f077
Reference in New Issue
Block a user