public Dialog_CreateModSyncFile(ModToSync mod, string assemblyVersion) { this.Mod = mod; this.AssemblyVersion = assemblyVersion; foreach (HostEnum h in Enum.GetValues(typeof(HostEnum))) { this.Hosts.Add(h.ToString()); } if (mod.Host != null) { this.selectedHost = mod.Host.Type.ToString(); this.isHostValid = false; } closeOnClickedOutside = false; }
private void DrawRow(Listing_Standard listing, ModToSync mod, int index, int reorderableGroup) { Rect rowRect = listing.GetRect(26f); Text.Anchor = TextAnchor.UpperLeft; string text = null; if (String.IsNullOrEmpty(mod.LocalInfo.Version) && mod.Host != null) { text = "ModSync.UnknownVersion".Translate(); } else if (mod.Host == null) { text = "ModSync.NotSupportedByModSync".Translate(); } if (!string.IsNullOrEmpty(text)) { text = text.Replace("{mod_name}", mod.Mod.Name); TooltipHandler.TipRegion(rowRect, new TipSignal(text, text.GetHashCode())); } float num = rowRect.width - 24f; if (mod.Mod.Active) { Rect position = new Rect(rowRect.xMax - 48f + 2f, rowRect.y, 24f, 24f); //GUI.DrawTexture(position, TexButton.DragHash); num -= 24f; } Text.Font = GameFont.Small; // Label Widgets.Label(new Rect(LABEL_X, rowRect.y, 250, 24), mod.TruncatedName); //GUI.color = Color.red; // no version on client string localVersion = "???"; if (!String.IsNullOrEmpty(mod.LocalInfo.Version)) { localVersion = mod.LocalInfo.Version; } if (mod.RequestDone && !mod.IsInSync) { GUI.color = Color.red; } Widgets.Label(new Rect(LOCAL_VERSION_X, rowRect.y, 150, 24), localVersion); GUI.color = Color.white; // remote version string remoteVersion = spinner.GetSpinnerDots(); if (mod.RequestDone) { if (mod.RemoteInfo != null && !string.IsNullOrEmpty(mod.RemoteInfo.Version)) { remoteVersion = mod.RemoteInfo.Version; //GUI.DrawTexture(new Rect(rect.xMax - 24f, rect.y, 24f, 24f), (Texture)texture2D); // draw download if needed if (!mod.IsInSync) { // not a save breaking mod GUI.DrawTexture(new Rect(rowRect.xMax - 140f - 28f, rowRect.y + 4, 24f, 24f), (Texture2D)((mod.RemoteInfo.IsSaveBreaking) ? Widgets.CheckboxOffTex : Widgets.CheckboxOnTex)); if (Widgets.ButtonText(new Rect(rowRect.xMax - 140f, rowRect.y, 140f, 24f), "ModSync.Update".Translate(), true, false, true)) { Application.OpenURL(mod.Host.DownloadPageUri); } } } else { remoteVersion = "ModSync.NAModSync".Translate(); } } Widgets.Label(new Rect(REMOTE_VERSON_X, rowRect.y, 150, 24), remoteVersion); GUI.color = Color.white; }