public void SelectIndex(int index) { var item = MenuItemObjectList[index]; ActiveUserControl = Activator.CreateInstance(item.UserControl, false) as UserControl; ActiveUserControl.DataContext = Activator.CreateInstance(item.DataContextObject); SetDefaults?.Invoke(index); MenuItemList[index].IsChecked = true; OnPropertyChanged("ActiveUserControl"); }
public Pharmacist(ModContentPack mod) { var type = AccessTools.TypeByName("Pharmacist.PharmacistSettings"); var outer = type; setDefaultsMethod = AccessTools.MethodDelegate <SetDefaults>(AccessTools.Method(type, "SetDefaults")); medicalCareField = AccessTools.StaticFieldRefAccess <object>(AccessTools.Field(type, "medicalCare")); type = AccessTools.Inner(outer, "MedicalCare"); diseaseMarginField = MP.RegisterSyncField(type, "_diseaseMargin"); minorWoundsThresholdField = MP.RegisterSyncField(type, "_minorWoundsThreshold"); diseaseThresholdField = MP.RegisterSyncField(type, "_diseaseThreshold"); MP.RegisterSyncWorker <object>(SyncMedicalCare, type); type = AccessTools.TypeByName("Pharmacist.MainTabWindow_Pharmacist"); MpCompat.RegisterLambdaDelegate(type, "DrawCareSelectors", 0, 1, 2); MpCompat.harmony.Patch(AccessTools.Method(type, "DrawOptions"), prefix: new HarmonyMethod(typeof(Pharmacist), nameof(PreDrawOptions)), postfix: new HarmonyMethod(typeof(Pharmacist), nameof(PostDrawOptions))); }
private void Awake() { if (SoundTable.Count == 0) { Bank[] array = null; try { if (RuntimeManager.StudioSystem.getBankList(out array) != 0) { array = null; } } catch { array = null; } if (array != null) { Bank[] array2 = array; for (int i = 0; i < array2.Length; i++) { Bank bank = array2[i]; EventDescription[] array3; RESULT eventList = bank.getEventList(out array3); string path; if (eventList != 0) { bank.getPath(out path); Debug.LogError($"ERROR [{eventList}] loading FMOD events for bank [{path}]"); } else { for (int j = 0; j < array3.Length; j++) { EventDescription eventDescription = array3[j]; eventDescription.getPath(out path); string simpleSoundEventName = Assets.GetSimpleSoundEventName(path); simpleSoundEventName = simpleSoundEventName.ToLowerInvariant(); if (simpleSoundEventName.Length > 0 && !SoundTable.ContainsKey(simpleSoundEventName)) { SoundTable[simpleSoundEventName] = path; if (path.ToLower().Contains("lowpriority") || simpleSoundEventName.Contains("lowpriority")) { LowPrioritySounds.Add(path); } else if (path.ToLower().Contains("highpriority") || simpleSoundEventName.Contains("highpriority")) { HighPrioritySounds.Add(path); } } } } } } } SetDefaults.Initialize(); LocString.CreateLocStringKeys(typeof(DUPLICANTS), "STRINGS."); LocString.CreateLocStringKeys(typeof(MISC), "STRINGS."); LocString.CreateLocStringKeys(typeof(UI), "STRINGS."); LocString.CreateLocStringKeys(typeof(ELEMENTS), "STRINGS."); LocString.CreateLocStringKeys(typeof(CREATURES), "STRINGS."); LocString.CreateLocStringKeys(typeof(SETITEMS), "STRINGS."); LocString.CreateLocStringKeys(typeof(RESEARCH), "STRINGS."); LocString.CreateLocStringKeys(typeof(ITEMS), "STRINGS."); LocString.CreateLocStringKeys(typeof(INPUT), "STRINGS."); LocString.CreateLocStringKeys(typeof(INPUT_BINDINGS), "STRINGS."); LocString.CreateLocStringKeys(typeof(BUILDING.STATUSITEMS), "STRINGS.BUILDING."); LocString.CreateLocStringKeys(typeof(BUILDING.DETAILS), "STRINGS.BUILDING."); LocString.CreateLocStringKeys(typeof(LORE), "STRINGS."); LocString.CreateLocStringKeys(typeof(CODEX), "STRINGS."); LocString.CreateLocStringKeys(typeof(WORLDS), "STRINGS."); LocString.CreateLocStringKeys(typeof(WORLD_TRAITS), "STRINGS."); LocString.CreateLocStringKeys(typeof(COLONY_ACHIEVEMENTS), "STRINGS."); LocString.CreateLocStringKeys(typeof(VIDEOS), "STRINGS."); }