fr.jeanf.eventsystem 0.1.97 → 0.1.99

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,39 @@
1
+ #if UNITY_EDITOR
2
+ using System.Collections;
3
+ using System.Collections.Generic;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+
7
+ namespace jeanf.EventSystem
8
+ {
9
+ public class StringListEventOnClick : MonoBehaviour
10
+ {
11
+ [Header("Broadcasting On:")]
12
+ [SerializeField] private StringListEventChannelSO testChannel;
13
+
14
+ [Space(20)]
15
+ [SerializeField] private List<string> valueToSend;
16
+
17
+ public void CallFunction()
18
+ {
19
+ testChannel.RaiseEvent(valueToSend);
20
+ }
21
+ }
22
+
23
+ [CustomEditor(typeof(StringListEventOnClick))]
24
+ public class SendStringEventOnClickEditor: Editor
25
+ {
26
+ public override void OnInspectorGUI()
27
+ {
28
+ DrawDefaultInspector();
29
+ var eventToSend = (StringListEventOnClick)target;
30
+ if(GUILayout.Button("Send String List", GUILayout.Height(30)))
31
+ {
32
+ eventToSend.CallFunction();
33
+ }
34
+ GUILayout.Space(10);
35
+ }
36
+ }
37
+ }
38
+ #endif
39
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 96c221eeadeaf2e4eb41dfbacd3a6d97
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,43 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ using UnityEngine.Events;
5
+
6
+ namespace jeanf.EventSystem
7
+ {
8
+ [System.Serializable]
9
+ public class StringListEvent: UnityEvent<List<string>>
10
+ {
11
+
12
+ }
13
+
14
+ public class StringListEventListener : MonoBehaviour
15
+ {
16
+ public StringListEventChannelSO _channel = default;
17
+
18
+ public StringListEvent OnStringListEventRaised;
19
+
20
+ private void OnEnable()
21
+ {
22
+ if (_channel != null)
23
+ _channel.OnEventRaised += Respond;
24
+ }
25
+
26
+ private void OnDisable()
27
+ {
28
+ if (_channel != null)
29
+ _channel.OnEventRaised -= Respond;
30
+ }
31
+
32
+ private void Respond(List<string> list)
33
+ {
34
+ OnStringListEventRaised?.Invoke(list);
35
+ }
36
+
37
+ public StringListEventListener(StringListEventChannelSO _channel, StringListEvent OnStringListEventRaised)
38
+ {
39
+ this._channel = _channel;
40
+ this.OnStringListEventRaised = OnStringListEventRaised;
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a3302b9f7830ce6418d0bf8d1ad85a30
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,23 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+
5
+ namespace jeanf.EventSystem
6
+ {
7
+ public class StringListEventSender : MonoBehaviour, IDebugBehaviour
8
+ {
9
+ public bool isDebug
10
+ {
11
+ get => _isDebug;
12
+ set => _isDebug = value;
13
+ }
14
+ [SerializeField] private bool _isDebug = false;
15
+ [field: Header("Broadcasting on:")] public StringListEventChannelSO stringListEventChannel;
16
+
17
+ public void SendStringList(List<string> list)
18
+ {
19
+ stringListEventChannel.RaiseEvent(list);
20
+ }
21
+
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: bb0c04d2d8282934f9f1f95ce4500a18
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.97",
3
+ "version": "0.1.99",
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",