Merge pull request 'Improved Countdown Timer' (#47) from feature/eventmode-countdown-timer into master
Reviewed-on: #47
|
@ -106,5 +106,19 @@
|
|||
"label": "Show Effect Radar for compatible songs (VERY WIP)",
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
|
||||
"songselect_enableTimer": {
|
||||
"label": "Display a countdown timer until a demo is played, when available (Buggy)",
|
||||
"type": "bool",
|
||||
"default": false
|
||||
},
|
||||
|
||||
"songselect_freezeTimer": {
|
||||
"label": "Freeze timer on value (in seconds, -1 to disable)",
|
||||
"type": "int",
|
||||
"default": -1,
|
||||
"min": -1,
|
||||
"max": 5999
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
require("common.globals")
|
||||
require("common.gameconfig")
|
||||
|
||||
local version = require("common.version")
|
||||
local Dim = require("common.dimensions")
|
||||
local Num = require("components.numbers")
|
||||
|
||||
local BAR_ALPHA = 191
|
||||
|
||||
|
@ -8,6 +12,10 @@ local footerY = Dim.design.height - FOOTER_HEIGHT
|
|||
|
||||
-- Images
|
||||
local footerRightImage = gfx.CreateSkinImage("components/bars/footer_right.png", 0)
|
||||
local timeImage = gfx.CreateSkinImage("components/bars/time.png", 0)
|
||||
local creditImage = gfx.CreateSkinImage("components/bars/credit.png", 0)
|
||||
local timeNumbers = Num.load_number_image("components/bars/time_num")
|
||||
local timeColon = gfx.CreateSkinImage("components/bars/time_colon.png", 0)
|
||||
|
||||
-- Animation related
|
||||
local entryTransitionScale = 0
|
||||
|
@ -15,7 +23,68 @@ local entryTransitionFooterYOffset = 0
|
|||
|
||||
local legend = {{control = "START", text = "Confirm selection"}, {control = "KNOB", text = "Scroll"}}
|
||||
|
||||
local function set() end
|
||||
local timeOut = tonumber(GameConfig["DemoIdleTime"]) or 0
|
||||
local demoIdleTime = timeOut
|
||||
local enableTimer = game.GetSkinSetting("songselect_enableTimer") or false
|
||||
local freezeTimer = game.GetSkinSetting("songselect_freezeTimer") or -1
|
||||
|
||||
local function resetTimer()
|
||||
timeOut = demoIdleTime or 0
|
||||
end
|
||||
|
||||
local function set(o)
|
||||
o = o or {
|
||||
enableTimer=game.GetSkinSetting("songselect_enableTimer") or false,
|
||||
freezeTimer=game.GetSkinSetting("songselect_freezeTimer") or -1
|
||||
}
|
||||
enableTimer = o.enableTimer
|
||||
freezeTimer = o.freezeTimer
|
||||
end
|
||||
|
||||
local function drawTimer(time_s, show_minutes)
|
||||
if show_minutes then
|
||||
gfx.BeginPath()
|
||||
local xpos, ypos = Dim.design.width - 500, footerY + 55
|
||||
local w, h = gfx.ImageSize(timeImage)
|
||||
gfx.ImageRect(xpos, ypos, w, h, timeImage, 1, 0)
|
||||
|
||||
-- Draw minutes:seconds display
|
||||
local minutes, seconds = time_s // 60, time_s % 60
|
||||
|
||||
local tens, ones = math.floor(minutes // 10), math.floor(minutes % 10)
|
||||
w, h = 90, 90
|
||||
xpos, ypos = xpos + 55, footerY - 16
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(xpos, ypos, w, h, timeNumbers[tens + 1], 1, 0)
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(xpos + w, ypos, w, h, timeNumbers[ones + 1], 1, 0)
|
||||
|
||||
xpos = xpos + 2 * w
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(xpos - 29, ypos, w, h, timeColon, 1, 0)
|
||||
|
||||
xpos = xpos + 32
|
||||
tens, ones = math.floor(seconds // 10), math.floor(seconds % 10)
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(xpos, ypos, w, h, timeNumbers[tens + 1], 1, 0)
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(xpos + w, ypos, w, h, timeNumbers[ones + 1], 1, 0)
|
||||
else
|
||||
gfx.BeginPath()
|
||||
local xpos, ypos = Dim.design.width - 270, footerY + 55
|
||||
local w, h = gfx.ImageSize(timeImage)
|
||||
gfx.ImageRect(xpos, ypos, w, h, timeImage, 1, 0)
|
||||
|
||||
-- Draw only seconds
|
||||
local tens, ones = math.floor(time_s // 10), math.floor(time_s % 10)
|
||||
w, h = 90, 90
|
||||
xpos, ypos = xpos + 55, footerY - 16
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(xpos, ypos, w, h, timeNumbers[tens + 1], 1, 0)
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(xpos + w, ypos, w, h, timeNumbers[ones + 1], 1, 0)
|
||||
end
|
||||
end
|
||||
|
||||
local function drawFooter()
|
||||
gfx.BeginPath()
|
||||
|
@ -23,9 +92,25 @@ local function drawFooter()
|
|||
gfx.Rect(0, footerY, Dim.design.width, FOOTER_HEIGHT)
|
||||
gfx.Fill()
|
||||
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(Dim.design.width - 275, footerY - 25, 328 * 0.85, 188 * 0.85, footerRightImage, 1, 0)
|
||||
-- Timer
|
||||
local showTimer = enableTimer and (freezeTimer ~= -1 or GameConfig["EventMode"] == "True")
|
||||
if showTimer then
|
||||
-- Show dynamic timer
|
||||
if freezeTimer ~= -1 then
|
||||
drawTimer(freezeTimer, freezeTimer > 59)
|
||||
else
|
||||
drawTimer(timeOut, demoIdleTime and demoIdleTime > 59)
|
||||
end
|
||||
gfx.BeginPath()
|
||||
local w, h = gfx.ImageSize(creditImage)
|
||||
gfx.ImageRect(Dim.design.width - 190, footerY + 95, w, h, creditImage, 1, 0)
|
||||
else
|
||||
-- Show static image
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(Dim.design.width - 275, footerY - 25, 328 * 0.85, 188 * 0.85, footerRightImage, 1, 0)
|
||||
end
|
||||
|
||||
-- Version String
|
||||
gfx.BeginPath()
|
||||
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
|
||||
gfx.FontSize(20)
|
||||
|
@ -40,6 +125,8 @@ local function progressTransitions(deltaTime)
|
|||
|
||||
entryTransitionFooterYOffset = FOOTER_HEIGHT * (1 - entryTransitionScale)
|
||||
footerY = Dim.design.height - FOOTER_HEIGHT + entryTransitionFooterYOffset
|
||||
|
||||
timeOut = math.max(timeOut - deltaTime, 0)
|
||||
end
|
||||
|
||||
local function draw(deltaTime, params)
|
||||
|
@ -64,4 +151,4 @@ local function draw(deltaTime, params)
|
|||
gfx.Restore()
|
||||
end
|
||||
|
||||
return {set = set, draw = draw}
|
||||
return {set = set, draw = draw, resetTimer = resetTimer}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
local Easing = require('common.easing')
|
||||
local Dim = require("common.dimensions")
|
||||
local SongSelectHeader = require('components.headers.songSelectHeader')
|
||||
local Footer = require('components.footer')
|
||||
|
||||
local defaultFolderBgImage = gfx.CreateSkinImage('song_select/filter_wheel/bg.png', 0)
|
||||
local collectionFolderBgImage = gfx.CreateSkinImage('song_select/filter_wheel/col_bg.png', 0)
|
||||
|
@ -371,7 +370,6 @@ local drawFilterWheel = function (deltaTime)
|
|||
|
||||
if (game.GetSkinSetting('_currentScreen') == 'songwheel') then
|
||||
SongSelectHeader.draw(deltaTime)
|
||||
Footer.draw(deltaTime)
|
||||
end
|
||||
|
||||
if (isFilterWheelActive ~= previousActiveState) then
|
||||
|
|
|
@ -6,6 +6,7 @@ local Wallpaper = require("components.wallpaper")
|
|||
local common = require('common.util')
|
||||
local Sound = require("common.sound")
|
||||
local Numbers = require('components.numbers')
|
||||
local Footer = require('components.footer')
|
||||
|
||||
local VolforceCalc = require('components.volforceCalc')
|
||||
|
||||
|
@ -1114,6 +1115,8 @@ local draw_songwheel = function(deltaTime)
|
|||
gfx.Text('S_I: ' .. selectedIndex .. ' // S_D: ' .. selectedDifficulty .. ' // S_UP: ' .. debugScrollingUp .. ' // AC_TS: ' .. transitionAfterscrollScale .. ' // L_TS: ' .. transitionLeaveScale .. ' // IR_CODE: ' .. irRequestStatus .. ' // IR_T: ' .. irRequestTimeout, 8, 8)
|
||||
end
|
||||
|
||||
Footer.draw(deltaTime)
|
||||
|
||||
gfx.ResetTransform()
|
||||
end
|
||||
|
||||
|
@ -1185,6 +1188,7 @@ set_index = function(newIndex)
|
|||
transitionAfterscrollScale = 0
|
||||
transitionJacketBgScrollScale = 0
|
||||
|
||||
Footer.resetTimer()
|
||||
|
||||
game.SetSkinSetting('_songWheelScrollbarTotal', #songwheel.songs)
|
||||
game.SetSkinSetting('_songWheelScrollbarIndex', newIndex)
|
||||
|
@ -1211,6 +1215,7 @@ set_diff = function(newDiff)
|
|||
game.PlaySample('song_wheel/diff_change.wav')
|
||||
end
|
||||
|
||||
Footer.resetTimer()
|
||||
updateRadar = true
|
||||
|
||||
selectedDifficulty = newDiff
|
||||
|
|
|
@ -150,6 +150,8 @@ local playedBgm = false
|
|||
|
||||
local triggerServiceMenu = false
|
||||
|
||||
Footer.set{enableTimer=false}
|
||||
|
||||
local function setButtonActions()
|
||||
buttons[1].action = Menu.Challenges
|
||||
buttons[2].action = Menu.Multiplayer
|
||||
|
|
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 3.8 KiB |