formatting
This commit is contained in:
parent
d5f9faabf2
commit
c3ae26521b
|
@ -1,7 +1,7 @@
|
|||
local Easing = require('common.easings');
|
||||
local Footer = require('components.footer');
|
||||
local Easing = require("common.easings");
|
||||
local Footer = require("components.footer");
|
||||
|
||||
local VolforceWindow = require('components.volforceWindow')
|
||||
local VolforceWindow = require("components.volforceWindow")
|
||||
|
||||
local resx, resy = game.GetResolution()
|
||||
local desw = 1080
|
||||
|
@ -13,20 +13,18 @@ local bgSfxPlayed = false;
|
|||
local BAR_ALPHA = 191;
|
||||
local HEADER_HEIGHT = 100
|
||||
|
||||
|
||||
local backgroundImage = gfx.CreateSkinImage("challenge_result/bg.png", 0);
|
||||
local playerInfoOverlayBgImage = gfx.CreateSkinImage("challenge_result/player_info_overlay_bg.png", 0);
|
||||
|
||||
local headerTitleImage = gfx.CreateSkinImage("challenge_result/header/title.png", 0);
|
||||
|
||||
|
||||
local username = game.GetSkinSetting('username');
|
||||
local username = game.GetSkinSetting("username");
|
||||
local appealCardImage = gfx.CreateSkinImage("crew/appeal_card.png", 0);
|
||||
local danBadgeImage = gfx.CreateSkinImage("dan/inf.png", 0);
|
||||
local crewImage = gfx.CreateSkinImage("crew/portrait.png", 0);
|
||||
|
||||
local irHeartbeatRequested = false;
|
||||
local IRserverName = '';
|
||||
local IRserverName = "";
|
||||
|
||||
-- AUDIO
|
||||
game.LoadSkinSample("challenge_result.wav")
|
||||
|
@ -43,15 +41,18 @@ local function handleSfx()
|
|||
game.PlaySample("challenge_result.wav", true)
|
||||
bgSfxPlayed = true
|
||||
end
|
||||
if game.GetButton(game.BUTTON_STA) then game.StopSample("challenge_result.wav") end
|
||||
if game.GetButton(game.BUTTON_BCK) then game.StopSample("challenge_result.wav") end
|
||||
if game.GetButton(game.BUTTON_STA) then
|
||||
game.StopSample("challenge_result.wav")
|
||||
end
|
||||
if game.GetButton(game.BUTTON_BCK) then
|
||||
game.StopSample("challenge_result.wav")
|
||||
end
|
||||
end
|
||||
|
||||
local function load_number_image(path)
|
||||
local images = {}
|
||||
for i = 0, 9 do
|
||||
images[i + 1] = gfx.CreateSkinImage(string.format("%s/%d.png", path, i),
|
||||
0)
|
||||
images[i + 1] = gfx.CreateSkinImage(string.format("%s/%d.png", path, i), 0)
|
||||
end
|
||||
return images
|
||||
end
|
||||
|
@ -68,7 +69,9 @@ local function draw_number(x, y, alpha, num, digits, images, is_dim, scale, kern
|
|||
local mul = 10 ^ (i - 1)
|
||||
local digit = math.floor(num / mul) % 10
|
||||
local a = alpha
|
||||
if is_dim and num < mul then a = 0.4 end
|
||||
if is_dim and num < mul then
|
||||
a = 0.4
|
||||
end
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(x, y, tw, th, images[digit + 1], a, 0)
|
||||
x = x - (tw * kern)
|
||||
|
@ -105,9 +108,9 @@ function drawPlayerInfo()
|
|||
|
||||
-- Draw description
|
||||
gfx.FontSize(28)
|
||||
gfx.LoadSkinFont('Digital-Serial-Bold.ttf')
|
||||
gfx.LoadSkinFont("Digital-Serial-Bold.ttf")
|
||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
||||
gfx.Text('Hellooooooo', 310, 370);
|
||||
gfx.Text("Hellooooooo", 310, 370);
|
||||
|
||||
-- Draw username
|
||||
gfx.FontSize(40)
|
||||
|
@ -133,9 +136,7 @@ function drawScorePanelContent()
|
|||
end
|
||||
game.Log("#" .. i .. " chart.score: " .. chart.score, game.LOGGER_INFO) -- debug
|
||||
-- Draw score
|
||||
draw_number(250, 150, 1.0,
|
||||
math.floor(chart.score / 10000), 4, scoreNumber, true, 0.40,
|
||||
1.12)
|
||||
draw_number(250, 150, 1.0, math.floor(chart.score / 10000), 4, scoreNumber, true, 0.40, 1.12)
|
||||
-- still not sure how ui scaling/layers works in this game, still figuring it out :p
|
||||
end
|
||||
|
||||
|
@ -143,7 +144,7 @@ end
|
|||
|
||||
local IR_HeartbeatResponse = function(res)
|
||||
if res.statusCode == IRData.States.Success then
|
||||
IRserverName = res.body.serverName .. ' ' .. res.body.irVersion;
|
||||
IRserverName = res.body.serverName .. " " .. res.body.irVersion;
|
||||
else
|
||||
game.Log("Can't connect to IR!", game.LOGGER_WARNING)
|
||||
end
|
||||
|
@ -170,7 +171,6 @@ function render(deltaTime)
|
|||
|
||||
drawScorePanelContent()
|
||||
|
||||
|
||||
drawHeader()
|
||||
Footer.draw(deltaTime);
|
||||
end
|
|
@ -30,12 +30,36 @@ local backgroundImage = gfx.CreateSkinImage("challenge_select/bg.png", 0)
|
|||
local jacketFallback = gfx.CreateSkinImage("song_select/loading.png", 0)
|
||||
local showGuide = game.GetSkinSetting("show_guide")
|
||||
local legendTable = {
|
||||
{["labelSingleLine"] = gfx.CreateLabel("SCROLL INFO",16, 0), ["labelMultiLine"] = gfx.CreateLabel("SCROLL\nINFO",16, 0), ["image"] = gfx.CreateSkinImage("legend/knob-left.png", 0)},
|
||||
{["labelSingleLine"] = gfx.CreateLabel("CHALL SELECT",16, 0), ["labelMultiLine"] = gfx.CreateLabel("CHALLENGE\nSELECT",16, 0), ["image"] = gfx.CreateSkinImage("legend/knob-right.png", 0)},
|
||||
{["labelSingleLine"] = gfx.CreateLabel("FILTER CHALLS",16, 0), ["labelMultiLine"] = gfx.CreateLabel("FILTER\nCHALLENGES",16, 0), ["image"] = gfx.CreateSkinImage("legend/FX-L.png", 0)},
|
||||
{["labelSingleLine"] = gfx.CreateLabel("SORT CHALLS",16, 0), ["labelMultiLine"] = gfx.CreateLabel("SORT\nCHALLENGES",16, 0), ["image"] = gfx.CreateSkinImage("legend/FX-R.png", 0)},
|
||||
{["labelSingleLine"] = gfx.CreateLabel("GAME SETTINGS",16, 0), ["labelMultiLine"] = gfx.CreateLabel("GAME\nSETTINGS",16, 0), ["image"] = gfx.CreateSkinImage("legend/FX-LR.png", 0)},
|
||||
{["labelSingleLine"] = gfx.CreateLabel("PLAY",16, 0), ["labelMultiLine"] = gfx.CreateLabel("PLAY",16, 0), ["image"] = gfx.CreateSkinImage("legend/start.png", 0)}
|
||||
{
|
||||
["labelSingleLine"] = gfx.CreateLabel("SCROLL INFO", 16, 0),
|
||||
["labelMultiLine"] = gfx.CreateLabel("SCROLL\nINFO", 16, 0),
|
||||
["image"] = gfx.CreateSkinImage("legend/knob-left.png", 0)
|
||||
},
|
||||
{
|
||||
["labelSingleLine"] = gfx.CreateLabel("CHALL SELECT", 16, 0),
|
||||
["labelMultiLine"] = gfx.CreateLabel("CHALLENGE\nSELECT", 16, 0),
|
||||
["image"] = gfx.CreateSkinImage("legend/knob-right.png", 0)
|
||||
},
|
||||
{
|
||||
["labelSingleLine"] = gfx.CreateLabel("FILTER CHALLS", 16, 0),
|
||||
["labelMultiLine"] = gfx.CreateLabel("FILTER\nCHALLENGES", 16, 0),
|
||||
["image"] = gfx.CreateSkinImage("legend/FX-L.png", 0)
|
||||
},
|
||||
{
|
||||
["labelSingleLine"] = gfx.CreateLabel("SORT CHALLS", 16, 0),
|
||||
["labelMultiLine"] = gfx.CreateLabel("SORT\nCHALLENGES", 16, 0),
|
||||
["image"] = gfx.CreateSkinImage("legend/FX-R.png", 0)
|
||||
},
|
||||
{
|
||||
["labelSingleLine"] = gfx.CreateLabel("GAME SETTINGS", 16, 0),
|
||||
["labelMultiLine"] = gfx.CreateLabel("GAME\nSETTINGS", 16, 0),
|
||||
["image"] = gfx.CreateSkinImage("legend/FX-LR.png", 0)
|
||||
},
|
||||
{
|
||||
["labelSingleLine"] = gfx.CreateLabel("PLAY", 16, 0),
|
||||
["labelMultiLine"] = gfx.CreateLabel("PLAY", 16, 0),
|
||||
["image"] = gfx.CreateSkinImage("legend/start.png", 0)
|
||||
}
|
||||
}
|
||||
local grades = {
|
||||
{ ["max"] = 6999999, ["image"] = gfx.CreateSkinImage("common/grades/D.png", 0) },
|
||||
|
@ -55,7 +79,7 @@ local badges = {
|
|||
gfx.CreateSkinImage("song_select/medal/clear.png", 1),
|
||||
gfx.CreateSkinImage("song_select/medal/hard.png", 1),
|
||||
gfx.CreateSkinImage("song_select/medal/uc.png", 1),
|
||||
gfx.CreateSkinImage("song_select/medal/puc.png", 1),
|
||||
gfx.CreateSkinImage("song_select/medal/puc.png", 1)
|
||||
}
|
||||
|
||||
gfx.LoadSkinFont("dfmarugoth.ttf");
|
||||
|
@ -91,7 +115,6 @@ local thirdY = 0
|
|||
local halfY = 0
|
||||
local fullY = 0
|
||||
|
||||
|
||||
adjustScreen = function(x, y)
|
||||
local a = x / y;
|
||||
fifthX = x / 5
|
||||
|
@ -107,9 +130,10 @@ adjustScreen = function(x,y)
|
|||
fullY = y
|
||||
end
|
||||
|
||||
|
||||
check_or_create_cache = function(song, full)
|
||||
if not songCache[song.id] then songCache[song.id] = {} end
|
||||
if not songCache[song.id] then
|
||||
songCache[song.id] = {}
|
||||
end
|
||||
|
||||
if not songCache[song.id]["title"] then
|
||||
songCache[song.id]["title"] = gfx.CreateLabel(song.title, 30, 0)
|
||||
|
@ -125,11 +149,14 @@ check_or_create_cache = function(song, full)
|
|||
end
|
||||
songCache[song.id]["chart_names"] = gfx.CreateLabel(names, 20, 0)
|
||||
end
|
||||
if song.topBadge ~= 0 and (
|
||||
not songCache[song.id]["percent"] or
|
||||
not songCache[song.id]["percent_value"] or
|
||||
songCache[song.id]["percent_value"] ~= song.bestScore) then
|
||||
songCache[song.id]["percent"] = gfx.CreateLabel(string.format("%u%%", math.max(0,(song.bestScore - 8000000)//10000)), 35, 0)
|
||||
if song.topBadge ~= 0
|
||||
and (not songCache[song.id]["percent"] or not songCache[song.id]["percent_value"]
|
||||
or songCache[song.id]["percent_value"] ~= song.bestScore) then
|
||||
songCache[song.id]["percent"] = gfx.CreateLabel(
|
||||
string.format(
|
||||
"%u%%", math.max(0, (song.bestScore - 8000000) // 10000)
|
||||
), 35, 0
|
||||
)
|
||||
songCache[song.id]["percent_value"] = song.bestScore
|
||||
end
|
||||
if full then
|
||||
|
@ -175,7 +202,9 @@ draw_scores = function(difficulty, x, y, w, h)
|
|||
scoreLabel = gfx.CreateLabel(string.format("%08d", highScore.score), 40, 0)
|
||||
if difficulty.topBadge ~= 0 then
|
||||
gfx.BeginPath()
|
||||
gfx.ImageRect(x+xOffset+w-h/2, y+h/2 +5, (h/2-10), h/2-10, badges[difficulty.topBadge], 1, 0)
|
||||
gfx.ImageRect(
|
||||
x + xOffset + w - h / 2, y + h / 2 + 5, (h / 2 - 10), h / 2 - 10, badges[difficulty.topBadge], 1, 0
|
||||
)
|
||||
end
|
||||
gfx.FillColor(255, 255, 255)
|
||||
gfx.FontSize(40);
|
||||
|
@ -234,9 +263,6 @@ draw_diff_icon = function(diff, x, y, w, h, selected, deltaTime)
|
|||
-- DiffRectangle.render(deltaTime, 183, 2.5, 10, songCache[song.id][selectedDiff],tostring(diff.level));
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
draw_diffs = function(diffs, x, y, w, h)
|
||||
local diffWidth = w / 2.5
|
||||
local diffHeight = w / 2.5
|
||||
|
@ -301,7 +327,6 @@ draw_selected = function(song, x, y, w, h)
|
|||
imageSize = math.floor(imageSize / square_size)
|
||||
local bottom_off = math.ceil((square_size - #song.charts))
|
||||
|
||||
|
||||
local img_row = 0;
|
||||
local img_col = 0;
|
||||
for i, chart in ipairs(song.charts) do
|
||||
|
@ -313,7 +338,10 @@ draw_selected = function(song, x, y, w, h)
|
|||
if math.ceil(i / square_size) == square_size then
|
||||
xoff = xoff
|
||||
end
|
||||
gfx.ImageRect(62.52,888.6+ (img_row/200 * imageSize), imageSize*1.19, imageSize*1.19, songCache[song.id]["jackets"][i], 1, 0)
|
||||
gfx.ImageRect(
|
||||
62.52, 888.6 + (img_row / 200 * imageSize), imageSize * 1.19, imageSize * 1.19,
|
||||
songCache[song.id]["jackets"][i], 1, 0
|
||||
)
|
||||
img_col = img_col + 1
|
||||
if img_col >= square_size then
|
||||
img_row = img_row + 1
|
||||
|
@ -378,7 +406,6 @@ draw_selected = function(song, x, y, w, h)
|
|||
gfx.DrawLabel(songCache[song.id]["percent"], 595, 1045, 200)
|
||||
end
|
||||
|
||||
|
||||
-- Render desc scrolling box
|
||||
do
|
||||
-- gfx.BeginPath()
|
||||
|
@ -406,8 +433,6 @@ draw_selected = function(song, x, y, w, h)
|
|||
gfx.Fill()
|
||||
end
|
||||
|
||||
|
||||
|
||||
gfx.BeginPath()
|
||||
gfx.TextAlign(gfx.TEXT_ALIGN_LEFT + gfx.TEXT_ALIGN_MIDDLE)
|
||||
gfx.DrawLabel(songCache[song.id]["desc"], 600, 942)
|
||||
|
@ -429,7 +454,8 @@ draw_songwheel = function(x,y,w,h)
|
|||
for i = math.max(selectedIndex - wheelSize / 2, 1), math.max(selectedIndex - 1, 0) do
|
||||
local song = chalwheel.challenges[i]
|
||||
local xpos = x + offsetX + ((selectedIndex - i + ioffset) ^ 2) * 3
|
||||
local offsetY = (selectedIndex - i + ioffset) * ( height - (wheelSize/2*((selectedIndex-i + ioffset)*aspectFloat)))
|
||||
local offsetY = (selectedIndex - i + ioffset)
|
||||
* (height - (wheelSize / 2 * ((selectedIndex - i + ioffset) * aspectFloat)))
|
||||
local ypos = y + ((h / 2 - height / 2) - offsetY)
|
||||
draw_song(song, xpos, ypos, width, height)
|
||||
end
|
||||
|
@ -438,7 +464,8 @@ draw_songwheel = function(x,y,w,h)
|
|||
for i = math.min(selectedIndex + wheelSize / 2, #chalwheel.challenges), selectedIndex + 1, -1 do
|
||||
local song = chalwheel.challenges[i]
|
||||
local xpos = x + offsetX + ((i - selectedIndex - ioffset) ^ 2) * 2
|
||||
local offsetY = (selectedIndex - i + ioffset) * ( height - (wheelSize/2*((i-selectedIndex - ioffset)*aspectFloat)))
|
||||
local offsetY = (selectedIndex - i + ioffset)
|
||||
* (height - (wheelSize / 2 * ((i - selectedIndex - ioffset) * aspectFloat)))
|
||||
local ypos = y + ((h / 2 - height / 2) - (selectedIndex - i) - offsetY)
|
||||
local alpha = 255 - (selectedIndex - i + ioffset) * 31
|
||||
draw_song(song, xpos, ypos, width, height)
|
||||
|
@ -511,8 +538,6 @@ draw_search = function(x,y,w,h)
|
|||
end
|
||||
|
||||
render = function(deltaTime)
|
||||
|
||||
|
||||
timer = (timer + deltaTime)
|
||||
timer = timer % 2
|
||||
resx, resy = game.GetResolution();
|
||||
|
@ -540,7 +565,6 @@ render = function(deltaTime)
|
|||
|
||||
draw_search(fifthX * 2, 5, fifthX * 3, fifthY / 5)
|
||||
|
||||
|
||||
ioffset = ioffset * 0.9
|
||||
doffset = doffset * 0.9
|
||||
soffset = soffset * 0.8
|
||||
|
@ -588,5 +612,7 @@ local gradeRates = {
|
|||
}
|
||||
|
||||
challenges_changed = function(withAll)
|
||||
if not withAll then return end
|
||||
if not withAll then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue