A game about forced loneliness, made by TACStudios
at master 127 lines 4.4 kB view raw
1using System; 2using UnityEngine; 3 4namespace Unity.Multiplayer.Center.Questionnaire 5{ 6 /// <summary> 7 /// The serializable data of the questionnaire 8 /// </summary> 9 [Serializable] 10 internal class QuestionnaireData 11 { 12 /// <summary> The version of the format to serialize/deserialize data </summary> 13 public string FormatVersion = "1.0.0"; 14 15 /// <summary> The version of the questionnaire itself (different questions, answer choice) </summary> 16 public string Version ="1.2"; 17 18 /// <summary> All the questions in the right order (some might be hidden though) </summary> 19 public Question[] Questions; 20 21 /// <summary> The predefined answers for presets. The content should match the questions.</summary> 22 public PresetData PresetData; 23 } 24 25 /// <summary> 26 /// Possible multiplayer solution that needs to be scored in order to assess a match. Some are mutually exclusive, 27 /// some are not. 28 /// </summary> 29 [Serializable] 30 internal enum PossibleSolution 31 { 32 /// <summary> Netcode for GameObject, incompatible with N4E </summary> 33 NGO, 34 35 /// <summary> Netcode for Entities, incompatible with NGO </summary> 36 N4E, 37 38 /// <summary> Client Hosted Architecture (also called "Listen server"; using a host and not a dedicated server) </summary> 39 LS, 40 41 /// <summary> Dedicated server architecture (using a dedicated server and not a host) </summary> 42 DS, 43 44 /// <summary> Distributed authority (Authority will be distributed across different players)</summary> 45 DA, 46 47 /// <summary> Not using Netcode for GameObjects nor Netcode for Entities </summary> 48 CustomNetcode, 49 50 /// <summary> Works asynchronously, with a database </summary> 51 NoNetcode, 52 53 /// <summary> Recommended backend for async games, without a Netcode (goes with <see cref="NoNetcode"/>) </summary> 54 CloudCode 55 } 56 57 [Serializable] 58 internal enum ViewType 59 { 60 /// <summary> Yes or No type of question best represented by a toggle</summary> 61 Toggle, 62 63 /// <summary> A question with multiple choices and where you can select only one answer</summary> 64 Radio, 65 66 /// <summary> A question with multiple choices and where you can select multiple answers</summary> 67 Checkboxes, 68 69 /// <summary> A question with a Drop Down</summary> 70 DropDown 71 } 72 73 [Serializable] 74 internal class Question 75 { 76 /// <summary> Id (unique across questions) </summary> 77 public string Id; 78 79 /// <summary> Short string to refer to the question (e.g. "Player Count") </summary> 80 public string Title; 81 82 /// <summary> Longer string to describe the question, which will be displayed in the tooltip </summary> 83 public string Description; 84 85 /// <summary> Optional weight to increase/decrease importance of this question, applied to all answers.</summary> 86 //TODO: use ignore if default 87 public float GlobalWeight = 1f; 88 89 /// <summary> The type of view to use to display the question </summary> 90 public ViewType ViewType; 91 92 /// <summary> The possible answers to the question </summary> 93 public Answer[] Choices; 94 95 /// <summary> If the question is mandatory or not. Not overwritten by presets </summary> 96 public bool IsMandatory; 97 } 98 99 [Serializable] 100 internal class Answer 101 { 102 /// <summary> Id (unique across answers) </summary> 103 public string Id; 104 105 /// <summary> What is displayed to the user </summary> 106 public string Title; 107 108 /// <summary> Optional description that will be shown in a tooltip </summary> 109 public string Description; 110 111 /// <summary> How picking this answer will impact the score of a given solution </summary> 112 public ScoreImpact[] ScoreImpacts; 113 } 114 115 [Serializable] 116 internal class ScoreImpact 117 { 118 /// <summary> Which score is impacted </summary> 119 public PossibleSolution Solution; 120 121 /// <summary> Absolute value to add or subtract from the target score</summary> 122 public float Score; 123 124 /// <summary> A comment displayed to the user as for why this score is impacted </summary> 125 public string Comment; 126 } 127}