协议调试:商城
This commit is contained in:
@@ -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")}`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user