Change IngameChatLogic & MusicPlayerLogic to use the mod's rules, not the map's

This commit is contained in:
Pavlos Touboulidis
2014-05-11 03:27:03 +03:00
parent 6f3d9e9c97
commit e0628b5f24
2 changed files with 9 additions and 9 deletions

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{ {
public class IngameChatLogic public class IngameChatLogic
{ {
readonly World world; readonly Ruleset modRules;
readonly ContainerWidget chatOverlay; readonly ContainerWidget chatOverlay;
readonly ChatDisplayWidget chatOverlayDisplay; readonly ChatDisplayWidget chatOverlayDisplay;
@@ -35,9 +35,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
bool teamChat; bool teamChat;
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
public IngameChatLogic(Widget widget, OrderManager orderManager, World world) public IngameChatLogic(Widget widget, OrderManager orderManager, World world, Ruleset modRules)
{ {
this.world = world; this.modRules = modRules;
chatTraits = world.WorldActor.TraitsImplementing<INotifyChat>().ToList(); chatTraits = world.WorldActor.TraitsImplementing<INotifyChat>().ToList();
@@ -165,7 +165,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (scrolledToBottom) if (scrolledToBottom)
chatScrollPanel.ScrollToBottom(); chatScrollPanel.ScrollToBottom();
Sound.PlayNotification(world.Map.Rules, null, "Sounds", "ChatLine", null); Sound.PlayNotification(modRules, null, "Sounds", "ChatLine", null);
} }
} }
} }

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
{ {
public class MusicPlayerLogic public class MusicPlayerLogic
{ {
readonly World world; readonly Ruleset modRules;
bool installed; bool installed;
MusicInfo currentSong = null; MusicInfo currentSong = null;
@@ -29,9 +29,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic
ScrollItemWidget itemTemplate; ScrollItemWidget itemTemplate;
[ObjectCreator.UseCtor] [ObjectCreator.UseCtor]
public MusicPlayerLogic(Widget widget, World world, Action onExit) public MusicPlayerLogic(Widget widget, Ruleset modRules, Action onExit)
{ {
this.world = world; this.modRules = modRules;
var panel = widget.Get("MUSIC_PANEL"); var panel = widget.Get("MUSIC_PANEL");
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
public void BuildMusicTable() public void BuildMusicTable()
{ {
music = world.Map.Rules.InstalledMusic.Select(a => a.Value).ToArray(); music = modRules.InstalledMusic.Select(a => a.Value).ToArray();
random = music.Shuffle(Game.CosmeticRandom).ToArray(); random = music.Shuffle(Game.CosmeticRandom).ToArray();
currentSong = Sound.CurrentMusic; currentSong = Sound.CurrentMusic;
if (currentSong == null && music.Any()) if (currentSong == null && music.Any())
@@ -109,7 +109,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (currentSong != null) if (currentSong != null)
musicList.ScrollToItem(currentSong.Filename); musicList.ScrollToItem(currentSong.Filename);
installed = world.Map.Rules.InstalledMusic.Any(); installed = modRules.InstalledMusic.Any();
} }
void Play() void Play()