fr.jeanf.eventsystem 0.1.76 → 0.1.78
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/Channels.meta +8 -0
- package/Runtime/Listeners/BoolEventListener.cs +2 -0
- package/Runtime/Listeners/GameObjectEventListener.cs +51 -0
- package/Runtime/Listeners/GameObjectEventListener.cs.meta +11 -0
- package/Runtime/Listeners/IntGameObjectEventListener.cs +49 -0
- package/Runtime/Listeners/IntGameObjectEventListener.cs.meta +11 -0
- package/Runtime/ScriptableObjects/GameObjectEventChannelSO.cs +16 -0
- package/Runtime/ScriptableObjects/GameObjectEventChannelSO.cs.meta +11 -0
- package/Runtime/ScriptableObjects/IntGameObjectEventChannelSO.cs +17 -0
- package/Runtime/ScriptableObjects/IntGameObjectEventChannelSO.cs.meta +11 -0
- package/Runtime/ScriptableObjects/VoidEventChannelSO.cs +1 -0
- package/Runtime/SenderInterfaces/GameObjectEventSender.cs +21 -0
- package/Runtime/SenderInterfaces/GameObjectEventSender.cs.meta +11 -0
- package/Runtime/SenderInterfaces/IGameObjectEventSender.cs +10 -0
- package/Runtime/SenderInterfaces/IGameObjectEventSender.cs.meta +11 -0
- package/Runtime/SenderInterfaces/IntGameObjectEventSender.cs +21 -0
- package/Runtime/SenderInterfaces/IntGameObjectEventSender.cs.meta +11 -0
- package/Samples/PlayerChannels/PokeEvent.asset +16 -0
- package/Samples/PlayerChannels/PokeEvent.asset.meta +8 -0
- package/Samples/PlayerChannels/TeleportationState.asset +16 -0
- package/Samples/PlayerChannels/TeleportationState.asset.meta +8 -0
- package/package.json +1 -1
|
@@ -25,6 +25,7 @@ namespace jeanf.EventSystem
|
|
|
25
25
|
[SerializeField] private bool _isDebug = false;
|
|
26
26
|
|
|
27
27
|
[SerializeField] private BoolEventChannelSO _channel = default;
|
|
28
|
+
[SerializeField] private bool invertIncomingValue = false;
|
|
28
29
|
|
|
29
30
|
public BoolEvent OnEventRaised;
|
|
30
31
|
|
|
@@ -42,6 +43,7 @@ namespace jeanf.EventSystem
|
|
|
42
43
|
|
|
43
44
|
private void Respond(bool value)
|
|
44
45
|
{
|
|
46
|
+
if (invertIncomingValue) value = !value;
|
|
45
47
|
OnEventRaised?.Invoke(value);
|
|
46
48
|
if(isDebug) Debug.Log($" bool event raised: {value}");
|
|
47
49
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
using System.Collections;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using UnityEngine.Events;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// To use a generic UnityEvent type you must override the generic type.
|
|
8
|
+
/// </summary>
|
|
9
|
+
namespace jeanf.EventSystem
|
|
10
|
+
{
|
|
11
|
+
[System.Serializable]
|
|
12
|
+
public class GameObjectEvent : UnityEvent<GameObject>
|
|
13
|
+
{
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
|
|
19
|
+
/// </summary>
|
|
20
|
+
public class GameObjectEventListener : MonoBehaviour, IDebugBehaviour
|
|
21
|
+
{
|
|
22
|
+
public bool isDebug
|
|
23
|
+
{
|
|
24
|
+
get => _isDebug;
|
|
25
|
+
set => _isDebug = value;
|
|
26
|
+
}
|
|
27
|
+
[SerializeField] private bool _isDebug = false;
|
|
28
|
+
|
|
29
|
+
[SerializeField] private GameObjectEventChannelSO _channel = default;
|
|
30
|
+
|
|
31
|
+
public GameObjectEvent OnEventRaised;
|
|
32
|
+
|
|
33
|
+
private void OnEnable()
|
|
34
|
+
{
|
|
35
|
+
if (_channel != null)
|
|
36
|
+
_channel.OnEventRaised += Respond;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private void OnDisable()
|
|
40
|
+
{
|
|
41
|
+
if (_channel != null)
|
|
42
|
+
_channel.OnEventRaised -= Respond;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private void Respond(GameObject value)
|
|
46
|
+
{
|
|
47
|
+
OnEventRaised?.Invoke(value);
|
|
48
|
+
if(isDebug) Debug.Log($" gameObject event raised: {value}");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -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 IntGameObjectEvent : UnityEvent<int, GameObject>
|
|
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 IntGameObjectEventListener : 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 IntGameObjectEventChannelSO _channel = default;
|
|
28
|
+
|
|
29
|
+
public IntGameObjectEvent 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, GameObject value)
|
|
44
|
+
{
|
|
45
|
+
OnEventRaised?.Invoke(nb, value);
|
|
46
|
+
if(isDebug) Debug.Log($" int-gameObject event raised: <{nb},{value}>");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
|
+
{
|
|
6
|
+
[CreateAssetMenu(menuName = "Events/GameObject Event Channel")]
|
|
7
|
+
public class GameObjectEventChannelSO : DescriptionBaseSO
|
|
8
|
+
{
|
|
9
|
+
public UnityAction<GameObject> OnEventRaised;
|
|
10
|
+
|
|
11
|
+
public void RaiseEvent(GameObject value)
|
|
12
|
+
{
|
|
13
|
+
OnEventRaised?.Invoke(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEngine.Events;
|
|
3
|
+
|
|
4
|
+
namespace jeanf.EventSystem
|
|
5
|
+
{
|
|
6
|
+
[CreateAssetMenu(menuName = "Events/<Int,GameObject> Event Channel")]
|
|
7
|
+
|
|
8
|
+
public class IntGameObjectEventChannelSO : DescriptionBaseSO
|
|
9
|
+
{
|
|
10
|
+
public UnityAction<int, GameObject> OnEventRaised;
|
|
11
|
+
|
|
12
|
+
public void RaiseEvent(int nb, GameObject value)
|
|
13
|
+
{
|
|
14
|
+
OnEventRaised?.Invoke(nb, value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace jeanf.EventSystem
|
|
4
|
+
{
|
|
5
|
+
public class GameObjectEventSender : 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 GameObjectEventChannelSO GameObjectMessageChannel;
|
|
15
|
+
|
|
16
|
+
public void SendGameObject(GameObject value)
|
|
17
|
+
{
|
|
18
|
+
GameObjectMessageChannel.RaiseEvent(value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
|
|
3
|
+
namespace jeanf.EventSystem
|
|
4
|
+
{
|
|
5
|
+
public class IntGameObjectEventSender : 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 IntGameObjectEventChannelSO gameObjectMessageChannel;
|
|
15
|
+
|
|
16
|
+
public void SendIntBool(int nb, GameObject value)
|
|
17
|
+
{
|
|
18
|
+
gameObjectMessageChannel.RaiseEvent(nb, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!114 &11400000
|
|
4
|
+
MonoBehaviour:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
m_GameObject: {fileID: 0}
|
|
10
|
+
m_Enabled: 1
|
|
11
|
+
m_EditorHideFlags: 0
|
|
12
|
+
m_Script: {fileID: 11500000, guid: ad082b8ba1f184e40b683b8289db4f24, type: 3}
|
|
13
|
+
m_Name: PokeEvent
|
|
14
|
+
m_EditorClassIdentifier:
|
|
15
|
+
_guid:
|
|
16
|
+
description:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
%YAML 1.1
|
|
2
|
+
%TAG !u! tag:unity3d.com,2011:
|
|
3
|
+
--- !u!114 &11400000
|
|
4
|
+
MonoBehaviour:
|
|
5
|
+
m_ObjectHideFlags: 0
|
|
6
|
+
m_CorrespondingSourceObject: {fileID: 0}
|
|
7
|
+
m_PrefabInstance: {fileID: 0}
|
|
8
|
+
m_PrefabAsset: {fileID: 0}
|
|
9
|
+
m_GameObject: {fileID: 0}
|
|
10
|
+
m_Enabled: 1
|
|
11
|
+
m_EditorHideFlags: 0
|
|
12
|
+
m_Script: {fileID: 11500000, guid: e0ed7a8546959a8479bb135ed3cf5fc1, type: 3}
|
|
13
|
+
m_Name: TeleportationState
|
|
14
|
+
m_EditorClassIdentifier:
|
|
15
|
+
_guid:
|
|
16
|
+
description:
|
package/package.json
CHANGED