data-driven pump-style coloring/naming (merge disparate difficulty string/color systems and simplify Lua)
This commit is contained in:
@@ -1,62 +1,2 @@
|
||||
local font = LoadFont( "common normal" );
|
||||
local frame = LoadActor( "_score frame" );
|
||||
--local text = GAMESTATE:GetPlayMode() == 'PlayMode_Oni' and "time" or "score";
|
||||
|
||||
local function DifficultyLabelText(pn)
|
||||
local yNormal = SCREEN_CENTER_Y+175;
|
||||
local yReverse = SCREEN_CENTER_Y-189;
|
||||
local xNormal = 286;
|
||||
local xReverse = 310;
|
||||
|
||||
local diffText = font .. {
|
||||
InitCommand=function(self)
|
||||
-- check to see if player is using reverse and set position accordingly.
|
||||
if GAMESTATE:PlayerIsUsingModifier(pn,"reverse") then
|
||||
if pn == PLAYER_1 then
|
||||
-- player 1 reverse position
|
||||
self:x(SCREEN_CENTER_X-xReverse);
|
||||
self:y(yReverse);
|
||||
else
|
||||
-- player 2 reverse position
|
||||
self:x(SCREEN_CENTER_X+xReverse);
|
||||
self:y(yReverse);
|
||||
end;
|
||||
else
|
||||
if pn == PLAYER_1 then
|
||||
-- player 1 normal position
|
||||
self:x(SCREEN_CENTER_X-xNormal);
|
||||
self:y(yNormal);
|
||||
else
|
||||
-- player 2 normal position
|
||||
self:x(SCREEN_CENTER_X+xNormal);
|
||||
self:y(yNormal);
|
||||
end;
|
||||
end;
|
||||
|
||||
-- set align based on player
|
||||
if pn == PLAYER_1 then self:horizalign('HorizAlign_Left');
|
||||
else self:horizalign('HorizAlign_Right');
|
||||
end;
|
||||
|
||||
-- other commands
|
||||
self:zoom(0.75);
|
||||
self:shadowlength(0);
|
||||
end;
|
||||
OnCommand=cmd(playcommand,'Update');
|
||||
CurrentStepsP1ChangedMessageCommand=cmd(playcommand,'Update');
|
||||
CurrentStepsP2ChangedMessageCommand=cmd(playcommand,'Update');
|
||||
UpdateCommand=function(self)
|
||||
self:settext(DifficultyToLocalizedString(GAMESTATE:GetCurrentSteps(pn):GetDifficulty()));
|
||||
end;
|
||||
Condition=GAMESTATE:IsSideJoined(pn) == true or GAMESTATE:GetPlayMode() == 'PlayMode_Rave';
|
||||
};
|
||||
|
||||
return diffText;
|
||||
end;
|
||||
|
||||
return Def.ActorFrame {
|
||||
|
||||
-- text on difficulty labels
|
||||
DifficultyLabelText(PLAYER_1);
|
||||
DifficultyLabelText(PLAYER_2);
|
||||
};
|
||||
|
||||
@@ -375,7 +375,7 @@ local t = Def.ActorFrame {
|
||||
DifficultyChangedCommand=function(self, params)
|
||||
if params.PlayerNumber ~= GAMESTATE:GetMasterPlayerNumber() then return end
|
||||
self:settext( params.Meter );
|
||||
self:diffuse( DifficultyToColor(params.Difficulty) );
|
||||
self:diffuse( CourseDifficutlyToColor(params.Difficulty) );
|
||||
end;
|
||||
};
|
||||
|
||||
@@ -388,7 +388,7 @@ local t = Def.ActorFrame {
|
||||
OnCommand=cmd(x,SCREEN_CENTER_X-222;y,-8;shadowlength,0;settext,"1");
|
||||
DifficultyChangedCommand=function(self, params)
|
||||
if params.PlayerNumber ~= GAMESTATE:GetMasterPlayerNumber() then return end
|
||||
self:diffuse( DifficultyToColor(params.Difficulty) );
|
||||
self:diffuse( CourseDifficutlyToColor(params.Difficulty) );
|
||||
end;
|
||||
};
|
||||
};
|
||||
|
||||
Executable → Regular
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.9 KiB |
Executable → Regular
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 978 B |
@@ -1,10 +0,0 @@
|
||||
return LoadFont( "common normal" ) .. {
|
||||
Text="XXXX";
|
||||
SetCommand=function(self,param)
|
||||
local s = DifficultyAndStepsTypeToLocalizedString( param.Difficulty, param.StepsType );
|
||||
s = string.upper(s); -- TODO: string.upper doesn't work correctly for French
|
||||
self:settext( s );
|
||||
local c = DifficultyAndStepsTypeToColor( param.Difficulty, param.StepsType );
|
||||
self:diffuse( c );
|
||||
end;
|
||||
}
|
||||
@@ -1,34 +1,3 @@
|
||||
return Def.ActorFrame {
|
||||
SetCommand=function(self,param)
|
||||
local Steps = param.Steps;
|
||||
local StepsType;
|
||||
if Steps then
|
||||
StepsType = Steps:GetStepsType();
|
||||
end
|
||||
--Trace( StepsType );
|
||||
self:GetChild("IconSingle"):visible( StepsType == "StepsType_Pump_Single" );
|
||||
self:GetChild("IconDouble"):visible( StepsType == "StepsType_Pump_Double" );
|
||||
end;
|
||||
LoadFont( "_venacti bold 26" ) .. {
|
||||
Text="XXXX";
|
||||
InitCommand=cmd(x,-110;y,-1;zoom,.5;shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077"););
|
||||
SetCommand=function(self,param)
|
||||
local s = DifficultyAndStepsTypeToLocalizedString( param.Difficulty, param.StepsType );
|
||||
if param.Difficulty == "Difficulty_Edit" then
|
||||
s = param.EditDescription;
|
||||
end
|
||||
s = string.upper(s); -- TODO: string.upper doesn't work correctly for French
|
||||
self:settext( s );
|
||||
local c = DifficultyAndStepsTypeToColor( param.Difficulty, param.StepsType );
|
||||
self:diffuse( c );
|
||||
end;
|
||||
};
|
||||
LoadActor( THEME:GetPathG("","_StepsType icon single") ) .. {
|
||||
Name="IconSingle";
|
||||
InitCommand=cmd(x,100;y,2;;visible,false);
|
||||
};
|
||||
LoadActor( THEME:GetPathG("","_StepsType icon double") ) .. {
|
||||
Name="IconDouble";
|
||||
InitCommand=cmd(x,100;y,2;visible,false);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -35,13 +35,20 @@ The following packages were exported to your Desktop:=The following packages wer
|
||||
[CatalogXml]
|
||||
Saving %s ...=Saving %s ...
|
||||
|
||||
[Difficulty]
|
||||
Beginner=Beginner
|
||||
Challenge=Expert
|
||||
Easy=Easy
|
||||
[DifficultyDisplayType]
|
||||
Single_Beginner=Beginner
|
||||
Single_Easy=Easy
|
||||
Single_Medium=Medium
|
||||
Single_Hard=Hard
|
||||
Single_Challenge=Expert
|
||||
Double_Beginner=Beginner
|
||||
Double_Easy=Easy
|
||||
Double_Medium=Medium
|
||||
Double_Hard=Hard
|
||||
Double_Challenge=Expert
|
||||
Edit=Edit
|
||||
Hard=Hard
|
||||
Medium=Medium
|
||||
Couple=Couple
|
||||
Routine=Routine
|
||||
|
||||
[CourseDifficulty]
|
||||
Beginner=BEGINNER
|
||||
@@ -1844,10 +1851,3 @@ Off=Off
|
||||
DoubleFor1Credit=Double For 1 Credit
|
||||
2PlayersFor1Credit=2 Players For 1 Credit
|
||||
|
||||
[DifficultyAndStepsType]
|
||||
Difficulty_Beginner-StepsType_Dance_Single=Novice
|
||||
Difficulty_Easy-StepsType_Dance_Single=Easy
|
||||
Difficulty_Medium-StepsType_Dance_Single=Medium
|
||||
Difficulty_Hard-StepsType_Dance_Single=Hard
|
||||
Difficulty_Challenge-StepsType_Dance_Single=Expert
|
||||
Difficulty_Edit-StepsType_Dance_Single=Edit
|
||||
|
||||
@@ -4,78 +4,42 @@ function PlayerColor( pn )
|
||||
return color("1,1,1,1")
|
||||
end
|
||||
|
||||
local DifficultyColors = {
|
||||
local DifficultyDisplayTypeColors = {
|
||||
DifficultyDisplayType_Single_Beginner = color("0.0,0.9,1.0,1"), -- light blue
|
||||
DifficultyDisplayType_Single_Easy = color("0.9,0.9,0.0,1"), -- yellow
|
||||
DifficultyDisplayType_Single_Medium = color("1.0,0.1,0.1,1"), -- light red
|
||||
DifficultyDisplayType_Single_Hard = color("0.2,1.0,0.2,1"), -- light green
|
||||
DifficultyDisplayType_Single_Challenge = color("0.2,0.6,1.0,1"), -- blue
|
||||
DifficultyDisplayType_Double_Beginner = color("0.0,0.9,1.0,1"), -- light blue
|
||||
DifficultyDisplayType_Double_Easy = color("0.9,0.9,0.0,1"), -- yellow
|
||||
DifficultyDisplayType_Double_Medium = color("1.0,0.1,0.1,1"), -- light red
|
||||
DifficultyDisplayType_Double_Hard = color("0.2,1.0,0.2,1"), -- light green
|
||||
DifficultyDisplayType_Double_Challenge = color("0.2,0.6,1.0,1"), -- blue
|
||||
Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray
|
||||
Difficulty_Couple = color("#ff9a00"), -- orange
|
||||
Difficulty_Routine = color("#ff9a00"), -- orange
|
||||
};
|
||||
|
||||
local CourseDifficultyColors = {
|
||||
Difficulty_Beginner = color("0.0,0.9,1.0,1"), -- light blue
|
||||
Difficulty_Easy = color("0.9,0.9,0.0,1"), -- yellow
|
||||
Difficulty_Medium = color("1.0,0.1,0.1,1"), -- light red
|
||||
Difficulty_Hard = color("0.2,1.0,0.2,1"), -- light green
|
||||
Difficulty_Challenge = color("0.2,0.6,1.0,1"), -- blue
|
||||
Difficulty_Edit = color("0.8,0.8,0.8,1"), -- gray
|
||||
}
|
||||
};
|
||||
|
||||
function DifficultyToColor( dc )
|
||||
local c = DifficultyColors[dc]
|
||||
function DifficultyDisplayTypeToColor( ddt )
|
||||
local c = DifficultyDisplayTypeColors[ddt]
|
||||
if c then return c end
|
||||
return color("#000000");
|
||||
end
|
||||
|
||||
|
||||
|
||||
function StepsOrTrailToLocalizedString(StepsOrTrail)
|
||||
if not StepsOrTrail then
|
||||
return "";
|
||||
end
|
||||
if lua.CheckType("Trail", StepsOrTrail) then
|
||||
local s = THEME:GetString("DifficultyAndStepsType", "Course");
|
||||
return s;
|
||||
end
|
||||
|
||||
local dc = StepsOrTrail:GetDifficulty();
|
||||
local st = StepsOrTrail.GetStepsType and StepsOrTrail:GetStepsType();
|
||||
return DifficultyAndStepsTypeToLocalizedString( dc, st );
|
||||
function CourseDifficutlyToColor( cd )
|
||||
local c = CourseDifficultyColors[cd]
|
||||
if c then return c end
|
||||
return color("#000000");
|
||||
end
|
||||
|
||||
function StepsOrTrailToIndex(StepsOrTrail)
|
||||
if not StepsOrTrail then return 1; end
|
||||
if lua.CheckType("Trail", StepsOrTrail) then
|
||||
return 8
|
||||
end
|
||||
local dc = StepsOrTrail:GetDifficulty();
|
||||
local st = StepsOrTrail.GetStepsType and StepsOrTrail:GetStepsType();
|
||||
return DifficultyAndStepsTypeToIndex( dc, st );
|
||||
end;
|
||||
function TrailColor()
|
||||
return color("#30f0c8");
|
||||
end;
|
||||
|
||||
function StepsOrTrailToColor(StepsOrTrail)
|
||||
if not StepsOrTrail then return color("#000000"); end
|
||||
if lua.CheckType("Trail", StepsOrTrail) then return TrailColor() end
|
||||
|
||||
local dc = StepsOrTrail:GetDifficulty();
|
||||
local st = StepsOrTrail.GetStepsType and StepsOrTrail:GetStepsType();
|
||||
return DifficultyAndStepsTypeToColor( dc, st );
|
||||
end
|
||||
|
||||
function DifficultyAndStepsTypeToLocalizedString( difficulty, stepsType )
|
||||
if( not difficulty or not stepsType ) then
|
||||
return "";
|
||||
end
|
||||
return THEME:GetString( "DifficultyAndStepsType", difficulty .. "-" .. stepsType );
|
||||
end
|
||||
|
||||
function DifficultyAndStepsTypeToIndex( difficulty, stepsType )
|
||||
for idx, entry in ipairs(DifficultyAndStepsTypeInfo) do
|
||||
if entry.difficulty == difficulty and entry.stepsType == stepsType then
|
||||
return idx;
|
||||
end
|
||||
end
|
||||
|
||||
if difficulty == "Difficulty_Edit" then
|
||||
return 7
|
||||
end;
|
||||
return nil;
|
||||
end
|
||||
|
||||
function DifficultyAndStepsTypeToColor( difficulty, stepsType )
|
||||
return DifficultyToColor( difficulty );
|
||||
|
||||
@@ -1969,7 +1969,7 @@ MaxTicks=14
|
||||
TicksX=0
|
||||
TicksY=0
|
||||
TicksOnCommand=shadowlength,0;stoke
|
||||
TicksSetCommand=%function(self,param) self:diffuse(DifficultyToColor(param.Difficulty)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end
|
||||
TicksSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)) if param.Meter > 9 then self:glowshift() else self:stopeffect() end end
|
||||
ShowTicks=false
|
||||
ShowMeter=true
|
||||
ShowDescription=false
|
||||
@@ -1977,7 +1977,15 @@ ZeroMeterString="?"
|
||||
MeterX=10
|
||||
MeterY=0
|
||||
MeterOnCommand=shadowlength,0
|
||||
MeterSetCommand=%function(self,param) if param.Difficulty then self:diffuse(DifficultyToColor(param.Difficulty)) end end
|
||||
MeterSetCommand=%function(self,param) if param.Difficulty then self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)) end end
|
||||
ShowAutogen=true
|
||||
AutogenX=0
|
||||
AutogenY=0
|
||||
AutogenOnCommand=
|
||||
ShowStepsType=false
|
||||
StepsTypeX=0
|
||||
StepsTypeY=0
|
||||
StepsTypeOnCommand=
|
||||
|
||||
[DifficultyDisplayEdit]
|
||||
Fallback="DifficultyDisplay"
|
||||
@@ -1988,11 +1996,37 @@ MeterOnCommand=shadowlength,2;zoom,0.7
|
||||
MeterOffCommand=
|
||||
ZeroMeterString=
|
||||
|
||||
[DifficultyDisplayListRow]
|
||||
Fallback="DifficultyDisplay"
|
||||
FrameX=0
|
||||
FrameY=0
|
||||
FrameOnCommand=
|
||||
ShowTicks=true
|
||||
NumTicks=13
|
||||
MaxTicks=13
|
||||
TicksSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)); end
|
||||
TicksX=0
|
||||
TicksY=0
|
||||
TicksOnCommand=shadowlength,0;shadowcolor,color("#FFFFFF");zoom,0.5;
|
||||
ShowMeter=1
|
||||
MeterX=92
|
||||
MeterY=-1
|
||||
MeterOnCommand=zoom,0.5;shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");
|
||||
ShowDescription=true
|
||||
DescriptionX=-110
|
||||
DescriptionY=-1
|
||||
DescriptionOnCommand=zoom,0.5;shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");maxwidth,150
|
||||
DescriptionSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)); end
|
||||
ZeroMeterString="?"
|
||||
MeterSetCommand=%function(self,param) self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)); end
|
||||
|
||||
[DifficultyDisplayGameplay]
|
||||
Fallback="DifficultyDisplay"
|
||||
MeterOnCommand=shadowlength,0;zoom,0.5
|
||||
FrameOnCommand=
|
||||
MeterSetCommand=%function(self,param) if param.Difficulty then self:diffuse(DifficultyToColor(param.Difficulty)) end end
|
||||
MeterSetCommand=%function(self,param) if param.Difficulty then self:diffuse(DifficultyDisplayTypeToColor(param.DifficultyDisplayType)) end end
|
||||
ShowAutogen=false
|
||||
ShowStepsType=false
|
||||
|
||||
[ScreenWithMenuElements]
|
||||
Fallback="Screen"
|
||||
@@ -3750,42 +3784,6 @@ PrevScreen="ScreenOptionsService"
|
||||
ScrollRandom=false
|
||||
ScrollRoulette=false
|
||||
|
||||
[ScreenGameplay DifficultyDisplayP1]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenGameplay DifficultyDisplayP2]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenGameplayExtra DifficultyDisplayP1]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenGameplayExtra DifficultyDisplayP2]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenDemonstration DifficultyDisplayP1]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenDemonstration DifficultyDisplayP2]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenEvaluation DifficultyDisplayP1]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenEvaluation DifficultyDisplayP2]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenGameplayMultiplayer DifficultyDisplayP1]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenGameplaySyncMachine DifficultyDisplayP1]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenGameplayShared DifficultyDisplayP1]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenGameplayShared DifficultyDisplayP2]
|
||||
Fallback="DifficultyDisplay"
|
||||
|
||||
[ScreenEdit]
|
||||
PrepareScreens=GetEditModeSubScreens()
|
||||
GroupedScreens=GetEditModeSubScreens()
|
||||
@@ -4056,12 +4054,6 @@ LineHighlightX=0
|
||||
ColorSelected=color("1,1,1,1")
|
||||
ColorNotSelected=color("0.7,0.7,0.7,1")
|
||||
|
||||
[ScreenJukebox DifficultyDisplayP1]
|
||||
Fallback="ScreenGameplay DifficultyDisplayP1"
|
||||
|
||||
[ScreenJukebox DifficultyDisplayP2]
|
||||
Fallback="ScreenGameplay DifficultyDisplayP2"
|
||||
|
||||
[ScreenOptionsManage]
|
||||
Fallback="ScreenOptionsSimple"
|
||||
TimerSeconds=-1
|
||||
@@ -4396,29 +4388,6 @@ CursorP2ShowCommand=sleep,.3;linear,.3;diffusealpha,1
|
||||
CursorP1HideCommand=linear,.3;diffusealpha,0
|
||||
CursorP2HideCommand=linear,.3;diffusealpha,0
|
||||
|
||||
[DifficultyListRow]
|
||||
Fallback="DifficultyDisplay"
|
||||
FrameX=0
|
||||
FrameY=0
|
||||
FrameOnCommand=
|
||||
ShowTicks=true
|
||||
NumTicks=13
|
||||
MaxTicks=13
|
||||
TicksSetCommand=%function(self,param) self:diffuse(DifficultyAndStepsTypeToColor(param.Difficulty,param.StepsType)); end
|
||||
TicksX=0
|
||||
TicksY=0
|
||||
TicksOnCommand=shadowlength,0;shadowcolor,color("#FFFFFF");zoom,0.5;
|
||||
ShowMeter=1
|
||||
MeterX=92
|
||||
MeterY=-1
|
||||
MeterOnCommand=zoom,0.5;shadowlengthx,0;shadowlengthy,2;shadowcolor,color("#00000077");
|
||||
ShowDescription=false
|
||||
DescriptionX=-70
|
||||
DescriptionY=0
|
||||
DescriptionOnCommand=horizalign,right;zoom,.5;shadowlength,2;maxwidth,150
|
||||
ZeroMeterString="?"
|
||||
MeterSetCommand=%function(self,param) self:diffuse(DifficultyAndStepsTypeToColor(param.Difficulty,param.StepsType)); end
|
||||
|
||||
[StreamDisplay]
|
||||
; a simple bar life meter:
|
||||
; PillTransformFunction=function(self,offsetFromCenter,itemIndex,numItems) local native_width=32; local zoomed_width=12; self:zoomx(zoomed_width/native_width); self:x((itemIndex-(numItems/2))*zoomed_width); end
|
||||
|
||||
Reference in New Issue
Block a user