update PastGirlListPanel.prefab
This commit is contained in:
@@ -416,7 +416,7 @@ export default class Utils {
|
|||||||
*/
|
*/
|
||||||
public static formatChatTime(timestamp: number | null): string {
|
public static formatChatTime(timestamp: number | null): string {
|
||||||
if (!timestamp) {
|
if (!timestamp) {
|
||||||
return "暂无聊天记录";
|
return LanguageUtils.getText("pastgirllistpanel.nomemory");
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
@@ -431,7 +431,7 @@ export default class Utils {
|
|||||||
return `${hours}:${minutes}`;
|
return `${hours}:${minutes}`;
|
||||||
} else if (diffDays < 7) {
|
} else if (diffDays < 7) {
|
||||||
// 一周内:显示x天前
|
// 一周内:显示x天前
|
||||||
return `${diffDays}${LanguageUtils.getText("purchasepanel.day")}}`;
|
return `${diffDays}${LanguageUtils.getText("purchasepanel.day")}`;
|
||||||
} else if (diffDays < 30) {
|
} else if (diffDays < 30) {
|
||||||
// 一个月内:显示x周前
|
// 一个月内:显示x周前
|
||||||
const weeks = Math.floor(diffDays / 7);
|
const weeks = Math.floor(diffDays / 7);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import { TipsPanel } from "./TipsPanel";
|
|||||||
import ResManager from "../../../Main/Manager/ResManager";
|
import ResManager from "../../../Main/Manager/ResManager";
|
||||||
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
|
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
|
||||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||||
|
import { GirlDetailPanel } from "./GirlDetailPanel";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ export class GirlListPopupPanel extends li_BaseView {
|
|||||||
private girlTag: Label;
|
private girlTag: Label;
|
||||||
private balanceCount: Label;
|
private balanceCount: Label;
|
||||||
|
|
||||||
base: GirlListItem;
|
base: GirlDetailPanel;
|
||||||
img: Sprite;
|
img: Sprite;
|
||||||
uitransform: UITransform;
|
uitransform: UITransform;
|
||||||
openUIDataCT(data) {
|
openUIDataCT(data) {
|
||||||
@@ -119,7 +120,7 @@ export class GirlListPopupPanel extends li_BaseView {
|
|||||||
walletData.balance = Number(resData.balance);
|
walletData.balance = Number(resData.balance);
|
||||||
walletData.vipExpire = Number(resData.vipExpire);
|
walletData.vipExpire = Number(resData.vipExpire);
|
||||||
// 刷新界面
|
// 刷新界面
|
||||||
this.base.refreshBuy(true);
|
this.base.refresh();
|
||||||
this.close();
|
this.close();
|
||||||
TipsPanel.show("Buy Succeed");
|
TipsPanel.show("Buy Succeed");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -68,17 +68,21 @@ export class PastGirlListPanel extends li_BaseView {
|
|||||||
item.reset();
|
item.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected onEnable(): void {
|
||||||
|
this.refresh();
|
||||||
|
}
|
||||||
// TODO: 实现获取已解锁女孩列表的逻辑
|
// TODO: 实现获取已解锁女孩列表的逻辑
|
||||||
// 这个方法需要遍历所有分类,找出 isRelease === true 的女孩
|
// 这个方法需要遍历所有分类,找出 isRelease === true 的女孩
|
||||||
private getUnlockedGirls(): number[] {
|
private async getUnlockedGirls(): Promise<number[]> {
|
||||||
|
await this.reqCanChatGirlData();
|
||||||
|
|
||||||
const GirlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
const GirlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
const allids = GirlData.getAllReleaseGirlIds();
|
const allids = GirlData.getAllCanChatGirlIds();
|
||||||
logger.log(allids);
|
logger.log(allids);
|
||||||
return allids;
|
return allids;
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
async refresh() {
|
||||||
// 回收当前显示的节点到缓存池
|
// 回收当前显示的节点到缓存池
|
||||||
if (this.cache) {
|
if (this.cache) {
|
||||||
for (let i = this.cache.length - 1; i >= 0; i--) {
|
for (let i = this.cache.length - 1; i >= 0; i--) {
|
||||||
@@ -89,24 +93,12 @@ export class PastGirlListPanel extends li_BaseView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取已解锁女孩列表
|
// 获取已解锁女孩列表
|
||||||
const ids = this.getUnlockedGirls();
|
const ids = await this.getUnlockedGirls();
|
||||||
|
|
||||||
// 创建带时间戳的数组用于排序
|
|
||||||
const girlsWithTime: { id: number; lastTime: number }[] = [];
|
|
||||||
|
|
||||||
// 收集每个女孩的最后聊天时间
|
|
||||||
for (let id of ids) {
|
|
||||||
const lastTime = ChatHistoryManager.Instance.getLastChatTime(id) || 0;
|
|
||||||
girlsWithTime.push({ id, lastTime });
|
|
||||||
}
|
|
||||||
|
|
||||||
// 按最后聊天时间降序排序(最近的在前)
|
|
||||||
girlsWithTime.sort((a, b) => b.lastTime - a.lastTime);
|
|
||||||
|
|
||||||
// 根据排序后的数据刷新界面
|
// 根据排序后的数据刷新界面
|
||||||
for (let girlData of girlsWithTime) {
|
for (let id of ids) {
|
||||||
let item = this.getItemFromPool();
|
let item = this.getItemFromPool();
|
||||||
item.refreshData(girlData.id, this.node);
|
item.refreshData(id, this.node);
|
||||||
item.node.active = true;
|
item.node.active = true;
|
||||||
this.cache.push(item);
|
this.cache.push(item);
|
||||||
|
|
||||||
@@ -142,7 +134,7 @@ export class PastGirlListPanel extends li_BaseView {
|
|||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
girlData.setCanChatGirlData(resData);
|
girlData.setCanChatGirlData(resData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy() {
|
onDestroy() {
|
||||||
// 清理缓存池,销毁所有缓存的节点
|
// 清理缓存池,销毁所有缓存的节点
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ 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 { ChatHistoryManager } from "../manager/ChatHistoryManager";
|
import { ChatHistoryManager } from "../manager/ChatHistoryManager";
|
||||||
|
import { ThemeData } from "../data/ThemeData";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -29,6 +30,15 @@ export class PastGirlListItem extends Component {
|
|||||||
|
|
||||||
@property(Node)
|
@property(Node)
|
||||||
starParent: Node;
|
starParent: Node;
|
||||||
|
|
||||||
|
@property(Node)
|
||||||
|
freeTag: Node;
|
||||||
|
|
||||||
|
@property(UITransform)
|
||||||
|
categoryBg: UITransform;
|
||||||
|
@property(Label)
|
||||||
|
categoryTxt: Label;
|
||||||
|
|
||||||
@property(Node)
|
@property(Node)
|
||||||
loading: Node;
|
loading: Node;
|
||||||
stars: Sprite[];
|
stars: Sprite[];
|
||||||
@@ -83,6 +93,10 @@ export class PastGirlListItem extends Component {
|
|||||||
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);
|
||||||
|
|
||||||
|
this.freeTag.active = girlData.isGirlFreeType(
|
||||||
|
this.category.toString(),
|
||||||
|
this.id
|
||||||
|
);
|
||||||
// 标签显示
|
// 标签显示
|
||||||
let desc = "";
|
let desc = "";
|
||||||
const tags = LanguageUtils.getText(this.tagKey).split("|");
|
const tags = LanguageUtils.getText(this.tagKey).split("|");
|
||||||
@@ -121,12 +135,28 @@ 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);
|
||||||
|
|
||||||
// 显示最近聊天时间
|
// 显示最近聊天时间
|
||||||
return this.updateLastChatTime();
|
return this.updateLastChatTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
private getLastChatTime(id: number): number | null {
|
private getLastChatTime(id: number): number | null {
|
||||||
return ChatHistoryManager.Instance.getLastChatTime(id);
|
const GirlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
return GirlData.getLatestChatRecordTimestamp(
|
||||||
|
this.category.toString(),
|
||||||
|
this.id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新最近聊天时间显示
|
// 更新最近聊天时间显示
|
||||||
@@ -174,7 +204,7 @@ export class PastGirlListItem extends Component {
|
|||||||
NavigationManager.Instance.setSelectedGirlId(this.id);
|
NavigationManager.Instance.setSelectedGirlId(this.id);
|
||||||
|
|
||||||
// 通过openSubPanel打开ChatPanel作为子面板
|
// 通过openSubPanel打开ChatPanel作为子面板
|
||||||
const chatData = { girlId: this.id };
|
const chatData = { base: this.baseNode };
|
||||||
NavigationManager.Instance.openSubPanel(
|
NavigationManager.Instance.openSubPanel(
|
||||||
"ChatPanel",
|
"ChatPanel",
|
||||||
this.baseNode,
|
this.baseNode,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -52,8 +52,8 @@
|
|||||||
"rawHeight": 46,
|
"rawHeight": 46,
|
||||||
"borderTop": 0,
|
"borderTop": 0,
|
||||||
"borderBottom": 0,
|
"borderBottom": 0,
|
||||||
"borderLeft": 0,
|
"borderLeft": 30,
|
||||||
"borderRight": 0,
|
"borderRight": 30,
|
||||||
"packable": true,
|
"packable": true,
|
||||||
"pixelsToUnit": 100,
|
"pixelsToUnit": 100,
|
||||||
"pivotX": 0.5,
|
"pivotX": 0.5,
|
||||||
|
|||||||
+1
-1
Submodule xchat_cfg updated: f1c13f8ca3...fe55f874d0
Reference in New Issue
Block a user