Files
itgmania212121/Themes/default/Scripts/03 ThemePrefs.lua
T

501 lines
13 KiB
Lua
Raw Normal View History

2010-01-26 21:00:30 -06:00
-- sm-ssc Default Theme Preferences Handler
-- Example usage of new system (not really implemented yet)
local Prefs =
{
AutoSetStyle =
{
Default = false,
Choices = { "ON", "OFF" },
Values = { true, false }
},
};
ThemePrefs.InitAll( Prefs )
2010-01-26 21:00:30 -06:00
function InitUserPrefs()
if GetUserPref("UserPrefGameplayShowStepsDisplay") == nil then
SetUserPref("UserPrefGameplayShowStepsDisplay", true);
end;
if GetUserPref("UserPrefGameplayShowScore") == nil then
SetUserPref("UserPrefGameplayShowScore", false);
2010-01-26 21:00:30 -06:00
end;
2010-12-21 10:11:16 -06:00
if GetUserPref("UserPrefSpecialScoringMode") == nil then
SetUserPref("UserPrefSpecialScoringMode", 'DDR 1st Mix');
2010-12-21 10:11:16 -06:00
end;
2010-03-01 00:41:15 -06:00
if GetUserPrefB("UserPrefShowLotsaOptions") == nil then
2010-01-26 21:00:30 -06:00
SetUserPref("UserPrefShowLotsaOptions", true);
end;
2010-01-26 21:00:30 -06:00
if GetUserPrefB("UserPrefAutoSetStyle") == nil then
SetUserPref("UserPrefAutoSetStyle", false);
end;
2010-03-01 00:41:15 -06:00
if GetUserPrefB("UserPrefLongFail") == nil then
SetUserPref("UserPrefLongFail", false);
end;
if GetUserPrefB("UserPrefNotePosition") == nil then
SetUserPref("UserPrefNotePosition", true);
end;
if GetUserPrefB("UserPrefComboOnRolls") == nil then
SetUserPref("UserPrefComboOnRolls", false);
end;
2010-07-23 18:57:48 -05:00
if GetUserPrefB("UserPrefProtimingP1") == nil then
SetUserPref("UserPrefProtimingP1", false);
end;
if GetUserPrefB("UserPrefProtimingP2") == nil then
SetUserPref("UserPrefProtimingP2", false);
end;
2010-07-21 22:40:14 -05:00
if GetUserPrefB("FlashyCombos") == nil then
SetUserPref("FlashyCombos", false);
end;
2010-08-22 12:43:20 -05:00
if GetUserPrefB("UserPrefComboUnderField") == nil then
SetUserPref("UserPrefComboUnderField", true);
end;
2010-01-26 21:00:30 -06:00
--[[ if GetUserPref("ProTimingP1") == nil then
SetUserPref("ProTimingP1", false);
end;
if GetUserPref("ProTimingP2") == nil then
SetUserPref("ProTimingP2", false);
end; --]]
end;
function GetProTiming(pn)
local pname = ToEnumShortString(pn);
if GetUserPref("ProTiming"..pname) then
return GetUserPrefB("ProTiming"..pname);
else
SetUserPref("ProTiming"..pname,false);
return false;
end;
end;
--[[ option rows ]]
-- screen cover
function OptionRowProTiming()
local t = {
Name = "ProTiming";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = false;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
2010-07-23 18:57:48 -05:00
local bShow;
if GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ) then
bShow = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) );
if bShow then
list[2] = true;
else
list[1] = true;
end
else
list[1] = true;
end;
--[[ local pname = ToEnumShortString(pn);
2010-01-26 21:00:30 -06:00
if getenv("ProTiming"..pname) == true then
list[2] = true;
else
list[1] = true;
2010-07-23 18:57:48 -05:00
end; --]]
2010-01-26 21:00:30 -06:00
end;
SaveSelections = function(self, list, pn)
2010-07-23 18:57:48 -05:00
local bSave;
if list[2] then
bSave = true;
else
bSave = false;
end;
SetUserPref("UserPrefProtiming" .. ToEnumShortString(pn),bSave);
--[[ local val;
2010-01-26 21:00:30 -06:00
if list[2] then
val = true;
else
val = false;
end;
local pname = ToEnumShortString(pn);
2010-07-23 18:57:48 -05:00
setenv("ProTiming"..pname, val); --]]
2010-01-26 21:00:30 -06:00
end;
};
setmetatable( t, t );
return t;
end;
function UserPrefGameplayShowScore()
2010-03-01 00:41:15 -06:00
local t = {
2010-01-26 21:00:30 -06:00
Name = "UserPrefGameplayShowScore";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
2010-03-01 00:41:15 -06:00
if ReadPrefFromFile("UserPrefGameplayShowScore") ~= nil then
if GetUserPrefB("UserPrefGameplayShowScore") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefGameplayShowScore",false);
2010-01-26 21:00:30 -06:00
list[1] = true;
2010-03-01 00:41:15 -06:00
end;
2010-01-26 21:00:30 -06:00
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
2010-03-01 00:41:15 -06:00
WritePrefToFile("UserPrefGameplayShowScore",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
2010-01-26 21:00:30 -06:00
end;
};
setmetatable( t, t );
return t;
end
function UserPrefGameplayShowStepsDisplay()
2010-03-01 00:41:15 -06:00
local t = {
2010-01-26 21:00:30 -06:00
Name = "UserPrefGameplayShowStepsDisplay";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
2010-03-01 00:41:15 -06:00
if ReadPrefFromFile("UserPrefGameplayShowStepsDisplay") ~= nil then
if GetUserPrefB("UserPrefGameplayShowStepsDisplay") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefGameplayShowStepsDisplay",false);
2010-01-26 21:00:30 -06:00
list[1] = true;
2010-03-01 00:41:15 -06:00
end;
2010-01-26 21:00:30 -06:00
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
2010-03-01 00:41:15 -06:00
WritePrefToFile("UserPrefGameplayShowStepsDisplay",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
2010-01-26 21:00:30 -06:00
end;
};
setmetatable( t, t );
return t;
end
function UserPrefShowLotsaOptions()
2010-03-01 00:41:15 -06:00
local t = {
2010-01-26 21:00:30 -06:00
Name = "UserPrefShowLotsaOptions";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Many','Few' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefShowLotsaOptions") ~= nil then
if GetUserPrefB("UserPrefShowLotsaOptions") then
list[1] = true;
else
list[2] = true;
end;
else
WritePrefToFile("UserPrefShowLotsaOptions",false);
list[2] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[1] then
val = true;
else
val = false;
end;
2010-03-01 00:41:15 -06:00
WritePrefToFile("UserPrefShowLotsaOptions",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
2010-12-21 10:11:16 -06:00
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function UserPrefSpecialScoringMode()
2011-01-09 21:11:54 -06:00
local baseChoices = { 'DDR 1stMIX', 'DDR 4thMIX', 'DDR SuperNOVA', 'DDR SuperNOVA 2', 'MIGS' }; --'[SSC] Radar Master'
2010-12-21 10:11:16 -06:00
local t = {
Name = "UserPrefSpecialScoringMode";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = baseChoices;
2010-12-21 10:11:16 -06:00
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefSpecialScoringMode") ~= nil then
2011-01-01 21:40:56 -06:00
local theValue = ReadPrefFromFile("UserPrefSpecialScoringMode");
local success = false;
for k,v in ipairs(baseChoices) do if v == theValue then list[k] = true success = true break end end;
2011-01-02 09:27:21 -06:00
if success == false then list[1] = true end;
2010-12-21 10:11:16 -06:00
else
2011-01-01 21:40:56 -06:00
WritePrefToFile("UserPrefSpecialScoringMode", 'DDR 1stMIX');
2010-12-21 10:11:16 -06:00
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
for k,v in ipairs(list) do if v then WritePrefToFile("UserPrefSpecialScoringMode", baseChoices[k]) break end end;
2010-01-26 21:00:30 -06:00
end;
};
setmetatable( t, t );
return t;
end
function GetDefaultOptionLines()
2010-01-26 21:00:30 -06:00
local LineSets = {
2010-08-24 16:37:24 -05:00
"1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,17,18", -- All
"1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx )
2010-01-26 21:00:30 -06:00
};
2010-06-18 18:42:27 -05:00
local function IsExtra()
if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then
return true
else
return false
end
end
if not IsExtra() then
2010-06-01 18:52:17 -05:00
if GetUserPrefB("UserPrefShowLotsaOptions") then
return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2];
else
return LineSets[2]; -- Just make sure!
end
2010-01-26 21:00:30 -06:00
else
2010-08-24 16:37:24 -05:00
return "1,8,14,2,7,13,16,17,18" -- "failsafe" list
2010-01-26 21:00:30 -06:00
end
end;
2010-01-26 21:00:30 -06:00
function UserPrefAutoSetStyle()
2010-03-01 00:41:15 -06:00
local t = {
2010-01-26 21:00:30 -06:00
Name = "UserPrefAutoSetStyle";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
2010-03-01 00:41:15 -06:00
if ReadPrefFromFile("UserPrefAutoSetStyle") ~= nil then
if GetUserPrefB("UserPrefAutoSetStyle") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefAutoSetStyle",false);
2010-01-26 21:00:30 -06:00
list[1] = true;
2010-03-01 00:41:15 -06:00
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefAutoSetStyle",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
2010-03-01 00:41:15 -06:00
end;
};
setmetatable( t, t );
return t;
end
function UserPrefNotePosition()
local t = {
Name = "UserPrefNotePosition";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Normal','Lower' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefNotePosition") ~= nil then
if GetUserPrefB("UserPrefNotePosition") then
list[1] = true;
else
list[2] = true;
end;
else
WritePrefToFile("UserPrefNotePosition",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[1] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefNotePosition",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
2010-03-01 00:41:15 -06:00
function UserPrefLongFail()
local t = {
Name = "UserPrefLongFail";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Short','Long' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefLongFail") ~= nil then
if GetUserPrefB("UserPrefLongFail") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefLongFail",false);
list[1] = true;
end;
2010-01-26 21:00:30 -06:00
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
2010-03-01 00:41:15 -06:00
WritePrefToFile("UserPrefLongFail",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function UserPrefComboOnRolls()
local t = {
Name = "UserPrefComboOnRolls";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefComboOnRolls") ~= nil then
if GetUserPrefB("UserPrefComboOnRolls") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefComboOnRolls",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefComboOnRolls",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
2010-01-26 21:00:30 -06:00
end;
};
setmetatable( t, t );
return t;
end
2010-07-21 22:40:14 -05:00
function UserPrefFlashyCombo()
local t = {
Name = "UserPrefFlashyCombo";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefFlashyCombo") ~= nil then
if GetUserPrefB("UserPrefFlashyCombo") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefFlashyCombo",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefFlashyCombo",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
2010-08-22 12:43:20 -05:00
function UserPrefComboUnderField()
local t = {
Name = "UserPrefComboUnderField";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefComboUnderField") ~= nil then
if GetUserPrefB("UserPrefComboUnderField") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefComboUnderField",true);
list[2] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefComboUnderField",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
--[[ end option rows ]]