Use a shared url for news updates. Fixes #5603.

This commit is contained in:
Paul Chote
2014-07-07 21:48:07 +12:00
parent 6ad5c99815
commit c352ff644f
7 changed files with 3 additions and 14 deletions

View File

@@ -35,7 +35,6 @@ namespace OpenRA
public readonly InstallData ContentInstaller; public readonly InstallData ContentInstaller;
public readonly Dictionary<string, Pair<string, int>> Fonts; public readonly Dictionary<string, Pair<string, int>> Fonts;
public readonly Size TileSize = new Size(24, 24); public readonly Size TileSize = new Size(24, 24);
public readonly string NewsUrl;
public readonly TileShape TileShape = TileShape.Rectangle; public readonly TileShape TileShape = TileShape.Rectangle;
public Manifest(string mod) public Manifest(string mod)
@@ -97,9 +96,6 @@ namespace OpenRA
compat.Add(c.Trim()); compat.Add(c.Trim());
MapCompatibility = compat.ToArray(); MapCompatibility = compat.ToArray();
if (yaml.ContainsKey("NewsUrl"))
NewsUrl = yaml["NewsUrl"].Value;
} }
static string[] YamlList(Dictionary<string, MiniYaml> yaml, string key) static string[] YamlList(Dictionary<string, MiniYaml> yaml, string key)

View File

@@ -141,6 +141,7 @@ namespace OpenRA
public string MapRepository = "http://resource.openra.net/map/"; public string MapRepository = "http://resource.openra.net/map/";
public bool FetchNews = true; public bool FetchNews = true;
public string NewsUrl = "http://www.openra.net/gamenews";
public DateTime NewsFetchedDate; public DateTime NewsFetchedDate;
} }

View File

@@ -147,7 +147,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS"); newsStatus = newsPanel.Get<LabelWidget>("NEWS_STATUS");
SetNewsStatus("Loading news"); SetNewsStatus("Loading news");
if (Game.modData.Manifest.NewsUrl != null) if (Game.Settings.Game.NewsUrl != null)
{ {
var cacheFile = GetNewsCacheFile(); var cacheFile = GetNewsCacheFile();
var cacheValid = File.Exists(cacheFile) && DateTime.Today.ToUniversalTime() <= Game.Settings.Game.NewsFetchedDate; var cacheValid = File.Exists(cacheFile) && DateTime.Today.ToUniversalTime() <= Game.Settings.Game.NewsFetchedDate;
@@ -155,7 +155,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic
if (cacheValid) if (cacheValid)
DisplayNews(ReadNews(File.ReadAllBytes(cacheFile))); DisplayNews(ReadNews(File.ReadAllBytes(cacheFile)));
else else
new Download(Game.modData.Manifest.NewsUrl, e => { }, NewsDownloadComplete); new Download(Game.Settings.Game.NewsUrl, e => { }, NewsDownloadComplete);
} }
var newsButton = newsBG.GetOrNull<DropDownButtonWidget>("NEWS_BUTTON"); var newsButton = newsBG.GetOrNull<DropDownButtonWidget>("NEWS_BUTTON");

View File

@@ -201,5 +201,3 @@ Missions:
mods/cnc/missions.yaml mods/cnc/missions.yaml
SupportsMapsFrom: cnc SupportsMapsFrom: cnc
NewsUrl: http://www.openra.net/gamenews

View File

@@ -176,5 +176,3 @@ LuaScripts:
mods/common/lua/facing.lua mods/common/lua/facing.lua
SupportsMapsFrom: d2k SupportsMapsFrom: d2k
NewsUrl: http://www.openra.net/gamenews

View File

@@ -196,5 +196,3 @@ Missions:
mods/ra/missions.yaml mods/ra/missions.yaml
SupportsMapsFrom: ra SupportsMapsFrom: ra
NewsUrl: http://www.openra.net/gamenews

View File

@@ -217,5 +217,3 @@ LuaScripts:
mods/common/lua/facing.lua mods/common/lua/facing.lua
SupportsMapsFrom: ts SupportsMapsFrom: ts
NewsUrl: http://www.openra.net/gamenews