IEnumerator DoPopulateList() { while (!downloader.Loaded) { yield return(null); } previousState = new Dictionary <string, bool>(); List <string> downloadableMods = downloader.GetListOfDownloadableMods(); //List< ModSettings > installedMods = settings.Settings.installedMods; foreach (string s in downloadableMods) { ModListElement listItem = Instantiate(modListElementPrefab); listItem.transform.SetParent(contentParent); listItem.ModName = s; //bool isInstalled = installedMods.Select(x => x).Where(x => x.modName.Contains(s)).ToList().Count > 0; ModSettings installedMod = settings.GetInstalledModByName(s); listItem.InstallStatus = installedMod != null; listItem.ModType = downloader.GetDoesModWriteToAssemblyByName(s) ? "Assembly" : "API"; listItem.ModDependencies = downloader.GetModDependenciesByName(s); listItem.gameObject.SetActive(true); listItem.owner = this; modElements.Add(listItem); previousState.Add(listItem.ModName, listItem.InstallStatus); listItem.SetToNormalColor(); } status.text = idleStatusMessage; //disable the "isgog" button if we're in a steam path... if (settings.Settings.gamePath.ToLower().Contains("steam")) { isGOG.gameObject.SetActive(false); } else { if (settings.Settings.isGOG.HasValue) { isGOG.isOn = settings.Settings.isGOG.Value; } } if (installer.HasSaveBackups()) { installer.ActivateRestoreSaveButton(); } yield break; }
void InstallMod(ModListElement modElement, bool downloadEvenIfFileExists = false) { Debug.Log("downloading " + modElement.ModName); status.text = "Downloading " + modElement.ModName; downloader.DownloadModByName(modElement.ModName, InstallDownloadedMod, downloadEvenIfFileExists); }
void RemoveMod(ModListElement modElement) { status.text = "Unintalling " + modElement.ModName; installer.UninstallMod(modElement.ModName); modElement.InstallStatus = false; }
//TODO: make this into an actual update that checks for a new version first public void UpdateMod(ModListElement modElement) { InstallMod(modElement, true); }