fr.jeanf.eventsystem 0.1.69 → 0.1.71
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/Runtime/Listeners/TransformEventListener.cs +35 -0
- package/Runtime/Listeners/TransformEventListener.cs.meta +11 -0
- package/Runtime/PingSystem/PingableScriptableObject.cs +60 -58
- package/Runtime/PingSystem/ScriptableObjectManager.cs +59 -55
- package/Runtime/ScriptableObjects/TeleportEventChannelSO.cs +2 -2
- package/Runtime/ScriptableObjects/TransformEventChannelSO.cs +16 -0
- package/Runtime/ScriptableObjects/TransformEventChannelSO.cs.meta +11 -0
- package/Runtime/SenderInterfaces/BoolEventSender.cs +15 -12
- package/Runtime/SenderInterfaces/FloatEventSender.cs +15 -12
- package/Runtime/SenderInterfaces/IScriptableObjectEventSender.cs +7 -4
- package/Runtime/SenderInterfaces/IntEventSender.cs +15 -12
- package/Runtime/SenderInterfaces/ScriptableObjectEventSender.cs +15 -12
- package/Runtime/SenderInterfaces/TransformEventSender.cs +44 -0
- package/Runtime/SenderInterfaces/TransformEventSender.cs.meta +11 -0
- package/Runtime/SenderInterfaces/VoidEventSender.cs +20 -19
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEngine.Events;
|
|
4
|
+
|
|
5
|
+
namespace jeanf.EventSystem
|
|
6
|
+
{
|
|
7
|
+
[System.Serializable]
|
|
8
|
+
public class TransformEvent : UnityEvent<Transform>
|
|
9
|
+
{
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
public class TransformEventListener : MonoBehaviour
|
|
13
|
+
{
|
|
14
|
+
[Header("Receiving on channel:")]
|
|
15
|
+
[SerializeField] private TransformEventChannelSO _channel = default;
|
|
16
|
+
|
|
17
|
+
public UnityEvent<Transform> OnEventRaised;
|
|
18
|
+
|
|
19
|
+
private void OnEnable()
|
|
20
|
+
{
|
|
21
|
+
if (_channel != null) _channel.OnEventRaised += Respond;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private void OnDisable()
|
|
25
|
+
{
|
|
26
|
+
if (_channel != null) _channel.OnEventRaised -= Respond;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private void Respond( Transform transform)
|
|
30
|
+
{
|
|
31
|
+
OnEventRaised?.Invoke(transform);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,67 +1,69 @@
|
|
|
1
1
|
using System;
|
|
2
|
-
using System.Collections;
|
|
3
|
-
using jeanf.EventSystem;
|
|
4
2
|
using UnityEngine;
|
|
5
3
|
|
|
6
|
-
|
|
4
|
+
namespace jeanf.EventSystem
|
|
7
5
|
{
|
|
8
|
-
public
|
|
9
|
-
{
|
|
10
|
-
get => _isDebug;
|
|
11
|
-
set => _isDebug = value;
|
|
12
|
-
}
|
|
13
|
-
[SerializeField] private bool _isDebug = false;
|
|
14
|
-
|
|
15
|
-
[SerializeField] private VoidEventChannelSO refreshPingableObjects;
|
|
16
|
-
[ReadOnly] [SerializeField] private string id = Guid.NewGuid().ToString();
|
|
17
|
-
|
|
18
|
-
public ScriptableObjectEventChannelSO channel
|
|
19
|
-
{
|
|
20
|
-
get => _channel;
|
|
21
|
-
set => _channel = value;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
[SerializeField] private ScriptableObjectEventChannelSO _channel;
|
|
25
|
-
public ScriptableObjectEvent OnEventRaised { get; set; }
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
private void Awake()
|
|
6
|
+
public class PingableScriptableObject : MonoBehaviour, IScriptableObjectEventSender, IScriptableObjectEventListener, IDebugBehaviour
|
|
29
7
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
if (channel != null)
|
|
8
|
+
public bool isDebug
|
|
9
|
+
{
|
|
10
|
+
get => _isDebug;
|
|
11
|
+
set => _isDebug = value;
|
|
12
|
+
}
|
|
13
|
+
[SerializeField] private bool _isDebug = false;
|
|
14
|
+
|
|
15
|
+
[SerializeField] private VoidEventChannelSO refreshPingableObjects;
|
|
16
|
+
[ReadOnly] [SerializeField] private string id = Guid.NewGuid().ToString();
|
|
17
|
+
|
|
18
|
+
public ScriptableObjectEventChannelSO channel
|
|
44
19
|
{
|
|
45
|
-
|
|
46
|
-
|
|
20
|
+
get => _channel;
|
|
21
|
+
set => _channel = value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[SerializeField] private ScriptableObjectEventChannelSO _channel;
|
|
25
|
+
public ScriptableObjectEvent OnEventRaised { get; set; }
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
private void Awake()
|
|
29
|
+
{
|
|
30
|
+
refreshPingableObjects.OnEventRaised += RefreshPingable;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private void OnEnable()
|
|
34
|
+
{
|
|
35
|
+
if (channel != null) channel.OnEventRaised += Respond;
|
|
36
|
+
AddScriptableObjectToList(id, channel);
|
|
37
|
+
}
|
|
38
|
+
private void OnDisable() => Unsubscribe();
|
|
39
|
+
private void OnDestroy() => Unsubscribe();
|
|
40
|
+
private void Unsubscribe()
|
|
41
|
+
{
|
|
42
|
+
|
|
43
|
+
if (channel != null)
|
|
44
|
+
{
|
|
45
|
+
channel.UnsubscribeEvent(id, channel);
|
|
46
|
+
channel.OnEventRaised -= null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (refreshPingableObjects.OnEventRaised != null)
|
|
50
|
+
refreshPingableObjects.OnEventRaised -= null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private void Respond(string id, ScriptableObject value)
|
|
54
|
+
{
|
|
55
|
+
OnEventRaised?.Invoke(value);
|
|
56
|
+
if(isDebug) Debug.Log($" scriptableObject event raised: {value}");
|
|
57
|
+
}
|
|
58
|
+
public void AddScriptableObjectToList(string id, ScriptableObject value)
|
|
59
|
+
{
|
|
60
|
+
channel.RaiseEvent(id, value);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public void RefreshPingable()
|
|
64
|
+
{
|
|
65
|
+
AddScriptableObjectToList(id, channel);
|
|
47
66
|
}
|
|
48
|
-
|
|
49
|
-
if (refreshPingableObjects.OnEventRaised != null)
|
|
50
|
-
refreshPingableObjects.OnEventRaised -= null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private void Respond(string id, ScriptableObject value)
|
|
54
|
-
{
|
|
55
|
-
OnEventRaised?.Invoke(value);
|
|
56
|
-
if(isDebug) Debug.Log($" scriptableObject event raised: {value}");
|
|
57
|
-
}
|
|
58
|
-
public void AddScriptableObjectToList(string id, ScriptableObject value)
|
|
59
|
-
{
|
|
60
|
-
channel.RaiseEvent(id, value);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public void RefreshPingable()
|
|
64
|
-
{
|
|
65
|
-
AddScriptableObjectToList(id, channel);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
|
|
@@ -4,78 +4,82 @@ using jeanf.EventSystem;
|
|
|
4
4
|
using UnityEngine;
|
|
5
5
|
using Object = UnityEngine.Object;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
namespace jeanf.EventSystem
|
|
8
8
|
{
|
|
9
|
-
public
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
public class ScriptableObjectManager : MonoBehaviour, IDebugBehaviour
|
|
10
|
+
{
|
|
11
|
+
public bool isDebug
|
|
12
|
+
{
|
|
13
|
+
get => _isDebug;
|
|
14
|
+
set => _isDebug = value;
|
|
15
|
+
}
|
|
16
|
+
[SerializeField] private bool _isDebug = false;
|
|
17
|
+
|
|
18
|
+
[SerializeField] private VoidEventChannelSO RefreshPingableObjects;
|
|
19
|
+
[SerializeField] private List<ScriptableObjectEventChannelSO> listOfPingableObjects = new List<ScriptableObjectEventChannelSO>();
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
private Dictionary<Object, Dictionary<string, Object>> genericDictionary = new Dictionary<Object, Dictionary<string, Object>>();
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
private void OnEnable() => Subscribe();
|
|
24
|
+
private void OnDisable() => Unsubscribe();
|
|
25
|
+
private void OnDestroy() => Unsubscribe();
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
foreach (var so in listOfPingableObjects)
|
|
27
|
+
private void Subscribe()
|
|
28
28
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
foreach (var so in listOfPingableObjects)
|
|
30
|
+
{
|
|
31
|
+
Debug.Log($"registering events for channel: {so.name}");
|
|
32
|
+
so.OnEventRaised += RegisterSO;
|
|
33
|
+
so.OnEventRemove += RemoveSOFromLists;
|
|
34
|
+
}
|
|
35
|
+
RefreshPingableObjects.RaiseEvent();
|
|
32
36
|
}
|
|
33
|
-
RefreshPingableObjects.RaiseEvent();
|
|
34
|
-
}
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
foreach (var so in listOfPingableObjects)
|
|
38
|
+
private void Unsubscribe()
|
|
39
39
|
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
foreach (var so in listOfPingableObjects)
|
|
41
|
+
{
|
|
42
|
+
Debug.Log($"unregistering events for channel: {so.name}");
|
|
43
|
+
so.OnEventRaised -= null;
|
|
44
|
+
so.OnEventRemove -= null;
|
|
45
|
+
}
|
|
46
|
+
genericDictionary.Clear();
|
|
47
|
+
genericDictionary.TrimExcess();
|
|
43
48
|
}
|
|
44
|
-
genericDictionary.Clear();
|
|
45
|
-
genericDictionary.TrimExcess();
|
|
46
|
-
}
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
private void RegisterSO(string id, ScriptableObject so)
|
|
51
|
+
{
|
|
52
|
+
UpdateLists(id, so);
|
|
53
|
+
}
|
|
52
54
|
|
|
53
|
-
|
|
54
|
-
{
|
|
55
|
-
if (so is not ScriptableObjectEventChannelSO mySo) return;
|
|
56
|
-
var type = mySo.type;
|
|
57
|
-
if(genericDictionary.ContainsKey(type))
|
|
55
|
+
private void UpdateLists(string id, ScriptableObject so)
|
|
58
56
|
{
|
|
59
|
-
if (
|
|
57
|
+
if (so is not ScriptableObjectEventChannelSO mySo) return;
|
|
58
|
+
var type = mySo.type;
|
|
59
|
+
if(genericDictionary.ContainsKey(type))
|
|
60
60
|
{
|
|
61
|
-
if
|
|
62
|
-
|
|
61
|
+
if (!genericDictionary[type].ContainsKey(id))
|
|
62
|
+
{
|
|
63
|
+
if(isDebug) Debug.Log($"adding [id: {id}] to the list of type {so.name}");
|
|
64
|
+
genericDictionary[type].Add(id, mySo);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else
|
|
68
|
+
{
|
|
69
|
+
if(isDebug) Debug.Log($"new type detected, adding a list of type {so.name} and adding [id: {id}] to it");
|
|
70
|
+
genericDictionary.Add(type, new Dictionary<string, Object>(){{id, mySo}});
|
|
63
71
|
}
|
|
64
72
|
}
|
|
65
|
-
|
|
73
|
+
|
|
74
|
+
private void RemoveSOFromLists(string id, ScriptableObject so)
|
|
66
75
|
{
|
|
67
|
-
if
|
|
68
|
-
|
|
76
|
+
if (so is not ScriptableObjectEventChannelSO mySo) return;
|
|
77
|
+
var type = mySo.type;
|
|
78
|
+
if (!genericDictionary.ContainsKey(type)) return;
|
|
79
|
+
if (!genericDictionary[type].ContainsKey(id)) return;
|
|
80
|
+
if(isDebug) Debug.Log($"removing [id: {id}] to the list of type {so.name}");
|
|
81
|
+
genericDictionary[type].Remove(id);
|
|
69
82
|
}
|
|
70
83
|
}
|
|
71
84
|
|
|
72
|
-
private void RemoveSOFromLists(string id, ScriptableObject so)
|
|
73
|
-
{
|
|
74
|
-
if (so is not ScriptableObjectEventChannelSO mySo) return;
|
|
75
|
-
var type = mySo.type;
|
|
76
|
-
if (!genericDictionary.ContainsKey(type)) return;
|
|
77
|
-
if (!genericDictionary[type].ContainsKey(id)) return;
|
|
78
|
-
if(isDebug) Debug.Log($"removing [id: {id}] to the list of type {so.name}");
|
|
79
|
-
genericDictionary[type].Remove(id);
|
|
80
|
-
}
|
|
81
85
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
|
+
{
|
|
6
|
+
[CreateAssetMenu(menuName = "Events/Transform Event Channel")]
|
|
7
|
+
public class TransformEventChannelSO : DescriptionBaseSO
|
|
8
|
+
{
|
|
9
|
+
public UnityAction<Transform> OnEventRaised;
|
|
10
|
+
|
|
11
|
+
public void RaiseEvent(Transform value)
|
|
12
|
+
{
|
|
13
|
+
OnEventRaised?.Invoke(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
using jeanf.EventSystem;
|
|
2
1
|
using UnityEngine;
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
namespace jeanf.EventSystem
|
|
5
4
|
{
|
|
6
|
-
public
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
public class BoolEventSender : MonoBehaviour, IDebugBehaviour
|
|
6
|
+
{
|
|
7
|
+
public bool isDebug
|
|
8
|
+
{
|
|
9
|
+
get => _isDebug;
|
|
10
|
+
set => _isDebug = value;
|
|
11
|
+
}
|
|
12
|
+
[SerializeField] private bool _isDebug = false;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
[field: Header("Broadcasting on:")] public BoolEventChannelSO boolMessageChannel;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
public void SendBool(bool value)
|
|
17
|
+
{
|
|
18
|
+
boolMessageChannel.RaiseEvent(value);
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
22
|
+
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
using jeanf.EventSystem;
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
5
|
{
|
|
6
|
-
public
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
public class FloatEventSender : MonoBehaviour, IDebugBehaviour
|
|
7
|
+
{
|
|
8
|
+
public bool isDebug
|
|
9
|
+
{
|
|
10
|
+
get => _isDebug;
|
|
11
|
+
set => _isDebug = value;
|
|
12
|
+
}
|
|
13
|
+
[SerializeField] private bool _isDebug = false;
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
[field: Header("Broadcasting on:")] public FloatEventChannelSO floatMessageChannel;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
public void SendFloat(float value)
|
|
18
|
+
{
|
|
19
|
+
floatMessageChannel.RaiseEvent(value);
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
|
-
}
|
|
22
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
using jeanf.EventSystem;
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
5
|
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
6
|
+
public interface IScriptableObjectEventSender
|
|
7
|
+
{
|
|
8
|
+
ScriptableObjectEventChannelSO channel { get; set; }
|
|
9
|
+
void AddScriptableObjectToList(string id, ScriptableObject value);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
using jeanf.EventSystem;
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
5
|
{
|
|
6
|
-
public
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
public class IntEventSender : MonoBehaviour, IDebugBehaviour
|
|
7
|
+
{
|
|
8
|
+
public bool isDebug
|
|
9
|
+
{
|
|
10
|
+
get => _isDebug;
|
|
11
|
+
set => _isDebug = value;
|
|
12
|
+
}
|
|
13
|
+
[SerializeField] private bool _isDebug = false;
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
[field: Header("Broadcasting on:")] public IntEventChannelSO intMessageChannel;
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
public void SendInt(int value)
|
|
18
|
+
{
|
|
19
|
+
intMessageChannel.RaiseEvent(value);
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
|
-
}
|
|
22
|
+
}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
using jeanf.EventSystem;
|
|
2
1
|
using UnityEngine;
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
namespace jeanf.EventSystem
|
|
5
4
|
{
|
|
6
|
-
public
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
public class ScriptableObjectEventSender : MonoBehaviour, IDebugBehaviour
|
|
6
|
+
{
|
|
7
|
+
public bool isDebug
|
|
8
|
+
{
|
|
9
|
+
get => _isDebug;
|
|
10
|
+
set => _isDebug = value;
|
|
11
|
+
}
|
|
12
|
+
[SerializeField] private bool _isDebug = false;
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
[field: Header("Broadcasting on:")] public ScriptableObjectEventChannelSO scriptableObjectMessageChannel;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
public void SendScriptableObject(string id, ScriptableObject value)
|
|
17
|
+
{
|
|
18
|
+
scriptableObjectMessageChannel.RaiseEvent(id, value);
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
22
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEngine.Serialization;
|
|
4
|
+
|
|
5
|
+
namespace jeanf.EventSystem
|
|
6
|
+
{
|
|
7
|
+
public class TransformEventSender : MonoBehaviour, IDebugBehaviour
|
|
8
|
+
{
|
|
9
|
+
public bool isDebug
|
|
10
|
+
{
|
|
11
|
+
get => _isDebug;
|
|
12
|
+
set => _isDebug = value;
|
|
13
|
+
}
|
|
14
|
+
[SerializeField] private bool _isDebug = false;
|
|
15
|
+
[SerializeField] private bool _sendTransfromOnAwake;
|
|
16
|
+
[SerializeField] private bool _sendCustomTransform;
|
|
17
|
+
[DrawIf("_sendCustomTransform", true, ComparisonType.Equals)]
|
|
18
|
+
[SerializeField] private Transform _transform;
|
|
19
|
+
|
|
20
|
+
[field: Header("Broadcasting on:")] public TransformEventChannelSO transformMessageChannel;
|
|
21
|
+
|
|
22
|
+
public void SendTransform(Transform value)
|
|
23
|
+
{
|
|
24
|
+
transformMessageChannel.RaiseEvent(value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public void SendCustomTransform()
|
|
28
|
+
{
|
|
29
|
+
SendTransform(_transform);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private void Awake()
|
|
33
|
+
{
|
|
34
|
+
if(!_sendTransfromOnAwake) return;
|
|
35
|
+
|
|
36
|
+
if(!_sendCustomTransform)SendTransform(this.gameObject.transform);
|
|
37
|
+
else
|
|
38
|
+
{
|
|
39
|
+
SendTransform(_transform);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using jeanf.EventSystem;
|
|
3
1
|
using UnityEngine;
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
namespace jeanf.EventSystem
|
|
6
4
|
{
|
|
7
|
-
public
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
public class VoidEventSender : MonoBehaviour, IDebugBehaviour
|
|
6
|
+
{
|
|
7
|
+
public bool isDebug
|
|
8
|
+
{
|
|
9
|
+
get => _isDebug;
|
|
10
|
+
set => _isDebug = value;
|
|
11
|
+
}
|
|
12
|
+
[SerializeField] private bool _isDebug = false;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
[field: Header("Broadcasting on:")] public VoidEventChannelSO voidMessageChannel;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
[SerializeField] private bool sendEventOnAwake = true;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
private void Awake()
|
|
19
|
+
{
|
|
20
|
+
if(sendEventOnAwake) SendVoidEvent();
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
public void SendVoidEvent()
|
|
24
|
+
{
|
|
25
|
+
voidMessageChannel.RaiseEvent();
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
|
-
}
|
|
28
|
+
}
|
package/package.json
CHANGED