update
This commit is contained in:
@@ -25,12 +25,14 @@ import { ImagePopup } from "../components/ImagePopup";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import LanguageUtils from "../../../Main/Common/LanguageUtils";
|
||||
import { UITransitionHelper } from "../../utils/UITransitionHelper";
|
||||
import { VideoEmotion, purchase } from "../../../schema/schema";
|
||||
import { PriceType, VideoEmotion, purchase } from "../../../schema/schema";
|
||||
import { PayToTalkSubpanel } from "./PayToTalkSubpanel";
|
||||
import { DataId, DataManager } from "../../data/DataManager";
|
||||
import { GirlData } from "../../data/GirlData";
|
||||
import { SceneBgVideoLayer } from "../../../Sub/UI/SceneBgVideoLayer";
|
||||
import { NavigationManager, PanelType } from "../../manager/NavigationManager";
|
||||
import { GirlService } from "../../network/services/GirlService";
|
||||
import proto from "db://assets/Scripts/proto/proto.pb.js";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("ChatPanel")
|
||||
@@ -143,15 +145,33 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
||||
this.chatController = null;
|
||||
}
|
||||
}
|
||||
refresh() {
|
||||
async refresh() {
|
||||
const newRoleId = NavigationManager.Instance.getSelectedGirlId();
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
|
||||
// 检查是否是切换角色
|
||||
const isRoleSwitch = this.id && this.id !== newRoleId;
|
||||
|
||||
this.id = newRoleId;
|
||||
this.categoryId =
|
||||
NavigationManager.Instance.getSelectedThemeId().toString();
|
||||
NavigationManager.Instance.getSelectedCategoryId().toString();
|
||||
|
||||
const isFree =
|
||||
girlData.getGrilPriceType(this.categoryId.toString(), this.id) ==
|
||||
PriceType.free;
|
||||
const isRelease = girlData.getIsRelease(
|
||||
this.categoryId.toString(),
|
||||
this.id
|
||||
);
|
||||
if (!isFree && !isRelease) {
|
||||
//未解锁
|
||||
ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
|
||||
base: this,
|
||||
category: this.categoryId,
|
||||
id: this.id,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取ChatController单例并绑定当前Panel
|
||||
this.chatController = ChatController.Instance;
|
||||
@@ -177,9 +197,19 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
||||
}
|
||||
}
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
|
||||
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
|
||||
if (this.nameKey == "") {
|
||||
const reqData = {
|
||||
id: this.id,
|
||||
};
|
||||
let res = await GirlService.I.reqGetGirlDetail(reqData);
|
||||
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||
// 保存数据
|
||||
girlData.setGirlDetailData(this.categoryId.toString(), res.data);
|
||||
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
|
||||
// 通过ChatController获取商业视频数据
|
||||
|
||||
@@ -137,7 +137,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
category: number;
|
||||
async refresh() {
|
||||
this.id = NavigationManager.Instance.getSelectedGirlId();
|
||||
|
||||
this.category = NavigationManager.Instance.getSelectedCategoryId();
|
||||
this.imgItemInst.node.active = false;
|
||||
this.videoAreaPos = new Vec3(540, 1384);
|
||||
|
||||
@@ -162,7 +162,6 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
}
|
||||
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
this.category = girlData.getGrilCategoryById(this.id);
|
||||
// 请求详细数据
|
||||
const reqData = {
|
||||
id: this.id,
|
||||
|
||||
@@ -30,25 +30,13 @@ export class GirlListPanel extends li_BaseView {
|
||||
category: number;
|
||||
private parentPanelName: string = null;
|
||||
|
||||
openUIDataCT(data) {
|
||||
console.log("[GirlListPanel] openUIDataCT called with data:", data);
|
||||
|
||||
// 支持新的数据格式:既可以是单纯的数字,也可以是包含主题ID和父页面信息的对象
|
||||
if (typeof data === "object") {
|
||||
this.category = data.themeId;
|
||||
this.parentPanelName = data.parentPanel;
|
||||
console.log("[GirlListPanel] Set parent panel:", this.parentPanelName);
|
||||
} else {
|
||||
this.category = data;
|
||||
}
|
||||
}
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
this.registerListener();
|
||||
this.itemInst = this._nodeTab.BubbleItem.getComponent(GirlListItem);
|
||||
this.itemInst.node.active = false;
|
||||
this.content = this._nodeTab.content;
|
||||
this.refresh(this.category);
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
cacheCategory: number = -1;
|
||||
@@ -68,7 +56,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 没有可复用的节点,创建新节点
|
||||
let newNode = instantiate(this.itemInst.node);
|
||||
let item = newNode.getComponent(GirlListItem);
|
||||
@@ -88,7 +76,8 @@ export class GirlListPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
|
||||
async refresh(category: number) {
|
||||
async refresh() {
|
||||
const category = NavigationManager.Instance.getSelectedCategoryId();
|
||||
if (category == this.cacheCategory) return;
|
||||
this.cacheCategory = category;
|
||||
|
||||
@@ -119,7 +108,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
item.refreshData(category, id, this.node);
|
||||
item.node.active = true;
|
||||
this.cache.push(item);
|
||||
|
||||
|
||||
// 确保节点在 content 中(可能已经在了)
|
||||
if (item.node.parent !== this.content) {
|
||||
this.content.addChild(item.node);
|
||||
@@ -156,7 +145,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
this.cache = [];
|
||||
|
||||
|
||||
// 清理 content 中所有的 GirlListItem 节点
|
||||
for (let i = this.content.children.length - 1; i >= 0; i--) {
|
||||
let child = this.content.children[i];
|
||||
|
||||
@@ -2,11 +2,8 @@ import { _decorator, Component, Label, Node } from "cc";
|
||||
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
||||
import {
|
||||
NavigationManager,
|
||||
PanelType,
|
||||
} from "../../manager/NavigationManager";
|
||||
|
||||
import { NavigationManager, PanelType } from "../../manager/NavigationManager";
|
||||
import { NavigationBtn } from "../items/NavigationBtn";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -15,20 +12,21 @@ export class NavigationPanel extends li_BaseView {
|
||||
private _nodeTab: any = {};
|
||||
private currentActivePanel: PanelType = PanelType.THEME;
|
||||
|
||||
private themeBtn: Node;
|
||||
private girlDetailBtn: Node;
|
||||
private chatBtn: Node;
|
||||
private settingBtn: Node;
|
||||
private themeBtn: NavigationBtn;
|
||||
private girlDetailBtn: NavigationBtn;
|
||||
private chatBtn: NavigationBtn;
|
||||
private settingBtn: NavigationBtn;
|
||||
|
||||
private loadingView: Node;
|
||||
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
|
||||
this.themeBtn = this._nodeTab.themeBtn;
|
||||
this.girlDetailBtn = this._nodeTab.girlDetailBtn;
|
||||
this.chatBtn = this._nodeTab.chatBtn;
|
||||
this.settingBtn = this._nodeTab.settingBtn;
|
||||
this.themeBtn = this._nodeTab.themeBtn.getComponent(NavigationBtn);
|
||||
this.girlDetailBtn =
|
||||
this._nodeTab.girlDetailBtn.getComponent(NavigationBtn);
|
||||
this.chatBtn = this._nodeTab.chatBtn.getComponent(NavigationBtn);
|
||||
this.settingBtn = this._nodeTab.settingBtn.getComponent(NavigationBtn);
|
||||
this.loadingView = this._nodeTab.loadingView;
|
||||
|
||||
this.hideLoading();
|
||||
@@ -46,22 +44,24 @@ export class NavigationPanel extends li_BaseView {
|
||||
private registerListener() {
|
||||
// 所有按钮点击都通过NavigationManager处理
|
||||
GButton.BandClick(
|
||||
this.themeBtn,
|
||||
() => NavigationManager.Instance.switchToPanel(PanelType.THEME),
|
||||
this.themeBtn.node,
|
||||
() => {
|
||||
NavigationManager.Instance.switchToPanel(PanelType.THEME);
|
||||
},
|
||||
this
|
||||
);
|
||||
GButton.BandClick(
|
||||
this.girlDetailBtn,
|
||||
this.girlDetailBtn.node,
|
||||
() => NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL),
|
||||
this
|
||||
);
|
||||
GButton.BandClick(
|
||||
this.chatBtn,
|
||||
this.chatBtn.node,
|
||||
() => NavigationManager.Instance.switchToPanel(PanelType.CHAT),
|
||||
this
|
||||
);
|
||||
GButton.BandClick(
|
||||
this.settingBtn,
|
||||
this.settingBtn.node,
|
||||
() => NavigationManager.Instance.switchToPanel(PanelType.SETTING),
|
||||
this
|
||||
);
|
||||
@@ -75,6 +75,7 @@ export class NavigationPanel extends li_BaseView {
|
||||
this.currentActivePanel = activePanel;
|
||||
this._nodeTab.CurrentPanel.getComponent(Label).string =
|
||||
this.currentActivePanel;
|
||||
|
||||
this.refreshButtonVisuals();
|
||||
}
|
||||
|
||||
@@ -88,6 +89,13 @@ export class NavigationPanel extends li_BaseView {
|
||||
"[NavigationPanel] Button states updated for:",
|
||||
this.currentActivePanel
|
||||
);
|
||||
|
||||
this.themeBtn.setFocus(this.currentActivePanel === PanelType.THEME);
|
||||
this.girlDetailBtn.setFocus(
|
||||
this.currentActivePanel === PanelType.GIRL_DETAIL
|
||||
);
|
||||
this.chatBtn.setFocus(this.currentActivePanel === PanelType.CHAT);
|
||||
this.settingBtn.setFocus(this.currentActivePanel === PanelType.SETTING);
|
||||
}
|
||||
|
||||
private initializeFirstPanel() {
|
||||
|
||||
Reference in New Issue
Block a user