fr.jeanf.eventsystem 0.1.71 → 0.1.73
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/IntBoolEventListener.cs +49 -0
- package/Runtime/Listeners/IntBoolEventListener.cs.meta +11 -0
- package/Runtime/Listeners/IntFloatEventListener.cs +49 -0
- package/Runtime/Listeners/IntFloatEventListener.cs.meta +11 -0
- package/Runtime/Listeners/IntIntEventListener.cs +49 -0
- package/Runtime/Listeners/IntIntEventListener.cs.meta +11 -0
- package/Runtime/Listeners/IntStringEventListener.cs +49 -0
- package/Runtime/Listeners/IntStringEventListener.cs.meta +11 -0
- package/Runtime/ScriptableObjects/IntBoolEventChannelSO.cs +17 -0
- package/Runtime/ScriptableObjects/IntBoolEventChannelSO.cs.meta +11 -0
- package/Runtime/ScriptableObjects/IntFloatEventChannelSO.cs +17 -0
- package/Runtime/ScriptableObjects/IntFloatEventChannelSO.cs.meta +11 -0
- package/Runtime/ScriptableObjects/IntIntEventChannelSO.cs +17 -0
- package/Runtime/ScriptableObjects/IntIntEventChannelSO.cs.meta +11 -0
- package/Runtime/ScriptableObjects/IntStringEventChannelSO.cs +17 -0
- package/Runtime/ScriptableObjects/IntStringEventChannelSO.cs.meta +11 -0
- package/Runtime/SenderInterfaces/IntBoolEventSender.cs +22 -0
- package/Runtime/SenderInterfaces/IntBoolEventSender.cs.meta +11 -0
- package/Runtime/SenderInterfaces/IntFloatEventSender.cs +22 -0
- package/Runtime/SenderInterfaces/IntFloatEventSender.cs.meta +11 -0
- package/Runtime/SenderInterfaces/IntIntEventSender.cs +22 -0
- package/Runtime/SenderInterfaces/IntIntEventSender.cs.meta +11 -0
- package/Runtime/SenderInterfaces/IntStringEventSender.cs +22 -0
- package/Runtime/SenderInterfaces/IntStringEventSender.cs.meta +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// To use a generic UnityEvent type you must override the generic type.
|
|
6
|
+
/// </summary>
|
|
7
|
+
namespace jeanf.EventSystem
|
|
8
|
+
{
|
|
9
|
+
[System.Serializable]
|
|
10
|
+
public class IntBoolEvent : UnityEvent<int, bool>
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
|
|
17
|
+
/// </summary>
|
|
18
|
+
public class IntBoolEventListener : MonoBehaviour, IDebugBehaviour
|
|
19
|
+
{
|
|
20
|
+
public bool isDebug
|
|
21
|
+
{
|
|
22
|
+
get => _isDebug;
|
|
23
|
+
set => _isDebug = value;
|
|
24
|
+
}
|
|
25
|
+
[SerializeField] private bool _isDebug = false;
|
|
26
|
+
|
|
27
|
+
[SerializeField] private IntBoolEventChannelSO _channel = default;
|
|
28
|
+
|
|
29
|
+
public IntBoolEvent OnEventRaised;
|
|
30
|
+
|
|
31
|
+
private void OnEnable()
|
|
32
|
+
{
|
|
33
|
+
if (_channel != null)
|
|
34
|
+
_channel.OnEventRaised += Respond;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private void OnDisable()
|
|
38
|
+
{
|
|
39
|
+
if (_channel != null)
|
|
40
|
+
_channel.OnEventRaised -= Respond;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private void Respond(int nb, bool value)
|
|
44
|
+
{
|
|
45
|
+
OnEventRaised?.Invoke(nb, value);
|
|
46
|
+
if(isDebug) Debug.Log($" int-bool event raised: <{nb},{value}>");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// To use a generic UnityEvent type you must override the generic type.
|
|
6
|
+
/// </summary>
|
|
7
|
+
namespace jeanf.EventSystem
|
|
8
|
+
{
|
|
9
|
+
[System.Serializable]
|
|
10
|
+
public class IntFloatEvent : UnityEvent<int, float>
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
|
|
17
|
+
/// </summary>
|
|
18
|
+
public class IntFloatEventListener : MonoBehaviour, IDebugBehaviour
|
|
19
|
+
{
|
|
20
|
+
public bool isDebug
|
|
21
|
+
{
|
|
22
|
+
get => _isDebug;
|
|
23
|
+
set => _isDebug = value;
|
|
24
|
+
}
|
|
25
|
+
[SerializeField] private bool _isDebug = false;
|
|
26
|
+
|
|
27
|
+
[SerializeField] private IntFloatEventChannelSO _channel = default;
|
|
28
|
+
|
|
29
|
+
public IntFloatEvent OnEventRaised;
|
|
30
|
+
|
|
31
|
+
private void OnEnable()
|
|
32
|
+
{
|
|
33
|
+
if (_channel != null)
|
|
34
|
+
_channel.OnEventRaised += Respond;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private void OnDisable()
|
|
38
|
+
{
|
|
39
|
+
if (_channel != null)
|
|
40
|
+
_channel.OnEventRaised -= Respond;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private void Respond(int nb, float value)
|
|
44
|
+
{
|
|
45
|
+
OnEventRaised?.Invoke(nb, value);
|
|
46
|
+
if(isDebug) Debug.Log($" int-bool event raised: <{nb},{value}>");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// To use a generic UnityEvent type you must override the generic type.
|
|
6
|
+
/// </summary>
|
|
7
|
+
namespace jeanf.EventSystem
|
|
8
|
+
{
|
|
9
|
+
[System.Serializable]
|
|
10
|
+
public class IntIntEvent : UnityEvent<int, int>
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
|
|
17
|
+
/// </summary>
|
|
18
|
+
public class IntIntEventListener : MonoBehaviour, IDebugBehaviour
|
|
19
|
+
{
|
|
20
|
+
public bool isDebug
|
|
21
|
+
{
|
|
22
|
+
get => _isDebug;
|
|
23
|
+
set => _isDebug = value;
|
|
24
|
+
}
|
|
25
|
+
[SerializeField] private bool _isDebug = false;
|
|
26
|
+
|
|
27
|
+
[SerializeField] private IntIntEventChannelSO _channel = default;
|
|
28
|
+
|
|
29
|
+
public IntIntEvent OnEventRaised;
|
|
30
|
+
|
|
31
|
+
private void OnEnable()
|
|
32
|
+
{
|
|
33
|
+
if (_channel != null)
|
|
34
|
+
_channel.OnEventRaised += Respond;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private void OnDisable()
|
|
38
|
+
{
|
|
39
|
+
if (_channel != null)
|
|
40
|
+
_channel.OnEventRaised -= Respond;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private void Respond(int nb, int value)
|
|
44
|
+
{
|
|
45
|
+
OnEventRaised?.Invoke(nb, value);
|
|
46
|
+
if(isDebug) Debug.Log($" int-bool event raised: <{nb},{value}>");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
/// <summary>
|
|
5
|
+
/// To use a generic UnityEvent type you must override the generic type.
|
|
6
|
+
/// </summary>
|
|
7
|
+
namespace jeanf.EventSystem
|
|
8
|
+
{
|
|
9
|
+
[System.Serializable]
|
|
10
|
+
public class IntStringEvent : UnityEvent<int, string>
|
|
11
|
+
{
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
|
|
17
|
+
/// </summary>
|
|
18
|
+
public class IntStringEventListener : MonoBehaviour, IDebugBehaviour
|
|
19
|
+
{
|
|
20
|
+
public bool isDebug
|
|
21
|
+
{
|
|
22
|
+
get => _isDebug;
|
|
23
|
+
set => _isDebug = value;
|
|
24
|
+
}
|
|
25
|
+
[SerializeField] private bool _isDebug = false;
|
|
26
|
+
|
|
27
|
+
[SerializeField] private IntStringEventChannelSO _channel = default;
|
|
28
|
+
|
|
29
|
+
public IntStringEvent OnEventRaised;
|
|
30
|
+
|
|
31
|
+
private void OnEnable()
|
|
32
|
+
{
|
|
33
|
+
if (_channel != null)
|
|
34
|
+
_channel.OnEventRaised += Respond;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private void OnDisable()
|
|
38
|
+
{
|
|
39
|
+
if (_channel != null)
|
|
40
|
+
_channel.OnEventRaised -= Respond;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private void Respond(int nb, string value)
|
|
44
|
+
{
|
|
45
|
+
OnEventRaised?.Invoke(nb, value);
|
|
46
|
+
if(isDebug) Debug.Log($" int-bool event raised: <{nb},{value}>");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
|
+
{
|
|
6
|
+
[CreateAssetMenu(menuName = "Events/<Int,Bool> Event Channel")]
|
|
7
|
+
|
|
8
|
+
public class IntBoolEventChannelSO : DescriptionBaseSO
|
|
9
|
+
{
|
|
10
|
+
public UnityAction<int, bool> OnEventRaised;
|
|
11
|
+
|
|
12
|
+
public void RaiseEvent(int nb, bool value)
|
|
13
|
+
{
|
|
14
|
+
OnEventRaised?.Invoke(nb, value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
|
+
{
|
|
6
|
+
[CreateAssetMenu(menuName = "Events/<Int,Float> Event Channel")]
|
|
7
|
+
|
|
8
|
+
public class IntFloatEventChannelSO : DescriptionBaseSO
|
|
9
|
+
{
|
|
10
|
+
public UnityAction<int, float> OnEventRaised;
|
|
11
|
+
|
|
12
|
+
public void RaiseEvent(int nb, float value)
|
|
13
|
+
{
|
|
14
|
+
OnEventRaised?.Invoke(nb, value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
|
+
{
|
|
6
|
+
[CreateAssetMenu(menuName = "Events/<Int,Int> Event Channel")]
|
|
7
|
+
|
|
8
|
+
public class IntIntEventChannelSO : DescriptionBaseSO
|
|
9
|
+
{
|
|
10
|
+
public UnityAction<int, int> OnEventRaised;
|
|
11
|
+
|
|
12
|
+
public void RaiseEvent(int nb, int value)
|
|
13
|
+
{
|
|
14
|
+
OnEventRaised?.Invoke(nb, value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
|
+
{
|
|
6
|
+
[CreateAssetMenu(menuName = "Events/<Int,String> Event Channel")]
|
|
7
|
+
|
|
8
|
+
public class IntStringEventChannelSO : DescriptionBaseSO
|
|
9
|
+
{
|
|
10
|
+
public UnityAction<int, string> OnEventRaised;
|
|
11
|
+
|
|
12
|
+
public void RaiseEvent(int nb, string value)
|
|
13
|
+
{
|
|
14
|
+
OnEventRaised?.Invoke(nb, value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace jeanf.EventSystem
|
|
4
|
+
{
|
|
5
|
+
public class IntBoolEventSender : MonoBehaviour, IDebugBehaviour
|
|
6
|
+
{
|
|
7
|
+
public bool isDebug
|
|
8
|
+
{
|
|
9
|
+
get => _isDebug;
|
|
10
|
+
set => _isDebug = value;
|
|
11
|
+
}
|
|
12
|
+
[SerializeField] private bool _isDebug = false;
|
|
13
|
+
|
|
14
|
+
[field: Header("Broadcasting on:")] public IntBoolEventChannelSO boolMessageChannel;
|
|
15
|
+
|
|
16
|
+
public void SendIntBool(int nb, bool value)
|
|
17
|
+
{
|
|
18
|
+
boolMessageChannel.RaiseEvent(nb, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace jeanf.EventSystem
|
|
4
|
+
{
|
|
5
|
+
public class IntFloatEventSender : MonoBehaviour, IDebugBehaviour
|
|
6
|
+
{
|
|
7
|
+
public bool isDebug
|
|
8
|
+
{
|
|
9
|
+
get => _isDebug;
|
|
10
|
+
set => _isDebug = value;
|
|
11
|
+
}
|
|
12
|
+
[SerializeField] private bool _isDebug = false;
|
|
13
|
+
|
|
14
|
+
[field: Header("Broadcasting on:")] public IntFloatEventChannelSO intfloatMessageChannel;
|
|
15
|
+
|
|
16
|
+
public void SendIntFloat(int nb, float value)
|
|
17
|
+
{
|
|
18
|
+
intfloatMessageChannel.RaiseEvent(nb, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace jeanf.EventSystem
|
|
4
|
+
{
|
|
5
|
+
public class IntIntEventSender : MonoBehaviour, IDebugBehaviour
|
|
6
|
+
{
|
|
7
|
+
public bool isDebug
|
|
8
|
+
{
|
|
9
|
+
get => _isDebug;
|
|
10
|
+
set => _isDebug = value;
|
|
11
|
+
}
|
|
12
|
+
[SerializeField] private bool _isDebug = false;
|
|
13
|
+
|
|
14
|
+
[field: Header("Broadcasting on:")] public IntIntEventChannelSO intintMessageChannel;
|
|
15
|
+
|
|
16
|
+
public void SendIntInt(int nb, int value)
|
|
17
|
+
{
|
|
18
|
+
intintMessageChannel.RaiseEvent(nb, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace jeanf.EventSystem
|
|
4
|
+
{
|
|
5
|
+
public class IntStringEventSender : MonoBehaviour, IDebugBehaviour
|
|
6
|
+
{
|
|
7
|
+
public bool isDebug
|
|
8
|
+
{
|
|
9
|
+
get => _isDebug;
|
|
10
|
+
set => _isDebug = value;
|
|
11
|
+
}
|
|
12
|
+
[SerializeField] private bool _isDebug = false;
|
|
13
|
+
|
|
14
|
+
[field: Header("Broadcasting on:")] public IntStringEventChannelSO intintMessageChannel;
|
|
15
|
+
|
|
16
|
+
public void SendIntString(int nb, string value)
|
|
17
|
+
{
|
|
18
|
+
intintMessageChannel.RaiseEvent(nb, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
package/package.json
CHANGED