Skip to content

Commit

Permalink
Basic replay watching ui
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Oct 6, 2018
1 parent f43a7c2 commit 57fd70e
Show file tree
Hide file tree
Showing 3 changed files with 711 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,22 @@ local width = SCREEN_WIDTH / 2 - 100
local height = 10
local alpha = 0.7
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--

local isReplay = GAMESTATE:GetPlayerState(PLAYER_1):GetPlayerController() == "PlayerController_Replay"
local replaySlider =
isReplay and
Widg.SliderBase {
width = width,
height = height,
min = 0,
visible = false,
max = GetPlayableTime(),
-- Change to onValueChangeEnd if this
-- lags too much
onValueChange = function(val)
SCREENMAN:GetTopScreen():SetReplayPosition(val)
end
} or
nil
local p =
Def.ActorFrame {
InitCommand = function(self)
Expand Down Expand Up @@ -982,7 +997,8 @@ local p =
settext(self, SecondsToMMSS(ttime))
diffuse(self, byMusicLength(ttime))
end
}
},
replaySlider
}

if enabledFullBar then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,47 @@ scroller =
SCREENMAN:GetTopScreen():JumpToReplayBookmark()
end
}
local span = 50
local x = -1 * span
local function button(txt, click)
x = x + span
return Widg.Button {
text = txt,
width = 60,
height = 30,
bgColor = getMainColor("highlight"),
highlight = {color = getMainColor("positive")},
border = {color = getMainColor("highlight"), width = 2},
onClick = click,
y = x + 50,
x = 210
}
end
local i = 1
scroller[#scroller + 1] =
Widg.Container {
x = 600,
y = 50,
content = {
button(
"Pause",
function()
i = i + 1
SCREENMAN:GetTopScreen():ToggleReplayPause()
end
),
button(
"Fast Forward",
function()
SCREENMAN:GetTopScreen():SetReplayPosition(SCREENMAN:GetTopScreen():GetSongPosition() + 5)
end
),
button(
"Rewind",
function()
SCREENMAN:GetTopScreen():SetReplayPosition(SCREENMAN:GetTopScreen():GetSongPosition() - 5)
end
)
}
}
return scroller
Loading

0 comments on commit 57fd70e

Please sign in to comment.