Skip to content

Commit

Permalink
Fix Noteskin Preview failing on non-dance Games
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Dec 21, 2019
1 parent ba396d9 commit a7c80ac
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 84 deletions.
67 changes: 25 additions & 42 deletions Themes/Til Death/BGAnimations/ScreenPlayerOptions overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,36 @@ local NSPreviewXSpan = 35
local NSPreviewReceptorY = -30
local OptionRowHeight = 35
local NoteskinRow = 0
local NSDirTable = GameToNSkinElements()

function NSkinPreviewWrapper(dir, ele)
local function NSkinPreviewWrapper(dir, ele)
return Def.ActorFrame {
InitCommand = function(self)
self:zoom(NSPreviewSize)
end,
LoadNSkinPreview("Get", dir, ele, PLAYER_1)
}
end
local function NSkinPreviewExtraTaps()
local out = Def.ActorFrame {}
for i = 2, #NSDirTable do
out[#out+1] = Def.ActorFrame {
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * (i-1))
end,
NSkinPreviewWrapper(NSDirTable[i], "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * (i-1)):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper(NSDirTable[i], "Receptor")
}
}
end
return out
end
t[#t + 1] =
Def.ActorFrame {
OnCommand = function(self)
Expand All @@ -205,54 +226,16 @@ t[#t + 1] =
)
end,
Def.ActorFrame {
NSkinPreviewWrapper("Left", "Tap Note")
NSkinPreviewWrapper(NSDirTable[1], "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Left", "Receptor")
NSkinPreviewWrapper(NSDirTable[1], "Receptor")
}
}
if GetScreenAspectRatio() > 1.7 then
t[#t][#(t[#t]) + 1] =
Def.ActorFrame {
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 1)
end,
NSkinPreviewWrapper("Down", "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 1):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Down", "Receptor")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 2)
end,
NSkinPreviewWrapper("Up", "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 2):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Up", "Receptor")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 3)
end,
NSkinPreviewWrapper("Right", "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 3):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Right", "Receptor")
}
}
t[#t][#(t[#t]) + 1] = NSkinPreviewExtraTaps()
end
return t
68 changes: 26 additions & 42 deletions Themes/_fallback/BGAnimations/ScreenPlayerOptions overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,37 @@ local NSPreviewXSpan = 35
local NSPreviewReceptorY = -30
local OptionRowHeight = 35
local NoteskinRow = 0
local NSDirTable = GameToNSkinElements()

function NSkinPreviewWrapper(dir, ele)
local function NSkinPreviewWrapper(dir, ele)
return Def.ActorFrame {
InitCommand = function(self)
self:zoom(NSPreviewSize)
end,
LoadNSkinPreview("Get", dir, ele, PLAYER_1)
}
end
local function NSkinPreviewExtraTaps()
local out = Def.ActorFrame {}
for i = 2, #NSDirTable do
out[#out+1] = Def.ActorFrame {
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * (i-1))
end,
NSkinPreviewWrapper(NSDirTable[i], "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * (i-1)):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper(NSDirTable[i], "Receptor")
}
}
end
return out
end

t[#t + 1] =
Def.ActorFrame {
OnCommand = function(self)
Expand All @@ -42,54 +64,16 @@ t[#t + 1] =
)
end,
Def.ActorFrame {
NSkinPreviewWrapper("Down", "Tap Note")
NSkinPreviewWrapper(NSDirTable[1], "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Down", "Receptor")
NSkinPreviewWrapper(NSDirTable[1], "Receptor")
}
}
if GetScreenAspectRatio() > 1.7 then
t[#t][#(t[#t]) + 1] =
Def.ActorFrame {
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 1)
end,
NSkinPreviewWrapper("Left", "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 1):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Left", "Receptor")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 2)
end,
NSkinPreviewWrapper("Up", "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 2):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Up", "Receptor")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 3)
end,
NSkinPreviewWrapper("Right", "Tap Note")
},
Def.ActorFrame {
InitCommand = function(self)
self:x(NSPreviewXSpan * 3):y(NSPreviewReceptorY)
end,
NSkinPreviewWrapper("Right", "Receptor")
}
}
t[#t][#(t[#t]) + 1] = NSkinPreviewExtraTaps()
end
return t
24 changes: 24 additions & 0 deletions Themes/_fallback/Scripts/09 SimNSkinPreview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,30 @@ local function SimChild(Container, Type)
return rType
end

function GameToNSkinElements()
local out = Def.ActorFrame {}
-- for this, restrict to only 4 keys to show them off
-- and to save on visible space
local theTable = {
dance = {
"Left", "Down", "Up", "Right"
},
pump = {
"DownLeft", "UpLeft", "Center", "UpRight", --"DownRight"
},
kb7 = {
"Key1", "Key2", "Key3", "Key4", --"Key5", "Key6", "Key7"
},
beat = {
"scratch", "Key1", "Key2", "Key3"
--"Key1", "Key2", "Key3", "Key4", "Key5", "Key6", "Key7", "scratch"
}
}

local game = PREFSMAN:GetPreference("CurrentGame")
return theTable[game]
end

--- Load a NoteSkin preview actor
-- @tparam string Noteskin Noteskin name. If "Get" then it does the currently selected noteskin, and updates itself when it changes. Defaults to "Get"
-- @tparam string Button Ex: "Up". Defaults to "Down"
Expand Down

0 comments on commit a7c80ac

Please sign in to comment.