public static void RegisterListWantsCrossRef <T>(List <T> wanterList, string targetDefName) where T : new() { WantedRefForList <T> wantedRefForList = null; foreach (WantedRef wantedRef in DirectXmlCrossRefLoader.wantedRefs) { if (wantedRef.wanter == wanterList) { wantedRefForList = (WantedRefForList <T>)wantedRef; break; } } if (wantedRefForList == null) { wantedRefForList = new WantedRefForList <T>((object)wanterList); DirectXmlCrossRefLoader.wantedRefs.Add((WantedRef)wantedRefForList); } wantedRefForList.AddWantedListEntry(targetDefName); }
public static void RegisterListWantsCrossRef <T>(List <T> wanterList, string targetDefName, object debugWanterInfo = null) where T : new() { WantedRefForList <T> wantedRefForList = null; foreach (WantedRef wantedRef in wantedRefs) { if (wantedRef.wanter == wanterList) { wantedRefForList = (WantedRefForList <T>)wantedRef; break; } } if (wantedRefForList == null) { wantedRefForList = new WantedRefForList <T>(wanterList, debugWanterInfo); wantedRefs.Add(wantedRefForList); } wantedRefForList.AddWantedListEntry(targetDefName); }
public static void RegisterListWantsCrossRef <T>(List <T> wanterList, string targetDefName, object debugWanterInfo = null, string mayRequireMod = null) { DeepProfiler.Start("RegisterListWantsCrossRef"); try { WantedRefForList <T> wantedRefForList = null; if (!wantedListDictRefs.TryGetValue(wanterList, out var value)) { wantedRefForList = new WantedRefForList <T>(wanterList, debugWanterInfo); wantedListDictRefs.Add(wanterList, wantedRefForList); wantedRefs.Add(wantedRefForList); } else { wantedRefForList = (WantedRefForList <T>)value; } wantedRefForList.AddWantedListEntry(targetDefName, mayRequireMod); } finally { DeepProfiler.End(); } }