public void SaveProfile() { ProfileValueChecker valueChecker = FindObjectOfType <ProfileValueChecker>();; Debug.Log("Profile Saver is attempting to save the current Profile"); ProfileSetter profileSetter = FindObjectOfType <ProfileSetter>(); bool profileSetCorrectly = valueChecker.CheckFullProfile(); if (profileSetCorrectly) { Debug.Log("Profile appears correct, attempting to save."); GameManager instance = FindObjectOfType <GameManager>();; ProfileUI profileUI = FindObjectOfType <ProfileUI>();; bool nameCheck = true; for (int i = 0; i < instance.Profiles.Count; i++) { if (profileSetter.CurrentProfile.Name == instance.Profiles[i].Name) { Debug.Log("A profile with the name " + instance.Profiles[i].Name + " has been found."); nameCheck = false; profileToLoad = i; } } if (nameCheck) { ProfileMessager messager = FindObjectOfType <ProfileMessager>(); Debug.Log("The profile is okay to save."); //profileSetter.ClearExcessDamageChartEntries(); Debug.Log("Attempting to add the profile to the profile list."); ProfileCopier copier = FindObjectOfType <ProfileCopier>(); Profile saveProfile = copier.CopyProfile(profileSetter.CurrentProfile); instance.Profiles.Add(saveProfile); instance.SaveProfiles(); profileUI.EnableLoad(); StartCoroutine(messager.DisplayTemporaryMessage("Profile Saved.", false)); //} else if (overwrite) { // instance.Profiles[profileToLoad] = profile; // overwritePanel.SetActive(false); // instance.Save(); } else { profileUI.OpenNameCheckPanel(); } } }
public void OverwriteProfile() { GameManager instance = FindObjectOfType <GameManager>(); ProfileCopier copier = FindObjectOfType <ProfileCopier>(); ProfileSaver saver = FindObjectOfType <ProfileSaver>(); ProfileSetter setter = FindObjectOfType <ProfileSetter>(); ProfileMessager messager = FindObjectOfType <ProfileMessager>(); Profile saveProfile = copier.CopyProfile(setter.CurrentProfile); instance.Profiles[saver.profileToLoad] = saveProfile; instance.SaveProfiles(); ui.Close(ProfileUI.CloseType.nameCheckSave); }
void LoadProfile() { //Debug.Log("Clicked!"); if (Profile != null) { ProfileCopier copier = FindObjectOfType <ProfileCopier>(); ProfileLoader loader = FindObjectOfType <ProfileLoader>(); ProfileSetter setter = FindObjectOfType <ProfileSetter>(); ProfileUI ui = FindObjectOfType <ProfileUI>(); setter.CurrentProfile = copier.CopyProfile(Profile); loader.LoadProfile(setter.CurrentProfile); ui.Close(ProfileUI.CloseType.loadPanelLoad); } }
public void LoadProfile() { Debug.Log("Attempting to Load the original profile."); GameManager instance = FindObjectOfType <GameManager>(); ProfileSaver saver = FindObjectOfType <ProfileSaver>(); ProfileCopier copier = FindObjectOfType <ProfileCopier>(); ProfileLoader loader = FindObjectOfType <ProfileLoader>(); ProfileSetter setter = FindObjectOfType <ProfileSetter>(); ProfileMessager messager = FindObjectOfType <ProfileMessager>(); Debug.Log("Loading profile named " + instance.Profiles[saver.profileToLoad].Name + "."); setter.CurrentProfile = copier.CopyProfile(instance.Profiles[saver.profileToLoad]); loader.LoadProfile(setter.CurrentProfile); ui.Close(ProfileUI.CloseType.nameCheckLoad); }