format date

This commit is contained in:
ckcz123 2019-03-28 19:38:44 +08:00
parent d7fb0a2f3f
commit 5e978fa2d4
2 changed files with 8 additions and 7 deletions

View File

@ -2224,17 +2224,12 @@ ui.prototype.drawStatistics = function (floorIds) {
(floorIds || core.floorIds).forEach(function (floorId) {
core.ui._drawStatistics_floorId(floorId, obj);
});
var formatTime = function (time) {
return core.setTwoDigits(parseInt(time/3600000))
+":"+core.setTwoDigits(parseInt(time/60000)%60)
+":"+core.setTwoDigits(parseInt(time/1000)%60);
}
var statistics = core.status.hero.statistics;
core.drawText([
this._drawStatistics_generateText(obj, "全塔", obj.total),
this._drawStatistics_generateText(obj, "当前", obj.current),
"当前总步数:"+core.status.hero.steps+",当前游戏时长:"+formatTime(statistics.currTime)
+",总游戏时长"+formatTime(statistics.totalTime)
"当前总步数:"+core.status.hero.steps+",当前游戏时长:"+core.formatTime(statistics.currTime)
+",总游戏时长"+core.formatTime(statistics.totalTime)
+"。\n瞬间移动次数"+statistics.moveDirectly+",共计少走"+statistics.ignoreSteps+"步。"
+"\n\n总计通过血瓶恢复生命值为"+core.formatBigNumber(statistics.hp)+"点。\n\n"
+"总计打死了"+statistics.battle+"个怪物,得到了"+core.formatBigNumber(statistics.money)+"金币,"+core.formatBigNumber(statistics.experience)+"点经验。\n\n"

View File

@ -348,6 +348,12 @@ utils.prototype.formatDate2 = function (date) {
+ core.setTwoDigits(date.getHours()) + core.setTwoDigits(date.getMinutes()) + core.setTwoDigits(date.getSeconds());
}
utils.prototype.formatTime = function (time) {
return core.setTwoDigits(parseInt(time/3600000))
+":"+core.setTwoDigits(parseInt(time/60000)%60)
+":"+core.setTwoDigits(parseInt(time/1000)%60);
}
////// 两位数显示 //////
utils.prototype.setTwoDigits = function (x) {
return parseInt(x) < 10 ? "0" + x : x;