public override void Check() { var hashCode = GetListHashCode(ModList); if (hashCode != GetInt("modListHashCode") || GetAssetBundleName(serializedObject.targetObject) == "") { int newIndex = 0; Type mod = null; if (Mods.FindMod(GetString("modTypeName"), GetString("modAssemblyName"), ModList, out mod)) { newIndex = ModList.IndexOf(mod); SetAssetBundle(ModNames[newIndex]); } else if (ModList.Count > 0) { SetString("modTypeName", ModList[0].FullName); SetString("modAssemblyName", ModList[0].Assembly.GetName().Name); SetString("modName", ModNames[0]); SetAssetBundle(ModNames[0]); } else { SetString("modTypeName", ""); SetString("modAssemblyName", ""); SetString("modName", ""); SetAssetBundle(""); } SetInt("modListHashCode", hashCode); //SetInt("selectedModIndex", newIndex); } SetInt("selectedFeatureIndex", 0); ApplyChanges(); //serializedObject.ApplyModifiedProperties(); }
public void SetMod(Type mod) { var index = ModList.IndexOf(mod); serializedObject.SetString("modAssemblyName", mod.Assembly.GetName().Name); serializedObject.SetString("modTypeName", mod.FullName); //serializedObject.SetInt("selectedModIndex", index); serializedObject.SetString("modName", ModNames[index]); SetAssetBundle(ModNames[index]); }
public int GetModIndex(Type mod) { return(ModList.IndexOf(mod)); }
public string GetModName(Type mod) { return(ModNames[ModList.IndexOf(mod)]); }