A game about forced loneliness, made by TACStudios
at master 63 lines 2.2 kB view raw
1using System; 2using Unity.Multiplayer.Center.Common; 3using UnityEditor; 4using UnityEngine; 5 6namespace Unity.Multiplayer.Center.Questionnaire 7{ 8 /// <summary> 9 /// The unity object that contains the current choices of the user. 10 /// </summary> 11 [FilePath("Assets/UserChoices.choices", FilePathAttribute.Location.ProjectFolder)] 12 internal class UserChoicesObject : ScriptableSingleton<UserChoicesObject> 13 { 14 /// <summary> 15 /// The version of the questionnaire the answers correspond to. 16 /// </summary> 17 public string QuestionnaireVersion; 18 19 /// <summary> 20 /// The answers of the user in the Game specs questionnaire. 21 /// </summary> 22 public AnswerData UserAnswers = new(); 23 24 /// <summary> 25 /// Current preset selected by the user. 26 /// </summary> 27 public Preset Preset; 28 29 /// <summary> 30 /// The main selections made by the user in the recommendation tab. 31 /// </summary> 32 public SelectedSolutionsData SelectedSolutions; 33 34 /// <summary> 35 /// Raised when the SelectedSolutions changes 36 /// </summary> 37 public event Action OnSolutionSelectionChanged; 38 39 /// <summary> 40 /// Set the user selection and calls OnSelectionChanged if needed 41 /// </summary> 42 /// <param name="hostingModel">The selected hosting model</param> 43 /// <param name="netcodeSolution">The selected netcode solution</param> 44 internal void SetUserSelection(SelectedSolutionsData.HostingModel hostingModel, SelectedSolutionsData.NetcodeSolution netcodeSolution) 45 { 46 SelectedSolutions.SelectedHostingModel = hostingModel; 47 SelectedSolutions.SelectedNetcodeSolution = netcodeSolution; 48 OnSolutionSelectionChanged?.Invoke(); 49 } 50 51 /// <summary> 52 /// Save to disk (see filepath) 53 /// </summary> 54 internal void Save() 55 { 56 QuestionnaireVersion = QuestionnaireObject.instance.Questionnaire.Version; 57 this.Save(true); 58 } 59 60 internal string FilePath => GetFilePath(); 61 62 } 63}