update
This commit is contained in:
@@ -632,9 +632,7 @@ export class NavigationManager {
|
||||
this.subPanelDic.delete(baseNode);
|
||||
}
|
||||
} else {
|
||||
logger.warn(
|
||||
`[NavigationManager] ${panelNode.name} 不在子页面列表中`
|
||||
);
|
||||
logger.warn(`[NavigationManager] ${panelNode.name} 不在子页面列表中`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,7 +807,7 @@ export class NavigationManager {
|
||||
}
|
||||
|
||||
panel.active = true;
|
||||
panel.getComponent(li_BaseView)
|
||||
panel.getComponent(li_BaseView);
|
||||
|
||||
switch (direction) {
|
||||
case "left":
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { _decorator, Component, Node } from "cc";
|
||||
import li_BaseView from "../../../Main/Common/li_BaseView";
|
||||
import Utils from "../../../Main/Common/Utils";
|
||||
import { GButton } from "../../../Main/Common/GButton";
|
||||
import {
|
||||
NavigationManager,
|
||||
PageTransitionType,
|
||||
} from "../../manager/NavigationManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("ChargePopPanel")
|
||||
export class ChargePopPanel extends li_BaseView {
|
||||
private _nodeTab: any = {};
|
||||
|
||||
onLoad(): void {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
|
||||
GButton.BandClick(this._nodeTab.chargeBtn, this.gotoCharge, this);
|
||||
GButton.BandClick(this._nodeTab.closeBtn, this.close, this);
|
||||
}
|
||||
|
||||
gotoCharge() {
|
||||
NavigationManager.Instance.openSubPanel(
|
||||
"PurchasePanel",
|
||||
NavigationManager.Instance.getCurrentActivePanelNode(),
|
||||
{ base: NavigationManager.Instance.getCurrentActivePanelNode() },
|
||||
{
|
||||
openAnimation: PageTransitionType.SLIDE_LEFT,
|
||||
closeAnimation: PageTransitionType.SLIDE_RIGHT,
|
||||
}
|
||||
);
|
||||
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "cf896a69-cffb-42e9-88fe-f2772f2f7fd5",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -78,8 +78,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
imgsLayout: Node;
|
||||
|
||||
videoAreaPos: Vec3;
|
||||
@property(Label)
|
||||
girlPrice: Label;
|
||||
|
||||
@property(Node)
|
||||
sendMsgText: Node;
|
||||
|
||||
@@ -113,12 +112,12 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, () => {
|
||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
let desc = "";
|
||||
const tags = LanguageUtils.getText(this.tagKey).split("|");
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
if (i != 0) desc += "\n";
|
||||
desc += tags[i];
|
||||
}
|
||||
this.tags.string = desc;
|
||||
const tags = LanguageUtils.getText(this.tagKey);
|
||||
// for (let i = 0; i < tags.length; i++) {
|
||||
// if (i != 0) desc += "\n";
|
||||
// desc += tags[i];
|
||||
// }
|
||||
this.tags.string = tags;
|
||||
this.desc.string = LanguageUtils.getText(this.descKey);
|
||||
});
|
||||
|
||||
@@ -190,20 +189,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
|
||||
const isRelease = girlData.getIsRelease(this.category.toString(), this.id);
|
||||
const isFree = girlData.isGirlFreeType(this.category.toString(), this.id);
|
||||
//if (isRelease || isFree) {
|
||||
// 先设置选中的角色ID
|
||||
this.girlPrice.node.active = false;
|
||||
this.sendMsgText.active = true;
|
||||
// } else {
|
||||
// this.girlPrice.node.active = true;
|
||||
// this.sendMsgText.active = false;
|
||||
|
||||
// this.girlPrice.string = girlData
|
||||
// .getGrilOriginalPrice(this.category.toString(), this.id)
|
||||
// .toString();
|
||||
// }
|
||||
|
||||
// 请求详细数据
|
||||
const reqData = {
|
||||
|
||||
@@ -27,7 +27,7 @@ export class PastGirlListPanel extends li_BaseView {
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
this.registerListener();
|
||||
this.itemInst = this._nodeTab.BubbleItem.getComponent(PastGirlListItem);
|
||||
this.itemInst = this._nodeTab.recItem.getComponent(PastGirlListItem);
|
||||
this.itemInst.node.active = false;
|
||||
this.content = this._nodeTab.content;
|
||||
//this.refresh();
|
||||
|
||||
@@ -23,6 +23,7 @@ import { ImagePopup } from "../components/ImagePopup";
|
||||
import { TipsPanel } from "./TipsPanel";
|
||||
import ResManager from "../../../Main/Manager/ResManager";
|
||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||
import { NavigationManager } from "../../manager/NavigationManager";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -35,9 +36,6 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
private resId: number;
|
||||
private type: proto.cs.EnmResType;
|
||||
private base: DetailImageItem | ImagePopup;
|
||||
private balanceCount: Label;
|
||||
|
||||
private desc: Label;
|
||||
|
||||
img: Sprite;
|
||||
uitransform: UITransform;
|
||||
@@ -55,11 +53,8 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
.start();
|
||||
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
this.desc = this._nodeTab.content.getComponent(Label);
|
||||
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
|
||||
this.img = this._nodeTab.img.getComponent(Sprite);
|
||||
let descText = LanguageUtils.getText("popupgirldetailpanel.content");
|
||||
this.balanceCount = this._nodeTab.balanceCount.getComponent(Label);
|
||||
this.refreshCoinNum();
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
@@ -104,18 +99,17 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
ResManager.I.changeRemoteSpriteFrame(this.img, newPath, () => {
|
||||
this.scaleToFillItem();
|
||||
});
|
||||
this.desc.string = descText.replace("{price}", this.priceLabel.string);
|
||||
|
||||
this.registerListener();
|
||||
}
|
||||
registerListener() {
|
||||
GButton.BandClick(this._nodeTab.BuyBtn, this.buyCharacter, this);
|
||||
GButton.BandClick(this._nodeTab.BuyBtn, this.buyAsset, this);
|
||||
GButton.BandClick(this._nodeTab.CloseBtn, this.Close, this);
|
||||
}
|
||||
Close() {
|
||||
this.close();
|
||||
}
|
||||
async buyCharacter() {
|
||||
async buyAsset() {
|
||||
// 购买id为girlId的女生
|
||||
logger.log(this.girlId + "---" + this.resId);
|
||||
|
||||
@@ -147,17 +141,16 @@ export class PopupGirlDetailPanel extends li_BaseView {
|
||||
} else {
|
||||
this.base.refreshSelf();
|
||||
}
|
||||
this.close();
|
||||
TipsPanel.show("Buy Succeed");
|
||||
NavigationManager.Instance.openPopupPanel("ReleasePanel");
|
||||
} else {
|
||||
TipsPanel.show("Insufficient balance, need to purchase");
|
||||
NavigationManager.Instance.openPopupPanel("ChargePopPanel");
|
||||
}
|
||||
this.close();
|
||||
}
|
||||
// 刷新余额
|
||||
private refreshCoinNum() {
|
||||
const walletData = DataManager.I.getDataById<WalletData>(DataId.Wallet);
|
||||
const balance = walletData.getOriginalBalance();
|
||||
this.balanceCount.string = balance.toString();
|
||||
}
|
||||
scaleToFillItem() {
|
||||
if (!this.img || !this.img.spriteFrame) return;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { _decorator, Component, Node } from "cc";
|
||||
import li_BaseView from "../../../Main/Common/li_BaseView";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("RankPanel")
|
||||
export class RankPanel extends li_BaseView {}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b738c201-567f-4b37-b10c-a3036032875d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { _decorator, Component, Node, tween, UIOpacity, Vec3 } from "cc";
|
||||
import li_BaseView from "../../../Main/Common/li_BaseView";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("ReleasePanel")
|
||||
export class ReleasePanel extends li_BaseView {
|
||||
onLoadCT(): void {
|
||||
this.scheduleOnce(this.autoClose, 1);
|
||||
}
|
||||
|
||||
private autoClose() {
|
||||
this.closePanel();
|
||||
}
|
||||
|
||||
private closePanel() {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "561267a1-b596-4747-af9d-438197888777",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import { EnvData } from "../../data/EnvData";
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
import { MainController } from "../../core/MainController";
|
||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||
import { RecomandItem } from "../../uiitems/RecomandItem";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -40,15 +41,20 @@ export class ThemePanel extends li_BaseView {
|
||||
private _nodeTab: any = {};
|
||||
|
||||
coinNum: Label;
|
||||
|
||||
itemInst: ThemeItem;
|
||||
content: Node;
|
||||
recItemInst: RecomandItem;
|
||||
|
||||
themeContent: Node;
|
||||
recGirlContent: Node;
|
||||
private vipLeftTime: Label;
|
||||
recId: number;
|
||||
recName: Label;
|
||||
recSprite: Sprite;
|
||||
//recName: Label;
|
||||
//recSprite: Sprite;
|
||||
|
||||
cache: ThemeItem[] = [];
|
||||
|
||||
recItemCache: RecomandItem[] = [];
|
||||
|
||||
// 子页面管理
|
||||
|
||||
// 加载状态保护
|
||||
@@ -56,23 +62,38 @@ export class ThemePanel extends li_BaseView {
|
||||
private loadingPromise: Promise<void> | null = null;
|
||||
private abortController: AbortController | null = null;
|
||||
|
||||
private recomandListBtn: Node;
|
||||
private moreThemeBtn: Node;
|
||||
|
||||
private themeScroll: Node;
|
||||
private recomandScroll: Node;
|
||||
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
|
||||
this.coinNum = this._nodeTab.coinNum.getComponent(Label);
|
||||
this.recName = this._nodeTab.characterNameText.getComponent(Label);
|
||||
this.recSprite = this._nodeTab.recPic.getComponent(Sprite);
|
||||
//this.recName = this._nodeTab.characterNameText.getComponent(Label);
|
||||
//this.recSprite = this._nodeTab.recPic.getComponent(Sprite);
|
||||
this.vipLeftTime = this._nodeTab.vipText.getComponent(Label);
|
||||
|
||||
this.recomandListBtn = this._nodeTab.recomandList;
|
||||
this.moreThemeBtn = this._nodeTab.moreTheme;
|
||||
this.themeScroll = this._nodeTab.themeScroll;
|
||||
this.recomandScroll = this._nodeTab.recomandScroll;
|
||||
|
||||
this.registerListener();
|
||||
this.itemInst = this._nodeTab.ThemeItem.getComponent(ThemeItem);
|
||||
this.itemInst.node.active = false;
|
||||
this.content = this._nodeTab.allThemecontent;
|
||||
|
||||
this.recItemInst = this._nodeTab.recItem.getComponent(RecomandItem);
|
||||
this.recItemInst.node.active = false;
|
||||
|
||||
this.themeContent = this._nodeTab.allThemecontent;
|
||||
this.recGirlContent = this._nodeTab.allRecGirlContent;
|
||||
|
||||
this.Show();
|
||||
}
|
||||
|
||||
rectNameKey: string;
|
||||
async Show(forceRefresh: boolean = false) {
|
||||
// 防止重复加载
|
||||
if (this.isLoading) {
|
||||
@@ -84,7 +105,7 @@ export class ThemePanel extends li_BaseView {
|
||||
}
|
||||
|
||||
this.isLoading = true;
|
||||
this.loadingPromise = this._showInternal(forceRefresh);
|
||||
this.loadingPromise = this._refreshDataInternal(forceRefresh);
|
||||
|
||||
try {
|
||||
await this.loadingPromise;
|
||||
@@ -92,9 +113,11 @@ export class ThemePanel extends li_BaseView {
|
||||
this.isLoading = false;
|
||||
this.loadingPromise = null;
|
||||
}
|
||||
|
||||
this.openRecomandList();
|
||||
}
|
||||
|
||||
private async _showInternal(forceRefresh: boolean = false) {
|
||||
private async _refreshDataInternal(forceRefresh: boolean = false) {
|
||||
// 创建新的AbortController用于取消操作
|
||||
this.abortController = new AbortController();
|
||||
const signal = this.abortController.signal;
|
||||
@@ -108,7 +131,6 @@ export class ThemePanel extends li_BaseView {
|
||||
DataId.Account
|
||||
);
|
||||
//this.uid.string = "uid: " + accountData.accId;
|
||||
this.recId = 1;
|
||||
|
||||
// 检查是否已被取消
|
||||
if (signal.aborted) {
|
||||
@@ -146,7 +168,7 @@ export class ThemePanel extends li_BaseView {
|
||||
}
|
||||
|
||||
// 处理每日推荐数据
|
||||
await this.handleDailyRecommendData(preloadStatus.dailyRecommend);
|
||||
await this.handleRecommendData(preloadStatus.dailyRecommend);
|
||||
|
||||
// 检查是否已被取消
|
||||
if (signal.aborted) {
|
||||
@@ -180,7 +202,6 @@ export class ThemePanel extends li_BaseView {
|
||||
// 直接使用预加载的数据渲染界面
|
||||
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
|
||||
if (themeData && themeData.themes) {
|
||||
this.renderThemeData(themeData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -193,14 +214,16 @@ export class ThemePanel extends li_BaseView {
|
||||
// 保存数据
|
||||
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
|
||||
themeData.themes = res.data;
|
||||
this.renderThemeData(themeData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染主题数据
|
||||
*/
|
||||
private renderThemeData(themeData: ThemeData): void {
|
||||
private renderThemeData(): void {
|
||||
if (this.cache.length > 0) return;
|
||||
|
||||
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
|
||||
const themeIds = themeData.themeIds;
|
||||
for (let id of themeIds) {
|
||||
let newNode = instantiate(this.itemInst.node);
|
||||
@@ -208,20 +231,19 @@ export class ThemePanel extends li_BaseView {
|
||||
item.refresh(id, this.node);
|
||||
newNode.active = true;
|
||||
this.cache.push(item);
|
||||
this.content.addChild(newNode);
|
||||
this.themeContent.addChild(newNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理每日推荐数据
|
||||
* 处理推荐数据
|
||||
*/
|
||||
private async handleDailyRecommendData(isPreloaded: boolean): Promise<void> {
|
||||
private async handleRecommendData(isPreloaded: boolean): Promise<void> {
|
||||
if (isPreloaded) {
|
||||
logger.log("[ThemePanel] 使用预加载的每日推荐数据");
|
||||
// 直接使用预加载的数据渲染界面
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
if (girlData) {
|
||||
this.renderDailyRecommendData(girlData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -233,29 +255,30 @@ export class ThemePanel extends li_BaseView {
|
||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
girlData.setDailyRecommend(res.data);
|
||||
this.renderDailyRecommendData(girlData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染每日推荐数据
|
||||
*/
|
||||
private renderDailyRecommendData(girlData: GirlData): void {
|
||||
this.recId = girlData.getRecommendGirlId();
|
||||
this.rectNameKey = girlData.getRecommendGrilName();
|
||||
let avatarPath = girlData.getRecommendGrilAvatar();
|
||||
this.recName.string = LanguageUtils.getText(this.rectNameKey);
|
||||
// 加载远程资源
|
||||
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
|
||||
let newPath = envData.cdn + "/" + "Girls/" + avatarPath + ".png";
|
||||
ResManager.I.changeRemoteSpriteFrame(this.recSprite, newPath, () => {
|
||||
let sizeTran = this.recSprite.node.parent.getComponent(UITransform);
|
||||
Utils.adjustBgPixelRatioToSize(
|
||||
sizeTran.contentSize,
|
||||
this.recSprite.node,
|
||||
1
|
||||
);
|
||||
});
|
||||
private renderRecommendData(): void {
|
||||
if (this.recItemCache.length > 0) return;
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
|
||||
let girlIDs = [];
|
||||
girlIDs.push(girlData.getRecommendGirlId());
|
||||
for (let id of girlIDs) {
|
||||
let newNode = instantiate(this.recItemInst.node);
|
||||
let item = newNode.getComponent(RecomandItem);
|
||||
item.init();
|
||||
item.refresh(id);
|
||||
newNode.active = true;
|
||||
this.recItemCache.push(item);
|
||||
this.recGirlContent.addChild(newNode);
|
||||
}
|
||||
|
||||
console.error("未实现每日推荐数据渲染");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,13 +297,11 @@ export class ThemePanel extends li_BaseView {
|
||||
}
|
||||
|
||||
private registerListener() {
|
||||
GButton.BandClick(this._nodeTab.settingBtn, this.openSetting, this);
|
||||
GButton.BandClick(this._nodeTab.msgBoxBtn, this.openMsgBox, this);
|
||||
|
||||
GButton.BandClick(this._nodeTab.ChatWithRecBtn, this.chatWithRec, this);
|
||||
|
||||
GButton.BandClick(this._nodeTab.ShopPanelEntry, this.enterShop, this);
|
||||
|
||||
GButton.BandClick(this.recomandListBtn, this.openRecomandList, this);
|
||||
GButton.BandClick(this.moreThemeBtn, this.openMoreTheme, this);
|
||||
|
||||
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, this.onLanguageChange);
|
||||
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
|
||||
Utils.addInnerEL(
|
||||
@@ -302,43 +323,32 @@ export class ThemePanel extends li_BaseView {
|
||||
);
|
||||
}
|
||||
|
||||
chatWithRec() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
openRecomandList() {
|
||||
this.themeScroll.active = false;
|
||||
this.recomandScroll.active = true;
|
||||
|
||||
// 是否已经解锁
|
||||
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.setSelectedGirlId(this.recId);
|
||||
NavigationManager.Instance.setSelectedCategoryId(
|
||||
girlData.getGrilCategoryById(this.recId)
|
||||
);
|
||||
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
|
||||
// } else {
|
||||
// //未解锁
|
||||
//todo:是否需要刷新数据
|
||||
this.renderRecommendData();
|
||||
|
||||
// NavigationManager.Instance.openPopupPanel("GirlListPopupPanel", {
|
||||
// base: this,
|
||||
// category: girlData.getGrilCategoryById(this.recId),
|
||||
// id: this.recId,
|
||||
// });
|
||||
// }
|
||||
this.updateTagState(true);
|
||||
}
|
||||
openMoreTheme() {
|
||||
this.themeScroll.active = true;
|
||||
this.recomandScroll.active = false;
|
||||
|
||||
//todo:是否需要刷新数据
|
||||
|
||||
this.renderThemeData();
|
||||
|
||||
this.updateTagState(false);
|
||||
}
|
||||
|
||||
openSetting() {
|
||||
// 通过NavigationManager切换到个人信息面板,保持动画和状态同步
|
||||
NavigationManager.Instance.openSubPanel("SettingPanel", this.node);
|
||||
}
|
||||
updateTagState(isRecomnend: boolean) {
|
||||
this.recomandListBtn.children[0].active = !isRecomnend;
|
||||
this.recomandListBtn.children[1].active = isRecomnend;
|
||||
|
||||
openMsgBox() {
|
||||
logger.log("打开信箱");
|
||||
this.moreThemeBtn.children[0].active = isRecomnend;
|
||||
this.moreThemeBtn.children[1].active = !isRecomnend;
|
||||
}
|
||||
|
||||
// 刷新余额
|
||||
@@ -445,7 +455,7 @@ export class ThemePanel extends li_BaseView {
|
||||
|
||||
// 事件回调函数(避免匿名函数导致的内存泄漏)
|
||||
private onLanguageChange = () => {
|
||||
this.recName.string = LanguageUtils.getText(this.rectNameKey);
|
||||
//this.recName.string = LanguageUtils.getText(this.rectNameKey);
|
||||
this.refreshVipExpire();
|
||||
};
|
||||
|
||||
|
||||
@@ -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": {}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user