public void downloadMods() { foreach (Item mod in downloadableListPopup.selectedItems()) { modManager.installMod((Repo)repoListPopup.selectedItem(), (Mod)mod); } downloadableListPopup.SetItemList(repoManager.getModListForRepo((Repo)repoListPopup.selectedItem())); downloadableListPopup.setSelectedItems(new List <Item> ()); modListPopup.SetItemList(modManager.installedMods); App.Popups.KillCurrentPopup(); }
public void OnGUI() { GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), ResourceManager.LoadTexture("DeckBuilder/bg")); new ScrollsFrame(new Rect((float)Screen.width / 15.0f, (float)Screen.height / 5.0f, (float)Screen.width / 15.0f * 8.0f, (float)Screen.height / 6.0f * 4.0f)).AddNinePatch(ScrollsFrame.Border.LIGHT_CURVED, NinePatch.Patches.CENTER).Draw(); new ScrollsFrame(new Rect((float)Screen.width / 15.0f * 9.5f, (float)Screen.height / 5.0f, (float)Screen.width / 15.0f * 4.5f, (float)Screen.height / 6.0f * 4.0f)).AddNinePatch(ScrollsFrame.Border.LIGHT_CURVED, NinePatch.Patches.CENTER).Draw(); Color textColor = GUI.skin.label.normal.textColor; GUI.skin.label.normal.textColor = Color.white; GUI.skin.label.fontSize = (int)(((float)(0x1c * Screen.height)) / 1080f); GUI.Label(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f + (float)Screen.width / 4.5f / 2.0f - (float)Screen.width / 8.0f / 2.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f, (float)Screen.width / 8.0f, 35.0f), "Repositories"); GUI.Label(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f * 1.5f + (float)Screen.width / 4.5f + (float)Screen.width / 4.1f / 2.0f - (float)Screen.width / 8.0f / 2.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f, (float)Screen.width / 8.0f, 35.0f), "Downloadable Mods"); GUI.Label(new Rect((float)Screen.width / 15.0f * 9.5f + (float)Screen.width / 35.0f + ((float)Screen.width / 15.0f * 4.5f - (float)Screen.width / 35.0f * 2.0f) / 2.0f - (float)Screen.width / 8.0f / 2.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f, (float)Screen.width / 8.0f, 35.0f), "Installed Mods"); GUI.skin.label.fontSize = 18; if (GUI.Button(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 9.0f - 1.0f, (float)Screen.width / 35.0f), string.Empty)) { //App.Popups.ShowTextEntry (this, "http://", "WARNING: Other repositories are NOT trusted by Scrollsguide.", "addRepo", "Add Repository", "Please enter the URL of the repository you want to add", "Add"); App.Popups.ShowTextEntry(this, "addRepo", "Add Repository", "WARNING: Other repositories are NOT trusted by Scrollsguide.", "Add", "Please enter the URL of the repository you want to add", "http://"); } GUI.Label(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 9.0f - 1.0f, (float)Screen.width / 35.0f), "Add Repository"); if (GUI.Button(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f + (float)Screen.width / 9.0f + 1.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 9.0f - 1.0f, (float)Screen.width / 35.0f), string.Empty)) { try { if (repoListPopup.selectedItem().Equals(repoManager.repositories[0])) { App.Popups.ShowOk(this, "remWarning", "Invalid Operation", "You cannot remove Scrollsguide from your repository list", "OK"); } else { repoManager.removeRepository((Repo)repoListPopup.selectedItem()); repoListPopup.SetItemList(repoManager.repositories); repoListPopup.setSelectedItem(repoManager.repositories[0]); downloadableListPopup.SetItemList(repoManager.getModListForRepo((Repo)repoListPopup.selectedItem())); } } catch {} } GUI.Label(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f + (float)Screen.width / 9.0f + 1.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 9.0f - 1.0f, (float)Screen.width / 35.0f), "Remove Repository"); if (GUI.Button(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f * 1.5f + (float)Screen.width / 4.5f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 4.1f, (float)Screen.width / 35.0f), string.Empty)) { App.Popups.ShowInfo("Downloading", "Please wait while the requested mods are being downloaded"); new Thread(downloadMods).Start(); } GUI.Label(new Rect((float)Screen.width / 15.0f + (float)Screen.width / 35.0f * 1.5f + (float)Screen.width / 4.5f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 4.1f, (float)Screen.width / 35.0f), "Download"); if (GUI.Button(new Rect((float)Screen.width / 15.0f * 9.5f + (float)Screen.width / 35.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 15.0f * 4.5f - (float)Screen.width / 35.0f * 2.0f, (float)Screen.width / 35.0f), string.Empty)) { loader.repatch(); } GUI.Label(new Rect((float)Screen.width / 15.0f * 9.5f + (float)Screen.width / 35.0f, (float)Screen.height / 5.0f + (float)Screen.height / 30.0f + (float)Screen.height / 6.0f * 4.0f - (float)Screen.height / 15.0f - 80.0f, (float)Screen.width / 15.0f * 4.5f - (float)Screen.width / 35.0f * 2.0f, (float)Screen.width / 35.0f), "Apply (Restarts Scrolls)"); TextAnchor alignment = GUI.skin.label.alignment; GUI.skin.label.alignment = TextAnchor.MiddleRight; GUI.skin.label.normal.textColor = Color.Lerp(Color.white, Color.yellow, 0.4f); GUI.Label(new Rect(Screen.width * 0.5f, Screen.height * 0.90f, Screen.width * 0.48f, Screen.height * 0.04f), "The Summoner ModLoader v" + ModLoader.getVersion() + " is not an official Scrolls feature"); GUI.Label(new Rect(Screen.width * 0.5f, Screen.height * 0.94f, Screen.width * 0.48f, Screen.height * 0.04f), "Read and submit bugs on http://www.scrollsguide.com/summoner"); GUI.skin.label.normal.textColor = textColor; GUI.skin.label.fontSize = defaultTextSize; GUI.skin.label.alignment = alignment; }