Add support for disabled click sound in scrollbar widget
This commit is contained in:
committed by
abcdefg30
parent
c3dfac7ade
commit
eb4de47362
@@ -45,6 +45,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public int ItemSpacing = 0;
|
public int ItemSpacing = 0;
|
||||||
public int ButtonDepth = ChromeMetrics.Get<int>("ButtonDepth");
|
public int ButtonDepth = ChromeMetrics.Get<int>("ButtonDepth");
|
||||||
public string ClickSound = ChromeMetrics.Get<string>("ClickSound");
|
public string ClickSound = ChromeMetrics.Get<string>("ClickSound");
|
||||||
|
public string ClickDisabledSound = ChromeMetrics.Get<string>("ClickDisabledSound");
|
||||||
public string Background = "scrollpanel-bg";
|
public string Background = "scrollpanel-bg";
|
||||||
public string ScrollBarBackground = "scrollpanel-bg";
|
public string ScrollBarBackground = "scrollpanel-bg";
|
||||||
public string Button = "scrollpanel-button";
|
public string Button = "scrollpanel-button";
|
||||||
@@ -385,8 +386,13 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (thumbPressed)
|
if (thumbPressed)
|
||||||
lastMouseLocation = mi.Location;
|
lastMouseLocation = mi.Location;
|
||||||
|
|
||||||
if (mi.Event == MouseInputEvent.Down && ((upPressed && !upDisabled) || (downPressed && !downDisabled) || thumbPressed))
|
if (mi.Event == MouseInputEvent.Down)
|
||||||
Game.Sound.PlayNotification(modRules, null, "Sounds", ClickSound, null);
|
{
|
||||||
|
if (thumbPressed || (upPressed && !upDisabled) || (downPressed && !downDisabled))
|
||||||
|
Game.Sound.PlayNotification(modRules, null, "Sounds", ClickSound, null);
|
||||||
|
else if ((upPressed && upDisabled) || (downPressed && downDisabled))
|
||||||
|
Game.Sound.PlayNotification(modRules, null, "Sounds", ClickDisabledSound, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return upPressed || downPressed || thumbPressed;
|
return upPressed || downPressed || thumbPressed;
|
||||||
|
|||||||
Reference in New Issue
Block a user