This commit is contained in:
2025-10-11 16:19:57 +08:00
parent 45ec2bbb7d
commit fdea1383d0
27 changed files with 1662 additions and 977 deletions
+4 -4
View File
@@ -2580,7 +2580,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 102.5, "y": 115.354,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -2619,7 +2619,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 750, "width": 750,
"height": 1394.4 "height": 1394.3999999999999
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -2642,8 +2642,8 @@
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0.30000000000009663, "_top": -12.553999999999917,
"_bottom": 205.29999999999998, "_bottom": 218.154,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
+1 -1
View File
@@ -249,7 +249,7 @@ export class SceneBgVideoLayer extends li_BaseView {
} else { } else {
targetWorldPos = new Vec3(pos.x, pos.y, pos.z || 0); targetWorldPos = new Vec3(pos.x, pos.y, pos.z || 0);
} }
this.videoPlayer.node.setWorldPosition(targetWorldPos); this.videoPlayer.node.setPosition(targetWorldPos);
logger.log( logger.log(
`SceneBgVideoLayer: 设置视频位置 (${targetWorldPos.x}, ${targetWorldPos.y}, ${targetWorldPos.z})` `SceneBgVideoLayer: 设置视频位置 (${targetWorldPos.x}, ${targetWorldPos.y}, ${targetWorldPos.z})`
); );
+30 -1
View File
@@ -38,7 +38,7 @@ export class MainController {
// 并行预加载所有数据 // 并行预加载所有数据
await Promise.all([ await Promise.all([
this.preloadThemeData(), this.preloadThemeData(),
this.preloadDailyRecommend(), //this.preloadDailyRecommend(),
this.preloadRecommendList(true, 1, 10), this.preloadRecommendList(true, 1, 10),
this.preloadShopList(), this.preloadShopList(),
]); ]);
@@ -267,4 +267,33 @@ export class MainController {
return false; return false;
} }
} }
/**
*
*/
async refreshRecommendList(): Promise<boolean> {
logger.log("[MainController] 开始强制刷新推荐列表数据");
try {
const reqData = {
page: 1,
limit: 10,
};
const res = await GirlService.I.reqRecommendList(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
// 保存数据到DataManager
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setRecommendList(res.data);
this.isRecommendListPreloaded = true;
logger.log("[MainController] 推荐列表数据刷新成功");
return true;
} else {
logger.warn("[MainController] 推荐列表数据刷新失败:", res);
return false;
}
} catch (error) {
logger.error("[MainController] 推荐列表数据刷新异常:", error);
return false;
}
}
} }
@@ -143,6 +143,7 @@ export class NavigationManager {
logger.log( logger.log(
`[NavigationManager] Already on ${panelType}, skipping switch` `[NavigationManager] Already on ${panelType}, skipping switch`
); );
callback && callback(this.getCurrentActivePanelNode());
return this.currentActivePanel; return this.currentActivePanel;
} }
@@ -373,7 +374,9 @@ export class NavigationManager {
// 如果配置了隐藏basePanel,记录映射关系 // 如果配置了隐藏basePanel,记录映射关系
if (config.hideBasePanel) { if (config.hideBasePanel) {
this.hiddenBasePanels.set(n, basePanel); this.hiddenBasePanels.set(n, basePanel);
logger.log(`[NavigationManager] 记录隐藏映射: ${n.name} -> ${basePanel.name}`); logger.log(
`[NavigationManager] 记录隐藏映射: ${n.name} -> ${basePanel.name}`
);
} }
// 执行打开动画 // 执行打开动画
@@ -619,7 +622,9 @@ export class NavigationManager {
if (this.hiddenBasePanels.has(panelNode)) { if (this.hiddenBasePanels.has(panelNode)) {
const basePanel = this.hiddenBasePanels.get(panelNode); const basePanel = this.hiddenBasePanels.get(panelNode);
if (basePanel && basePanel.isValid) { if (basePanel && basePanel.isValid) {
logger.log(`[NavigationManager] 恢复显示basePanel: ${basePanel.name}`); logger.log(
`[NavigationManager] 恢复显示basePanel: ${basePanel.name}`
);
basePanel.active = true; basePanel.active = true;
} }
this.hiddenBasePanels.delete(panelNode); this.hiddenBasePanels.delete(panelNode);
+1 -18
View File
@@ -99,7 +99,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.waitingAI = this._nodeTab.waitingAI; this.waitingAI = this._nodeTab.waitingAI;
// 获取 videoArea 的尺寸和位置 // 获取 videoArea 的尺寸和位置
this.targetSize = this.videoArea.contentSize; this.targetSize = this.videoArea.contentSize;
this.videoAreaPos = new Vec3(540, 1170, 0); this.videoAreaPos = new Vec3(0, 92.637, 0);
this.register(); this.register();
//this.refresh(); //this.refresh();
@@ -168,23 +168,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.categoryId = this.categoryId =
NavigationManager.Instance.getSelectedCategoryId().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) {
//未解锁
NavigationManager.Instance.openPopupPanel("GirlListPopupPanel-Fix", {
base: this,
category: this.categoryId,
id: this.id,
});
return;
}
// 获取ChatController单例并绑定当前Panel // 获取ChatController单例并绑定当前Panel
this.chatController = ChatController.Instance; this.chatController = ChatController.Instance;
this.chatController.bindView(this); this.chatController.bindView(this);
@@ -77,7 +77,7 @@ export class GirlDetailPanel extends li_BaseView {
@property(Node) @property(Node)
imgsLayout: Node; imgsLayout: Node;
videoAreaPos: Vec3; //videoAreaPos: Vec3;
@property(Node) @property(Node)
sendMsgText: Node; sendMsgText: Node;
@@ -165,7 +165,7 @@ export class GirlDetailPanel extends li_BaseView {
this.id = NavigationManager.Instance.getSelectedGirlId(); this.id = NavigationManager.Instance.getSelectedGirlId();
this.category = NavigationManager.Instance.getSelectedCategoryId(); this.category = NavigationManager.Instance.getSelectedCategoryId();
this.imgItemInst.node.active = false; this.imgItemInst.node.active = false;
this.videoAreaPos = new Vec3(540, 1384 - 60); //this.videoAreaPos = new Vec3(540, 1384 - 60);
const pos = new Vec3( const pos = new Vec3(
this.descContent.position.x, this.descContent.position.x,
@@ -255,7 +255,7 @@ export class GirlDetailPanel extends li_BaseView {
this.videoLayer.playVideo(firstPath, { this.videoLayer.playVideo(firstPath, {
loop: true, loop: true,
size: targetSize, size: targetSize,
position: this.videoAreaPos, position: new Vec3(0, 67.717, 0),
}); });
} }
@@ -349,6 +349,8 @@ export class GirlDetailPanel extends li_BaseView {
// id: this.id, // id: this.id,
// }); // });
// } // }
this.close();
} }
returnBtn() { returnBtn() {
@@ -128,7 +128,7 @@ export class GirlListPanel extends li_BaseView {
for (let i = 0; i < allId.length; i++) { for (let i = 0; i < allId.length; i++) {
let id = allId[i]; let id = allId[i];
let item = this.getItemFromPool(); let item = this.getItemFromPool();
item.refreshData(category, id, this.node); item.refreshData(category, id, this);
item.node.active = true; item.node.active = true;
this.cache.push(item); this.cache.push(item);
+208 -13
View File
@@ -6,6 +6,7 @@ import {
Label, Label,
Sprite, Sprite,
UITransform, UITransform,
ScrollView,
} from "cc"; } from "cc";
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView"; import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
import Utils from "db://assets/Scripts/Main/Common/Utils"; import Utils from "db://assets/Scripts/Main/Common/Utils";
@@ -67,6 +68,13 @@ export class ThemePanel extends li_BaseView {
private themeScroll: Node; private themeScroll: Node;
private recomandScroll: Node; private recomandScroll: Node;
private recomandScrollView: ScrollView = null;
// 推荐列表分页状态
private currentPage: number = 1;
private pageLimit: number = 10;
private isLoadingMore: boolean = false;
private hasMoreData: boolean = true;
onLoadCT() { onLoadCT() {
Utils.parseNode(this.node, this._nodeTab); Utils.parseNode(this.node, this._nodeTab);
@@ -81,6 +89,12 @@ export class ThemePanel extends li_BaseView {
this.themeScroll = this._nodeTab.themeScroll; this.themeScroll = this._nodeTab.themeScroll;
this.recomandScroll = this._nodeTab.recomandScroll; this.recomandScroll = this._nodeTab.recomandScroll;
// 获取推荐列表的 ScrollView 组件
if (this.recomandScroll) {
this.recomandScrollView =
this.recomandScroll.getComponentInChildren(ScrollView);
}
this.registerListener(); this.registerListener();
this.itemInst = this._nodeTab.ThemeItem.getComponent(ThemeItem); this.itemInst = this._nodeTab.ThemeItem.getComponent(ThemeItem);
this.itemInst.node.active = false; this.itemInst.node.active = false;
@@ -145,7 +159,7 @@ export class ThemePanel extends li_BaseView {
logger.log("[ThemePanel] 开始强制刷新数据"); logger.log("[ThemePanel] 开始强制刷新数据");
await Promise.all([ await Promise.all([
MainController.I.refreshThemeData(), MainController.I.refreshThemeData(),
MainController.I.refreshDailyRecommend(), MainController.I.refreshRecommendList(),
]); ]);
logger.log("[ThemePanel] 数据刷新完成"); logger.log("[ThemePanel] 数据刷新完成");
@@ -167,8 +181,8 @@ export class ThemePanel extends li_BaseView {
throw new Error("Operation was aborted"); throw new Error("Operation was aborted");
} }
// 处理每日推荐数据 // 处理推荐列表数据
await this.handleRecommendData(preloadStatus.dailyRecommend); await this.handleRecommendData(preloadStatus.recommendList);
// 检查是否已被取消 // 检查是否已被取消
if (signal.aborted) { if (signal.aborted) {
@@ -240,7 +254,7 @@ export class ThemePanel extends li_BaseView {
*/ */
private async handleRecommendData(isPreloaded: boolean): Promise<void> { private async handleRecommendData(isPreloaded: boolean): Promise<void> {
if (isPreloaded) { if (isPreloaded) {
logger.log("[ThemePanel] 使用预加载的每日推荐数据"); logger.log("[ThemePanel] 使用预加载的推荐列表数据");
// 直接使用预加载的数据渲染界面 // 直接使用预加载的数据渲染界面
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl); const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
if (girlData) { if (girlData) {
@@ -249,25 +263,35 @@ export class ThemePanel extends li_BaseView {
} }
// 如果没有预加载数据,则请求数据 // 如果没有预加载数据,则请求数据
logger.log("[ThemePanel] 请求每日推荐数据"); logger.log("[ThemePanel] 请求推荐列表数据");
const reqData = {}; const reqData = {
let res = await GirlService.I.reqDailyRecommend(reqData); page: 1,
limit: 10,
};
let res = await GirlService.I.reqRecommendList(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) { if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl); const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
girlData.setDailyRecommend(res.data); girlData.setRecommendList(res.data);
} }
} }
/** /**
* *
*/ */
private renderRecommendData(): void { private renderRecommendData(): void {
if (this.recItemCache.length > 0) return; if (this.recItemCache.length > 0) return;
// 重置分页状态
this.currentPage = 1;
this.hasMoreData = true;
this.isLoadingMore = false;
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl); const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
let girlIDs = []; // 获取推荐列表的所有 ID
girlIDs.push(girlData.getRecommendGirlId()); let girlIDs = girlData.getRecommendListIds();
// 遍历创建推荐项
for (let id of girlIDs) { for (let id of girlIDs) {
let newNode = instantiate(this.recItemInst.node); let newNode = instantiate(this.recItemInst.node);
let item = newNode.getComponent(RecomandItem); let item = newNode.getComponent(RecomandItem);
@@ -278,7 +302,127 @@ export class ThemePanel extends li_BaseView {
this.recGirlContent.addChild(newNode); this.recGirlContent.addChild(newNode);
} }
console.error("未实现每日推荐数据渲染"); // 检查首次加载的数据量,判断是否还有更多数据
if (girlIDs.length < this.pageLimit) {
this.hasMoreData = false;
}
logger.log(`[ThemePanel] 渲染推荐列表完成,共 ${girlIDs.length} 个推荐项`);
}
/**
* Cocos Creator
*/
private onRecommendScrollToBottom(): void {
logger.log("[ThemePanel] 推荐列表滚动到底部");
this.loadMoreRecommendData();
}
/**
*
*/
private onRecommendScrolling(): void {
if (!this.recomandScrollView) return;
// 获取滚动进度(0-1
const scrollOffset = this.recomandScrollView.getScrollOffset();
const maxScrollOffset = this.recomandScrollView.getMaxScrollOffset();
// 当滚动到距离底部 100 像素以内时,开始加载
if (maxScrollOffset.y > 0 && scrollOffset.y >= maxScrollOffset.y - 100) {
this.loadMoreRecommendData();
}
}
/**
*
*/
private async loadMoreRecommendData(): Promise<void> {
// 防止重复加载
if (this.isLoadingMore) {
logger.log("[ThemePanel] 正在加载中,跳过");
return;
}
// 检查是否还有更多数据
if (!this.hasMoreData) {
logger.log("[ThemePanel] 没有更多数据了");
return;
}
try {
this.isLoadingMore = true;
this.currentPage++;
logger.log(`[ThemePanel] 开始加载第 ${this.currentPage} 页推荐数据`);
const reqData = {
page: this.currentPage,
limit: this.pageLimit,
};
const res = await GirlService.I.reqRecommendList(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 追加数据到 GirlData
girlData.addRecommendList(res.data);
// 检查是否还有更多数据
const girls = res.data.girls || [];
if (girls.length < this.pageLimit) {
this.hasMoreData = false;
logger.log("[ThemePanel] 已加载所有推荐数据");
}
// 渲染新增数据
this.renderMoreRecommendData(girls.length);
logger.log(
`[ThemePanel] 第 ${this.currentPage} 页加载完成,新增 ${girls.length}`
);
} else {
logger.warn("[ThemePanel] 加载下一页推荐数据失败:", res);
// 加载失败,回退页码
this.currentPage--;
}
} catch (error) {
logger.error("[ThemePanel] 加载下一页推荐数据异常:", error);
// 加载失败,回退页码
this.currentPage--;
} finally {
this.isLoadingMore = false;
}
}
/**
*
* @param newCount
*/
private renderMoreRecommendData(newCount: number): void {
if (newCount <= 0) return;
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
const allGirlIDs = girlData.getRecommendListIds();
// 只渲染新增的部分(从末尾开始取 newCount 个)
const startIndex = allGirlIDs.length - newCount;
const newGirlIDs = allGirlIDs.slice(startIndex);
logger.log(`[ThemePanel] 开始渲染 ${newCount} 个新增推荐项`);
for (let id of newGirlIDs) {
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);
}
logger.log(`[ThemePanel] 新增推荐项渲染完成`);
} }
/** /**
@@ -302,6 +446,20 @@ export class ThemePanel extends li_BaseView {
GButton.BandClick(this.recomandListBtn, this.openRecomandList, this); GButton.BandClick(this.recomandListBtn, this.openRecomandList, this);
GButton.BandClick(this.moreThemeBtn, this.openMoreTheme, this); GButton.BandClick(this.moreThemeBtn, this.openMoreTheme, this);
// 注册推荐列表滚动事件
if (this.recomandScrollView) {
this.recomandScrollView.node.on(
"scroll-to-bottom",
this.onRecommendScrollToBottom,
this
);
this.recomandScrollView.node.on(
"scrolling",
this.onRecommendScrolling,
this
);
}
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, this.onLanguageChange); Utils.addInnerEL(InnerMsgCode.LanguageChange, this, this.onLanguageChange);
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange); Utils.addInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
Utils.addInnerEL( Utils.addInnerEL(
@@ -394,8 +552,9 @@ export class ThemePanel extends li_BaseView {
* *
*/ */
private clearCache(): void { private clearCache(): void {
// 清理主题缓存
if (this.cache && this.cache.length > 0) { if (this.cache && this.cache.length > 0) {
logger.log(`[ThemePanel] 清理 ${this.cache.length} 个缓存节点`); logger.log(`[ThemePanel] 清理 ${this.cache.length}主题缓存节点`);
for (let i = this.cache.length - 1; i >= 0; i--) { for (let i = this.cache.length - 1; i >= 0; i--) {
if (this.cache[i] && this.cache[i].node && this.cache[i].node.isValid) { if (this.cache[i] && this.cache[i].node && this.cache[i].node.isValid) {
this.cache[i].node.destroy(); this.cache[i].node.destroy();
@@ -403,6 +562,28 @@ export class ThemePanel extends li_BaseView {
} }
this.cache = []; this.cache = [];
} }
// 清理推荐项缓存
if (this.recItemCache && this.recItemCache.length > 0) {
logger.log(
`[ThemePanel] 清理 ${this.recItemCache.length} 个推荐项缓存节点`
);
for (let i = this.recItemCache.length - 1; i >= 0; i--) {
if (
this.recItemCache[i] &&
this.recItemCache[i].node &&
this.recItemCache[i].node.isValid
) {
this.recItemCache[i].node.destroy();
}
}
this.recItemCache = [];
}
// 重置推荐列表分页状态
this.currentPage = 1;
this.hasMoreData = true;
this.isLoadingMore = false;
} }
/** /**
@@ -437,6 +618,20 @@ export class ThemePanel extends li_BaseView {
this.isLoading = false; this.isLoading = false;
this.loadingPromise = null; this.loadingPromise = null;
// 移除推荐列表滚动事件监听
if (this.recomandScrollView) {
this.recomandScrollView.node.off(
"scroll-to-bottom",
this.onRecommendScrollToBottom,
this
);
this.recomandScrollView.node.off(
"scrolling",
this.onRecommendScrolling,
this
);
}
// 移除事件监听器(修复回调函数引用问题) // 移除事件监听器(修复回调函数引用问题)
Utils.removeInnerEL( Utils.removeInnerEL(
InnerMsgCode.LanguageChange, InnerMsgCode.LanguageChange,
+11 -13
View File
@@ -22,6 +22,8 @@ import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData"; import { GirlData } from "../data/GirlData";
import { EnvData } from "../data/EnvData"; import { EnvData } from "../data/EnvData";
import { logger } from "db://assets/Scripts/Main/Common/Logger"; import { logger } from "db://assets/Scripts/Main/Common/Logger";
import { GButton } from "../../Main/Common/GButton";
import { GirlListPanel } from "../ui/panels/GirlListPanel";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -36,6 +38,8 @@ export class GirlListItem extends Component {
@property(Node) @property(Node)
chatIcon: Node; chatIcon: Node;
@property(Node)
detailBtn: Node;
@property(Node) @property(Node)
starParent: Node; starParent: Node;
@@ -68,6 +72,8 @@ export class GirlListItem extends Component {
this, this,
this.onLanguageChangeCallback this.onLanguageChangeCallback
); );
GButton.BandClick(this.chatIcon, this.onClickChat, this);
GButton.BandClick(this.detailBtn, this.onClickDetail, this);
} }
protected onDestroy(): void { protected onDestroy(): void {
@@ -78,8 +84,8 @@ export class GirlListItem extends Component {
); );
} }
baseNode: Node; baseNode: GirlListPanel;
refreshData(category: number, girlId: number, baseNode: Node) { refreshData(category: number, girlId: number, baseNode: GirlListPanel) {
if (!this.stars) { if (!this.stars) {
this.stars = this.starParent.getComponentsInChildren(Sprite); this.stars = this.starParent.getComponentsInChildren(Sprite);
} }
@@ -92,17 +98,8 @@ export class GirlListItem extends Component {
this.nameKey = girlData.getGrilName(this.category.toString(), this.id); this.nameKey = girlData.getGrilName(this.category.toString(), this.id);
this.girlName.string = LanguageUtils.getText(this.nameKey); this.girlName.string = LanguageUtils.getText(this.nameKey);
this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id); this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id);
// let desc = "";
// const tags = LanguageUtils.getText(this.tagKey).split("|");
// for (let i = 0; i < tags.length; i++) {
// if (i != 0) desc += "|";
// desc += tags[i];
// }
this.tags.string = LanguageUtils.getText(this.tagKey); this.tags.string = LanguageUtils.getText(this.tagKey);
let priceType = girlData.getGrilPriceType(
this.category.toString(),
this.id
);
this.starParent.active = true; this.starParent.active = true;
this.chatIcon.active = true; this.chatIcon.active = true;
@@ -115,7 +112,7 @@ export class GirlListItem extends Component {
//listAvatarPath = listAvatarPath.replace("Avatar", "avatar"); //临时 //listAvatarPath = listAvatarPath.replace("Avatar", "avatar"); //临时
ResManager.I.changeRemoteSpriteFrame(this.avatar, newPath, () => { ResManager.I.changeRemoteSpriteFrame(this.avatar, newPath, () => {
let sizeTran = this.avatar.node.parent.getComponent(UITransform); let sizeTran = this.avatar.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.avatar.node, 2); Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.avatar.node, 1);
this.loading.active = false; this.loading.active = false;
}); });
@@ -197,6 +194,7 @@ export class GirlListItem extends Component {
} else { } else {
logger.warn("[GirlListItem] 无法获取当前激活的主页面"); logger.warn("[GirlListItem] 无法获取当前激活的主页面");
} }
this.baseNode.close();
} }
onClickChat() { onClickChat() {
@@ -4,6 +4,7 @@ import Utils from "db://assets/Scripts/Main/Common/Utils";
import { import {
NavigationManager, NavigationManager,
PageTransitionType, PageTransitionType,
PanelType,
} from "../manager/NavigationManager"; } from "../manager/NavigationManager";
import LanguageUtils from "../../Main/Common/LanguageUtils"; import LanguageUtils from "../../Main/Common/LanguageUtils";
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode"; import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
@@ -11,6 +12,8 @@ import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData"; import { GirlData } from "../data/GirlData";
import { EnvData } from "../data/EnvData"; import { EnvData } from "../data/EnvData";
import { ThemeData } from "../data/ThemeData"; import { ThemeData } from "../data/ThemeData";
import { GButton } from "../../Main/Common/GButton";
import { logger } from "../../Main/Common/Logger";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -28,6 +31,11 @@ export class PastGirlListItem extends Component {
@property(Node) @property(Node)
starParent: Node; starParent: Node;
@property(Node)
chatBtn: Node;
@property(Node)
detailBtn: Node;
stars: Sprite[]; stars: Sprite[];
id: number = -1; id: number = -1;
@@ -55,6 +63,9 @@ export class PastGirlListItem extends Component {
this, this,
this.onLanguageChangeCallback this.onLanguageChangeCallback
); );
GButton.BandClick(this.chatBtn, this.onClickChat, this);
GButton.BandClick(this.detailBtn, this.onClickDetail, this);
} }
protected onDestroy(): void { protected onDestroy(): void {
@@ -120,7 +131,7 @@ export class PastGirlListItem extends Component {
let newPath = envData.cdn + "/" + "Girls/" + avatarPath + ".png"; let newPath = envData.cdn + "/" + "Girls/" + avatarPath + ".png";
ResManager.I.changeRemoteSpriteFrame(this.avatar, newPath, () => { ResManager.I.changeRemoteSpriteFrame(this.avatar, newPath, () => {
let sizeTran = this.avatar.node.parent.getComponent(UITransform); let sizeTran = this.avatar.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.avatar.node, 2); Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.avatar.node, 1);
}); });
// 显示星级(好感度) // 显示星级(好感度)
@@ -194,20 +205,48 @@ export class PastGirlListItem extends Component {
} }
} }
onClickGirl() { onClickDetail() {
// 由于都是已解锁的女孩,直接打开聊天面板作为子面板 const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
// 先设置选中的角色ID // 是否已经解锁
NavigationManager.Instance.setSelectedGirlId(this.id);
// 通过openSubPanel打开ChatPanel作为子面板 NavigationManager.Instance.setSelectedGirlId(this.id);
const chatData = { base: this.baseNode }; NavigationManager.Instance.setSelectedCategoryId(this.category);
NavigationManager.Instance.openSubPanel(
"ChatPanel", // 以subpanel方式打开GirlDetailPanel
this.baseNode, const currentPanel = NavigationManager.Instance.getCurrentActivePanelNode();
chatData, if (currentPanel) {
{ NavigationManager.Instance.openSubPanel(
openAnimation: PageTransitionType.SLIDE_LEFT, "GirlDetailPanel",
closeAnimation: PageTransitionType.SLIDE_RIGHT, currentPanel,
this.id,
{
openAnimation: PageTransitionType.SLIDE_LEFT,
closeAnimation: PageTransitionType.SLIDE_RIGHT,
hideBasePanel: true, // 隐藏底层panel,实现全屏显示
}
);
} else {
logger.warn("[GirlListItem] 无法获取当前激活的主页面");
}
}
onClickChat() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
NavigationManager.Instance.setSelectedGirlId(this.id);
NavigationManager.Instance.setSelectedCategoryId(
girlData.getGrilCategoryById(this.id)
);
NavigationManager.Instance.switchToPanel(
PanelType.PAST_GIRL_LIST,
false,
(base) => {
const chatData = { girlId: this.id, base: base };
NavigationManager.Instance.openSubPanel("ChatPanel", base, chatData, {
openAnimation: PageTransitionType.SLIDE_LEFT,
closeAnimation: PageTransitionType.SLIDE_RIGHT,
});
} }
); );
} }
+19 -15
View File
@@ -51,19 +51,31 @@ export class RecomandItem extends Component {
this.id = girlId; this.id = girlId;
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl); const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
const category = girlData.getGrilCategoryById(girlId); const category = girlData.getGrilCategoryById(girlId);
const rectNameKey = girlData.getRecommendGrilName();
this.girlName.string = LanguageUtils.getText(rectNameKey); // 数据
const tagkey = girlData.getGrilTagKey(category.toString(), girlId); let nameKey = girlData.getGrilName(category.toString(), this.id);
this.tag.string = LanguageUtils.getText(tagkey); this.girlName.string = LanguageUtils.getText(nameKey);
let tagKey = girlData.getGrilTagKey(category.toString(), this.id);
let avatarPath = girlData.getRecommendGrilAvatar(); this.tag.string = LanguageUtils.getText(tagKey);
const starCount = girlData.getStar(category.toString(), girlId); this.heartParent.active = true;
let avatarPath = girlData.getGrilAvatar(category.toString(), this.id);
const envData = DataManager.I.getDataById<EnvData>(DataId.Env);
let newPath = envData.cdn + "/" + "Girls/" + avatarPath + ".png";
//listAvatarPath = listAvatarPath.replace("Avatar", "avatar"); //临时
ResManager.I.changeRemoteSpriteFrame(this.recPic, newPath, () => {
let sizeTran = this.recPic.node.parent.getComponent(UITransform);
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.recPic.node, 1);
});
const star = girlData.getStar(category.toString(), this.id);
logger.log("好感度:" + star);
for (let i = 0; i < this.hearts.length; i++) { for (let i = 0; i < this.hearts.length; i++) {
const element = this.hearts[i]; const element = this.hearts[i];
if (starCount > i) { if (star > i) {
ResManager.I.changeResourceSpriteFrame( ResManager.I.changeResourceSpriteFrame(
element, element,
"ui/common/heart/heart" "ui/common/heart/heart"
@@ -75,14 +87,6 @@ export class RecomandItem extends Component {
); );
} }
} }
// 加载远程资源
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() { chatToHer() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl); const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
File diff suppressed because it is too large Load Diff
@@ -3027,6 +3027,9 @@
"chatIcon": { "chatIcon": {
"__id__": 114 "__id__": 114
}, },
"detailBtn": {
"__id__": 106
},
"starParent": { "starParent": {
"__id__": 70 "__id__": 70
}, },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 KiB

After

Width:  |  Height:  |  Size: 130 KiB

@@ -46,10 +46,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 444, "width": 319,
"height": 330, "height": 220,
"rawWidth": 444, "rawWidth": 319,
"rawHeight": 330, "rawHeight": 220,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
@@ -61,17 +61,17 @@
"meshType": 0, "meshType": 0,
"vertices": { "vertices": {
"rawPosition": [ "rawPosition": [
-222, -159.5,
-165, -110,
0, 0,
222, 159.5,
-165, -110,
0, 0,
-222, -159.5,
165, 110,
0, 0,
222, 159.5,
165, 110,
0 0
], ],
"indexes": [ "indexes": [
@@ -84,12 +84,12 @@
], ],
"uv": [ "uv": [
0, 0,
330, 220,
444, 319,
330, 220,
0, 0,
0, 0,
444, 319,
0 0
], ],
"nuv": [ "nuv": [
@@ -103,13 +103,13 @@
1 1
], ],
"minPos": [ "minPos": [
-222, -159.5,
-165, -110,
0 0
], ],
"maxPos": [ "maxPos": [
222, 159.5,
165, 110,
0 0
] ]
}, },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

After

Width:  |  Height:  |  Size: 147 KiB

@@ -46,10 +46,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 444, "width": 319,
"height": 330, "height": 220,
"rawWidth": 444, "rawWidth": 319,
"rawHeight": 330, "rawHeight": 220,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
@@ -61,17 +61,17 @@
"meshType": 0, "meshType": 0,
"vertices": { "vertices": {
"rawPosition": [ "rawPosition": [
-222, -159.5,
-165, -110,
0, 0,
222, 159.5,
-165, -110,
0, 0,
-222, -159.5,
165, 110,
0, 0,
222, 159.5,
165, 110,
0 0
], ],
"indexes": [ "indexes": [
@@ -84,12 +84,12 @@
], ],
"uv": [ "uv": [
0, 0,
330, 220,
444, 319,
330, 220,
0, 0,
0, 0,
444, 319,
0 0
], ],
"nuv": [ "nuv": [
@@ -103,13 +103,13 @@
1 1
], ],
"minPos": [ "minPos": [
-222, -159.5,
-165, -110,
0 0
], ],
"maxPos": [ "maxPos": [
222, 159.5,
165, 110,
0 0
] ]
}, },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 129 KiB

@@ -46,10 +46,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 444, "width": 319,
"height": 330, "height": 220,
"rawWidth": 444, "rawWidth": 319,
"rawHeight": 330, "rawHeight": 220,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
@@ -61,17 +61,17 @@
"meshType": 0, "meshType": 0,
"vertices": { "vertices": {
"rawPosition": [ "rawPosition": [
-222, -159.5,
-165, -110,
0, 0,
222, 159.5,
-165, -110,
0, 0,
-222, -159.5,
165, 110,
0, 0,
222, 159.5,
165, 110,
0 0
], ],
"indexes": [ "indexes": [
@@ -84,12 +84,12 @@
], ],
"uv": [ "uv": [
0, 0,
330, 220,
444, 319,
330, 220,
0, 0,
0, 0,
444, 319,
0 0
], ],
"nuv": [ "nuv": [
@@ -103,13 +103,13 @@
1 1
], ],
"minPos": [ "minPos": [
-222, -159.5,
-165, -110,
0 0
], ],
"maxPos": [ "maxPos": [
222, 159.5,
165, 110,
0 0
] ]
}, },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 121 KiB

@@ -46,10 +46,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 444, "width": 319,
"height": 329, "height": 220,
"rawWidth": 444, "rawWidth": 319,
"rawHeight": 329, "rawHeight": 220,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
@@ -61,17 +61,17 @@
"meshType": 0, "meshType": 0,
"vertices": { "vertices": {
"rawPosition": [ "rawPosition": [
-222, -159.5,
-164.5, -110,
0, 0,
222, 159.5,
-164.5, -110,
0, 0,
-222, -159.5,
164.5, 110,
0, 0,
222, 159.5,
164.5, 110,
0 0
], ],
"indexes": [ "indexes": [
@@ -84,12 +84,12 @@
], ],
"uv": [ "uv": [
0, 0,
329, 220,
444, 319,
329, 220,
0, 0,
0, 0,
444, 319,
0 0
], ],
"nuv": [ "nuv": [
@@ -103,13 +103,13 @@
1 1
], ],
"minPos": [ "minPos": [
-222, -159.5,
-164.5, -110,
0 0
], ],
"maxPos": [ "maxPos": [
222, 159.5,
164.5, 110,
0 0
] ]
}, },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 119 KiB

@@ -46,10 +46,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 444, "width": 319,
"height": 327, "height": 220,
"rawWidth": 444, "rawWidth": 319,
"rawHeight": 327, "rawHeight": 220,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
@@ -61,17 +61,17 @@
"meshType": 0, "meshType": 0,
"vertices": { "vertices": {
"rawPosition": [ "rawPosition": [
-222, -159.5,
-163.5, -110,
0, 0,
222, 159.5,
-163.5, -110,
0, 0,
-222, -159.5,
163.5, 110,
0, 0,
222, 159.5,
163.5, 110,
0 0
], ],
"indexes": [ "indexes": [
@@ -84,12 +84,12 @@
], ],
"uv": [ "uv": [
0, 0,
327, 220,
444, 319,
327, 220,
0, 0,
0, 0,
444, 319,
0 0
], ],
"nuv": [ "nuv": [
@@ -103,13 +103,13 @@
1 1
], ],
"minPos": [ "minPos": [
-222, -159.5,
-163.5, -110,
0 0
], ],
"maxPos": [ "maxPos": [
222, 159.5,
163.5, 110,
0 0
] ]
}, },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 230 KiB

After

Width:  |  Height:  |  Size: 127 KiB

@@ -46,10 +46,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 444, "width": 319,
"height": 329, "height": 220,
"rawWidth": 444, "rawWidth": 319,
"rawHeight": 329, "rawHeight": 220,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
@@ -61,17 +61,17 @@
"meshType": 0, "meshType": 0,
"vertices": { "vertices": {
"rawPosition": [ "rawPosition": [
-222, -159.5,
-164.5, -110,
0, 0,
222, 159.5,
-164.5, -110,
0, 0,
-222, -159.5,
164.5, 110,
0, 0,
222, 159.5,
164.5, 110,
0 0
], ],
"indexes": [ "indexes": [
@@ -84,12 +84,12 @@
], ],
"uv": [ "uv": [
0, 0,
329, 220,
444, 319,
329, 220,
0, 0,
0, 0,
444, 319,
0 0
], ],
"nuv": [ "nuv": [
@@ -103,13 +103,13 @@
1 1
], ],
"minPos": [ "minPos": [
-222, -159.5,
-164.5, -110,
0 0
], ],
"maxPos": [ "maxPos": [
222, 159.5,
164.5, 110,
0 0
] ]
}, },
File diff suppressed because it is too large Load Diff
+16 -14
View File
@@ -2020,6 +2020,8 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "1fB4ecWkhGQ4x6XhJQdNjH", "fileId": "1fB4ecWkhGQ4x6XhJQdNjH",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{ {
@@ -3350,7 +3352,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -70.58100000000002, "y": -52.21500000000002,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -4535,7 +4537,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 621.9, "y": 603.5339999999999,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -6766,7 +6768,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 730, "width": 730,
"height": 1243.8 "height": 1207.068
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -6911,7 +6913,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 730, "width": 730,
"height": 1243.8 "height": 1207.068
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -7064,7 +7066,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 750, "width": 750,
"height": 1243.8 "height": 1207.068
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -7138,8 +7140,8 @@
"_target": null, "_target": null,
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 248.68099999999998, "_top": 248.68100000000004,
"_bottom": 107.519, "_bottom": 144.25099999999992,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
@@ -7205,7 +7207,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -70.58100000000002, "y": -52.21500000000002,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -8008,7 +8010,7 @@
"_actualFontSize": 25, "_actualFontSize": 25,
"_fontSize": 24, "_fontSize": 24,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 18.1, "_lineHeight": 31.1,
"_overflow": 2, "_overflow": 2,
"_enableWrapText": true, "_enableWrapText": true,
"_font": { "_font": {
@@ -9686,7 +9688,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 750, "width": 750,
"height": 1243.8 "height": 1207.068
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -9831,7 +9833,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 750, "width": 750,
"height": 1243.8 "height": 1207.068
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -9906,7 +9908,7 @@
"elastic": true, "elastic": true,
"inertia": true, "inertia": true,
"horizontal": false, "horizontal": false,
"vertical": false, "vertical": true,
"cancelInnerEvents": true, "cancelInnerEvents": true,
"scrollEvents": [], "scrollEvents": [],
"_content": { "_content": {
@@ -9984,7 +9986,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 750, "width": 750,
"height": 1243.8 "height": 1207.068
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -10059,7 +10061,7 @@
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 248.68099999999998, "_top": 248.68099999999998,
"_bottom": 107.519, "_bottom": 144.25099999999998,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,