This commit is contained in:
2025-10-10 16:09:14 +08:00
parent 561b3c5eee
commit df9ca6bfaa
66 changed files with 7433 additions and 7779 deletions
@@ -26,9 +26,6 @@ export class DetailImageItem extends Component {
@property(Sprite)
img: Sprite;
@property(Node)
question: Node;
@property(Sprite)
video: Sprite;
@@ -36,8 +33,7 @@ export class DetailImageItem extends Component {
priceFrame: Node;
@property(Label)
videoPrice: Label;
@property(Node)
loading: Node;
base: GirlDetailPanel;
url: string;
isImage: boolean;
@@ -102,16 +98,16 @@ export class DetailImageItem extends Component {
/**
* 查看图片或者视频上报,用于排行榜
* @param girlId 角色Id
*/
*/
private async reqViewGirl(girlId: number) {
const reqData = {
girlId
girlId,
};
let res = await GirlService.I.reqViewGirl(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
}
}
}
}
scaleToFillItem() {
if (!this.img || !this.img.spriteFrame) return;
@@ -167,8 +163,6 @@ export class DetailImageItem extends Component {
this.resId = resId;
//this.question.active = true; // 显示问号,表示加载中
this.loading.active = true;
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let imgPath = "";
this.video.enabled = type === proto.cs.EnmResType.ERT_Video;
@@ -231,9 +225,7 @@ export class DetailImageItem extends Component {
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
let newPath = envData.cdn + "/" + "Girls/" + imgPath + ".jpg";
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
this.question.active = false;
this.scaleToFillItem();
this.loading.active = false;
});
}
@@ -246,7 +238,6 @@ export class DetailImageItem extends Component {
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
let newPath = envData.cdn + "/" + "Girls/" + imgPath + ".jpg";
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
this.question.active = false; // 图片加载成功后隐藏问号
this.scaleToFillItem();
});
}
@@ -262,10 +253,8 @@ export class DetailImageItem extends Component {
this.type = null;
this.isVisible = false;
this.question.active = true;
this.video.enabled = false;
this.priceFrame.active = false;
this.loading.active = false;
this.videoPrice.string = "";
if (this.img && this.img.spriteFrame) {
@@ -29,12 +29,6 @@ export class GirlListItem extends Component {
girlName: Label;
@property(Label)
tags: Label;
@property(Label)
price: Label;
@property(Node)
freeNode: Node;
@property(Node)
unreleaseCover: Node;
@property(Node)
chatIcon: Node;
@@ -107,34 +101,10 @@ export class GirlListItem extends Component {
this.category.toString(),
this.id
);
this.price.string = girlData
.getGrilOriginalPrice(this.category.toString(), this.id)
.toString();
this.price.node.active = false;
this.freeNode.active = false;
this.starParent.active = true;
this.chatIcon.active = true;
this.unreleaseCover.active = false;
// if (isRelease) {
// } else {
// this.unreleaseCover.active = true;
// this.chatIcon.active = false;
// if (priceType == PriceType.free) {
// this.price.node.active = false;
// this.freeNode.active = true;
// this.starParent.active = true;
// } else {
// this.price.node.active = true;
// this.freeNode.active = false;
// this.starParent.active = false;
// }
// }
// this.price.node.active = priceType == PriceType.pay;
// this.freeNode.active = priceType == PriceType.free;
//this.tryNode.active = priceType == PriceType.first_time_free;
let avatarPath = girlData.getGrilAvatar(this.category.toString(), this.id);
this.loading.active = true;
@@ -182,14 +152,9 @@ export class GirlListItem extends Component {
// 清理文本内容
if (this.girlName) this.girlName.string = "";
if (this.tags) this.tags.string = "";
if (this.price) this.price.string = "";
// 重置可见性状态
if (this.price?.node) this.price.node.active = false;
if (this.freeNode) this.freeNode.active = false;
if (this.starParent) this.starParent.active = false;
if (this.chatIcon) this.chatIcon.active = false;
if (this.unreleaseCover) this.unreleaseCover.active = false;
// 清理头像
if (this.avatar) {
@@ -28,16 +28,6 @@ export class PastGirlListItem extends Component {
@property(Node)
starParent: Node;
@property(Node)
freeTag: Node;
@property(UITransform)
categoryBg: UITransform;
@property(Label)
categoryTxt: Label;
@property(Node)
loading: Node;
stars: Sprite[];
id: number = -1;
@@ -108,10 +98,6 @@ export class PastGirlListItem extends Component {
this.girlName.string = LanguageUtils.getText(this.nameKey);
this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id);
this.freeTag.active = girlData.isGirlFreeType(
this.category.toString(),
this.id
);
// 标签显示
let desc = "";
const tags = LanguageUtils.getText(this.tagKey).split("|");
@@ -126,14 +112,12 @@ export class PastGirlListItem extends Component {
// 加载头像
let avatarPath = girlData.getGrilAvatar(this.category.toString(), this.id);
this.loading.active = true;
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
let newPath = envData.cdn + "/" + "Girls/" + avatarPath + ".png";
ResManager.I.changeRemoteSpriteFrame(this.avatar, newPath, () => {
let sizeTran = this.avatar.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.avatar.node, 2);
this.loading.active = false;
});
// 显示星级(好感度)
@@ -153,14 +137,6 @@ export class PastGirlListItem extends Component {
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
const cat = girlData.getGrilCategoryById(this.id);
let key = themeData.getLanKeyById(1001 + cat);
this.categoryTxt.string = LanguageUtils.getText(key);
this.scheduleOnce(() => {
const size = this.categoryTxt.getComponent(UITransform).contentSize;
this.categoryBg.setContentSize(
size.x + 60,
this.categoryBg.contentSize.y
);
}, 0);
// 显示最近聊天时间
this.updateLastChatTime();
@@ -190,7 +166,6 @@ export class PastGirlListItem extends Component {
// 重置UI状态
this.node.active = false;
this.loading.active = false;
// 清理文本内容
if (this.girlName) this.girlName.string = "";
@@ -0,0 +1,95 @@
import { _decorator, Component, Label, Node, Sprite, UITransform } from "cc";
import Utils from "../../Main/Common/Utils";
import { GButton } from "../../Main/Common/GButton";
import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData";
import LanguageUtils from "../../Main/Common/LanguageUtils";
import ResManager from "../../Main/Manager/ResManager";
import { EnvData } from "../data/EnvData";
import { NavigationManager, PanelType } from "../manager/NavigationManager";
const { ccclass, property } = _decorator;
@ccclass("RecomandItem")
export class RecomandItem extends Component {
private _nodeTab: any = {};
private recPic: Sprite;
private girlName: Label;
private tag: Label;
private heartParent: Node;
private hearts: Sprite[] = [];
private chatBtn: Node;
private id: number;
init() {
Utils.parseNode(this.node, this._nodeTab);
this.recPic = this._nodeTab.recPic.getComponent(Sprite);
this.girlName = this._nodeTab.name.getComponent(Label);
this.tag = this._nodeTab.tag.getComponent(Label);
this.heartParent = this._nodeTab.heartBg;
this.heartParent.children.forEach((a) =>
this.hearts.push(a.getComponent(Sprite))
);
this.chatBtn = this._nodeTab.chatBtn;
GButton.BandClick(this.chatBtn, this.chatToHer, this);
GButton.BandClick(this.chatBtn, this.gotoDetail, this);
}
refresh(girlId: number) {
this.id = girlId;
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
const category = girlData.getGrilCategoryById(girlId);
const rectNameKey = girlData.getRecommendGrilName();
this.girlName.string = LanguageUtils.getText(rectNameKey);
const tagkey = girlData.getGrilTagKey(category.toString(), girlId);
this.tag.string = LanguageUtils.getText(tagkey);
let avatarPath = girlData.getRecommendGrilAvatar();
const starCount = girlData.getStar(category.toString(), girlId);
for (let i = 0; i < this.hearts.length; i++) {
const element = this.hearts[i];
if (starCount > i) {
ResManager.I.changeResourceSpriteFrame(element, "ui/common/ZY_UI_AX1");
} else {
ResManager.I.changeResourceSpriteFrame(element, "ui/common/ZY_UI_AX2");
}
}
// 加载远程资源
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
let newPath = envData.cdn + "/" + "Girls/" + avatarPath + ".png";
ResManager.I.changeRemoteSpriteFrame(this.recPic, newPath, () => {
let sizeTran = this.recPic.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.recPic.node, 1);
});
}
chatToHer() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
NavigationManager.Instance.setSelectedGirlId(this.id);
NavigationManager.Instance.setSelectedCategoryId(
girlData.getGrilCategoryById(this.id)
);
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
}
gotoDetail()
{
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
NavigationManager.Instance.setSelectedGirlId(this.id);
NavigationManager.Instance.setSelectedCategoryId(
girlData.getGrilCategoryById(this.id)
);
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "abef322a-b403-409e-a72e-c3ccb90848f9",
"files": [],
"subMetas": {},
"userData": {}
}
+1 -11
View File
@@ -16,18 +16,11 @@ const { ccclass, property } = _decorator;
@ccclass("ThemeItem")
export class ThemeItem extends Component {
@property(Sprite)
lockImg: Sprite;
@property(Sprite)
lockCover: Sprite;
@property(Label)
titleName: Label;
@property(UITransform)
titleNameBg: UITransform;
@property(Node)
loading: Node;
@property(Sprite)
img: Sprite;
@@ -64,12 +57,10 @@ export class ThemeItem extends Component {
}
refresh(themeId: number, parentPanel?: Node) {
if (this.loading) this.loading.active = true;
this.baseNode = parentPanel;
// 主题数据
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
this.lockImg.node.active = this.lockCover.node.active =
!themeData.getIsReleaseById(themeId);
this.isLocked = !themeData.getIsReleaseById(themeId);
this.key = themeData.getLanKeyById(themeId);
this.updateTitle();
@@ -81,7 +72,6 @@ export class ThemeItem extends Component {
() => {
let sizeTran = this.img.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.img.node, 3);
if (this.loading) this.loading.active = false;
}
);
GButton.RemoveAndBandClick(this.node, this.OnClickThis, this);