net.dreditor.minigames.mc 0.0.0-stage → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DREditor.Minigames.MC.asmdef +22 -0
- package/DREditor.Minigames.MC.asmdef.meta +7 -0
- package/MultipleChoiceBuilder.cs +78 -0
- package/MultipleChoiceBuilder.cs.meta +11 -0
- package/MultipleChoiceBuilderEditor.cs +76 -0
- package/MultipleChoiceBuilderEditor.cs.meta +11 -0
- package/MultipleChoiceManager.cs +296 -0
- package/MultipleChoiceManager.cs.meta +11 -0
- package/MultipleChoiceOption.cs +44 -0
- package/MultipleChoiceOption.cs.meta +11 -0
- package/MultipleChoiceOptionEditor.cs +50 -0
- package/MultipleChoiceOptionEditor.cs.meta +11 -0
- package/Samples/Multiple_Choice_Canvas_Shell.prefab +139 -0
- package/Samples/Multiple_Choice_Canvas_Shell.prefab.meta +7 -0
- package/Samples/Multiple_Choice_Canvas_Template.prefab +444 -0
- package/Samples/Multiple_Choice_Canvas_Template.prefab.meta +7 -0
- package/Samples/Multiple_Choice_Manager_Shell.prefab +66 -0
- package/Samples/Multiple_Choice_Manager_Shell.prefab.meta +7 -0
- package/Samples/Multiple_Choice_Manager_Template.prefab +327 -0
- package/Samples/Multiple_Choice_Manager_Template.prefab.meta +7 -0
- package/Samples/Multiple_Choice_Option_Template.prefab +317 -0
- package/Samples/Multiple_Choice_Option_Template.prefab.meta +7 -0
- package/Samples.meta +8 -0
- package/package.json +39 -6
- package/package.json.meta +7 -0
- package/README.md +0 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "DREditor.Minigames.MC",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"Unity.InputSystem",
|
|
6
|
+
"Unity.TextMeshPro",
|
|
7
|
+
"DREditor",
|
|
8
|
+
"DREditor.Editor",
|
|
9
|
+
"DREditor.UIHandling",
|
|
10
|
+
"DREditor.Audio",
|
|
11
|
+
"DREditor.Minigames"
|
|
12
|
+
],
|
|
13
|
+
"includePlatforms": [],
|
|
14
|
+
"excludePlatforms": [],
|
|
15
|
+
"allowUnsafeCode": false,
|
|
16
|
+
"overrideReferences": false,
|
|
17
|
+
"precompiledReferences": [],
|
|
18
|
+
"autoReferenced": true,
|
|
19
|
+
"defineConstraints": [],
|
|
20
|
+
"versionDefines": [],
|
|
21
|
+
"noEngineReferences": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Linq;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.Minigames.MC
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[System.Serializable]
|
|
13
|
+
[CreateAssetMenu(menuName = "DREditor/Minigames/Multiple Choice", fileName = "MC Builder")]
|
|
14
|
+
public class MultipleChoiceBuilder : MinigameBuilderBase
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
public List<MultipleChoiceOption> choices = new() { new(), new(), new(), new() };
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
public string question = "";
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
public int damageOnWrong = 1;
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
public float timerMinutes;
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
[Range(0, 59)]
|
|
40
|
+
public float timerSeconds;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
/// <param name="question"></param>
|
|
47
|
+
public virtual void SetQuestion(string question) => this.question = question;
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
/// <param name="damageOnWrong"></param>
|
|
53
|
+
public virtual void SetDamageOnWrong(int damageOnWrong) => this.damageOnWrong = damageOnWrong;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
/// <summary>
|
|
57
|
+
///
|
|
58
|
+
/// </summary>
|
|
59
|
+
/// <param name="text"></param>
|
|
60
|
+
/// <returns></returns>
|
|
61
|
+
public virtual MultipleChoiceOption GetOptionWithText(string text)
|
|
62
|
+
{
|
|
63
|
+
for (int i = 0; i < choices.Count; i++)
|
|
64
|
+
if (choices[i].text == text)
|
|
65
|
+
return choices[i];
|
|
66
|
+
|
|
67
|
+
UnityEngine.Debug.LogWarning("ALERT: Selected choice text did not contain an existing answer.");
|
|
68
|
+
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
///
|
|
74
|
+
/// </summary>
|
|
75
|
+
/// <returns></returns>
|
|
76
|
+
public virtual List<string> GetChoiceTexts() => choices.Select(choice => choice.text).ToList();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Editor.Utility;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.Minigames.MC
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[CustomEditor(typeof(MultipleChoiceBuilder))]
|
|
13
|
+
public class MultipleChoiceBuilderEditor : TimedMinigameEditor<MultipleChoiceBuilder>
|
|
14
|
+
{
|
|
15
|
+
/// <inheritdoc/>
|
|
16
|
+
public override void OnInspectorGUI()
|
|
17
|
+
{
|
|
18
|
+
serializedObject.Update();
|
|
19
|
+
|
|
20
|
+
CreateForm();
|
|
21
|
+
|
|
22
|
+
EditorUtility.SetDirty(builder);
|
|
23
|
+
|
|
24
|
+
serializedObject.ApplyModifiedProperties();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// <summary>
|
|
28
|
+
///
|
|
29
|
+
/// </summary>
|
|
30
|
+
protected virtual void CreateForm()
|
|
31
|
+
{
|
|
32
|
+
DisplayBuilderInformation();
|
|
33
|
+
|
|
34
|
+
DisplayChoices();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// <summary>
|
|
38
|
+
///
|
|
39
|
+
/// </summary>
|
|
40
|
+
protected virtual void DisplayBuilderInformation()
|
|
41
|
+
{
|
|
42
|
+
builder.SetQuestion(HandyFields.StringArea("Question: ", builder.question));
|
|
43
|
+
|
|
44
|
+
builder.SetDamageOnWrong(HandyFields.IntField("Damage on Wrong: ", builder.damageOnWrong, 25, 7));
|
|
45
|
+
|
|
46
|
+
builder.SetDifficultyTimes(TimerDifficultyEditor.DisplaySettings(builder.times));
|
|
47
|
+
|
|
48
|
+
using (new GUILayout.HorizontalScope())
|
|
49
|
+
GUILayout.Label("", GUILayout.Width(120));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
///
|
|
54
|
+
/// </summary>
|
|
55
|
+
protected virtual void DisplayChoices()
|
|
56
|
+
{
|
|
57
|
+
for (int i = 0; i < builder.choices.Count; i++)
|
|
58
|
+
{
|
|
59
|
+
MultipleChoiceOptionEditor.Display(builder.choices[i]);
|
|
60
|
+
|
|
61
|
+
if (GUILayout.Button("Remove Choice", GUILayout.Width(120)))
|
|
62
|
+
builder.choices.RemoveAt(i);
|
|
63
|
+
|
|
64
|
+
using (new GUILayout.HorizontalScope())
|
|
65
|
+
GUILayout.Label("", GUILayout.Width(120));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
using (new GUILayout.HorizontalScope())
|
|
69
|
+
GUILayout.Label("", GUILayout.Width(120));
|
|
70
|
+
|
|
71
|
+
if (GUILayout.Button("Add Choice", GUILayout.Width(120)))
|
|
72
|
+
builder.choices.Add(new());
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
#endif
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Audio;
|
|
3
|
+
using DREditor.Services;
|
|
4
|
+
using DREditor.UIHandling;
|
|
5
|
+
using System.Collections;
|
|
6
|
+
using System.Collections.Generic;
|
|
7
|
+
using TMPro;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using UnityEngine.Events;
|
|
10
|
+
using UnityEngine.EventSystems;
|
|
11
|
+
using UnityEngine.InputSystem;
|
|
12
|
+
using UnityEngine.UI;
|
|
13
|
+
using static UnityEngine.InputSystem.InputAction;
|
|
14
|
+
|
|
15
|
+
namespace DREditor.Minigames.MC
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[ClassHeader(nameof(MinigameManagerBase) + ", " +
|
|
21
|
+
"\n\n")]
|
|
22
|
+
public class MultipleChoiceManager : MinigameManagerBase
|
|
23
|
+
{
|
|
24
|
+
/// <summary>
|
|
25
|
+
///
|
|
26
|
+
/// </summary>
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
[SerializeField] protected InputActionReference submit = null;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/// <summary>
|
|
32
|
+
///
|
|
33
|
+
/// </summary>
|
|
34
|
+
[Header("")]
|
|
35
|
+
[Divider]
|
|
36
|
+
[Tooltip("")]
|
|
37
|
+
[SerializeField] protected bool debugMode = false;
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
///
|
|
41
|
+
/// </summary>
|
|
42
|
+
[Tooltip("")]
|
|
43
|
+
[SerializeField] protected MultipleChoiceBuilder builder = null;
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
///
|
|
48
|
+
/// </summary>
|
|
49
|
+
[Header("")]
|
|
50
|
+
[Divider]
|
|
51
|
+
[Tooltip("")]
|
|
52
|
+
[SerializeField] protected TMP_Text questionText = null;
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
[Tooltip("")]
|
|
58
|
+
[SerializeField] protected Transform choicesParent = null;
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
///
|
|
62
|
+
/// </summary>
|
|
63
|
+
[Tooltip("")]
|
|
64
|
+
[SerializeField] protected GameObject choicePrefab = null;
|
|
65
|
+
|
|
66
|
+
/// <summary>
|
|
67
|
+
///
|
|
68
|
+
/// </summary>
|
|
69
|
+
[Tooltip("")]
|
|
70
|
+
[SerializeField] protected UIVisibilityComponent gameUI = null;
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
///
|
|
74
|
+
/// </summary>
|
|
75
|
+
[Tooltip("")]
|
|
76
|
+
[SerializeField] protected UIVisibilityComponent introUI = null;
|
|
77
|
+
|
|
78
|
+
/// <summary>
|
|
79
|
+
///
|
|
80
|
+
/// </summary>
|
|
81
|
+
[Tooltip("")]
|
|
82
|
+
[SerializeField] protected UIVisibilityComponent answerUI = null;
|
|
83
|
+
|
|
84
|
+
/// <summary>
|
|
85
|
+
///
|
|
86
|
+
/// </summary>
|
|
87
|
+
[Tooltip("")]
|
|
88
|
+
[SerializeField] protected float menuFadeWaitTime = 0.75f;
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
[Header("")]
|
|
92
|
+
[SerializeField] protected UnityEvent OnMinigameStarted;
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
///
|
|
97
|
+
/// </summary>
|
|
98
|
+
protected bool inSelect = false;
|
|
99
|
+
|
|
100
|
+
/// <summary>
|
|
101
|
+
///
|
|
102
|
+
/// </summary>
|
|
103
|
+
protected List<Selectable> choices = new();
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
/// <summary>
|
|
107
|
+
///
|
|
108
|
+
/// </summary>
|
|
109
|
+
/// <param name="inSelect"></param>
|
|
110
|
+
protected virtual void SetInSelect(bool inSelect) => this.inSelect = inSelect;
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
/// <inheritdoc/>
|
|
114
|
+
protected override void OnMinigameDisable()
|
|
115
|
+
{
|
|
116
|
+
base.OnMinigameDisable();
|
|
117
|
+
|
|
118
|
+
submit.action.started -= SubmitChoice;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/// <summary>
|
|
122
|
+
///
|
|
123
|
+
/// </summary>
|
|
124
|
+
protected virtual void Start()
|
|
125
|
+
{
|
|
126
|
+
if (debugMode)
|
|
127
|
+
StartChoosing(builder);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// <summary>
|
|
131
|
+
///
|
|
132
|
+
/// </summary>
|
|
133
|
+
/// <param name="asset"></param>
|
|
134
|
+
public void PlayMultipleChoice(ScriptableObject asset)
|
|
135
|
+
=> FindAnyObjectByType<MultipleChoiceManager>().StartChoosing((MultipleChoiceBuilder)asset);
|
|
136
|
+
|
|
137
|
+
/// <summary>
|
|
138
|
+
///
|
|
139
|
+
/// </summary>
|
|
140
|
+
/// <param name="builder"></param>
|
|
141
|
+
public virtual void StartChoosing(MultipleChoiceBuilder builder) => StartCoroutine(BeginChoice(builder));
|
|
142
|
+
|
|
143
|
+
/// <summary>
|
|
144
|
+
///
|
|
145
|
+
/// </summary>
|
|
146
|
+
protected virtual IEnumerator BeginChoice(MultipleChoiceBuilder builder)
|
|
147
|
+
{
|
|
148
|
+
this.builder = builder;
|
|
149
|
+
|
|
150
|
+
Initialize();
|
|
151
|
+
|
|
152
|
+
if (questionText != null)
|
|
153
|
+
questionText.text = builder.question;
|
|
154
|
+
|
|
155
|
+
OnMinigameStarted?.Invoke();
|
|
156
|
+
|
|
157
|
+
if (introUI != null)
|
|
158
|
+
yield return introUI.ShowTillComplete();
|
|
159
|
+
|
|
160
|
+
if (TrialTimer != null)
|
|
161
|
+
TrialTimer.ShowInitialize(builder.times, false);
|
|
162
|
+
|
|
163
|
+
EventSystem.current.SetSelectedGameObject(choices[0].gameObject);
|
|
164
|
+
|
|
165
|
+
submit.action.started += SubmitChoice;
|
|
166
|
+
|
|
167
|
+
SetInSelect(true);
|
|
168
|
+
|
|
169
|
+
yield break;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/// <summary>
|
|
173
|
+
///
|
|
174
|
+
/// </summary>
|
|
175
|
+
protected virtual void Initialize()
|
|
176
|
+
{
|
|
177
|
+
var choiceTexts = builder.GetChoiceTexts();
|
|
178
|
+
|
|
179
|
+
foreach (var choiceText in choiceTexts)
|
|
180
|
+
{
|
|
181
|
+
if (string.IsNullOrEmpty(choiceText))
|
|
182
|
+
continue;
|
|
183
|
+
|
|
184
|
+
GameObject choice = Instantiate(choicePrefab, choicesParent);
|
|
185
|
+
|
|
186
|
+
choice.GetComponentInChildren<TMP_Text>().text = choiceText;
|
|
187
|
+
|
|
188
|
+
choices.Add(choice.GetComponent<Selectable>());
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/// <summary>
|
|
193
|
+
///
|
|
194
|
+
/// </summary>
|
|
195
|
+
/// <param name="context"></param>
|
|
196
|
+
protected virtual void SubmitChoice(CallbackContext context)
|
|
197
|
+
{
|
|
198
|
+
if (inSelect)
|
|
199
|
+
{
|
|
200
|
+
string selectedText = EventSystem.current.currentSelectedGameObject.GetComponentInChildren<TMP_Text>().text;
|
|
201
|
+
|
|
202
|
+
MultipleChoiceOption selectedOption = builder.GetOptionWithText(selectedText);
|
|
203
|
+
|
|
204
|
+
if (selectedOption == null)
|
|
205
|
+
return;
|
|
206
|
+
|
|
207
|
+
ServiceLocator.GetService<SFXManagerBase>().PlaySubmit();
|
|
208
|
+
|
|
209
|
+
SetInSelect(false);
|
|
210
|
+
|
|
211
|
+
submit.action.started -= SubmitChoice;
|
|
212
|
+
|
|
213
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
214
|
+
|
|
215
|
+
if (TrialTimer != null)
|
|
216
|
+
TrialTimer.PauseTimer();
|
|
217
|
+
|
|
218
|
+
HideVisuals();
|
|
219
|
+
|
|
220
|
+
if (selectedOption.isAnswer)
|
|
221
|
+
StartCoroutine(ResolveMinigame());
|
|
222
|
+
else
|
|
223
|
+
TrialMistake(selectedOption.wrongDialogue);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/// <inheritdoc/>
|
|
228
|
+
public override IEnumerator ResolveMinigame()
|
|
229
|
+
{
|
|
230
|
+
yield return new WaitForSeconds(menuFadeWaitTime);
|
|
231
|
+
|
|
232
|
+
if (answerUI != null)
|
|
233
|
+
yield return answerUI.ShowTillComplete();
|
|
234
|
+
|
|
235
|
+
yield return base.ResolveMinigame();
|
|
236
|
+
|
|
237
|
+
yield break;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/// <summary>
|
|
241
|
+
///
|
|
242
|
+
/// </summary>
|
|
243
|
+
protected virtual void HideVisuals()
|
|
244
|
+
{
|
|
245
|
+
if (TrialTimer != null)
|
|
246
|
+
TrialTimer.Hide();
|
|
247
|
+
|
|
248
|
+
gameUI.Hide();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/// <inheritdoc/>
|
|
252
|
+
protected override void Restart()
|
|
253
|
+
{
|
|
254
|
+
gameUI.Show();
|
|
255
|
+
|
|
256
|
+
EventSystem.current.SetSelectedGameObject(choices[0].gameObject);
|
|
257
|
+
|
|
258
|
+
if (TrialTimer != null)
|
|
259
|
+
TrialTimer.Show();
|
|
260
|
+
|
|
261
|
+
StartCoroutine(ResolveRestart());
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/// <summary>
|
|
265
|
+
///
|
|
266
|
+
/// </summary>
|
|
267
|
+
protected virtual IEnumerator ResolveRestart()
|
|
268
|
+
{
|
|
269
|
+
yield return TrialTimer.WaitForChangeToComplete();
|
|
270
|
+
|
|
271
|
+
if (TrialTimer != null)
|
|
272
|
+
TrialTimer.ResumeTimer();
|
|
273
|
+
|
|
274
|
+
yield return new WaitForSeconds(Time.deltaTime);
|
|
275
|
+
|
|
276
|
+
submit.action.started += SubmitChoice;
|
|
277
|
+
|
|
278
|
+
SetInSelect(true);
|
|
279
|
+
|
|
280
|
+
yield break;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
/// <inheritdoc/>
|
|
285
|
+
protected override void OnTimeUp()
|
|
286
|
+
{
|
|
287
|
+
SetInSelect(false);
|
|
288
|
+
|
|
289
|
+
EventSystem.current.SetSelectedGameObject(null);
|
|
290
|
+
|
|
291
|
+
HideVisuals();
|
|
292
|
+
|
|
293
|
+
base.OnTimeUp();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.Minigames.MC
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
[System.Serializable]
|
|
10
|
+
public class MultipleChoiceOption
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
public string text = "";
|
|
16
|
+
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
public bool isAnswer = false;
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
public TrialDialogue wrongDialogue;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
public virtual void SetText(string text) => this.text = text;
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
///
|
|
35
|
+
/// </summary>
|
|
36
|
+
public virtual void SetIsAnswer(bool isAnswer) => this.isAnswer = isAnswer;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
public virtual void SetWrongDialogue(TrialDialogue wrongDialogue)
|
|
42
|
+
=> this.wrongDialogue = wrongDialogue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Editor.Utility;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.Minigames.MC
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[System.Serializable]
|
|
13
|
+
public static class MultipleChoiceOptionEditor
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
public static void Display(MultipleChoiceOption option)
|
|
19
|
+
{
|
|
20
|
+
using (new GUILayout.HorizontalScope())
|
|
21
|
+
{
|
|
22
|
+
option.SetText(HandyFields.StringField("Choice Text: ", option.text));
|
|
23
|
+
|
|
24
|
+
GUILayout.Space(5);
|
|
25
|
+
|
|
26
|
+
EditorGUILayout.LabelField("Is Answer: ", GUILayout.Width(70));
|
|
27
|
+
|
|
28
|
+
option.SetIsAnswer(EditorGUILayout.Toggle(option.isAnswer));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!option.isAnswer)
|
|
32
|
+
{
|
|
33
|
+
GUILayout.Space(5);
|
|
34
|
+
|
|
35
|
+
using (new GUILayout.HorizontalScope())
|
|
36
|
+
{
|
|
37
|
+
GUILayout.Label("On Wrong Dialogue: ", GUILayout.Width(120));
|
|
38
|
+
|
|
39
|
+
option.SetWrongDialogue(HandyFields.UnityField(option.wrongDialogue, 170, 25));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (option.wrongDialogue != null)
|
|
43
|
+
option.SetWrongDialogue(null);
|
|
44
|
+
|
|
45
|
+
GUILayout.Space(20);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
#endif
|