update
This commit is contained in:
@@ -408,37 +408,21 @@ export default class Utils {
|
||||
* 格式化聊天时间显示
|
||||
* @param timestamp 时间戳(毫秒),如果为null则显示"暂无聊天记录"
|
||||
* @returns 格式化的时间字符串
|
||||
* 格式规则:
|
||||
* - 一日内:显示时和分(HH:mm)
|
||||
* - 一周内:显示x天前
|
||||
* - 一个月内:显示x周前
|
||||
* - 一个月以上:显示"一个月以上"
|
||||
* 格式规则:显示完整的年月日时分秒(例如:2025-9-17 20:40:50)
|
||||
*/
|
||||
public static formatChatTime(timestamp: number | null): string {
|
||||
if (!timestamp) {
|
||||
return LanguageUtils.getText("pastgirllistpanel.nomemory");
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
const chatDate = new Date(timestamp);
|
||||
const diffMs = now.getTime() - chatDate.getTime();
|
||||
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
||||
const year = chatDate.getFullYear();
|
||||
const month = chatDate.getMonth() + 1;
|
||||
const day = chatDate.getDate();
|
||||
const hours = Utils.padStart(chatDate.getHours().toString(), 2);
|
||||
const minutes = Utils.padStart(chatDate.getMinutes().toString(), 2);
|
||||
const seconds = Utils.padStart(chatDate.getSeconds().toString(), 2);
|
||||
|
||||
if (diffDays === 0) {
|
||||
// 一日内:显示时和分
|
||||
const hours = Utils.padStart(chatDate.getHours().toString(), 2);
|
||||
const minutes = Utils.padStart(chatDate.getMinutes().toString(), 2);
|
||||
return `${hours}:${minutes}`;
|
||||
} else if (diffDays < 7) {
|
||||
// 一周内:显示x天前
|
||||
return `${diffDays}${LanguageUtils.getText("purchasepanel.day")}`;
|
||||
} else if (diffDays < 30) {
|
||||
// 一个月内:显示x周前
|
||||
const weeks = Math.floor(diffDays / 7);
|
||||
return `${weeks}${LanguageUtils.getText("purchasepanel.week")}`;
|
||||
} else {
|
||||
// 一个月以上:显示"一个月以上"
|
||||
return LanguageUtils.getText("purchasepanel.months");
|
||||
}
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,8 +232,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
}
|
||||
|
||||
let age = girlData.getGrilAge(this.category.toString(), this.id);
|
||||
this.descAge.string =
|
||||
LanguageUtils.getText("girldetailpanel.age") + age.toString();
|
||||
this.descAge.string = age.toString();
|
||||
|
||||
const firstPath = girlData.getFirstGrilVideoPath(
|
||||
this.category.toString(),
|
||||
@@ -326,17 +325,21 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
OnClickChatBtn() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
|
||||
|
||||
//if (isRelease || isFree) {
|
||||
// 直接在当前页面打开ChatPanel作为子页面
|
||||
const currentPanel = NavigationManager.Instance.getCurrentActivePanelNode();
|
||||
if (currentPanel) {
|
||||
const chatData = { girlId: this.id, base: currentPanel };
|
||||
NavigationManager.Instance.openSubPanel("ChatPanel", currentPanel, chatData, {
|
||||
openAnimation: PageTransitionType.SLIDE_LEFT,
|
||||
closeAnimation: PageTransitionType.SLIDE_RIGHT,
|
||||
hideBasePanel: true,
|
||||
});
|
||||
NavigationManager.Instance.openSubPanel(
|
||||
"ChatPanel",
|
||||
currentPanel,
|
||||
chatData,
|
||||
{
|
||||
openAnimation: PageTransitionType.SLIDE_LEFT,
|
||||
closeAnimation: PageTransitionType.SLIDE_RIGHT,
|
||||
hideBasePanel: true,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
logger.warn("[GirlDetailPanel] 无法获取当前激活的主页面");
|
||||
}
|
||||
|
||||
@@ -56,6 +56,26 @@ export class ShowPanel extends li_BaseView {
|
||||
start() {
|
||||
//this.splash.node.on(Node.EventType.TOUCH_START,this.onclickback);
|
||||
GButton.BandClick(this.splash.node, this.onClose, this);
|
||||
|
||||
// 监听视频点击事件(Web平台上视频会覆盖UI,需要直接监听视频点击)
|
||||
if (this.videoPlayer) {
|
||||
this.videoPlayer.node.on(
|
||||
VideoPlayer.EventType.CLICKED,
|
||||
this.onClose,
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// 清理视频点击事件监听
|
||||
if (this.videoPlayer && this.videoPlayer.node) {
|
||||
this.videoPlayer.node.off(
|
||||
VideoPlayer.EventType.CLICKED,
|
||||
this.onClose,
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected onClose() {
|
||||
@@ -63,7 +83,7 @@ export class ShowPanel extends li_BaseView {
|
||||
if (this.videoPlayer) {
|
||||
this.videoPlayer.stop();
|
||||
}
|
||||
|
||||
|
||||
if (this.func) {
|
||||
this.func();
|
||||
}
|
||||
@@ -105,10 +125,10 @@ export class ShowPanel extends li_BaseView {
|
||||
const pos = this.videoArea.node.getWorldPosition();
|
||||
this.videoPlayer.node.setWorldPosition(pos);
|
||||
}
|
||||
|
||||
|
||||
this.videoPlayer.loop = true;
|
||||
this.videoPlayer.play();
|
||||
|
||||
|
||||
// 延迟调整缩放以填充区域
|
||||
this.scheduleOnce(() => {
|
||||
this.adjustVideoScale();
|
||||
@@ -123,7 +143,7 @@ export class ShowPanel extends li_BaseView {
|
||||
const videoAreaPos = this.videoArea
|
||||
? this.videoArea.node.getWorldPosition()
|
||||
: undefined;
|
||||
|
||||
|
||||
if (SceneBgVideoLayer.handle) {
|
||||
SceneBgVideoLayer.handle.playVideo(path, {
|
||||
loop: true,
|
||||
@@ -140,13 +160,13 @@ export class ShowPanel extends li_BaseView {
|
||||
*/
|
||||
private adjustVideoScale() {
|
||||
if (!this.videoPlayer || !this.videoArea) return;
|
||||
|
||||
|
||||
const videoTransform = this.videoPlayer.node.getComponent(UITransform);
|
||||
if (videoTransform && videoTransform.height > 0) {
|
||||
const scaleX = this.videoArea.width / videoTransform.width;
|
||||
const scaleY = this.videoArea.height / videoTransform.height;
|
||||
const scale = Math.max(scaleX, scaleY); // 填满整个区域
|
||||
|
||||
|
||||
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
|
||||
logger.log(`ShowPanel: 调整视频缩放到 ${scale}`);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ export class DetailImageItem extends Component {
|
||||
|
||||
@property(Sprite)
|
||||
video: Sprite;
|
||||
@property(Sprite)
|
||||
videoReady: Sprite;
|
||||
|
||||
@property(Node)
|
||||
priceFrame: Node;
|
||||
@@ -166,6 +168,8 @@ export class DetailImageItem extends Component {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
let imgPath = "";
|
||||
this.video.enabled = type === proto.cs.EnmResType.ERT_Video;
|
||||
this.videoReady.enabled = false;
|
||||
|
||||
this.priceFrame.active = type === proto.cs.EnmResType.ERT_Video;
|
||||
let price = 0;
|
||||
// 是否可见,不可见代表需要解锁
|
||||
@@ -183,6 +187,13 @@ export class DetailImageItem extends Component {
|
||||
this.girlId,
|
||||
this.resId
|
||||
);
|
||||
if (this.isVisible) {
|
||||
this.video.enabled = false;
|
||||
this.videoReady.enabled = true;
|
||||
} else {
|
||||
this.video.enabled = true;
|
||||
this.videoReady.enabled = false;
|
||||
}
|
||||
}
|
||||
if (type === proto.cs.EnmResType.ERT_Image) {
|
||||
// 图片
|
||||
|
||||
Reference in New Issue
Block a user