net.dreditor.minigames.ca 0.1.6 → 0.1.8
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/ArgumentBuilder.cs +80 -80
- package/ArgumentBuilder.cs.meta +11 -11
- package/ArgumentPage.cs +36 -36
- package/ArgumentPage.cs.meta +11 -11
- package/ArgumentQuestionPanel.cs +136 -136
- package/ArgumentQuestionPanel.cs.meta +11 -11
- package/ClosingArgumentSettings.cs +23 -23
- package/ClosingArgumentSettings.cs.meta +11 -11
- package/ClosingArgumentStockBase.cs +250 -250
- package/ClosingArgumentStockBase.cs.meta +11 -11
- package/DREditor.Minigames.CA.asmdef +24 -24
- package/DREditor.Minigames.CA.asmdef.meta +7 -7
- package/Editor/ArgumentBuilderEditor.cs +139 -139
- package/Editor/ArgumentBuilderEditor.cs.meta +12 -12
- package/Editor/ArgumentPageEditor.cs +283 -283
- package/Editor/ArgumentPageEditor.cs.meta +11 -11
- package/Editor/ArgumentPanelEditor.cs +141 -141
- package/Editor/ArgumentPanelEditor.cs.meta +11 -11
- package/Editor/ArgumentStockEditor.cs +167 -167
- package/Editor/ArgumentStockEditor.cs.meta +11 -11
- package/Editor/CAHandyFields.cs +32 -32
- package/Editor/CAHandyFields.cs.meta +1 -1
- package/Editor/DREditor.Minigames.CA.Editor.asmdef +20 -20
- package/Editor/DREditor.Minigames.CA.Editor.asmdef.meta +7 -7
- package/Editor/PreviewableArgumentBuilderEditor.cs +286 -286
- package/Editor/PreviewableArgumentBuilderEditor.cs.meta +12 -12
- package/Editor.meta +8 -8
- package/IActiveStockPanel.cs +36 -36
- package/IActiveStockPanel.cs.meta +11 -11
- package/IArgumentPreviewInitializer.cs +19 -19
- package/IArgumentPreviewInitializer.cs.meta +11 -11
- package/IClosingArgumentListener.cs +17 -17
- package/IClosingArgumentListener.cs.meta +11 -11
- package/IClosingArgumentPagePreviewer.cs +16 -16
- package/IClosingArgumentPagePreviewer.cs.meta +11 -11
- package/IClosingArgumentResetable.cs +15 -15
- package/IClosingArgumentResetable.cs.meta +11 -11
- package/ILockPreview.cs +16 -16
- package/ILockPreview.cs.meta +11 -11
- package/IPageListener.cs +17 -17
- package/IPageListener.cs.meta +11 -11
- package/IPagesInitializer.cs +17 -17
- package/IPagesInitializer.cs.meta +11 -11
- package/ITotalStockListener.cs +16 -16
- package/ITotalStockListener.cs.meta +11 -11
- package/Managers/ArgumentInitializerBase.cs +17 -17
- package/Managers/ArgumentInitializerBase.cs.meta +11 -11
- package/Managers/ClosingArgumentInitializer.cs +128 -128
- package/Managers/ClosingArgumentInitializer.cs.meta +10 -10
- package/Managers/ClosingArgumentManager.cs +269 -269
- package/Managers/ClosingArgumentManager.cs.meta +10 -10
- package/Managers/ClosingArgumentManagerBase.cs +146 -146
- package/Managers/ClosingArgumentManagerBase.cs.meta +11 -11
- package/Managers/ClosingArgumentPreviewInitializer.cs +80 -80
- package/Managers/ClosingArgumentPreviewInitializer.cs.meta +17 -17
- package/Managers.meta +8 -8
- package/Pages/IPageInitializer.cs +23 -23
- package/Pages/IPageInitializer.cs.meta +11 -11
- package/Pages/MainPagePreviewer.cs +66 -66
- package/Pages/MainPagePreviewer.cs.meta +11 -11
- package/Pages/MiniPageInitializer.cs +144 -144
- package/Pages/MiniPageInitializer.cs.meta +11 -11
- package/Pages/MoveMainPagesComponent.cs +163 -163
- package/Pages/MoveMainPagesComponent.cs.meta +11 -11
- package/Pages/MovePageComponent.cs +104 -104
- package/Pages/MovePageComponent.cs.meta +11 -11
- package/Pages/MovePageHandler.cs +215 -215
- package/Pages/MovePageHandler.cs.meta +11 -11
- package/Pages/PageArrows.cs +124 -124
- package/Pages/PageArrows.cs.meta +11 -11
- package/Pages/PageCounter.cs +65 -65
- package/Pages/PageCounter.cs.meta +11 -11
- package/Pages/PageHandlerBase.cs +30 -30
- package/Pages/PageHandlerBase.cs.meta +11 -11
- package/Pages/PageInitializer.cs +195 -195
- package/Pages/PageInitializer.cs.meta +11 -11
- package/Pages/PageInitializerBase.cs +65 -65
- package/Pages/PageInitializerBase.cs.meta +11 -11
- package/Pages/PagePreviewer.cs +57 -57
- package/Pages/PagePreviewer.cs.meta +11 -11
- package/Pages.meta +8 -8
- package/PanelInitializerBase.cs +147 -147
- package/PanelInitializerBase.cs.meta +11 -11
- package/Panels/ClosingArgumentReticle.cs +169 -169
- package/Panels/ClosingArgumentReticle.cs.meta +11 -11
- package/Panels/ClosingArgumentShooter.cs +153 -153
- package/Panels/ClosingArgumentShooter.cs.meta +11 -11
- package/Panels/CorrectMiniPanelUpdater.cs +45 -45
- package/Panels/CorrectMiniPanelUpdater.cs.meta +11 -11
- package/Panels/CorrectPanelUpdater.cs +24 -24
- package/Panels/CorrectPanelUpdater.cs.meta +11 -11
- package/Panels/PanelInitializer.cs +51 -51
- package/Panels/PanelInitializer.cs.meta +11 -11
- package/Panels/PreviewPanelInitializer.cs +58 -58
- package/Panels/PreviewPanelInitializer.cs.meta +11 -11
- package/Panels/QuestionPanel.cs +143 -143
- package/Panels/QuestionPanel.cs.meta +11 -11
- package/Panels/QuestionPanelBase.cs +68 -68
- package/Panels/QuestionPanelBase.cs.meta +11 -11
- package/Panels.meta +8 -8
- package/{Samples → Samples~}/CACameraEnabled.asset +21 -21
- package/{Samples → Samples~}/CACameraEnabled.asset.meta +8 -8
- package/{Samples → Samples~}/CAPanelTarget.asset +25 -25
- package/{Samples → Samples~}/CAPanelTarget.asset.meta +8 -8
- package/{Samples → Samples~}/CAResult.asset +21 -21
- package/{Samples → Samples~}/CAResult.asset.meta +8 -8
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Hidden Top.anim +600 -600
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Hidden Top.anim.meta +8 -8
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Hidden.anim +600 -600
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Hidden.anim.meta +8 -8
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Shown Top.anim +600 -600
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Shown Top.anim.meta +8 -8
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Shown.anim +582 -582
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Being Shown.anim.meta +8 -8
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Mystery Square.controller +188 -188
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square/Mystery Square.controller.meta +8 -8
- package/{Samples → Samples~}/CA_Animations/CA_Page_Square.meta +8 -8
- package/{Samples → Samples~}/CA_Animations.meta +8 -8
- package/{Samples → Samples~}/Managers/CA_Camera.prefab +159 -159
- package/{Samples → Samples~}/Managers/CA_Camera.prefab.meta +7 -7
- package/{Samples → Samples~}/Managers/CA_Camera_Canvas.prefab +195 -195
- package/{Samples → Samples~}/Managers/CA_Camera_Canvas.prefab.meta +7 -7
- package/{Samples → Samples~}/Managers/CA_Manager_Preview_Shell.prefab +267 -267
- package/{Samples → Samples~}/Managers/CA_Manager_Preview_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Managers/CA_Manager_Preview_Template.prefab +613 -613
- package/{Samples → Samples~}/Managers/CA_Manager_Preview_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Managers/CA_Manager_Shell.prefab +443 -443
- package/{Samples → Samples~}/Managers/CA_Manager_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Managers/CA_Manager_Template.prefab +709 -709
- package/{Samples → Samples~}/Managers/CA_Manager_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Managers/CA_Result_UI_ETemplate.prefab +433 -433
- package/{Samples → Samples~}/Managers/CA_Result_UI_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Managers.meta +8 -8
- package/{Samples → Samples~}/Pages/CA_Colliders.prefab +305 -305
- package/{Samples → Samples~}/Pages/CA_Colliders.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/CA_Main_Page_Arrows_ETemplate.prefab +221 -221
- package/{Samples → Samples~}/Pages/CA_Main_Page_Arrows_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/CA_Page_Gameplay_Shell.prefab +435 -435
- package/{Samples → Samples~}/Pages/CA_Page_Gameplay_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/CA_Page_Gameplay_Template.prefab +220 -220
- package/{Samples → Samples~}/Pages/CA_Page_Gameplay_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/CA_Reticle_ETemplate.prefab +337 -337
- package/{Samples → Samples~}/Pages/CA_Reticle_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/CA_Reticle_Shooter_Template.prefab +148 -148
- package/{Samples → Samples~}/Pages/CA_Reticle_Shooter_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/Mystery_Square_ETemplate.prefab +857 -857
- package/{Samples → Samples~}/Pages/Mystery_Square_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/Page_Add_Ons_ETemplate.prefab +203 -203
- package/{Samples → Samples~}/Pages/Page_Add_Ons_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages/Page_ETemplate.prefab +256 -256
- package/{Samples → Samples~}/Pages/Page_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Pages.meta +8 -8
- package/{Samples → Samples~}/Stocks/CA_Stock_Display_Shell.prefab +110 -110
- package/{Samples → Samples~}/Stocks/CA_Stock_Display_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Stocks/CA_Stock_Display_Template.prefab +731 -731
- package/{Samples → Samples~}/Stocks/CA_Stock_Display_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Stocks/CA_Stock_ETemplate.prefab +427 -427
- package/{Samples → Samples~}/Stocks/CA_Stock_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/Stocks/CA_Stock_Parent_Shell.prefab +61 -61
- package/{Samples → Samples~}/Stocks/CA_Stock_Parent_Shell.prefab.meta +7 -7
- package/{Samples → Samples~}/Stocks/CA_Stock_Parent_Template.prefab +1017 -1017
- package/{Samples → Samples~}/Stocks/CA_Stock_Parent_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/Stocks.meta +8 -8
- package/{Samples → Samples~}/UI/CA_Trial_Timer_Canvas_Template.prefab +229 -229
- package/{Samples → Samples~}/UI/CA_Trial_Timer_Canvas_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/UI/CA_UI_Background_ETemplate.prefab +86 -86
- package/{Samples → Samples~}/UI/CA_UI_Background_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/UI/CA_UI_Pages_Decorations_Template.prefab +109 -109
- package/{Samples → Samples~}/UI/CA_UI_Pages_Decorations_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/UI/CA_UI_Stock_Panel_ETemplate.prefab +464 -464
- package/{Samples → Samples~}/UI/CA_UI_Stock_Panel_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/UI/CA_UI_Template.prefab +261 -261
- package/{Samples → Samples~}/UI/CA_UI_Template.prefab.meta +7 -7
- package/{Samples → Samples~}/UI/Page_Counter_UI_ETemplate.prefab +831 -831
- package/{Samples → Samples~}/UI/Page_Counter_UI_ETemplate.prefab.meta +7 -7
- package/{Samples → Samples~}/UI.meta +8 -8
- package/Stocks/ActiveStockPanel.cs +177 -177
- package/Stocks/ActiveStockPanel.cs.meta +11 -11
- package/Stocks/ActiveStockPanelBase.cs +80 -80
- package/Stocks/ActiveStockPanelBase.cs.meta +11 -11
- package/Stocks/ActiveStockPanelStateable.cs +142 -142
- package/Stocks/ActiveStockPanelStateable.cs.meta +11 -11
- package/Stocks/ClosingArgumentStock.cs +120 -120
- package/Stocks/ClosingArgumentStock.cs.meta +11 -11
- package/Stocks/ShootCAStockVisibility.cs +133 -133
- package/Stocks/ShootCAStockVisibility.cs.meta +1 -1
- package/Stocks/StockParent.cs +127 -127
- package/Stocks/StockParent.cs.meta +11 -11
- package/Stocks.meta +8 -8
- package/package.json +46 -41
- package/package.json.meta +7 -7
- package/Samples.meta +0 -8
|
@@ -1,170 +1,170 @@
|
|
|
1
|
-
// Original Author: Henry (Meowpixel)
|
|
2
|
-
// Updated/Reworked by: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
3
|
-
using DREditor.EventObjects;
|
|
4
|
-
using DREditor.UIHandling.Reticles;
|
|
5
|
-
using System.Collections;
|
|
6
|
-
using System.Collections.Generic;
|
|
7
|
-
using UnityEngine;
|
|
8
|
-
using UnityEngine.Serialization;
|
|
9
|
-
|
|
10
|
-
namespace DREditor.Minigames.CA.Panels
|
|
11
|
-
{
|
|
12
|
-
/// <summary>
|
|
13
|
-
///
|
|
14
|
-
/// </summary>
|
|
15
|
-
[ClassHeader(nameof(HoverReticle) + ", " + nameof(Reticle) +
|
|
16
|
-
"\n\n")]
|
|
17
|
-
public class ClosingArgumentReticle : HoverReticle
|
|
18
|
-
{
|
|
19
|
-
/// <summary>
|
|
20
|
-
///
|
|
21
|
-
/// </summary>
|
|
22
|
-
[Header("")]
|
|
23
|
-
[Divider]
|
|
24
|
-
[FormerlySerializedAs("caInputAllowed")]
|
|
25
|
-
[Tooltip("")]
|
|
26
|
-
[SerializeField] protected BoolWithEvent inputAllowed = null;
|
|
27
|
-
|
|
28
|
-
/// <summary>
|
|
29
|
-
///
|
|
30
|
-
/// </summary>
|
|
31
|
-
[Tooltip("")]
|
|
32
|
-
[SerializeField] protected int bufferFrames = 5;
|
|
33
|
-
|
|
34
|
-
/// <summary>
|
|
35
|
-
///
|
|
36
|
-
/// </summary>
|
|
37
|
-
[Range(0, 1)]
|
|
38
|
-
[Tooltip("")]
|
|
39
|
-
[SerializeField] protected float dampenScaleFactor = 0.012f;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
///
|
|
44
|
-
/// </summary>
|
|
45
|
-
[Header("")]
|
|
46
|
-
[Divider]
|
|
47
|
-
[Tooltip("")]
|
|
48
|
-
[SerializeField] protected Rigidbody2D rigidBody = null;
|
|
49
|
-
|
|
50
|
-
/// <summary>
|
|
51
|
-
///
|
|
52
|
-
/// </summary>
|
|
53
|
-
[Tooltip("")]
|
|
54
|
-
[SerializeField] protected List<Collider2D> currentColliders = new();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/// <summary>
|
|
58
|
-
///
|
|
59
|
-
/// </summary>
|
|
60
|
-
protected Coroutine enterCoroutine = null;
|
|
61
|
-
|
|
62
|
-
/// <summary>
|
|
63
|
-
///
|
|
64
|
-
/// </summary>
|
|
65
|
-
protected Coroutine exitCoroutine = null;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
protected virtual void OnEnable() => inputAllowed.AddListener(OnInputUpdated);
|
|
69
|
-
|
|
70
|
-
protected virtual void OnDisable() => inputAllowed.RemoveListener(OnInputUpdated);
|
|
71
|
-
|
|
72
|
-
/// <summary>
|
|
73
|
-
///
|
|
74
|
-
/// </summary>
|
|
75
|
-
/// <param name="canInput"></param>
|
|
76
|
-
protected virtual void OnInputUpdated(bool canInput) => SetLock(!canInput);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/// <inheritdoc/>
|
|
80
|
-
protected override void Start()
|
|
81
|
-
{
|
|
82
|
-
base.Start();
|
|
83
|
-
|
|
84
|
-
rigidBody = GetComponent<Rigidbody2D>();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
protected virtual void OnTriggerEnter2D(Collider2D collision)
|
|
89
|
-
{
|
|
90
|
-
currentColliders.Add(collision);
|
|
91
|
-
|
|
92
|
-
if (enterCoroutine != null)
|
|
93
|
-
StopCoroutine(enterCoroutine);
|
|
94
|
-
|
|
95
|
-
enterCoroutine = StartCoroutine(CheckEnter(collision));
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/// <summary>
|
|
99
|
-
///
|
|
100
|
-
/// </summary>
|
|
101
|
-
/// <param name="collision"></param>
|
|
102
|
-
protected virtual IEnumerator CheckEnter(Collider2D collision)
|
|
103
|
-
{
|
|
104
|
-
yield return new WaitForSeconds(Time.deltaTime * bufferFrames);
|
|
105
|
-
|
|
106
|
-
if (!locked)
|
|
107
|
-
{
|
|
108
|
-
QuestionPanelBase foundQuestion = collision.gameObject.GetComponent<QuestionPanelBase>();
|
|
109
|
-
|
|
110
|
-
object foundPanel = foundQuestion;
|
|
111
|
-
|
|
112
|
-
if (foundPanel != null && foundPanel != hoveredObject)
|
|
113
|
-
HoverObject(foundQuestion.transform, foundQuestion);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
protected virtual void OnTriggerExit2D(Collider2D collision)
|
|
119
|
-
{
|
|
120
|
-
currentColliders.Remove(collision);
|
|
121
|
-
|
|
122
|
-
if (exitCoroutine != null)
|
|
123
|
-
StopCoroutine(exitCoroutine);
|
|
124
|
-
|
|
125
|
-
exitCoroutine = StartCoroutine(CheckExit());
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/// <summary>
|
|
129
|
-
///
|
|
130
|
-
/// </summary>
|
|
131
|
-
protected virtual IEnumerator CheckExit()
|
|
132
|
-
{
|
|
133
|
-
yield return new WaitForSeconds(Time.deltaTime * bufferFrames);
|
|
134
|
-
|
|
135
|
-
if (currentColliders.Count == 0)
|
|
136
|
-
StopHoveringObject();
|
|
137
|
-
else
|
|
138
|
-
HoverObject(currentColliders[0].transform,
|
|
139
|
-
currentColliders[0].gameObject.GetComponent<QuestionPanelBase>());
|
|
140
|
-
//For above,
|
|
141
|
-
//if it's colliding with two at the same time and leaving the collision of one.
|
|
142
|
-
//Otherwise the selection would be wrongly set to null.
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
/// <inheritdoc/>
|
|
147
|
-
protected override Vector3 GrabMovement() => base.GrabMovement() * dampenScaleFactor;
|
|
148
|
-
|
|
149
|
-
/// <inheritdoc/>
|
|
150
|
-
protected override void ApplyCalculatedMovement(Vector3 calculatedMovement)
|
|
151
|
-
{
|
|
152
|
-
if (rigidBody != null)
|
|
153
|
-
rigidBody.MovePosition(rigidBody.position + (Vector2)calculatedMovement);
|
|
154
|
-
else
|
|
155
|
-
base.ApplyCalculatedMovement(calculatedMovement);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/// <summary>
|
|
159
|
-
///
|
|
160
|
-
/// </summary>
|
|
161
|
-
/// <param name="to"></param>
|
|
162
|
-
public override void SetLock(bool to)
|
|
163
|
-
{
|
|
164
|
-
base.SetLock(to);
|
|
165
|
-
|
|
166
|
-
if (!locked)
|
|
167
|
-
gameObject.GetComponent<BoxCollider2D>().enabled = !to;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
1
|
+
// Original Author: Henry (Meowpixel)
|
|
2
|
+
// Updated/Reworked by: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
3
|
+
using DREditor.EventObjects;
|
|
4
|
+
using DREditor.UIHandling.Reticles;
|
|
5
|
+
using System.Collections;
|
|
6
|
+
using System.Collections.Generic;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
using UnityEngine.Serialization;
|
|
9
|
+
|
|
10
|
+
namespace DREditor.Minigames.CA.Panels
|
|
11
|
+
{
|
|
12
|
+
/// <summary>
|
|
13
|
+
///
|
|
14
|
+
/// </summary>
|
|
15
|
+
[ClassHeader(nameof(HoverReticle) + ", " + nameof(Reticle) +
|
|
16
|
+
"\n\n")]
|
|
17
|
+
public class ClosingArgumentReticle : HoverReticle
|
|
18
|
+
{
|
|
19
|
+
/// <summary>
|
|
20
|
+
///
|
|
21
|
+
/// </summary>
|
|
22
|
+
[Header("")]
|
|
23
|
+
[Divider]
|
|
24
|
+
[FormerlySerializedAs("caInputAllowed")]
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected BoolWithEvent inputAllowed = null;
|
|
27
|
+
|
|
28
|
+
/// <summary>
|
|
29
|
+
///
|
|
30
|
+
/// </summary>
|
|
31
|
+
[Tooltip("")]
|
|
32
|
+
[SerializeField] protected int bufferFrames = 5;
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
///
|
|
36
|
+
/// </summary>
|
|
37
|
+
[Range(0, 1)]
|
|
38
|
+
[Tooltip("")]
|
|
39
|
+
[SerializeField] protected float dampenScaleFactor = 0.012f;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
///
|
|
44
|
+
/// </summary>
|
|
45
|
+
[Header("")]
|
|
46
|
+
[Divider]
|
|
47
|
+
[Tooltip("")]
|
|
48
|
+
[SerializeField] protected Rigidbody2D rigidBody = null;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
///
|
|
52
|
+
/// </summary>
|
|
53
|
+
[Tooltip("")]
|
|
54
|
+
[SerializeField] protected List<Collider2D> currentColliders = new();
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
///
|
|
59
|
+
/// </summary>
|
|
60
|
+
protected Coroutine enterCoroutine = null;
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
///
|
|
64
|
+
/// </summary>
|
|
65
|
+
protected Coroutine exitCoroutine = null;
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
protected virtual void OnEnable() => inputAllowed.AddListener(OnInputUpdated);
|
|
69
|
+
|
|
70
|
+
protected virtual void OnDisable() => inputAllowed.RemoveListener(OnInputUpdated);
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
///
|
|
74
|
+
/// </summary>
|
|
75
|
+
/// <param name="canInput"></param>
|
|
76
|
+
protected virtual void OnInputUpdated(bool canInput) => SetLock(!canInput);
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
/// <inheritdoc/>
|
|
80
|
+
protected override void Start()
|
|
81
|
+
{
|
|
82
|
+
base.Start();
|
|
83
|
+
|
|
84
|
+
rigidBody = GetComponent<Rigidbody2D>();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
protected virtual void OnTriggerEnter2D(Collider2D collision)
|
|
89
|
+
{
|
|
90
|
+
currentColliders.Add(collision);
|
|
91
|
+
|
|
92
|
+
if (enterCoroutine != null)
|
|
93
|
+
StopCoroutine(enterCoroutine);
|
|
94
|
+
|
|
95
|
+
enterCoroutine = StartCoroutine(CheckEnter(collision));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// <summary>
|
|
99
|
+
///
|
|
100
|
+
/// </summary>
|
|
101
|
+
/// <param name="collision"></param>
|
|
102
|
+
protected virtual IEnumerator CheckEnter(Collider2D collision)
|
|
103
|
+
{
|
|
104
|
+
yield return new WaitForSeconds(Time.deltaTime * bufferFrames);
|
|
105
|
+
|
|
106
|
+
if (!locked)
|
|
107
|
+
{
|
|
108
|
+
QuestionPanelBase foundQuestion = collision.gameObject.GetComponent<QuestionPanelBase>();
|
|
109
|
+
|
|
110
|
+
object foundPanel = foundQuestion;
|
|
111
|
+
|
|
112
|
+
if (foundPanel != null && foundPanel != hoveredObject)
|
|
113
|
+
HoverObject(foundQuestion.transform, foundQuestion);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
protected virtual void OnTriggerExit2D(Collider2D collision)
|
|
119
|
+
{
|
|
120
|
+
currentColliders.Remove(collision);
|
|
121
|
+
|
|
122
|
+
if (exitCoroutine != null)
|
|
123
|
+
StopCoroutine(exitCoroutine);
|
|
124
|
+
|
|
125
|
+
exitCoroutine = StartCoroutine(CheckExit());
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/// <summary>
|
|
129
|
+
///
|
|
130
|
+
/// </summary>
|
|
131
|
+
protected virtual IEnumerator CheckExit()
|
|
132
|
+
{
|
|
133
|
+
yield return new WaitForSeconds(Time.deltaTime * bufferFrames);
|
|
134
|
+
|
|
135
|
+
if (currentColliders.Count == 0)
|
|
136
|
+
StopHoveringObject();
|
|
137
|
+
else
|
|
138
|
+
HoverObject(currentColliders[0].transform,
|
|
139
|
+
currentColliders[0].gameObject.GetComponent<QuestionPanelBase>());
|
|
140
|
+
//For above,
|
|
141
|
+
//if it's colliding with two at the same time and leaving the collision of one.
|
|
142
|
+
//Otherwise the selection would be wrongly set to null.
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
/// <inheritdoc/>
|
|
147
|
+
protected override Vector3 GrabMovement() => base.GrabMovement() * dampenScaleFactor;
|
|
148
|
+
|
|
149
|
+
/// <inheritdoc/>
|
|
150
|
+
protected override void ApplyCalculatedMovement(Vector3 calculatedMovement)
|
|
151
|
+
{
|
|
152
|
+
if (rigidBody != null)
|
|
153
|
+
rigidBody.MovePosition(rigidBody.position + (Vector2)calculatedMovement);
|
|
154
|
+
else
|
|
155
|
+
base.ApplyCalculatedMovement(calculatedMovement);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/// <summary>
|
|
159
|
+
///
|
|
160
|
+
/// </summary>
|
|
161
|
+
/// <param name="to"></param>
|
|
162
|
+
public override void SetLock(bool to)
|
|
163
|
+
{
|
|
164
|
+
base.SetLock(to);
|
|
165
|
+
|
|
166
|
+
if (!locked)
|
|
167
|
+
gameObject.GetComponent<BoxCollider2D>().enabled = !to;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
170
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 0d6771b3bb2bf8b4e8d08d26660a2037
|
|
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: 0d6771b3bb2bf8b4e8d08d26660a2037
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
// Original Author: Henry (Meowpixel)
|
|
2
|
-
// Updated/Reworked by: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
3
|
-
using DREditor.EventObjects;
|
|
4
|
-
using DREditor.UIHandling.Reticles;
|
|
5
|
-
using System.Collections;
|
|
6
|
-
using System.Linq;
|
|
7
|
-
using UnityEngine;
|
|
8
|
-
using UnityEngine.Events;
|
|
9
|
-
using UnityEngine.InputSystem;
|
|
10
|
-
|
|
11
|
-
namespace DREditor.Minigames.CA.Panels
|
|
12
|
-
{
|
|
13
|
-
/// <summary>
|
|
14
|
-
///
|
|
15
|
-
/// </summary>
|
|
16
|
-
[ClassHeader(nameof(ControlledComponent) + ", " + nameof(IClosingArgumentResetable) +
|
|
17
|
-
"\n\n")]
|
|
18
|
-
public class ClosingArgumentShooter : ControlledComponent, IClosingArgumentResetable
|
|
19
|
-
{
|
|
20
|
-
/// <summary>
|
|
21
|
-
///
|
|
22
|
-
/// </summary>
|
|
23
|
-
[Tooltip("")]
|
|
24
|
-
[SerializeField] protected InputActionReference choose = null;
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
///
|
|
28
|
-
/// </summary>
|
|
29
|
-
[Tooltip("")]
|
|
30
|
-
[SerializeField] protected TransformWithEvent caPanelTarget = null;
|
|
31
|
-
|
|
32
|
-
/// <summary>
|
|
33
|
-
///
|
|
34
|
-
/// </summary>
|
|
35
|
-
[Tooltip("")]
|
|
36
|
-
[SerializeField] protected BoolWithEvent caResult = null;
|
|
37
|
-
|
|
38
|
-
/// <summary>
|
|
39
|
-
///
|
|
40
|
-
/// </summary>
|
|
41
|
-
[Tooltip("")]
|
|
42
|
-
[SerializeField] protected HoverReticle reticle = null;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
[Header("")]
|
|
46
|
-
[SerializeField] protected UnityEvent OnStockFly = null;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/// <summary>
|
|
50
|
-
///
|
|
51
|
-
/// </summary>
|
|
52
|
-
protected IActiveStockPanel activeStockPanel;
|
|
53
|
-
|
|
54
|
-
/// <summary>
|
|
55
|
-
///
|
|
56
|
-
/// </summary>
|
|
57
|
-
protected IClosingArgumentListener[] argumentListeners;
|
|
58
|
-
|
|
59
|
-
/// <summary>
|
|
60
|
-
///
|
|
61
|
-
/// </summary>
|
|
62
|
-
protected QuestionPanelBase hoveredPanel;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
/// <inheritdoc/>
|
|
66
|
-
public override void ActivateControls()
|
|
67
|
-
=> choose.action.performed += EvaluateSelectedStock;
|
|
68
|
-
|
|
69
|
-
/// <inheritdoc/>
|
|
70
|
-
public override void DeactivateControls()
|
|
71
|
-
=> choose.action.performed -= EvaluateSelectedStock;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
/// <summary>
|
|
75
|
-
///
|
|
76
|
-
/// </summary>
|
|
77
|
-
/// <param name="context"></param>
|
|
78
|
-
protected virtual void EvaluateSelectedStock(InputAction.CallbackContext context)
|
|
79
|
-
{
|
|
80
|
-
hoveredPanel = reticle.GetHoveredObject<QuestionPanelBase>();
|
|
81
|
-
|
|
82
|
-
if (!(hoveredPanel != null && context.performed))
|
|
83
|
-
return;
|
|
84
|
-
|
|
85
|
-
activeStockPanel ??= transform.root.GetComponentInChildren<IActiveStockPanel>();
|
|
86
|
-
|
|
87
|
-
if (!activeStockPanel.CurrentStockSelectable())
|
|
88
|
-
return;
|
|
89
|
-
|
|
90
|
-
argumentListeners ??= FindObjectsByType<MonoBehaviour>().OfType<IClosingArgumentListener>().ToArray();
|
|
91
|
-
|
|
92
|
-
OnStockFly?.Invoke();
|
|
93
|
-
|
|
94
|
-
DisableInput();
|
|
95
|
-
|
|
96
|
-
StartCoroutine(ShootPanelRoutine());
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/// <summary>
|
|
100
|
-
///
|
|
101
|
-
/// </summary>
|
|
102
|
-
protected virtual IEnumerator ShootPanelRoutine()
|
|
103
|
-
{
|
|
104
|
-
SetPanelTargetPosition();
|
|
105
|
-
|
|
106
|
-
yield return ShootStockAnimation();
|
|
107
|
-
|
|
108
|
-
ProcessPanelShot();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/// <summary>
|
|
112
|
-
///
|
|
113
|
-
/// </summary>
|
|
114
|
-
protected virtual void SetPanelTargetPosition()
|
|
115
|
-
{
|
|
116
|
-
Transform hoveredPanelTransform = hoveredPanel.transform;
|
|
117
|
-
|
|
118
|
-
caPanelTarget.SetValue(new(hoveredPanelTransform.position, Quaternion.identity));
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/// <summary>
|
|
122
|
-
///
|
|
123
|
-
/// </summary>
|
|
124
|
-
protected virtual IEnumerator ShootStockAnimation() => activeStockPanel.ShootStock();
|
|
125
|
-
|
|
126
|
-
/// <summary>
|
|
127
|
-
///
|
|
128
|
-
/// </summary>
|
|
129
|
-
protected virtual void ProcessPanelShot()
|
|
130
|
-
{
|
|
131
|
-
bool result = ShotStockResult();
|
|
132
|
-
|
|
133
|
-
if (caResult.Value != result)
|
|
134
|
-
caResult.SetValue(result);
|
|
135
|
-
else
|
|
136
|
-
caResult.Invoke();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/// <summary>
|
|
140
|
-
///
|
|
141
|
-
/// </summary>
|
|
142
|
-
/// <returns></returns>
|
|
143
|
-
protected virtual bool ShotStockResult()
|
|
144
|
-
{
|
|
145
|
-
Transform hoveredStockTransform = hoveredPanel.GetStockTransform();
|
|
146
|
-
|
|
147
|
-
return activeStockPanel.CurrentStockMatches(hoveredStockTransform);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/// <inheritdoc/>
|
|
152
|
-
public virtual void CAReset() => argumentListeners = null;
|
|
153
|
-
}
|
|
1
|
+
// Original Author: Henry (Meowpixel)
|
|
2
|
+
// Updated/Reworked by: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
3
|
+
using DREditor.EventObjects;
|
|
4
|
+
using DREditor.UIHandling.Reticles;
|
|
5
|
+
using System.Collections;
|
|
6
|
+
using System.Linq;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
using UnityEngine.Events;
|
|
9
|
+
using UnityEngine.InputSystem;
|
|
10
|
+
|
|
11
|
+
namespace DREditor.Minigames.CA.Panels
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
///
|
|
15
|
+
/// </summary>
|
|
16
|
+
[ClassHeader(nameof(ControlledComponent) + ", " + nameof(IClosingArgumentResetable) +
|
|
17
|
+
"\n\n")]
|
|
18
|
+
public class ClosingArgumentShooter : ControlledComponent, IClosingArgumentResetable
|
|
19
|
+
{
|
|
20
|
+
/// <summary>
|
|
21
|
+
///
|
|
22
|
+
/// </summary>
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected InputActionReference choose = null;
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
[Tooltip("")]
|
|
30
|
+
[SerializeField] protected TransformWithEvent caPanelTarget = null;
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
[Tooltip("")]
|
|
36
|
+
[SerializeField] protected BoolWithEvent caResult = null;
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
[Tooltip("")]
|
|
42
|
+
[SerializeField] protected HoverReticle reticle = null;
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
[Header("")]
|
|
46
|
+
[SerializeField] protected UnityEvent OnStockFly = null;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
protected IActiveStockPanel activeStockPanel;
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
///
|
|
56
|
+
/// </summary>
|
|
57
|
+
protected IClosingArgumentListener[] argumentListeners;
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
///
|
|
61
|
+
/// </summary>
|
|
62
|
+
protected QuestionPanelBase hoveredPanel;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/// <inheritdoc/>
|
|
66
|
+
public override void ActivateControls()
|
|
67
|
+
=> choose.action.performed += EvaluateSelectedStock;
|
|
68
|
+
|
|
69
|
+
/// <inheritdoc/>
|
|
70
|
+
public override void DeactivateControls()
|
|
71
|
+
=> choose.action.performed -= EvaluateSelectedStock;
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/// <summary>
|
|
75
|
+
///
|
|
76
|
+
/// </summary>
|
|
77
|
+
/// <param name="context"></param>
|
|
78
|
+
protected virtual void EvaluateSelectedStock(InputAction.CallbackContext context)
|
|
79
|
+
{
|
|
80
|
+
hoveredPanel = reticle.GetHoveredObject<QuestionPanelBase>();
|
|
81
|
+
|
|
82
|
+
if (!(hoveredPanel != null && context.performed))
|
|
83
|
+
return;
|
|
84
|
+
|
|
85
|
+
activeStockPanel ??= transform.root.GetComponentInChildren<IActiveStockPanel>();
|
|
86
|
+
|
|
87
|
+
if (!activeStockPanel.CurrentStockSelectable())
|
|
88
|
+
return;
|
|
89
|
+
|
|
90
|
+
argumentListeners ??= FindObjectsByType<MonoBehaviour>().OfType<IClosingArgumentListener>().ToArray();
|
|
91
|
+
|
|
92
|
+
OnStockFly?.Invoke();
|
|
93
|
+
|
|
94
|
+
DisableInput();
|
|
95
|
+
|
|
96
|
+
StartCoroutine(ShootPanelRoutine());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// <summary>
|
|
100
|
+
///
|
|
101
|
+
/// </summary>
|
|
102
|
+
protected virtual IEnumerator ShootPanelRoutine()
|
|
103
|
+
{
|
|
104
|
+
SetPanelTargetPosition();
|
|
105
|
+
|
|
106
|
+
yield return ShootStockAnimation();
|
|
107
|
+
|
|
108
|
+
ProcessPanelShot();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/// <summary>
|
|
112
|
+
///
|
|
113
|
+
/// </summary>
|
|
114
|
+
protected virtual void SetPanelTargetPosition()
|
|
115
|
+
{
|
|
116
|
+
Transform hoveredPanelTransform = hoveredPanel.transform;
|
|
117
|
+
|
|
118
|
+
caPanelTarget.SetValue(new(hoveredPanelTransform.position, Quaternion.identity));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/// <summary>
|
|
122
|
+
///
|
|
123
|
+
/// </summary>
|
|
124
|
+
protected virtual IEnumerator ShootStockAnimation() => activeStockPanel.ShootStock();
|
|
125
|
+
|
|
126
|
+
/// <summary>
|
|
127
|
+
///
|
|
128
|
+
/// </summary>
|
|
129
|
+
protected virtual void ProcessPanelShot()
|
|
130
|
+
{
|
|
131
|
+
bool result = ShotStockResult();
|
|
132
|
+
|
|
133
|
+
if (caResult.Value != result)
|
|
134
|
+
caResult.SetValue(result);
|
|
135
|
+
else
|
|
136
|
+
caResult.Invoke();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/// <summary>
|
|
140
|
+
///
|
|
141
|
+
/// </summary>
|
|
142
|
+
/// <returns></returns>
|
|
143
|
+
protected virtual bool ShotStockResult()
|
|
144
|
+
{
|
|
145
|
+
Transform hoveredStockTransform = hoveredPanel.GetStockTransform();
|
|
146
|
+
|
|
147
|
+
return activeStockPanel.CurrentStockMatches(hoveredStockTransform);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
/// <inheritdoc/>
|
|
152
|
+
public virtual void CAReset() => argumentListeners = null;
|
|
153
|
+
}
|
|
154
154
|
}
|