net.dreditor.minigames 0.1.6 → 0.1.7
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/.attestation.p7m +0 -0
- package/BulletDifficulty.cs +36 -36
- package/BulletDifficulty.cs.meta +11 -11
- package/BulletDifficultyEditor.cs +380 -380
- package/BulletDifficultyEditor.cs.meta +11 -11
- package/DREditor.Minigames.asmdef +36 -36
- package/DREditor.Minigames.asmdef.meta +7 -7
- package/DifficultyEditorBase.cs +60 -60
- package/DifficultyEditorBase.cs.meta +11 -11
- package/IShatterGraphic.cs +32 -32
- package/IShatterGraphic.cs.meta +11 -11
- package/IShatterText.cs +33 -33
- package/IShatterText.cs.meta +11 -11
- package/InitializeTrialOffsets.cs +51 -51
- package/InitializeTrialOffsets.cs.meta +11 -11
- package/MinigameBuilderBase.cs +28 -28
- package/MinigameBuilderBase.cs.meta +11 -11
- package/MinigameControlsUIHandler.cs +94 -94
- package/MinigameControlsUIHandler.cs.meta +11 -11
- package/MinigameManagerBase.cs +197 -197
- package/MinigameManagerBase.cs.meta +11 -11
- package/QuestionToggle.cs +154 -154
- package/QuestionToggle.cs.meta +11 -11
- package/RestoreControlsUIPostDialogue.cs +100 -100
- package/RestoreControlsUIPostDialogue.cs.meta +1 -1
- package/{Samples → Samples~}/Bullet Shatter Mesh Generator.asset +23 -23
- package/{Samples → Samples~}/Bullet Shatter Mesh Generator.asset.meta +8 -8
- package/{Samples → Samples~}/HasStamina.asset +21 -21
- package/{Samples → Samples~}/HasStamina.asset.meta +8 -8
- package/{Samples → Samples~}/IsDrainingStamina.asset +21 -21
- package/{Samples → Samples~}/IsDrainingStamina.asset.meta +8 -8
- package/{Samples → Samples~}/MinigameInputAllowed.asset +21 -21
- package/{Samples → Samples~}/MinigameInputAllowed.asset.meta +8 -8
- package/{Samples → Samples~}/Minigame_Controls_UI_Handler.prefab +53 -53
- package/{Samples → Samples~}/Minigame_Controls_UI_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/Quad Shatter.asset +31 -31
- package/{Samples → Samples~}/Quad Shatter.asset.meta +8 -8
- package/{Samples → Samples~}/ShatterCameraEnabled.asset +21 -21
- package/{Samples → Samples~}/ShatterCameraEnabled.asset.meta +8 -8
- package/{Samples → Samples~}/Shatter_Graphic.prefab +98 -98
- package/{Samples → Samples~}/Shatter_Graphic.prefab.meta +7 -7
- package/{Samples → Samples~}/Stamina_Handler.prefab +59 -59
- package/{Samples → Samples~}/Stamina_Handler.prefab.meta +7 -7
- package/{Samples → Samples~}/TBS_Manager_Shell.prefab +60 -60
- package/{Samples → Samples~}/TBS_Manager_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/TBS_Manager_Template.prefab +504 -504
- package/{Samples → Samples~}/TBS_Manager_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Shell.prefab +289 -289
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Template.prefab +449 -449
- package/{Samples → Samples~}/Trial_UI_Shatter_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Triangle Shatter.asset +31 -31
- package/{Samples → Samples~}/Triangle Shatter.asset.meta +8 -8
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Shell.prefab +221 -221
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Template.prefab +525 -525
- package/{Samples → Samples~}/Truth_Bullet_Menu_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Shell.prefab +38 -38
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Template.prefab +1159 -1159
- package/{Samples → Samples~}/Truth_Bullet_Menu_Holder_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Minigame_Canvas_Template.prefab +494 -494
- package/{Samples → Samples~}/Truth_Bullet_Minigame_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Truth_Bullet_Option_ETemplate.prefab +294 -294
- package/{Samples → Samples~}/Truth_Bullet_Option_ETemplate.prefab.meta +7 -7
- package/Shattering/BreakTex.renderTexture +39 -39
- package/Shattering/BreakTex.renderTexture.meta +8 -8
- package/Shattering/BulletShatter.cs +176 -176
- package/Shattering/BulletShatter.cs.meta +11 -11
- package/Shattering/IShatterableCanvas.cs +20 -20
- package/Shattering/IShatterableCanvas.cs.meta +11 -11
- package/Shattering/MeshGenerator.cs +178 -178
- package/Shattering/MeshGenerator.cs.meta +11 -11
- package/Shattering/RenderCanvasOnShatter.cs +47 -47
- package/Shattering/RenderCanvasOnShatter.cs.meta +11 -11
- package/Shattering/ShatterCameraRender.cs +79 -79
- package/Shattering/ShatterCameraRender.cs.meta +11 -11
- package/Shattering/ShatterGraphic.cs +135 -135
- package/Shattering/ShatterGraphic.cs.meta +11 -11
- package/Shattering/ShatterMeshGraphic.cs +304 -304
- package/Shattering/ShatterMeshGraphic.cs.meta +11 -11
- package/Shattering/ShatterProcess.cs +282 -282
- package/Shattering/ShatterProcess.cs.meta +11 -11
- package/Shattering/ShatterProcessBase.cs +51 -51
- package/Shattering/ShatterProcessBase.cs.meta +11 -11
- package/Shattering/ShatterQuad.cs +56 -56
- package/Shattering/ShatterQuad.cs.meta +11 -11
- package/Shattering/ShatterQuadProcess.cs +65 -65
- package/Shattering/ShatterQuadProcess.cs.meta +11 -11
- package/Shattering/ShatterShape.cs +84 -84
- package/Shattering/ShatterShape.cs.meta +11 -11
- package/Shattering/ShatterTri.cs +27 -27
- package/Shattering/ShatterTri.cs.meta +11 -11
- package/Shattering/ShatterTriProcess.cs +179 -179
- package/Shattering/ShatterTriProcess.cs.meta +11 -11
- package/Shattering/ShatterWithUI.cs +68 -68
- package/Shattering/ShatterWithUI.cs.meta +11 -11
- package/Shattering/SplitShatter.cs +114 -114
- package/Shattering/SplitShatter.cs.meta +11 -11
- package/Shattering/TMPTextShatter.cs +243 -243
- package/Shattering/TMPTextShatter.cs.meta +11 -11
- package/Shattering/UIBreakVisibility.cs +172 -172
- package/Shattering/UIBreakVisibility.cs.meta +11 -11
- package/Shattering.meta +8 -8
- package/ShuffleUtility.cs +32 -32
- package/ShuffleUtility.cs.meta +11 -11
- package/SimpleRandom.cs +32 -32
- package/SimpleRandom.cs.meta +11 -11
- package/Stats/ColorHealthBar.cs +56 -56
- package/Stats/ColorHealthBar.cs.meta +11 -11
- package/Stats/ColorHealthModifier.cs +138 -138
- package/Stats/ColorHealthModifier.cs.meta +11 -11
- package/Stats/GaugeHandler.cs +72 -72
- package/Stats/GaugeHandler.cs.meta +1 -1
- package/Stats/HealthBarModifier.cs +89 -89
- package/Stats/HealthBarModifier.cs.meta +11 -11
- package/Stats/HealthStat.cs +77 -77
- package/Stats/HealthStat.cs.meta +11 -11
- package/Stats/HealthStatBase.cs +26 -26
- package/Stats/HealthStatBase.cs.meta +11 -11
- package/Stats/IGauge.cs +36 -36
- package/Stats/IGauge.cs.meta +1 -1
- package/Stats/InfluenceGauge.cs +107 -107
- package/Stats/InfluenceGauge.cs.meta +11 -11
- package/Stats/InfluenceGaugeBase.cs +42 -42
- package/Stats/InfluenceGaugeBase.cs.meta +11 -11
- package/Stats/SimpleGauge.cs +46 -46
- package/Stats/SimpleGauge.cs.meta +1 -1
- package/Stats/StaminaHandler.cs +153 -153
- package/Stats/StaminaHandler.cs.meta +11 -11
- package/Stats/TrialStats.cs +140 -140
- package/Stats/TrialStats.cs.meta +11 -11
- package/Stats/TrialStatsBase.cs +36 -36
- package/Stats/TrialStatsBase.cs.meta +11 -11
- package/Stats.meta +8 -8
- package/TBS/TBSelectBuilder.cs +59 -59
- package/TBS/TBSelectBuilder.cs.meta +11 -11
- package/TBS/TBSelectBuilderEditor.cs +166 -166
- package/TBS/TBSelectBuilderEditor.cs.meta +11 -11
- package/TBS/TBSelectManager.cs +315 -315
- package/TBS/TBSelectManager.cs.meta +11 -11
- package/TBS/TBSelection.cs +46 -46
- package/TBS/TBSelection.cs.meta +11 -11
- package/TBS/TrialTruthBulletMenu.cs +24 -24
- package/TBS/TrialTruthBulletMenu.cs.meta +11 -11
- package/TBS.meta +8 -8
- package/ThreadSafeSimpleRandom.cs +29 -29
- package/ThreadSafeSimpleRandom.cs.meta +11 -11
- package/TimedDifficultyEditor.cs +56 -56
- package/TimedDifficultyEditor.cs.meta +11 -11
- package/TimedMinigameEditor.cs +31 -31
- package/TimedMinigameEditor.cs.meta +11 -11
- package/TimerBase.cs +189 -189
- package/TimerBase.cs.meta +11 -11
- package/TimerDifficulty.cs +45 -45
- package/TimerDifficulty.cs.meta +11 -11
- package/TrialDialogueMinigame.cs +276 -276
- package/TrialDialogueMinigame.cs.meta +11 -11
- package/TrialDiscussion.cs +68 -68
- package/TrialDiscussion.cs.meta +11 -11
- package/TrialTimer.cs +113 -113
- package/TrialTimer.cs.meta +11 -11
- package/TrialTimerBase.cs +129 -129
- package/TrialTimerBase.cs.meta +11 -11
- package/package.json +56 -51
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
|
@@ -1,381 +1,381 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
#if UNITY_EDITOR
|
|
3
|
-
using DREditor.Investigations;
|
|
4
|
-
using DREditor.States;
|
|
5
|
-
using DREditor.Editor.Utility;
|
|
6
|
-
using System;
|
|
7
|
-
using System.Collections.Generic;
|
|
8
|
-
using System.Linq;
|
|
9
|
-
using UnityEditor;
|
|
10
|
-
using UnityEngine;
|
|
11
|
-
|
|
12
|
-
namespace DREditor.Minigames
|
|
13
|
-
{
|
|
14
|
-
/// <summary>
|
|
15
|
-
///
|
|
16
|
-
/// </summary>
|
|
17
|
-
[Serializable]
|
|
18
|
-
public class BulletDifficultyEditor : DifficultyEditorBase<List<BulletDifficulty>>
|
|
19
|
-
{
|
|
20
|
-
/// <summary>
|
|
21
|
-
///
|
|
22
|
-
/// </summary>
|
|
23
|
-
protected EvidenceDatabase evidenceDatabase = null;
|
|
24
|
-
|
|
25
|
-
/// <summary>
|
|
26
|
-
///
|
|
27
|
-
/// </summary>
|
|
28
|
-
protected List<BulletDifficulty> bulletDifficulties;
|
|
29
|
-
|
|
30
|
-
/// <summary>
|
|
31
|
-
///
|
|
32
|
-
/// </summary>
|
|
33
|
-
protected List<TruthBullet> inheritedBullets;
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
///
|
|
37
|
-
/// </summary>
|
|
38
|
-
protected List<TruthBullet> ownedBullets;
|
|
39
|
-
|
|
40
|
-
/// <summary>
|
|
41
|
-
///
|
|
42
|
-
/// </summary>
|
|
43
|
-
protected List<TruthBullet> difficultyBullets;
|
|
44
|
-
|
|
45
|
-
/// <summary>
|
|
46
|
-
///
|
|
47
|
-
/// </summary>
|
|
48
|
-
protected StateAsset difficulty;
|
|
49
|
-
|
|
50
|
-
/// <summary>
|
|
51
|
-
///
|
|
52
|
-
/// </summary>
|
|
53
|
-
protected int chapterIndex;
|
|
54
|
-
|
|
55
|
-
/// <summary>
|
|
56
|
-
///
|
|
57
|
-
/// </summary>
|
|
58
|
-
protected int ownedIndex;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/// <summary>
|
|
62
|
-
///
|
|
63
|
-
/// </summary>
|
|
64
|
-
/// <param name="bulletDifficulties"></param>
|
|
65
|
-
/// <param name="chapterIndex"></param>
|
|
66
|
-
/// <returns></returns>
|
|
67
|
-
public virtual List<BulletDifficulty> DisplaySettings(List<BulletDifficulty> bulletDifficulties, ref int chapterIndex)
|
|
68
|
-
{
|
|
69
|
-
this.chapterIndex = chapterIndex;
|
|
70
|
-
|
|
71
|
-
this.bulletDifficulties = bulletDifficulties;
|
|
72
|
-
|
|
73
|
-
base.DisplaySettings(bulletDifficulties);
|
|
74
|
-
|
|
75
|
-
if (difficultyDatabase == null ||
|
|
76
|
-
!DatabaseUtility
|
|
77
|
-
.InitializeDatabase(evidenceDatabase, out evidenceDatabase))
|
|
78
|
-
return this.bulletDifficulties;
|
|
79
|
-
|
|
80
|
-
foldout = EditorGUILayout.Foldout(foldout, "Truth Bullets", largeFoldoutStyle);
|
|
81
|
-
|
|
82
|
-
if (foldout)
|
|
83
|
-
{
|
|
84
|
-
GUILayout.Space(10);
|
|
85
|
-
|
|
86
|
-
chapterIndex = HandyFields.IntField("Current Chapter: ", chapterIndex, 20);
|
|
87
|
-
|
|
88
|
-
if (chapterIndex < evidenceDatabase.Evidences.Count)
|
|
89
|
-
{
|
|
90
|
-
PopulateMissingDifficulties();
|
|
91
|
-
|
|
92
|
-
DisplayDifficulties();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
EditorGUILayout.EndFoldoutHeaderGroup();
|
|
97
|
-
|
|
98
|
-
return this.bulletDifficulties;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/// <summary>
|
|
102
|
-
///
|
|
103
|
-
/// </summary>
|
|
104
|
-
protected virtual void PopulateMissingDifficulties()
|
|
105
|
-
{
|
|
106
|
-
for (int i = 0; i < difficultyDatabase.States.Count; i++)
|
|
107
|
-
if (i >= bulletDifficulties.Count)
|
|
108
|
-
bulletDifficulties.Add(new(difficultyDatabase.States[i]));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/// <summary>
|
|
112
|
-
///
|
|
113
|
-
/// </summary>
|
|
114
|
-
protected virtual void DisplayDifficulties()
|
|
115
|
-
{
|
|
116
|
-
for (int i = 0; i < difficultyDatabase.States.Count; i++)
|
|
117
|
-
DisplayDifficulty(i);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/// <summary>
|
|
121
|
-
///
|
|
122
|
-
/// </summary>
|
|
123
|
-
/// <param name="i"></param>
|
|
124
|
-
protected virtual void DisplayDifficulty(int i)
|
|
125
|
-
{
|
|
126
|
-
InitializeInheritedBullets(i);
|
|
127
|
-
|
|
128
|
-
difficulty = bulletDifficulties[i].difficulty;
|
|
129
|
-
|
|
130
|
-
difficultyBullets = bulletDifficulties[i].bullets;
|
|
131
|
-
|
|
132
|
-
DisplayPair();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/// <summary>
|
|
136
|
-
///
|
|
137
|
-
/// </summary>
|
|
138
|
-
/// <param name="i"></param>
|
|
139
|
-
protected virtual void InitializeInheritedBullets(int i)
|
|
140
|
-
{
|
|
141
|
-
inheritedBullets = new();
|
|
142
|
-
|
|
143
|
-
for (int prev = 0; prev < i; prev++)
|
|
144
|
-
foreach (var bullet in bulletDifficulties[prev].bullets)
|
|
145
|
-
if (!inheritedBullets.Contains(bullet))
|
|
146
|
-
inheritedBullets.Add(bullet);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
/// <summary>
|
|
151
|
-
///
|
|
152
|
-
/// </summary>
|
|
153
|
-
protected virtual void DisplayPair()
|
|
154
|
-
{
|
|
155
|
-
EditorGUILayout.LabelField("Truth Bullets for: " + difficulty.stateName);
|
|
156
|
-
|
|
157
|
-
DisplayInheritedBullets();
|
|
158
|
-
|
|
159
|
-
ValidateInheritedBullets();
|
|
160
|
-
|
|
161
|
-
DisplayOwnedBullets();
|
|
162
|
-
|
|
163
|
-
DisplayAddButton();
|
|
164
|
-
|
|
165
|
-
RemoveAllBulletDuplicates();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/// <summary>
|
|
169
|
-
///
|
|
170
|
-
/// </summary>
|
|
171
|
-
protected virtual void DisplayInheritedBullets()
|
|
172
|
-
{
|
|
173
|
-
if (inheritedBullets.Count > 0)
|
|
174
|
-
{
|
|
175
|
-
GUI.enabled = false;
|
|
176
|
-
|
|
177
|
-
for (int i = 0; i < inheritedBullets.Count; i++)
|
|
178
|
-
{
|
|
179
|
-
using (new EditorGUILayout.HorizontalScope())
|
|
180
|
-
{
|
|
181
|
-
Evidence trialEvidence = evidenceDatabase.Evidences[chapterIndex];
|
|
182
|
-
|
|
183
|
-
int choiceIndex = trialEvidence.TruthBullets.IndexOf(inheritedBullets[i]);
|
|
184
|
-
|
|
185
|
-
EditorGUILayout.IntPopup(choiceIndex, trialEvidence.ToStringArray(), trialEvidence.TointArray());
|
|
186
|
-
|
|
187
|
-
EditorGUILayout.LabelField("(Inherited)", GUILayout.Width(80));
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
GUI.enabled = true;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/// <summary>
|
|
196
|
-
///
|
|
197
|
-
/// </summary>
|
|
198
|
-
protected virtual void ValidateInheritedBullets()
|
|
199
|
-
{
|
|
200
|
-
for (int i = 0; i < inheritedBullets.Count; i++)
|
|
201
|
-
if (i >= difficultyBullets.Count)
|
|
202
|
-
difficultyBullets.Add(inheritedBullets[i]);
|
|
203
|
-
else
|
|
204
|
-
difficultyBullets[i] = inheritedBullets[i];
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/// <summary>
|
|
208
|
-
///
|
|
209
|
-
/// </summary>
|
|
210
|
-
protected virtual void DisplayOwnedBullets()
|
|
211
|
-
{
|
|
212
|
-
ownedBullets = new();
|
|
213
|
-
|
|
214
|
-
foreach (var bullet in difficultyBullets)
|
|
215
|
-
if (!inheritedBullets.Contains(bullet))
|
|
216
|
-
ownedBullets.Add(bullet);
|
|
217
|
-
|
|
218
|
-
for (int i = 0; i < ownedBullets.Count; i++)
|
|
219
|
-
using (new EditorGUILayout.HorizontalScope())
|
|
220
|
-
DisplayOwnedBullet(i);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/// <summary>
|
|
224
|
-
///
|
|
225
|
-
/// </summary>
|
|
226
|
-
/// <param name="i"></param>
|
|
227
|
-
protected virtual void DisplayOwnedBullet(int i)
|
|
228
|
-
{
|
|
229
|
-
ownedIndex = i;
|
|
230
|
-
|
|
231
|
-
DisplayBullet();
|
|
232
|
-
|
|
233
|
-
DisplayRemoveButton();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/// <summary>
|
|
237
|
-
///
|
|
238
|
-
/// </summary>
|
|
239
|
-
protected virtual void DisplayBullet()
|
|
240
|
-
{
|
|
241
|
-
InitializeValidBullets(out List<TruthBullet> availableBullets, out List<string> availableNames);
|
|
242
|
-
|
|
243
|
-
DisplayValidBullet(availableBullets, availableNames);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/// <summary>
|
|
247
|
-
///
|
|
248
|
-
/// </summary>
|
|
249
|
-
/// <param name="availableBullets"></param>
|
|
250
|
-
/// <param name="availableNames"></param>
|
|
251
|
-
protected virtual void InitializeValidBullets(out List<TruthBullet> availableBullets, out List<string> availableNames)
|
|
252
|
-
{
|
|
253
|
-
Evidence trialEvidence = evidenceDatabase.Evidences[chapterIndex];
|
|
254
|
-
|
|
255
|
-
availableBullets = new();
|
|
256
|
-
|
|
257
|
-
availableNames = new();
|
|
258
|
-
|
|
259
|
-
for (int j = 0; j < trialEvidence.TruthBullets.Count; j++)
|
|
260
|
-
{
|
|
261
|
-
TruthBullet evidenceBullet = trialEvidence.TruthBullets[j];
|
|
262
|
-
|
|
263
|
-
if (!difficultyBullets.Contains(evidenceBullet) ||
|
|
264
|
-
evidenceBullet == ownedBullets[ownedIndex])
|
|
265
|
-
{
|
|
266
|
-
availableBullets.Add(evidenceBullet);
|
|
267
|
-
|
|
268
|
-
availableNames.Add(trialEvidence.ToStringArray()[j]);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/// <summary>
|
|
274
|
-
///
|
|
275
|
-
/// </summary>
|
|
276
|
-
/// <param name="availableBullets"></param>
|
|
277
|
-
/// <param name="availableNames"></param>
|
|
278
|
-
protected virtual void DisplayValidBullet(List<TruthBullet> availableBullets, List<string> availableNames)
|
|
279
|
-
{
|
|
280
|
-
int choiceIndex = availableBullets.IndexOf(ownedBullets[ownedIndex]);
|
|
281
|
-
|
|
282
|
-
if (choiceIndex == -1 && availableBullets.Count > 0)
|
|
283
|
-
choiceIndex = 0;
|
|
284
|
-
|
|
285
|
-
if (availableBullets.Count > 0)
|
|
286
|
-
{
|
|
287
|
-
int newIndex = EditorGUILayout.IntPopup(choiceIndex, availableNames.ToArray(),
|
|
288
|
-
Enumerable.Range(0, availableBullets.Count).ToArray());
|
|
289
|
-
|
|
290
|
-
if (newIndex != choiceIndex)
|
|
291
|
-
{
|
|
292
|
-
difficultyBullets.Remove(ownedBullets[ownedIndex]);
|
|
293
|
-
|
|
294
|
-
ownedBullets[ownedIndex] = availableBullets[newIndex];
|
|
295
|
-
|
|
296
|
-
difficultyBullets.Add(ownedBullets[ownedIndex]);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
else
|
|
300
|
-
EditorGUILayout.LabelField("No available bullets");
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/// <summary>
|
|
304
|
-
///
|
|
305
|
-
/// </summary>
|
|
306
|
-
protected virtual void DisplayRemoveButton()
|
|
307
|
-
{
|
|
308
|
-
if (GUILayout.Button("Remove Bullet"))
|
|
309
|
-
RemoveInheritedBullet();
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/// <summary>
|
|
313
|
-
///
|
|
314
|
-
/// </summary>
|
|
315
|
-
protected virtual void RemoveInheritedBullet()
|
|
316
|
-
{
|
|
317
|
-
int difficultyIndex = bulletDifficulties.IndexOf(
|
|
318
|
-
bulletDifficulties
|
|
319
|
-
.Where(pair => pair.difficulty == difficulty)
|
|
320
|
-
.First()
|
|
321
|
-
);
|
|
322
|
-
|
|
323
|
-
for (int x = difficultyIndex; x < bulletDifficulties.Count; x++)
|
|
324
|
-
bulletDifficulties[x].bullets.RemoveAt(ownedIndex);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
/// <summary>
|
|
328
|
-
///
|
|
329
|
-
/// </summary>
|
|
330
|
-
protected virtual void DisplayAddButton()
|
|
331
|
-
{
|
|
332
|
-
if (difficultyBullets.Count != evidenceDatabase.Evidences[chapterIndex].TruthBullets.Count &&
|
|
333
|
-
GUILayout.Button("Add Bullet"))
|
|
334
|
-
{
|
|
335
|
-
Evidence trialEvidence = evidenceDatabase.Evidences[chapterIndex];
|
|
336
|
-
|
|
337
|
-
TruthBullet bulletToAdd = null;
|
|
338
|
-
|
|
339
|
-
foreach (var bullet in trialEvidence.TruthBullets)
|
|
340
|
-
if (!difficultyBullets.Contains(bullet))
|
|
341
|
-
{
|
|
342
|
-
bulletToAdd = bullet;
|
|
343
|
-
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
AddOwnedBullet(bulletToAdd);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/// <summary>
|
|
352
|
-
///
|
|
353
|
-
/// </summary>
|
|
354
|
-
/// <param name="bulletToAdd"></param>
|
|
355
|
-
protected virtual void AddOwnedBullet(TruthBullet bulletToAdd)
|
|
356
|
-
{
|
|
357
|
-
if (bulletToAdd == null)
|
|
358
|
-
return;
|
|
359
|
-
|
|
360
|
-
difficultyBullets.Add(bulletToAdd);
|
|
361
|
-
|
|
362
|
-
int insertIndex = difficultyBullets.IndexOf(bulletToAdd);
|
|
363
|
-
|
|
364
|
-
int difficultyIndex = bulletDifficulties
|
|
365
|
-
.IndexOf(bulletDifficulties.Where(pair => pair.difficulty == difficulty).First());
|
|
366
|
-
|
|
367
|
-
for (int i = difficultyIndex + 1; i < bulletDifficulties.Count; i++)
|
|
368
|
-
bulletDifficulties[i].bullets.Insert(insertIndex, bulletToAdd);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/// <summary>
|
|
372
|
-
///
|
|
373
|
-
/// </summary>
|
|
374
|
-
protected virtual void RemoveAllBulletDuplicates()
|
|
375
|
-
{
|
|
376
|
-
for (int i = 0; i < bulletDifficulties.Count; i++)
|
|
377
|
-
bulletDifficulties[i].RemoveDuplicateBullets();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
#if UNITY_EDITOR
|
|
3
|
+
using DREditor.Investigations;
|
|
4
|
+
using DREditor.States;
|
|
5
|
+
using DREditor.Editor.Utility;
|
|
6
|
+
using System;
|
|
7
|
+
using System.Collections.Generic;
|
|
8
|
+
using System.Linq;
|
|
9
|
+
using UnityEditor;
|
|
10
|
+
using UnityEngine;
|
|
11
|
+
|
|
12
|
+
namespace DREditor.Minigames
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
///
|
|
16
|
+
/// </summary>
|
|
17
|
+
[Serializable]
|
|
18
|
+
public class BulletDifficultyEditor : DifficultyEditorBase<List<BulletDifficulty>>
|
|
19
|
+
{
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
protected EvidenceDatabase evidenceDatabase = null;
|
|
24
|
+
|
|
25
|
+
/// <summary>
|
|
26
|
+
///
|
|
27
|
+
/// </summary>
|
|
28
|
+
protected List<BulletDifficulty> bulletDifficulties;
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
protected List<TruthBullet> inheritedBullets;
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
protected List<TruthBullet> ownedBullets;
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
///
|
|
42
|
+
/// </summary>
|
|
43
|
+
protected List<TruthBullet> difficultyBullets;
|
|
44
|
+
|
|
45
|
+
/// <summary>
|
|
46
|
+
///
|
|
47
|
+
/// </summary>
|
|
48
|
+
protected StateAsset difficulty;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
protected int chapterIndex;
|
|
54
|
+
|
|
55
|
+
/// <summary>
|
|
56
|
+
///
|
|
57
|
+
/// </summary>
|
|
58
|
+
protected int ownedIndex;
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/// <summary>
|
|
62
|
+
///
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <param name="bulletDifficulties"></param>
|
|
65
|
+
/// <param name="chapterIndex"></param>
|
|
66
|
+
/// <returns></returns>
|
|
67
|
+
public virtual List<BulletDifficulty> DisplaySettings(List<BulletDifficulty> bulletDifficulties, ref int chapterIndex)
|
|
68
|
+
{
|
|
69
|
+
this.chapterIndex = chapterIndex;
|
|
70
|
+
|
|
71
|
+
this.bulletDifficulties = bulletDifficulties;
|
|
72
|
+
|
|
73
|
+
base.DisplaySettings(bulletDifficulties);
|
|
74
|
+
|
|
75
|
+
if (difficultyDatabase == null ||
|
|
76
|
+
!DatabaseUtility
|
|
77
|
+
.InitializeDatabase(evidenceDatabase, out evidenceDatabase))
|
|
78
|
+
return this.bulletDifficulties;
|
|
79
|
+
|
|
80
|
+
foldout = EditorGUILayout.Foldout(foldout, "Truth Bullets", largeFoldoutStyle);
|
|
81
|
+
|
|
82
|
+
if (foldout)
|
|
83
|
+
{
|
|
84
|
+
GUILayout.Space(10);
|
|
85
|
+
|
|
86
|
+
chapterIndex = HandyFields.IntField("Current Chapter: ", chapterIndex, 20);
|
|
87
|
+
|
|
88
|
+
if (chapterIndex < evidenceDatabase.Evidences.Count)
|
|
89
|
+
{
|
|
90
|
+
PopulateMissingDifficulties();
|
|
91
|
+
|
|
92
|
+
DisplayDifficulties();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
EditorGUILayout.EndFoldoutHeaderGroup();
|
|
97
|
+
|
|
98
|
+
return this.bulletDifficulties;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// <summary>
|
|
102
|
+
///
|
|
103
|
+
/// </summary>
|
|
104
|
+
protected virtual void PopulateMissingDifficulties()
|
|
105
|
+
{
|
|
106
|
+
for (int i = 0; i < difficultyDatabase.States.Count; i++)
|
|
107
|
+
if (i >= bulletDifficulties.Count)
|
|
108
|
+
bulletDifficulties.Add(new(difficultyDatabase.States[i]));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// <summary>
|
|
112
|
+
///
|
|
113
|
+
/// </summary>
|
|
114
|
+
protected virtual void DisplayDifficulties()
|
|
115
|
+
{
|
|
116
|
+
for (int i = 0; i < difficultyDatabase.States.Count; i++)
|
|
117
|
+
DisplayDifficulty(i);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/// <summary>
|
|
121
|
+
///
|
|
122
|
+
/// </summary>
|
|
123
|
+
/// <param name="i"></param>
|
|
124
|
+
protected virtual void DisplayDifficulty(int i)
|
|
125
|
+
{
|
|
126
|
+
InitializeInheritedBullets(i);
|
|
127
|
+
|
|
128
|
+
difficulty = bulletDifficulties[i].difficulty;
|
|
129
|
+
|
|
130
|
+
difficultyBullets = bulletDifficulties[i].bullets;
|
|
131
|
+
|
|
132
|
+
DisplayPair();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/// <summary>
|
|
136
|
+
///
|
|
137
|
+
/// </summary>
|
|
138
|
+
/// <param name="i"></param>
|
|
139
|
+
protected virtual void InitializeInheritedBullets(int i)
|
|
140
|
+
{
|
|
141
|
+
inheritedBullets = new();
|
|
142
|
+
|
|
143
|
+
for (int prev = 0; prev < i; prev++)
|
|
144
|
+
foreach (var bullet in bulletDifficulties[prev].bullets)
|
|
145
|
+
if (!inheritedBullets.Contains(bullet))
|
|
146
|
+
inheritedBullets.Add(bullet);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
/// <summary>
|
|
151
|
+
///
|
|
152
|
+
/// </summary>
|
|
153
|
+
protected virtual void DisplayPair()
|
|
154
|
+
{
|
|
155
|
+
EditorGUILayout.LabelField("Truth Bullets for: " + difficulty.stateName);
|
|
156
|
+
|
|
157
|
+
DisplayInheritedBullets();
|
|
158
|
+
|
|
159
|
+
ValidateInheritedBullets();
|
|
160
|
+
|
|
161
|
+
DisplayOwnedBullets();
|
|
162
|
+
|
|
163
|
+
DisplayAddButton();
|
|
164
|
+
|
|
165
|
+
RemoveAllBulletDuplicates();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/// <summary>
|
|
169
|
+
///
|
|
170
|
+
/// </summary>
|
|
171
|
+
protected virtual void DisplayInheritedBullets()
|
|
172
|
+
{
|
|
173
|
+
if (inheritedBullets.Count > 0)
|
|
174
|
+
{
|
|
175
|
+
GUI.enabled = false;
|
|
176
|
+
|
|
177
|
+
for (int i = 0; i < inheritedBullets.Count; i++)
|
|
178
|
+
{
|
|
179
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
180
|
+
{
|
|
181
|
+
Evidence trialEvidence = evidenceDatabase.Evidences[chapterIndex];
|
|
182
|
+
|
|
183
|
+
int choiceIndex = trialEvidence.TruthBullets.IndexOf(inheritedBullets[i]);
|
|
184
|
+
|
|
185
|
+
EditorGUILayout.IntPopup(choiceIndex, trialEvidence.ToStringArray(), trialEvidence.TointArray());
|
|
186
|
+
|
|
187
|
+
EditorGUILayout.LabelField("(Inherited)", GUILayout.Width(80));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
GUI.enabled = true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/// <summary>
|
|
196
|
+
///
|
|
197
|
+
/// </summary>
|
|
198
|
+
protected virtual void ValidateInheritedBullets()
|
|
199
|
+
{
|
|
200
|
+
for (int i = 0; i < inheritedBullets.Count; i++)
|
|
201
|
+
if (i >= difficultyBullets.Count)
|
|
202
|
+
difficultyBullets.Add(inheritedBullets[i]);
|
|
203
|
+
else
|
|
204
|
+
difficultyBullets[i] = inheritedBullets[i];
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/// <summary>
|
|
208
|
+
///
|
|
209
|
+
/// </summary>
|
|
210
|
+
protected virtual void DisplayOwnedBullets()
|
|
211
|
+
{
|
|
212
|
+
ownedBullets = new();
|
|
213
|
+
|
|
214
|
+
foreach (var bullet in difficultyBullets)
|
|
215
|
+
if (!inheritedBullets.Contains(bullet))
|
|
216
|
+
ownedBullets.Add(bullet);
|
|
217
|
+
|
|
218
|
+
for (int i = 0; i < ownedBullets.Count; i++)
|
|
219
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
220
|
+
DisplayOwnedBullet(i);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/// <summary>
|
|
224
|
+
///
|
|
225
|
+
/// </summary>
|
|
226
|
+
/// <param name="i"></param>
|
|
227
|
+
protected virtual void DisplayOwnedBullet(int i)
|
|
228
|
+
{
|
|
229
|
+
ownedIndex = i;
|
|
230
|
+
|
|
231
|
+
DisplayBullet();
|
|
232
|
+
|
|
233
|
+
DisplayRemoveButton();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/// <summary>
|
|
237
|
+
///
|
|
238
|
+
/// </summary>
|
|
239
|
+
protected virtual void DisplayBullet()
|
|
240
|
+
{
|
|
241
|
+
InitializeValidBullets(out List<TruthBullet> availableBullets, out List<string> availableNames);
|
|
242
|
+
|
|
243
|
+
DisplayValidBullet(availableBullets, availableNames);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/// <summary>
|
|
247
|
+
///
|
|
248
|
+
/// </summary>
|
|
249
|
+
/// <param name="availableBullets"></param>
|
|
250
|
+
/// <param name="availableNames"></param>
|
|
251
|
+
protected virtual void InitializeValidBullets(out List<TruthBullet> availableBullets, out List<string> availableNames)
|
|
252
|
+
{
|
|
253
|
+
Evidence trialEvidence = evidenceDatabase.Evidences[chapterIndex];
|
|
254
|
+
|
|
255
|
+
availableBullets = new();
|
|
256
|
+
|
|
257
|
+
availableNames = new();
|
|
258
|
+
|
|
259
|
+
for (int j = 0; j < trialEvidence.TruthBullets.Count; j++)
|
|
260
|
+
{
|
|
261
|
+
TruthBullet evidenceBullet = trialEvidence.TruthBullets[j];
|
|
262
|
+
|
|
263
|
+
if (!difficultyBullets.Contains(evidenceBullet) ||
|
|
264
|
+
evidenceBullet == ownedBullets[ownedIndex])
|
|
265
|
+
{
|
|
266
|
+
availableBullets.Add(evidenceBullet);
|
|
267
|
+
|
|
268
|
+
availableNames.Add(trialEvidence.ToStringArray()[j]);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/// <summary>
|
|
274
|
+
///
|
|
275
|
+
/// </summary>
|
|
276
|
+
/// <param name="availableBullets"></param>
|
|
277
|
+
/// <param name="availableNames"></param>
|
|
278
|
+
protected virtual void DisplayValidBullet(List<TruthBullet> availableBullets, List<string> availableNames)
|
|
279
|
+
{
|
|
280
|
+
int choiceIndex = availableBullets.IndexOf(ownedBullets[ownedIndex]);
|
|
281
|
+
|
|
282
|
+
if (choiceIndex == -1 && availableBullets.Count > 0)
|
|
283
|
+
choiceIndex = 0;
|
|
284
|
+
|
|
285
|
+
if (availableBullets.Count > 0)
|
|
286
|
+
{
|
|
287
|
+
int newIndex = EditorGUILayout.IntPopup(choiceIndex, availableNames.ToArray(),
|
|
288
|
+
Enumerable.Range(0, availableBullets.Count).ToArray());
|
|
289
|
+
|
|
290
|
+
if (newIndex != choiceIndex)
|
|
291
|
+
{
|
|
292
|
+
difficultyBullets.Remove(ownedBullets[ownedIndex]);
|
|
293
|
+
|
|
294
|
+
ownedBullets[ownedIndex] = availableBullets[newIndex];
|
|
295
|
+
|
|
296
|
+
difficultyBullets.Add(ownedBullets[ownedIndex]);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else
|
|
300
|
+
EditorGUILayout.LabelField("No available bullets");
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/// <summary>
|
|
304
|
+
///
|
|
305
|
+
/// </summary>
|
|
306
|
+
protected virtual void DisplayRemoveButton()
|
|
307
|
+
{
|
|
308
|
+
if (GUILayout.Button("Remove Bullet"))
|
|
309
|
+
RemoveInheritedBullet();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/// <summary>
|
|
313
|
+
///
|
|
314
|
+
/// </summary>
|
|
315
|
+
protected virtual void RemoveInheritedBullet()
|
|
316
|
+
{
|
|
317
|
+
int difficultyIndex = bulletDifficulties.IndexOf(
|
|
318
|
+
bulletDifficulties
|
|
319
|
+
.Where(pair => pair.difficulty == difficulty)
|
|
320
|
+
.First()
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
for (int x = difficultyIndex; x < bulletDifficulties.Count; x++)
|
|
324
|
+
bulletDifficulties[x].bullets.RemoveAt(ownedIndex);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/// <summary>
|
|
328
|
+
///
|
|
329
|
+
/// </summary>
|
|
330
|
+
protected virtual void DisplayAddButton()
|
|
331
|
+
{
|
|
332
|
+
if (difficultyBullets.Count != evidenceDatabase.Evidences[chapterIndex].TruthBullets.Count &&
|
|
333
|
+
GUILayout.Button("Add Bullet"))
|
|
334
|
+
{
|
|
335
|
+
Evidence trialEvidence = evidenceDatabase.Evidences[chapterIndex];
|
|
336
|
+
|
|
337
|
+
TruthBullet bulletToAdd = null;
|
|
338
|
+
|
|
339
|
+
foreach (var bullet in trialEvidence.TruthBullets)
|
|
340
|
+
if (!difficultyBullets.Contains(bullet))
|
|
341
|
+
{
|
|
342
|
+
bulletToAdd = bullet;
|
|
343
|
+
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
AddOwnedBullet(bulletToAdd);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/// <summary>
|
|
352
|
+
///
|
|
353
|
+
/// </summary>
|
|
354
|
+
/// <param name="bulletToAdd"></param>
|
|
355
|
+
protected virtual void AddOwnedBullet(TruthBullet bulletToAdd)
|
|
356
|
+
{
|
|
357
|
+
if (bulletToAdd == null)
|
|
358
|
+
return;
|
|
359
|
+
|
|
360
|
+
difficultyBullets.Add(bulletToAdd);
|
|
361
|
+
|
|
362
|
+
int insertIndex = difficultyBullets.IndexOf(bulletToAdd);
|
|
363
|
+
|
|
364
|
+
int difficultyIndex = bulletDifficulties
|
|
365
|
+
.IndexOf(bulletDifficulties.Where(pair => pair.difficulty == difficulty).First());
|
|
366
|
+
|
|
367
|
+
for (int i = difficultyIndex + 1; i < bulletDifficulties.Count; i++)
|
|
368
|
+
bulletDifficulties[i].bullets.Insert(insertIndex, bulletToAdd);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/// <summary>
|
|
372
|
+
///
|
|
373
|
+
/// </summary>
|
|
374
|
+
protected virtual void RemoveAllBulletDuplicates()
|
|
375
|
+
{
|
|
376
|
+
for (int i = 0; i < bulletDifficulties.Count; i++)
|
|
377
|
+
bulletDifficulties[i].RemoveDuplicateBullets();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
381
|
#endif
|