fr.jeanf.eventsystem 0.1.65 → 0.1.67

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.
@@ -0,0 +1,50 @@
1
+ using System;
2
+ using UnityEngine;
3
+ using UnityEngine.Events;
4
+
5
+ /// <summary>
6
+ /// To use a generic UnityEvent type you must override the generic type.
7
+ /// </summary>
8
+ namespace jeanf.EventSystem
9
+ {
10
+ [System.Serializable]
11
+ public class DateTimeEvent : UnityEvent<DateTime>
12
+ {
13
+
14
+ }
15
+
16
+ /// <summary>
17
+ /// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
18
+ /// </summary>
19
+ public class DateTimeEventListener : MonoBehaviour, IDebugBehaviour
20
+ {
21
+ public bool isDebug
22
+ {
23
+ get => _isDebug;
24
+ set => _isDebug = value;
25
+ }
26
+ [SerializeField] private bool _isDebug = false;
27
+
28
+ [SerializeField] private DateTimeEventChannelSO _channel = default;
29
+
30
+ public DateTimeEvent OnEventRaised;
31
+
32
+ private void OnEnable()
33
+ {
34
+ if (_channel != null)
35
+ _channel.OnEventRaised += Respond;
36
+ }
37
+
38
+ private void OnDisable()
39
+ {
40
+ if (_channel != null)
41
+ _channel.OnEventRaised -= Respond;
42
+ }
43
+
44
+ private void Respond(DateTime value)
45
+ {
46
+ OnEventRaised?.Invoke(value);
47
+ if(isDebug) Debug.Log($" bool event raised: {value}");
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 31e074f6ae236be418967598416b8727
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,17 @@
1
+ using System;
2
+ using UnityEngine;
3
+ using UnityEngine.Events;
4
+
5
+ namespace jeanf.EventSystem
6
+ {
7
+ [CreateAssetMenu(menuName = "Events/DateTime Event Channel")]
8
+ public class DateTimeEventChannelSO : DescriptionBaseSO
9
+ {
10
+ public UnityAction<DateTime> OnEventRaised;
11
+
12
+ public void RaiseEvent(DateTime value)
13
+ {
14
+ OnEventRaised?.Invoke(value);
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ba97a5c1597b7154ba7d47d2de2b0356
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,20 @@
1
+ using System;
2
+ using jeanf.EventSystem;
3
+ using UnityEngine;
4
+
5
+ public class DateTimeEventSender : 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 DateTimeEventChannelSO boolMessageChannel;
15
+
16
+ public void SendBool(DateTime value)
17
+ {
18
+ boolMessageChannel.RaiseEvent(value);
19
+ }
20
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0a31a7a249641724797e1e2e4fb0499b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,19 @@
1
+ using jeanf.EventSystem;
2
+ using UnityEngine;
3
+
4
+ public class IntEventSender : MonoBehaviour, IDebugBehaviour
5
+ {
6
+ public bool isDebug
7
+ {
8
+ get => _isDebug;
9
+ set => _isDebug = value;
10
+ }
11
+ [SerializeField] private bool _isDebug = false;
12
+
13
+ [field: Header("Broadcasting on:")] public IntEventChannelSO intMessageChannel;
14
+
15
+ public void SendInt(int value)
16
+ {
17
+ intMessageChannel.RaiseEvent(value);
18
+ }
19
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: fcb9eb5af08078243a842c18f70cf15c
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"fr.jeanf.eventsystem",
3
- "version":"0.1.65",
3
+ "version":"0.1.67",
4
4
  "displayName":"Event System",
5
5
  "description":"This package contains a basic Event System based on Scriptable Objects as communication medium",
6
6
  "unity": "2021.3",