public static void ExportRequiredAssetsHTML(string path, List <CacheProceduralObject> list) { if (File.Exists(path)) { File.Delete(path); } var reqAssets = new Dictionary <uint, string>(); foreach (var obj in list) { if (!obj.basePrefabName.Contains("_Data")) { continue; } if (!obj.basePrefabName.Contains(".")) { continue; } uint id; var split = obj.basePrefabName.Split(new string[] { "." }, StringSplitOptions.RemoveEmptyEntries); if (uint.TryParse(split[0], out id)) { if (reqAssets.ContainsKey(id)) { continue; } PrefabInfo info = (obj.baseInfoType == "PROP") ? (PrefabInfo)(obj._baseProp) : (PrefabInfo)(obj._baseBuilding); var name = ""; if (info == null) { name = split[1].Replace("_Data", ""); } else { name = info.GetLocalizedTitle(); } reqAssets.Add(id, name); } } if (reqAssets.Count == 0) { return; } TextWriter tw = new StreamWriter(path); tw.WriteLine("<html><head><style>table, td { border: 1px solid black; }</style></head><body><table style=\"width:25%\"><thead><tr><th colspan=\"2\">Required assets for PO export</th></tr></thead><tbody>"); foreach (var req in reqAssets) { tw.WriteLine("<tr><td>" + req.Value + "</td><td style=\"text-align:center;\"><input type=button onClick=\"parent.open('https://steamcommunity.com/sharedfiles/filedetails/?id=" + req.Key.ToString() + "')\" value='Show on the workshop'></td></tr>"); } tw.Close(); }
public static void Postfix(PrefabInfo a, PrefabInfo b, ref int __result) { if (config.IsMixedSortEnabled) { int num = a.m_UIPriority.CompareTo(b.m_UIPriority); if (num == 0 && a.m_isCustomContent && b.m_isCustomContent) { num = a.GetLocalizedTitle().CompareTo(b.GetLocalizedTitle()); } __result = num; } }
/// <summary> /// Initializes the current instance with values from specified prefab. /// </summary> /// <param name="prefab">The prefab.</param> private bool InitializePrefab(PrefabInfo prefab) { try { this.Clear(); if ((UnityEngine.Object)prefab == (UnityEngine.Object)null) { this.InitializeNames((string)null); this.InitializeFailed(prefab); return(false); } bool success = this.InitializeTypes(prefab); try { if (!string.IsNullOrEmpty(prefab.name)) { success = this.InitializeNames(prefab.name) & success; } else if (!String.IsNullOrEmpty(prefab.gameObject.name)) { success = this.InitializeNames(prefab.gameObject.name) && success; } else { this.InitializeNames((string)null); success = false; } } catch { this.InitializeNames((string)null); success = false; } try { this.Title = prefab.GetLocalizedTitle(); if (this.Title != null) { this.Title = titleCleaningPattern.Replace(this.Title, "$1"); } } catch { this.Title = null; } success = this.InitializeCategory(prefab) && success; if (!success) { this.InitializeFailed(prefab); return(false); } return(this.InitializeData(prefab) && success); } catch (Exception ex) { if (Log.LogALot) { Log.Error(this, "Initialize", ex); } return(false); } }