net.dreditor.eventobjectservices 0.1.4 → 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/BoolWithEventOnTitleScreen.cs +10 -0
- package/BoolWithEventOnTitleScreen.cs.meta +11 -0
- package/DREditor.EventObjectServices.asmdef +17 -0
- package/DREditor.EventObjectServices.asmdef.meta +7 -0
- package/EvaluateCamerasStates.cs +103 -0
- package/EvaluateCamerasStates.cs.meta +11 -0
- package/FloatWithEventListener.cs +10 -0
- package/FloatWithEventListener.cs.meta +11 -0
- package/FloatWithEventOnTitleScreen.cs +10 -0
- package/FloatWithEventOnTitleScreen.cs.meta +11 -0
- package/IntWithEventIndexListener.cs +25 -0
- package/IntWithEventIndexListener.cs.meta +11 -0
- package/IntWithEventListener.cs +10 -0
- package/IntWithEventListener.cs.meta +11 -0
- package/IntWithEventOnTitleScreen.cs +10 -0
- package/IntWithEventOnTitleScreen.cs.meta +11 -0
- package/InverseObjectStateBoolWithEvent.cs +50 -0
- package/InverseObjectStateBoolWithEvent.cs.meta +11 -0
- package/ObjectActiveOnChapterIndex.cs +84 -0
- package/ObjectActiveOnChapterIndex.cs.meta +11 -0
- package/ObjectNameDisplayer.cs +47 -0
- package/ObjectNameDisplayer.cs.meta +11 -0
- package/OptionWithEventListener.cs +57 -0
- package/OptionWithEventListener.cs.meta +11 -0
- package/ResetCharacterControllerOnEvent.cs +47 -0
- package/ResetCharacterControllerOnEvent.cs.meta +11 -0
- package/Samples~/Float_With_Event_On_Title_Screen.prefab +48 -0
- package/{package.json.meta → Samples~/Float_With_Event_On_Title_Screen.prefab.meta} +2 -2
- package/Samples~/Int_With_Event_On_Title_Screen.prefab +48 -0
- package/Samples~/Int_With_Event_On_Title_Screen.prefab.meta +7 -0
- package/Samples~/Reset_Player.prefab +118 -0
- package/Samples~/Reset_Player.prefab.meta +7 -0
- package/Samples~/Selectable_Object_Manager.prefab +49 -0
- package/Samples~/Selectable_Object_Manager.prefab.meta +7 -0
- package/SceneEventOnStart.cs +27 -0
- package/SceneEventOnStart.cs.meta +11 -0
- package/SelectStringWithEvent.cs +44 -0
- package/SelectStringWithEvent.cs.meta +11 -0
- package/SelectableObjectManager.cs +45 -0
- package/SelectableObjectManager.cs.meta +11 -0
- package/SpriteOnIntEvent.cs +68 -0
- package/SpriteOnIntEvent.cs.meta +11 -0
- package/StringWithEventListener.cs +10 -0
- package/StringWithEventListener.cs.meta +11 -0
- package/TextWithEventListener.cs +46 -0
- package/TextWithEventListener.cs.meta +11 -0
- package/ValueWithEventListener.cs +60 -0
- package/ValueWithEventListener.cs.meta +11 -0
- package/ValueWithEventOnTitleScreen.cs +37 -0
- package/ValueWithEventOnTitleScreen.cs.meta +11 -0
- package/package.json +15 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!1 &6218484912143513166
|
|
4
|
+
GameObject:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
serializedVersion: 6
|
|
10
|
+
m_Component:
|
|
11
|
+
- component: {fileID: 3198786556347803580}
|
|
12
|
+
- component: {fileID: 7378750083384516191}
|
|
13
|
+
m_Layer: 0
|
|
14
|
+
m_Name: Float_With_Event_On_Title_Screen
|
|
15
|
+
m_TagString: Untagged
|
|
16
|
+
m_Icon: {fileID: 0}
|
|
17
|
+
m_NavMeshLayer: 0
|
|
18
|
+
m_StaticEditorFlags: 0
|
|
19
|
+
m_IsActive: 1
|
|
20
|
+
--- !u!4 &3198786556347803580
|
|
21
|
+
Transform:
|
|
22
|
+
m_ObjectHideFlags: 0
|
|
23
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
24
|
+
m_PrefabInstance: {fileID: 0}
|
|
25
|
+
m_PrefabAsset: {fileID: 0}
|
|
26
|
+
m_GameObject: {fileID: 6218484912143513166}
|
|
27
|
+
serializedVersion: 2
|
|
28
|
+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
29
|
+
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
30
|
+
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
31
|
+
m_ConstrainProportionsScale: 0
|
|
32
|
+
m_Children: []
|
|
33
|
+
m_Father: {fileID: 0}
|
|
34
|
+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
35
|
+
--- !u!114 &7378750083384516191
|
|
36
|
+
MonoBehaviour:
|
|
37
|
+
m_ObjectHideFlags: 0
|
|
38
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
39
|
+
m_PrefabInstance: {fileID: 0}
|
|
40
|
+
m_PrefabAsset: {fileID: 0}
|
|
41
|
+
m_GameObject: {fileID: 6218484912143513166}
|
|
42
|
+
m_Enabled: 1
|
|
43
|
+
m_EditorHideFlags: 0
|
|
44
|
+
m_Script: {fileID: 11500000, guid: 164f5339acd8f69479293b15d23255e3, type: 3}
|
|
45
|
+
m_Name:
|
|
46
|
+
m_EditorClassIdentifier:
|
|
47
|
+
valueWithEvent: {fileID: 0}
|
|
48
|
+
valueOnTitleScreen: 0
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!1 &6004071304089541848
|
|
4
|
+
GameObject:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
serializedVersion: 6
|
|
10
|
+
m_Component:
|
|
11
|
+
- component: {fileID: 6484371101614218494}
|
|
12
|
+
- component: {fileID: 138012809352553554}
|
|
13
|
+
m_Layer: 0
|
|
14
|
+
m_Name: Int_With_Event_On_Title_Screen
|
|
15
|
+
m_TagString: Untagged
|
|
16
|
+
m_Icon: {fileID: 0}
|
|
17
|
+
m_NavMeshLayer: 0
|
|
18
|
+
m_StaticEditorFlags: 0
|
|
19
|
+
m_IsActive: 1
|
|
20
|
+
--- !u!4 &6484371101614218494
|
|
21
|
+
Transform:
|
|
22
|
+
m_ObjectHideFlags: 0
|
|
23
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
24
|
+
m_PrefabInstance: {fileID: 0}
|
|
25
|
+
m_PrefabAsset: {fileID: 0}
|
|
26
|
+
m_GameObject: {fileID: 6004071304089541848}
|
|
27
|
+
serializedVersion: 2
|
|
28
|
+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
29
|
+
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
30
|
+
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
31
|
+
m_ConstrainProportionsScale: 0
|
|
32
|
+
m_Children: []
|
|
33
|
+
m_Father: {fileID: 0}
|
|
34
|
+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
35
|
+
--- !u!114 &138012809352553554
|
|
36
|
+
MonoBehaviour:
|
|
37
|
+
m_ObjectHideFlags: 0
|
|
38
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
39
|
+
m_PrefabInstance: {fileID: 0}
|
|
40
|
+
m_PrefabAsset: {fileID: 0}
|
|
41
|
+
m_GameObject: {fileID: 6004071304089541848}
|
|
42
|
+
m_Enabled: 1
|
|
43
|
+
m_EditorHideFlags: 0
|
|
44
|
+
m_Script: {fileID: 11500000, guid: 5bc71ee10345ccc4298cc09d582eab08, type: 3}
|
|
45
|
+
m_Name:
|
|
46
|
+
m_EditorClassIdentifier:
|
|
47
|
+
valueWithEvent: {fileID: 0}
|
|
48
|
+
valueOnTitleScreen: 0
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!1 &3989816913283648452
|
|
4
|
+
GameObject:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
serializedVersion: 6
|
|
10
|
+
m_Component:
|
|
11
|
+
- component: {fileID: 3989816913283648453}
|
|
12
|
+
- component: {fileID: 4986489640994252236}
|
|
13
|
+
- component: {fileID: 6022949670910768861}
|
|
14
|
+
- component: {fileID: 387974391978806701}
|
|
15
|
+
m_Layer: 0
|
|
16
|
+
m_Name: Reset_Player
|
|
17
|
+
m_TagString: Untagged
|
|
18
|
+
m_Icon: {fileID: 0}
|
|
19
|
+
m_NavMeshLayer: 0
|
|
20
|
+
m_StaticEditorFlags: 0
|
|
21
|
+
m_IsActive: 1
|
|
22
|
+
--- !u!4 &3989816913283648453
|
|
23
|
+
Transform:
|
|
24
|
+
m_ObjectHideFlags: 0
|
|
25
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
26
|
+
m_PrefabInstance: {fileID: 0}
|
|
27
|
+
m_PrefabAsset: {fileID: 0}
|
|
28
|
+
m_GameObject: {fileID: 3989816913283648452}
|
|
29
|
+
serializedVersion: 2
|
|
30
|
+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
31
|
+
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
32
|
+
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
33
|
+
m_ConstrainProportionsScale: 0
|
|
34
|
+
m_Children: []
|
|
35
|
+
m_Father: {fileID: 0}
|
|
36
|
+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
37
|
+
--- !u!114 &4986489640994252236
|
|
38
|
+
MonoBehaviour:
|
|
39
|
+
m_ObjectHideFlags: 0
|
|
40
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
41
|
+
m_PrefabInstance: {fileID: 0}
|
|
42
|
+
m_PrefabAsset: {fileID: 0}
|
|
43
|
+
m_GameObject: {fileID: 3989816913283648452}
|
|
44
|
+
m_Enabled: 1
|
|
45
|
+
m_EditorHideFlags: 0
|
|
46
|
+
m_Script: {fileID: 11500000, guid: 14aceeafb0d4613429e0fb471fe4f4fa, type: 3}
|
|
47
|
+
m_Name:
|
|
48
|
+
m_EditorClassIdentifier:
|
|
49
|
+
sceneEvent: {fileID: 11400000, guid: 3dfdfd6fc50605441abedd812cd9a678, type: 2}
|
|
50
|
+
--- !u!114 &6022949670910768861
|
|
51
|
+
MonoBehaviour:
|
|
52
|
+
m_ObjectHideFlags: 0
|
|
53
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
54
|
+
m_PrefabInstance: {fileID: 0}
|
|
55
|
+
m_PrefabAsset: {fileID: 0}
|
|
56
|
+
m_GameObject: {fileID: 3989816913283648452}
|
|
57
|
+
m_Enabled: 1
|
|
58
|
+
m_EditorHideFlags: 0
|
|
59
|
+
m_Script: {fileID: 11500000, guid: 9122f094a109f78448db952c36a264a9, type: 3}
|
|
60
|
+
m_Name:
|
|
61
|
+
m_EditorClassIdentifier:
|
|
62
|
+
Event: {fileID: 11400000, guid: 3dfdfd6fc50605441abedd812cd9a678, type: 2}
|
|
63
|
+
Response:
|
|
64
|
+
m_PersistentCalls:
|
|
65
|
+
m_Calls:
|
|
66
|
+
- m_Target: {fileID: 11400000, guid: 884056a6fa9114243a754619cf72ee9d, type: 2}
|
|
67
|
+
m_TargetAssemblyTypeName: DREditor.EventObjects.ValueWithEvent`2[[System.Boolean,
|
|
68
|
+
mscorlib
|
|
69
|
+
m_MethodName: SetValue
|
|
70
|
+
m_Mode: 6
|
|
71
|
+
m_Arguments:
|
|
72
|
+
m_ObjectArgument: {fileID: 0}
|
|
73
|
+
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
|
74
|
+
m_IntArgument: 0
|
|
75
|
+
m_FloatArgument: 0
|
|
76
|
+
m_StringArgument:
|
|
77
|
+
m_BoolArgument: 1
|
|
78
|
+
m_CallState: 2
|
|
79
|
+
- m_Target: {fileID: 11400000, guid: ecf132a66f959974d84a1d2292242bdf, type: 2}
|
|
80
|
+
m_TargetAssemblyTypeName: DREditor.EventObjects.ValueWithEvent`2[[System.Boolean,
|
|
81
|
+
mscorlib
|
|
82
|
+
m_MethodName: SetValue
|
|
83
|
+
m_Mode: 6
|
|
84
|
+
m_Arguments:
|
|
85
|
+
m_ObjectArgument: {fileID: 0}
|
|
86
|
+
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
|
87
|
+
m_IntArgument: 0
|
|
88
|
+
m_FloatArgument: 0
|
|
89
|
+
m_StringArgument:
|
|
90
|
+
m_BoolArgument: 1
|
|
91
|
+
m_CallState: 2
|
|
92
|
+
- m_Target: {fileID: 11400000, guid: f8f9b888b06f45e4981e562ebe49b441, type: 2}
|
|
93
|
+
m_TargetAssemblyTypeName: SceneEvent, DREditor
|
|
94
|
+
m_MethodName: Raise
|
|
95
|
+
m_Mode: 1
|
|
96
|
+
m_Arguments:
|
|
97
|
+
m_ObjectArgument: {fileID: 0}
|
|
98
|
+
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
|
99
|
+
m_IntArgument: 0
|
|
100
|
+
m_FloatArgument: 0
|
|
101
|
+
m_StringArgument:
|
|
102
|
+
m_BoolArgument: 0
|
|
103
|
+
m_CallState: 2
|
|
104
|
+
Condition: {fileID: 0}
|
|
105
|
+
conditionMustBe: 1
|
|
106
|
+
--- !u!114 &387974391978806701
|
|
107
|
+
MonoBehaviour:
|
|
108
|
+
m_ObjectHideFlags: 0
|
|
109
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
110
|
+
m_PrefabInstance: {fileID: 0}
|
|
111
|
+
m_PrefabAsset: {fileID: 0}
|
|
112
|
+
m_GameObject: {fileID: 3989816913283648452}
|
|
113
|
+
m_Enabled: 1
|
|
114
|
+
m_EditorHideFlags: 0
|
|
115
|
+
m_Script: {fileID: 11500000, guid: c658899ac83647b43a6f2269a8f0ed08, type: 3}
|
|
116
|
+
m_Name:
|
|
117
|
+
m_EditorClassIdentifier:
|
|
118
|
+
time: 1
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!1 &3766085903236068557
|
|
4
|
+
GameObject:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
serializedVersion: 6
|
|
10
|
+
m_Component:
|
|
11
|
+
- component: {fileID: 4660671282321954657}
|
|
12
|
+
- component: {fileID: 785969475086834910}
|
|
13
|
+
m_Layer: 0
|
|
14
|
+
m_Name: Selectable_Object_Manager
|
|
15
|
+
m_TagString: Untagged
|
|
16
|
+
m_Icon: {fileID: 0}
|
|
17
|
+
m_NavMeshLayer: 0
|
|
18
|
+
m_StaticEditorFlags: 0
|
|
19
|
+
m_IsActive: 1
|
|
20
|
+
--- !u!4 &4660671282321954657
|
|
21
|
+
Transform:
|
|
22
|
+
m_ObjectHideFlags: 0
|
|
23
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
24
|
+
m_PrefabInstance: {fileID: 0}
|
|
25
|
+
m_PrefabAsset: {fileID: 0}
|
|
26
|
+
m_GameObject: {fileID: 3766085903236068557}
|
|
27
|
+
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
|
28
|
+
m_LocalPosition: {x: 0, y: 0, z: 0}
|
|
29
|
+
m_LocalScale: {x: 1, y: 1, z: 1}
|
|
30
|
+
m_ConstrainProportionsScale: 0
|
|
31
|
+
m_Children: []
|
|
32
|
+
m_Father: {fileID: 0}
|
|
33
|
+
m_RootOrder: 0
|
|
34
|
+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
|
35
|
+
--- !u!114 &785969475086834910
|
|
36
|
+
MonoBehaviour:
|
|
37
|
+
m_ObjectHideFlags: 0
|
|
38
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
39
|
+
m_PrefabInstance: {fileID: 0}
|
|
40
|
+
m_PrefabAsset: {fileID: 0}
|
|
41
|
+
m_GameObject: {fileID: 3766085903236068557}
|
|
42
|
+
m_Enabled: 1
|
|
43
|
+
m_EditorHideFlags: 0
|
|
44
|
+
m_Script: {fileID: 11500000, guid: bb6ffa591c7301142a0c51ad24a2c4f4, type: 3}
|
|
45
|
+
m_Name:
|
|
46
|
+
m_EditorClassIdentifier:
|
|
47
|
+
registerService: 1
|
|
48
|
+
dontDestroyOnLoad: 0
|
|
49
|
+
selectables: []
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.EventObjectServices
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
/// <remarks></remarks>
|
|
11
|
+
public class SceneEventOnStart : MonoBehaviour
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
///
|
|
15
|
+
/// </summary>
|
|
16
|
+
[Header("")]
|
|
17
|
+
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected SceneEvent sceneEvent = null;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
protected virtual void Start() => sceneEvent.Raise();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEngine.EventSystems;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.EventObjectServices
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ClassHeader(nameof(UIBehaviour) + ", " + nameof(ISelectHandler) + ", " + nameof(IOptionEventListener) +
|
|
12
|
+
"\n\n")]
|
|
13
|
+
public class SelectStringWithEvent : UIBehaviour, ISelectHandler, IOptionEventListener
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected StringWithEvent stringWithEvent = null;
|
|
20
|
+
|
|
21
|
+
/// <summary>
|
|
22
|
+
///
|
|
23
|
+
/// </summary>
|
|
24
|
+
[TextArea]
|
|
25
|
+
[Tooltip("")]
|
|
26
|
+
[SerializeField] protected string textForEvent;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
/// <summary>
|
|
30
|
+
///
|
|
31
|
+
/// </summary>
|
|
32
|
+
/// <param name="eventData"></param>
|
|
33
|
+
public virtual void OnSelect(BaseEventData eventData) => stringWithEvent.SetValue(textForEvent);
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/// <inheritdoc/>
|
|
37
|
+
public virtual void Initialize(IOptionEvent option)
|
|
38
|
+
{
|
|
39
|
+
stringWithEvent = option.DisplayDescriptionEvent;
|
|
40
|
+
|
|
41
|
+
textForEvent = option.OptionDescription;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using DREditor.Services;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
using System.Linq;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace DREditor.EventObjectServices
|
|
9
|
+
{
|
|
10
|
+
/// <summary>
|
|
11
|
+
///
|
|
12
|
+
/// </summary>
|
|
13
|
+
[ClassHeader(nameof(ServiceHolder<IObjectPooler<SelectableObject>>) + " for type: " + nameof(IObjectPooler<SelectableObject>) +
|
|
14
|
+
" of type: " + nameof(SelectableObject) +
|
|
15
|
+
"\n\n")]
|
|
16
|
+
public class SelectableObjectManager : ServiceHolder<IObjectPooler<SelectableObject>>, IObjectPooler<SelectableObject>
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Tooltip("")]
|
|
22
|
+
[SerializeField] protected List<SelectableObject> selectables = new();
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/// <inheritdoc/>
|
|
26
|
+
public virtual List<SelectableObject> GetRegisteredObjects() => selectables;
|
|
27
|
+
|
|
28
|
+
/// <inheritdoc/>
|
|
29
|
+
public virtual void RegisterObject(SelectableObject obj) => selectables.Add(obj);
|
|
30
|
+
|
|
31
|
+
/// <inheritdoc/>
|
|
32
|
+
public virtual void UnregisterObject(SelectableObject obj) => selectables.Remove(obj);
|
|
33
|
+
|
|
34
|
+
/// <inheritdoc/>
|
|
35
|
+
public virtual SelectableObject GetObjectByName(string name)
|
|
36
|
+
{
|
|
37
|
+
var matches = GetRegisteredObjects().Where(talkable => talkable.gameObject.name == name);
|
|
38
|
+
|
|
39
|
+
if (matches.Any())
|
|
40
|
+
return matches.First();
|
|
41
|
+
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEngine.UI;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.EventObjectServices
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
[ClassHeader(nameof(IntWithEventListener) +
|
|
12
|
+
"\n\n")]
|
|
13
|
+
public class SpriteOnIntEvent : IntWithEventListener
|
|
14
|
+
{
|
|
15
|
+
/// <summary>
|
|
16
|
+
///
|
|
17
|
+
/// </summary>
|
|
18
|
+
[Tooltip("")]
|
|
19
|
+
[SerializeField] protected bool setOnAwake = true;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
/// <summary>
|
|
23
|
+
///
|
|
24
|
+
/// </summary>
|
|
25
|
+
[Header("")]
|
|
26
|
+
[Divider]
|
|
27
|
+
[Tooltip("")]
|
|
28
|
+
[SerializeField] protected List<MaskableGraphic> graphics = new();
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
///
|
|
32
|
+
/// </summary>
|
|
33
|
+
[Tooltip("")]
|
|
34
|
+
[SerializeField] protected List<Sprite> spritesByIndex = new();
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
protected virtual void Awake()
|
|
38
|
+
{
|
|
39
|
+
if (setOnAwake)
|
|
40
|
+
OnValueChanged(valueWithEvent.Value);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/// <inheritdoc/>
|
|
45
|
+
protected override void OnValueChanged(int value)
|
|
46
|
+
{
|
|
47
|
+
if (graphics.Count > 0 && TryGetComponent(out MaskableGraphic validGraphic))
|
|
48
|
+
graphics.Add(validGraphic);
|
|
49
|
+
|
|
50
|
+
if (value < spritesByIndex.Count)
|
|
51
|
+
foreach (var graphic in graphics)
|
|
52
|
+
SetTexture(graphic, spritesByIndex[value]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/// <summary>
|
|
56
|
+
///
|
|
57
|
+
/// </summary>
|
|
58
|
+
/// <param name="graphic"></param>
|
|
59
|
+
/// <param name="sprite"></param>
|
|
60
|
+
protected virtual void SetTexture(MaskableGraphic graphic, Sprite sprite)
|
|
61
|
+
{
|
|
62
|
+
if (graphic is Image image)
|
|
63
|
+
image.sprite = sprite;
|
|
64
|
+
else if (graphic is RawImage rawImage)
|
|
65
|
+
rawImage.texture = sprite.texture;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
|
|
4
|
+
namespace DREditor.EventObjectServices
|
|
5
|
+
{
|
|
6
|
+
/// <summary>
|
|
7
|
+
///
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class StringWithEventListener : ValueWithEventListener<StringWithEvent, string, StringEvent> { }
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using TMPro;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
namespace DREditor.EventObjectServices
|
|
6
|
+
{
|
|
7
|
+
/// <summary>
|
|
8
|
+
///
|
|
9
|
+
/// </summary>
|
|
10
|
+
[RequireComponent(typeof(TMP_Text))]
|
|
11
|
+
public class TextWithEventListener : StringWithEventListener
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
///
|
|
15
|
+
/// </summary>
|
|
16
|
+
[Tooltip("")]
|
|
17
|
+
[SerializeField] protected string prefix = "";
|
|
18
|
+
|
|
19
|
+
/// <summary>
|
|
20
|
+
///
|
|
21
|
+
/// </summary>
|
|
22
|
+
[Tooltip("")]
|
|
23
|
+
[SerializeField] protected string suffix = " ";
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/// <summary>
|
|
27
|
+
///
|
|
28
|
+
/// </summary>
|
|
29
|
+
protected TMP_Text TMP_Text => GetComponent<TMP_Text>();
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/// <inheritdoc/>
|
|
33
|
+
protected override void OnValueChanged(string updatedValue)
|
|
34
|
+
{
|
|
35
|
+
base.OnValueChanged(updatedValue);
|
|
36
|
+
|
|
37
|
+
UpdateTextWithString(updatedValue);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// <summary>
|
|
41
|
+
///
|
|
42
|
+
/// </summary>
|
|
43
|
+
/// <param name="updatedValue"></param>
|
|
44
|
+
protected virtual void UpdateTextWithString(string updatedValue) => TMP_Text.text = prefix + updatedValue + suffix;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
|
|
2
|
+
using DREditor.EventObjects;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEngine.Events;
|
|
5
|
+
|
|
6
|
+
namespace DREditor.EventObjectServices
|
|
7
|
+
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
///
|
|
10
|
+
/// </summary>
|
|
11
|
+
/// <typeparam name="T"></typeparam>
|
|
12
|
+
/// <typeparam name="TX"></typeparam>
|
|
13
|
+
/// <typeparam name="TY"></typeparam>
|
|
14
|
+
public abstract class ValueWithEventListener<T, TX, TY> : MonoBehaviour
|
|
15
|
+
where T : ValueWithEvent<TX, TY>
|
|
16
|
+
where TY : UnityEvent<TX>, new()
|
|
17
|
+
{
|
|
18
|
+
/// <summary>
|
|
19
|
+
///
|
|
20
|
+
/// </summary>
|
|
21
|
+
[Header("")]
|
|
22
|
+
[Divider]
|
|
23
|
+
[Tooltip("")]
|
|
24
|
+
[SerializeField] protected T valueWithEvent = null;
|
|
25
|
+
|
|
26
|
+
[Space]
|
|
27
|
+
|
|
28
|
+
[Header("")]
|
|
29
|
+
[SerializeField] protected TY OnValueChangedEvent;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
///
|
|
34
|
+
/// </summary>
|
|
35
|
+
protected TX UpdatedValue { get; private set; }
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
///
|
|
40
|
+
/// </summary>
|
|
41
|
+
protected virtual void OnEnable() => valueWithEvent?.AddListener(OnValueChanged);
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
///
|
|
45
|
+
/// </summary>
|
|
46
|
+
protected virtual void OnDisable() => valueWithEvent?.RemoveListener(OnValueChanged);
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
/// <summary>
|
|
50
|
+
///
|
|
51
|
+
/// </summary>
|
|
52
|
+
/// <param name="updatedValue"></param>
|
|
53
|
+
protected virtual void OnValueChanged(TX updatedValue)
|
|
54
|
+
{
|
|
55
|
+
UpdatedValue = updatedValue;
|
|
56
|
+
|
|
57
|
+
OnValueChangedEvent?.Invoke(updatedValue);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|