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
package/TrialDiscussion.cs
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.Dialogues;
|
|
3
|
-
using DREditor.Dialogues.Loading;
|
|
4
|
-
using DREditor.Services;
|
|
5
|
-
using UnityEditor;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Minigames
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
[System.Serializable]
|
|
14
|
-
[CreateAssetMenu(menuName = "DREditor/Dialogues/Trial Discussion", fileName = "TrialDiscussion")]
|
|
15
|
-
public class TrialDiscussion : ScriptableObject, IDialogueHolder
|
|
16
|
-
{
|
|
17
|
-
/// <summary>
|
|
18
|
-
///
|
|
19
|
-
/// </summary>
|
|
20
|
-
[Header("")]
|
|
21
|
-
[Divider]
|
|
22
|
-
[Tooltip("")]
|
|
23
|
-
public TrialDialogue[] trialDialogues;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
///
|
|
28
|
-
/// </summary>
|
|
29
|
-
/// <returns>
|
|
30
|
-
///
|
|
31
|
-
/// </returns>
|
|
32
|
-
public virtual bool CheckIfSaveDialogue()
|
|
33
|
-
{
|
|
34
|
-
foreach (TrialDialogue currentTrialDialogue in trialDialogues)
|
|
35
|
-
if (ServiceLocator.GetService<IDialogueManager>().GetManagerComponent<DialogueLoadIdentifier>()
|
|
36
|
-
.CheckDialogue<TrialLine>(currentTrialDialogue))
|
|
37
|
-
return true;
|
|
38
|
-
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
///
|
|
44
|
-
/// </summary>
|
|
45
|
-
/// <param name="dialogue"></param>
|
|
46
|
-
/// <returns>
|
|
47
|
-
///
|
|
48
|
-
/// </returns>
|
|
49
|
-
public virtual int GetIndexOfTrialDialogue(TrialDialogue dialogue)
|
|
50
|
-
{
|
|
51
|
-
for (int i = 0; i < trialDialogues.Length; i++)
|
|
52
|
-
if (dialogue.name == trialDialogues[i].name)
|
|
53
|
-
return i;
|
|
54
|
-
|
|
55
|
-
UnityEngine.Debug.LogWarning(
|
|
56
|
-
$"TrialDiscussion: WARNING: None of the Trial Dialogues in asset {name} matched the name of the " +
|
|
57
|
-
$"searched dialogue {dialogue.name}. Returning Index 0.");
|
|
58
|
-
|
|
59
|
-
return 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
#if UNITY_EDITOR
|
|
64
|
-
|
|
65
|
-
protected virtual void OnValidate() => EditorUtility.SetDirty(this);
|
|
66
|
-
|
|
67
|
-
#endif
|
|
68
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.Dialogues;
|
|
3
|
+
using DREditor.Dialogues.Loading;
|
|
4
|
+
using DREditor.Services;
|
|
5
|
+
using UnityEditor;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Minigames
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[System.Serializable]
|
|
14
|
+
[CreateAssetMenu(menuName = "DREditor/Dialogues/Trial Discussion", fileName = "TrialDiscussion")]
|
|
15
|
+
public class TrialDiscussion : ScriptableObject, IDialogueHolder
|
|
16
|
+
{
|
|
17
|
+
/// <summary>
|
|
18
|
+
///
|
|
19
|
+
/// </summary>
|
|
20
|
+
[Header("")]
|
|
21
|
+
[Divider]
|
|
22
|
+
[Tooltip("")]
|
|
23
|
+
public TrialDialogue[] trialDialogues;
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
/// <returns>
|
|
30
|
+
///
|
|
31
|
+
/// </returns>
|
|
32
|
+
public virtual bool CheckIfSaveDialogue()
|
|
33
|
+
{
|
|
34
|
+
foreach (TrialDialogue currentTrialDialogue in trialDialogues)
|
|
35
|
+
if (ServiceLocator.GetService<IDialogueManager>().GetManagerComponent<DialogueLoadIdentifier>()
|
|
36
|
+
.CheckDialogue<TrialLine>(currentTrialDialogue))
|
|
37
|
+
return true;
|
|
38
|
+
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
/// <param name="dialogue"></param>
|
|
46
|
+
/// <returns>
|
|
47
|
+
///
|
|
48
|
+
/// </returns>
|
|
49
|
+
public virtual int GetIndexOfTrialDialogue(TrialDialogue dialogue)
|
|
50
|
+
{
|
|
51
|
+
for (int i = 0; i < trialDialogues.Length; i++)
|
|
52
|
+
if (dialogue.name == trialDialogues[i].name)
|
|
53
|
+
return i;
|
|
54
|
+
|
|
55
|
+
UnityEngine.Debug.LogWarning(
|
|
56
|
+
$"TrialDiscussion: WARNING: None of the Trial Dialogues in asset {name} matched the name of the " +
|
|
57
|
+
$"searched dialogue {dialogue.name}. Returning Index 0.");
|
|
58
|
+
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
#if UNITY_EDITOR
|
|
64
|
+
|
|
65
|
+
protected virtual void OnValidate() => EditorUtility.SetDirty(this);
|
|
66
|
+
|
|
67
|
+
#endif
|
|
68
|
+
}
|
|
69
69
|
}
|
package/TrialDiscussion.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: aa2a45f1e135ac546a626c46f340a2d5
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: aa2a45f1e135ac546a626c46f340a2d5
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/TrialTimer.cs
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.UIHandling;
|
|
3
|
-
using System.Collections;
|
|
4
|
-
using TMPro;
|
|
5
|
-
using UnityEngine;
|
|
6
|
-
|
|
7
|
-
namespace DREditor.Minigames
|
|
8
|
-
{
|
|
9
|
-
/// <summary>
|
|
10
|
-
///
|
|
11
|
-
/// </summary>
|
|
12
|
-
[ClassHeader(nameof(TrialTimerBase) + ", " + nameof(TimerBase) + ", " + nameof(IUIVisibility) +
|
|
13
|
-
"\n\n")]
|
|
14
|
-
public class TrialTimer : TrialTimerBase
|
|
15
|
-
{
|
|
16
|
-
/// <summary>
|
|
17
|
-
///
|
|
18
|
-
/// </summary>
|
|
19
|
-
[Tooltip("")]
|
|
20
|
-
[SerializeField] protected string resetTimerText = "00:00.000";
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected string timerFormat = "{0:00}:{1:00}.{2:000}";
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
///
|
|
30
|
-
/// </summary>
|
|
31
|
-
[Tooltip("")]
|
|
32
|
-
[SerializeField] protected UIVisibilityComponent visibilityComponent = null;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
///
|
|
37
|
-
/// </summary>
|
|
38
|
-
protected TMP_Text timerText = null;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/// <summary>
|
|
42
|
-
///
|
|
43
|
-
/// </summary>
|
|
44
|
-
/// <param name="text"></param>
|
|
45
|
-
protected virtual void SetTimerText(string text) => timerText.text = text;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/// <summary>
|
|
49
|
-
///
|
|
50
|
-
/// </summary>
|
|
51
|
-
protected virtual void Awake()
|
|
52
|
-
{
|
|
53
|
-
if (!TryGetComponent(out timerText))
|
|
54
|
-
if (GetComponentInChildren<TMP_Text>() is TMP_Text childText)
|
|
55
|
-
timerText = childText;
|
|
56
|
-
else
|
|
57
|
-
UnityEngine.Debug.LogError(nameof(TrialTimer) + ": Could not find a TMP text component on the timer!");
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/// <inheritdoc/>
|
|
62
|
-
public override void StopTimer()
|
|
63
|
-
{
|
|
64
|
-
base.StopTimer();
|
|
65
|
-
|
|
66
|
-
SetTimerText("");
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/// <inheritdoc/>
|
|
70
|
-
protected override void CountDownTime()
|
|
71
|
-
{
|
|
72
|
-
base.CountDownTime();
|
|
73
|
-
|
|
74
|
-
if (minutes < 0 || seconds < 0 || milliseconds < 0)
|
|
75
|
-
SetTimeRemaining(-1);
|
|
76
|
-
else
|
|
77
|
-
SetTimerVisual();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/// <inheritdoc/>
|
|
81
|
-
protected override void TimeHasRunOut()
|
|
82
|
-
{
|
|
83
|
-
SetTimerText(resetTimerText);
|
|
84
|
-
|
|
85
|
-
base.TimeHasRunOut();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/// <inheritdoc/>
|
|
90
|
-
public override void Show()
|
|
91
|
-
{
|
|
92
|
-
if (visibilityComponent != null)
|
|
93
|
-
visibilityComponent.Show();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/// <inheritdoc/>
|
|
97
|
-
public override void Hide()
|
|
98
|
-
{
|
|
99
|
-
if (visibilityComponent != null)
|
|
100
|
-
visibilityComponent.Hide();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/// <inheritdoc/>
|
|
104
|
-
public override IEnumerator WaitForChangeToComplete()
|
|
105
|
-
{
|
|
106
|
-
if (visibilityComponent != null)
|
|
107
|
-
yield return visibilityComponent.WaitForChangeToComplete();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/// <inheritdoc/>
|
|
111
|
-
protected override void SetTimerVisual()
|
|
112
|
-
=> SetTimerText(string.Format(timerFormat, minutes, seconds, milliseconds));
|
|
113
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.UIHandling;
|
|
3
|
+
using System.Collections;
|
|
4
|
+
using TMPro;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace DREditor.Minigames
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
///
|
|
11
|
+
/// </summary>
|
|
12
|
+
[ClassHeader(nameof(TrialTimerBase) + ", " + nameof(TimerBase) + ", " + nameof(IUIVisibility) +
|
|
13
|
+
"\n\n")]
|
|
14
|
+
public class TrialTimer : TrialTimerBase
|
|
15
|
+
{
|
|
16
|
+
/// <summary>
|
|
17
|
+
///
|
|
18
|
+
/// </summary>
|
|
19
|
+
[Tooltip("")]
|
|
20
|
+
[SerializeField] protected string resetTimerText = "00:00.000";
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected string timerFormat = "{0:00}:{1:00}.{2:000}";
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
[Tooltip("")]
|
|
32
|
+
[SerializeField] protected UIVisibilityComponent visibilityComponent = null;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
/// <summary>
|
|
36
|
+
///
|
|
37
|
+
/// </summary>
|
|
38
|
+
protected TMP_Text timerText = null;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/// <summary>
|
|
42
|
+
///
|
|
43
|
+
/// </summary>
|
|
44
|
+
/// <param name="text"></param>
|
|
45
|
+
protected virtual void SetTimerText(string text) => timerText.text = text;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
/// <summary>
|
|
49
|
+
///
|
|
50
|
+
/// </summary>
|
|
51
|
+
protected virtual void Awake()
|
|
52
|
+
{
|
|
53
|
+
if (!TryGetComponent(out timerText))
|
|
54
|
+
if (GetComponentInChildren<TMP_Text>() is TMP_Text childText)
|
|
55
|
+
timerText = childText;
|
|
56
|
+
else
|
|
57
|
+
UnityEngine.Debug.LogError(nameof(TrialTimer) + ": Could not find a TMP text component on the timer!");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
/// <inheritdoc/>
|
|
62
|
+
public override void StopTimer()
|
|
63
|
+
{
|
|
64
|
+
base.StopTimer();
|
|
65
|
+
|
|
66
|
+
SetTimerText("");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// <inheritdoc/>
|
|
70
|
+
protected override void CountDownTime()
|
|
71
|
+
{
|
|
72
|
+
base.CountDownTime();
|
|
73
|
+
|
|
74
|
+
if (minutes < 0 || seconds < 0 || milliseconds < 0)
|
|
75
|
+
SetTimeRemaining(-1);
|
|
76
|
+
else
|
|
77
|
+
SetTimerVisual();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/// <inheritdoc/>
|
|
81
|
+
protected override void TimeHasRunOut()
|
|
82
|
+
{
|
|
83
|
+
SetTimerText(resetTimerText);
|
|
84
|
+
|
|
85
|
+
base.TimeHasRunOut();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/// <inheritdoc/>
|
|
90
|
+
public override void Show()
|
|
91
|
+
{
|
|
92
|
+
if (visibilityComponent != null)
|
|
93
|
+
visibilityComponent.Show();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/// <inheritdoc/>
|
|
97
|
+
public override void Hide()
|
|
98
|
+
{
|
|
99
|
+
if (visibilityComponent != null)
|
|
100
|
+
visibilityComponent.Hide();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/// <inheritdoc/>
|
|
104
|
+
public override IEnumerator WaitForChangeToComplete()
|
|
105
|
+
{
|
|
106
|
+
if (visibilityComponent != null)
|
|
107
|
+
yield return visibilityComponent.WaitForChangeToComplete();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/// <inheritdoc/>
|
|
111
|
+
protected override void SetTimerVisual()
|
|
112
|
+
=> SetTimerText(string.Format(timerFormat, minutes, seconds, milliseconds));
|
|
113
|
+
}
|
|
114
114
|
}
|
package/TrialTimer.cs.meta
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: d01a028b39bec1c46867de44ec47fd43
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d01a028b39bec1c46867de44ec47fd43
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
package/TrialTimerBase.cs
CHANGED
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
-
using DREditor.EventObjects;
|
|
3
|
-
using DREditor.UIHandling;
|
|
4
|
-
using System.Collections;
|
|
5
|
-
using System.Collections.Generic;
|
|
6
|
-
using UnityEngine;
|
|
7
|
-
|
|
8
|
-
namespace DREditor.Minigames
|
|
9
|
-
{
|
|
10
|
-
/// <summary>
|
|
11
|
-
///
|
|
12
|
-
/// </summary>
|
|
13
|
-
public abstract class TrialTimerBase : TimerBase, IUIVisibility
|
|
14
|
-
{
|
|
15
|
-
/// <summary>
|
|
16
|
-
///
|
|
17
|
-
/// </summary>
|
|
18
|
-
[Tooltip("")]
|
|
19
|
-
[SerializeField] protected IntWithEvent actionTimerDifficulty = null;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/// <summary>
|
|
23
|
-
///
|
|
24
|
-
/// </summary>
|
|
25
|
-
/// <param name="times"></param>
|
|
26
|
-
/// <param name="finishVisualStart"></param>
|
|
27
|
-
public virtual void ShowInitialize(List<TimerDifficulty> times, bool finishVisualStart = false)
|
|
28
|
-
{
|
|
29
|
-
Initialize(times);
|
|
30
|
-
|
|
31
|
-
Show();
|
|
32
|
-
|
|
33
|
-
StartCoroutine(ResumeOnVisualEnd(finishVisualStart));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/// <summary>
|
|
37
|
-
///
|
|
38
|
-
/// </summary>
|
|
39
|
-
/// <param name="times"></param>
|
|
40
|
-
public virtual void Initialize(List<TimerDifficulty> times)
|
|
41
|
-
{
|
|
42
|
-
TimerDifficulty timed = times[actionTimerDifficulty.Value];
|
|
43
|
-
|
|
44
|
-
float time = (timed.minutes * 60) + timed.seconds;
|
|
45
|
-
|
|
46
|
-
StartTimer(time);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/// <summary>
|
|
50
|
-
///
|
|
51
|
-
/// </summary>
|
|
52
|
-
/// <param name="finishVisualOnStart"></param>
|
|
53
|
-
/// <returns></returns>
|
|
54
|
-
protected virtual IEnumerator ResumeOnVisualEnd(bool finishVisualOnStart)
|
|
55
|
-
{
|
|
56
|
-
PauseTimer();
|
|
57
|
-
|
|
58
|
-
ResetTimer();
|
|
59
|
-
|
|
60
|
-
if (finishVisualOnStart)
|
|
61
|
-
yield return WaitForChangeToComplete();
|
|
62
|
-
|
|
63
|
-
ResumeTimer();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/// <summary>
|
|
67
|
-
///
|
|
68
|
-
/// </summary>
|
|
69
|
-
public virtual void HideStop()
|
|
70
|
-
{
|
|
71
|
-
Hide();
|
|
72
|
-
|
|
73
|
-
StopTimer();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/// <summary>
|
|
77
|
-
///
|
|
78
|
-
/// </summary>
|
|
79
|
-
public virtual void DisplayRemainingTime()
|
|
80
|
-
{
|
|
81
|
-
CalculateTimerVariables();
|
|
82
|
-
|
|
83
|
-
SetTimerVisual();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/// <summary>
|
|
87
|
-
///
|
|
88
|
-
/// </summary>
|
|
89
|
-
protected abstract void SetTimerVisual();
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/// <inheritdoc/>
|
|
93
|
-
public abstract void Show();
|
|
94
|
-
|
|
95
|
-
/// <inheritdoc/>
|
|
96
|
-
public abstract void Hide();
|
|
97
|
-
|
|
98
|
-
/// <inheritdoc/>
|
|
99
|
-
public abstract IEnumerator WaitForChangeToComplete();
|
|
100
|
-
|
|
101
|
-
/// <summary>
|
|
102
|
-
///
|
|
103
|
-
/// </summary>
|
|
104
|
-
/// <param name="timed"></param>
|
|
105
|
-
public virtual void Initialize(TimerDifficulty timed)
|
|
106
|
-
{
|
|
107
|
-
SetTimer(timed);
|
|
108
|
-
|
|
109
|
-
Show();
|
|
110
|
-
|
|
111
|
-
PauseTimer();
|
|
112
|
-
|
|
113
|
-
ResetTimer();
|
|
114
|
-
|
|
115
|
-
ResumeTimer();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/// <summary>
|
|
120
|
-
///
|
|
121
|
-
/// </summary>
|
|
122
|
-
[ContextMenu("Debug Start")]
|
|
123
|
-
public void DebugStart()
|
|
124
|
-
{
|
|
125
|
-
Show();
|
|
126
|
-
|
|
127
|
-
StartTimer(startTime);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.UIHandling;
|
|
4
|
+
using System.Collections;
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.Minigames
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
public abstract class TrialTimerBase : TimerBase, IUIVisibility
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected IntWithEvent actionTimerDifficulty = null;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
/// <param name="times"></param>
|
|
26
|
+
/// <param name="finishVisualStart"></param>
|
|
27
|
+
public virtual void ShowInitialize(List<TimerDifficulty> times, bool finishVisualStart = false)
|
|
28
|
+
{
|
|
29
|
+
Initialize(times);
|
|
30
|
+
|
|
31
|
+
Show();
|
|
32
|
+
|
|
33
|
+
StartCoroutine(ResumeOnVisualEnd(finishVisualStart));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
///
|
|
38
|
+
/// </summary>
|
|
39
|
+
/// <param name="times"></param>
|
|
40
|
+
public virtual void Initialize(List<TimerDifficulty> times)
|
|
41
|
+
{
|
|
42
|
+
TimerDifficulty timed = times[actionTimerDifficulty.Value];
|
|
43
|
+
|
|
44
|
+
float time = (timed.minutes * 60) + timed.seconds;
|
|
45
|
+
|
|
46
|
+
StartTimer(time);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
/// <param name="finishVisualOnStart"></param>
|
|
53
|
+
/// <returns></returns>
|
|
54
|
+
protected virtual IEnumerator ResumeOnVisualEnd(bool finishVisualOnStart)
|
|
55
|
+
{
|
|
56
|
+
PauseTimer();
|
|
57
|
+
|
|
58
|
+
ResetTimer();
|
|
59
|
+
|
|
60
|
+
if (finishVisualOnStart)
|
|
61
|
+
yield return WaitForChangeToComplete();
|
|
62
|
+
|
|
63
|
+
ResumeTimer();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/// <summary>
|
|
67
|
+
///
|
|
68
|
+
/// </summary>
|
|
69
|
+
public virtual void HideStop()
|
|
70
|
+
{
|
|
71
|
+
Hide();
|
|
72
|
+
|
|
73
|
+
StopTimer();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/// <summary>
|
|
77
|
+
///
|
|
78
|
+
/// </summary>
|
|
79
|
+
public virtual void DisplayRemainingTime()
|
|
80
|
+
{
|
|
81
|
+
CalculateTimerVariables();
|
|
82
|
+
|
|
83
|
+
SetTimerVisual();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/// <summary>
|
|
87
|
+
///
|
|
88
|
+
/// </summary>
|
|
89
|
+
protected abstract void SetTimerVisual();
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
/// <inheritdoc/>
|
|
93
|
+
public abstract void Show();
|
|
94
|
+
|
|
95
|
+
/// <inheritdoc/>
|
|
96
|
+
public abstract void Hide();
|
|
97
|
+
|
|
98
|
+
/// <inheritdoc/>
|
|
99
|
+
public abstract IEnumerator WaitForChangeToComplete();
|
|
100
|
+
|
|
101
|
+
/// <summary>
|
|
102
|
+
///
|
|
103
|
+
/// </summary>
|
|
104
|
+
/// <param name="timed"></param>
|
|
105
|
+
public virtual void Initialize(TimerDifficulty timed)
|
|
106
|
+
{
|
|
107
|
+
SetTimer(timed);
|
|
108
|
+
|
|
109
|
+
Show();
|
|
110
|
+
|
|
111
|
+
PauseTimer();
|
|
112
|
+
|
|
113
|
+
ResetTimer();
|
|
114
|
+
|
|
115
|
+
ResumeTimer();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/// <summary>
|
|
120
|
+
///
|
|
121
|
+
/// </summary>
|
|
122
|
+
[ContextMenu("Debug Start")]
|
|
123
|
+
public void DebugStart()
|
|
124
|
+
{
|
|
125
|
+
Show();
|
|
126
|
+
|
|
127
|
+
StartTimer(startTime);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
130
|
}
|