public SinglePlayerBar(List<Download> neededDownloads, ScriptMissionData profile, string modInternalName) { InitializeComponent(); this.neededDownloads = neededDownloads; this.profile = profile; timer.Interval = 500; timer.Tick += timer_Tick; timer.Start(); this.modInternalName = modInternalName; }
public static void StartDownloadedMission(ScriptMissionData profile, string modInternalName) { var spring = new Spring(Program.SpringPaths); var name = Program.Conf.LobbyPlayerName; if (string.IsNullOrEmpty(name)) name = "Player"; if (Utils.VerifySpringInstalled()) { spring.RunLocalScriptGame(profile.StartScript.Replace("%MOD%", modInternalName).Replace("%MAP%", profile.MapName).Replace("%NAME%", name)); var serv = GlobalConst.GetContentService(); serv.NotifyMissionRun(Program.Conf.LobbyPlayerName, profile.Name); } }
public static void DownloadAndStartMission(ScriptMissionData profile) { var modVer = Program.Downloader.PackageDownloader.GetByTag(profile.ModTag); if (modVer == null) { Trace.TraceError("Cannot start mission - cannot find rapid tag: {0}", profile.ModTag); return; } var modName = modVer.InternalName; var neededDownloads = new List<Download>(); if (!Program.SpringScanner.HasResource(modName)) neededDownloads.Add(Program.Downloader.GetResource(DownloadType.MOD, modName)); if (!Program.SpringScanner.HasResource(profile.MapName)) neededDownloads.Add(Program.Downloader.GetResource(DownloadType.MAP, profile.MapName)); if (profile.ManualDependencies != null) foreach (var entry in profile.ManualDependencies) if (!string.IsNullOrEmpty(entry) && !Program.SpringScanner.HasResource(entry)) neededDownloads.Add(Program.Downloader.GetResource(DownloadType.UNKNOWN, entry)); var needEngine = Program.Downloader.GetAndSwitchEngine(Program.SpringPaths.SpringVersion); if (needEngine != null) neededDownloads.Add(needEngine); if (neededDownloads.Count > 0) Program.NotifySection.AddBar(new SinglePlayerBar(neededDownloads, profile, modName)); else StartDownloadedMission(profile, modName); }