协议调试:商城

This commit is contained in:
chen wei bo
2025-09-10 11:37:47 +08:00
parent ce39270ebb
commit c1471c1540
4 changed files with 122 additions and 62 deletions
+19
View File
@@ -12,6 +12,7 @@ import {
view,
} from "cc";
import li_EventManager from "./li_EventManager";
import LanguageUtils from "./LanguageUtils";
const { ccclass, property } = _decorator;
@@ -355,4 +356,22 @@ export default class Utils {
console.log(`${key}消耗时间:${timecha}毫秒`);
Utils._eplTime = time;
}
// 获取格式化字符串: vip失效时间
public static formatVipLeftTime(expiryTimestamp: number): string {
const dateNow = new Date();
const timeDiff = Math.abs(expiryTimestamp - dateNow.getTime());
const hours = Math.floor(timeDiff / (1000 * 60 * 60));
if (hours >= 24) {
return (
(hours % 24).toString() + LanguageUtils.getText("purchasepanel.day")
);
}
const minutes = Math.floor((timeDiff / (1000 * 60)) % 60);
//const seconds = Math.floor((timeDiff / 1000) % 60);
return `${hours}${LanguageUtils.getText(
"purchasepanel.hour"
)}:${minutes}${LanguageUtils.getText("purchasepanel.minute")}`;
}
}