combo cleanup

This commit is contained in:
Chris Danford
2009-04-04 23:18:12 +00:00
parent 13d28b44b5
commit 6ed1c8bd2b
6 changed files with 46 additions and 21 deletions
@@ -1,6 +1,7 @@
local c;
local player = Var "Player";
local ShowComboAt = THEME:GetMetric("Combo", "ShowComboAt");
local ShowMissesAt = THEME:GetMetric("Combo", "ShowMissesAt");
local Pulse = THEME:GetMetric("Combo", "PulseCommand");
local NumberMinZoom = THEME:GetMetric("Combo", "NumberMinZoom");
@@ -8,53 +9,72 @@ local NumberMaxZoom = THEME:GetMetric("Combo", "NumberMaxZoom");
local NumberMaxZoomAt = THEME:GetMetric("Combo", "NumberMaxZoomAt");
local t = Def.ActorFrame {
LoadFont( "Combo", "numbers" ) .. {
Name="Number";
OnCommand = THEME:GetMetric("Combo", "NumberOnCommand");
LoadFont( "Combo", "ComboNumber" ) .. {
Name="ComboNumber";
OnCommand = THEME:GetMetric("Combo", "ComboNumberOnCommand");
};
LoadFont( "Combo", "MissesNumber" ) .. {
Name="MissesNumber";
OnCommand = THEME:GetMetric("Combo", "MissesNumberOnCommand");
};
LoadActor("_combo") .. {
Name="ComboLabel";
OnCommand = THEME:GetMetric("Combo", "LabelOnCommand");
OnCommand = THEME:GetMetric("Combo", "ComboLabelOnCommand");
};
LoadActor("_misses") .. {
Name="MissesLabel";
OnCommand = THEME:GetMetric("Combo", "LabelOnCommand");
OnCommand = THEME:GetMetric("Combo", "MissesLabelOnCommand");
};
InitCommand = function(self)
c = self:GetChildren();
c.Number:visible(false);
c.ComboNumber:visible(false);
c.MissesNumber:visible(false);
c.ComboLabel:visible(false);
c.MissesLabel:visible(false);
end;
ComboCommand=function(self, param)
local iCombo = param.Misses or param.Combo;
if not iCombo or iCombo < ShowComboAt then
c.Number:visible(false);
c.ComboLabel:visible(false);
c.MissesLabel:visible(false);
local iNum = param.Misses or param.Combo;
c.ComboNumber:visible(false);
c.MissesNumber:visible(false);
c.ComboLabel:visible(false);
c.MissesLabel:visible(false);
local ShowAt;
if param.Combo then
ShowAt = ShowComboAt;
else
ShowAt = ShowMissesAt;
end
if not iNum or ShowAt == 0 or iNum < ShowAt then
return;
end
local Number;
if param.Combo then
Number = c.ComboNumber;
else
Number = c.MissesNumber;
end
local Label;
if param.Combo then
Label = c.ComboLabel;
else
Label = c.MissesLabel;
end
-- reset the label's visibility so we don't accidentally draw both labels
Label:visible(false);
param.Zoom = scale( iCombo, 0, NumberMaxZoomAt, NumberMinZoom, NumberMaxZoom );
param.Zoom = scale( iNum, 0, NumberMaxZoomAt, NumberMinZoom, NumberMaxZoom );
param.Zoom = clamp( param.Zoom, NumberMinZoom, NumberMaxZoom );
c.Number:visible(true);
Number:visible(true);
Label:visible(true);
c.Number:settext( string.format("%i", iCombo) );
Number:settext( string.format("%i", iNum) );
Pulse( c.Number, param );
Pulse( Number, param );
Pulse( Label, param );
end;
};