protected override void OnLoadLevel() { Instance = null; activeDiagrams.Clear(); UnityEngine.Object.Destroy(base.gameObject); base.OnLoadLevel(); }
protected override void OnSpawn() { base.OnSpawn(); if ((UnityEngine.Object)Instance == (UnityEngine.Object)null) { Instance = this; activeUnitObjs = new List <GameObject>(); inactiveUnitObjs = new List <GameObject>(); foreach (OverlayInfo overlayInfo in overlayInfoList) { overlayInfo.name = Strings.Get(overlayInfo.name); for (int i = 0; i < overlayInfo.infoUnits.Count; i++) { overlayInfo.infoUnits[i].description = Strings.Get(overlayInfo.infoUnits[i].description); if (!string.IsNullOrEmpty(overlayInfo.infoUnits[i].tooltip)) { overlayInfo.infoUnits[i].tooltip = Strings.Get(overlayInfo.infoUnits[i].tooltip); } } } ClearLegend(); } else { UnityEngine.Object.Destroy(base.gameObject); } }
public static void Prefix(OverlayLegend __instance) { var instance = Traverse.Create(__instance); if (instance.Field("overlayInfoList").FieldExists() && instance.Field("overlayInfoList").GetValue <List <OverlayLegend.OverlayInfo> >() != null) { var info = new OverlayLegend.OverlayInfo { name = MapOverlay.LocName, mode = MapOverlay.ID, infoUnits = new List <OverlayLegend.OverlayInfoUnit>(), isProgrammaticallyPopulated = true }; instance.Field("overlayInfoList").GetValue <List <OverlayLegend.OverlayInfo> >().Add(info); } }