public void RenameProfile(string newProfileLabel, int profileIndex = -2, bool includeActive = true) { if (!KickStarter.settingsManager.useProfiles || newProfileLabel.Length == 0) { return; } int profileID = KickStarter.options.ProfileIndexToID(profileIndex, includeActive); if (profileID == -1) { Debug.LogWarning("Invalid profile index: " + profileIndex + " - nothing to delete!"); return; } else if (profileIndex == -2) { profileID = Options.GetActiveProfileID(); } if (profileID == GetActiveProfileID()) { optionsData.label = newProfileLabel; SavePrefs(); } else if (PlayerPrefs.HasKey(GetPrefKeyName(profileID))) { OptionsData tempOptionsData = LoadPrefsFromID(profileID, false); tempOptionsData.label = newProfileLabel; SavePrefsToID(profileID, tempOptionsData, true); } PlayerMenus.RecalculateAll(); }
public static void SwitchProfile(int ID) { SetActiveProfileID(ID); LoadPrefs(); Debug.Log("Switched to profile " + ID.ToString() + ": '" + optionsData.label + "'"); if (Application.isPlaying) { KickStarter.saveSystem.GatherSaveFiles(); PlayerMenus.RecalculateAll(); } }
public void CreateProfile(string _label = "") { int newProfileID = FindFirstEmptyProfileID(); OptionsData newOptionsData = new OptionsData(optionsData, newProfileID); if (_label != "") { newOptionsData.label = _label; } optionsData = newOptionsData; SetActiveProfileID(newProfileID); SavePrefs(); if (Application.isPlaying) { KickStarter.saveSystem.GatherSaveFiles(); PlayerMenus.RecalculateAll(); } }
public static void LoadPrefs() { if (Application.isPlaying) { KickStarter.options.CustomLoadOptionsHook(); } optionsData = LoadPrefsFromID(GetActiveProfileID(), Application.isPlaying, true); if (optionsData.language == 0 && KickStarter.speechManager && KickStarter.speechManager.ignoreOriginalText && KickStarter.speechManager.languages.Count > 1) { // Ignore original language optionsData.language = 1; SavePrefs(); } if (Application.isPlaying) { KickStarter.saveSystem.GatherSaveFiles(); PlayerMenus.RecalculateAll(); } }