diff --git a/Event Logger/Scriptable Variables/BooleanGameEventLogger.cs b/Event Logger/Scriptable Variables/BooleanGameEventLogger.cs new file mode 100644 index 0000000000000000000000000000000000000000..2b0ba488f9571c4ebca0591434b889d3bb81a506 --- /dev/null +++ b/Event Logger/Scriptable Variables/BooleanGameEventLogger.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using Shared.ScriptableVariables; + +namespace Shared.EventLog { + // Logs a boolean game event when it is raised + // Depends on ScriptableVariable package + public class BooleanGameEventLogger : BooleanGameEventListener { + [Tooltip("The event log to add the event trigger log to")] + public EventLog eventLog; + [Tooltip("The custom key to use in the event log (if not set, the key will be the event name itself)")] + public string customKey; + [Tooltip("The custom format of the event value output (if not set, the value will be the ToString() of the value)")] + public string customValueFormat; + + //--------------------------------------------------------------------------- + // Overridden event listening function to add the event to the event log + public override void OnEventRaised(bool value) { + eventLog.Add(string.IsNullOrEmpty(customKey) ? $"{eventToListenTo.name} Triggered" : customKey, !string.IsNullOrEmpty(customValueFormat) ? string.Format(customValueFormat, value) : value.ToString()); + base.OnEventRaised(value); + } + } +} diff --git a/Event Logger/Scriptable Variables/BooleanGameEventLogger.cs.meta b/Event Logger/Scriptable Variables/BooleanGameEventLogger.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e48a86b29dd0ac87ae8c4cb19dab55d03f7f00bb --- /dev/null +++ b/Event Logger/Scriptable Variables/BooleanGameEventLogger.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 8e522c9f678eaa648a263ea5e6919776 +timeCreated: 1510685488 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Event Logger/Scriptable Variables/FloatGameEventLogger.cs b/Event Logger/Scriptable Variables/FloatGameEventLogger.cs new file mode 100644 index 0000000000000000000000000000000000000000..42692280b9e1831568ab7753bef71a3fe27298ea --- /dev/null +++ b/Event Logger/Scriptable Variables/FloatGameEventLogger.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using Shared.ScriptableVariables; + +namespace Shared.EventLog { + // Logs a float game event when it is raised + // Depends on ScriptableVariable package + public class FloatGameEventLogger : FloatGameEventListener { + [Tooltip("The event log to add the event trigger log to")] + public EventLog eventLog; + [Tooltip("The custom key to use in the event log (if not set, the key will be the event name itself)")] + public string customKey; + [Tooltip("The custom format of the event value output (if not set, the value will be the ToString() of the value)")] + public string customValueFormat; + + //--------------------------------------------------------------------------- + // Overridden event listening function to add the event to the event log + public override void OnEventRaised(float value) { + eventLog.Add(string.IsNullOrEmpty(customKey) ? $"{eventToListenTo.name} Triggered" : customKey, !string.IsNullOrEmpty(customValueFormat) ? string.Format(customValueFormat, value) : value.ToString()); + base.OnEventRaised(value); + } + } +} diff --git a/Event Logger/Scriptable Variables/FloatGameEventLogger.cs.meta b/Event Logger/Scriptable Variables/FloatGameEventLogger.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..ef7469f91fec8c213d418d2b52360b746c302f16 --- /dev/null +++ b/Event Logger/Scriptable Variables/FloatGameEventLogger.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 5e790628a507f5d449c58dc70a429127 +timeCreated: 1510685488 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Event Logger/Scriptable Variables/GameEventLogger.cs b/Event Logger/Scriptable Variables/GameEventLogger.cs index 72746321ee7f8901b11ab58257782b5db74c5aeb..2b0136117323830151940423b68338ae47b72084 100644 --- a/Event Logger/Scriptable Variables/GameEventLogger.cs +++ b/Event Logger/Scriptable Variables/GameEventLogger.cs @@ -7,11 +7,15 @@ namespace Shared.EventLog { public class GameEventLogger : GameEventListener { [Tooltip("The event log to add the event trigger log to")] public EventLog eventLog; + [Tooltip("The custom key to use in the event log")] + public string customKey; + [Tooltip("The custom value to use in the event log")] + public string customValue; //--------------------------------------------------------------------------- // Overridden event listening function to add the event to the event log public override void OnEventRaised() { - eventLog.Add(eventToListenTo.name + " Triggered", ""); + eventLog.Add(string.IsNullOrEmpty(customKey) ? $"{eventToListenTo.name} Triggered" : customKey, string.IsNullOrEmpty(customValue) ? "" : customValue); base.OnEventRaised(); } } diff --git a/Event Logger/Scriptable Variables/IntGameEventLogger.cs b/Event Logger/Scriptable Variables/IntGameEventLogger.cs new file mode 100644 index 0000000000000000000000000000000000000000..2b058fbe9613fb32379db156af5d09e909414532 --- /dev/null +++ b/Event Logger/Scriptable Variables/IntGameEventLogger.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using Shared.ScriptableVariables; + +namespace Shared.EventLog { + // Logs a int game event when it is raised + // Depends on ScriptableVariable package + public class IntGameEventLogger : IntGameEventListener { + [Tooltip("The event log to add the event trigger log to")] + public EventLog eventLog; + [Tooltip("The custom key to use in the event log (if not set, the key will be the event name itself)")] + public string customKey; + [Tooltip("The custom format of the event value output (if not set, the value will be the ToString() of the value)")] + public string customValueFormat; + + //--------------------------------------------------------------------------- + // Overridden event listening function to add the event to the event log + public override void OnEventRaised(int value) { + eventLog.Add(string.IsNullOrEmpty(customKey) ? $"{eventToListenTo.name} Triggered" : customKey, !string.IsNullOrEmpty(customValueFormat) ? string.Format(customValueFormat, value) : value.ToString()); + base.OnEventRaised(value); + } + } +} diff --git a/Event Logger/Scriptable Variables/IntGameEventLogger.cs.meta b/Event Logger/Scriptable Variables/IntGameEventLogger.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..9920d970f2f4854d9c2acbc640f374f87c93dd10 --- /dev/null +++ b/Event Logger/Scriptable Variables/IntGameEventLogger.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 21cd7582d990fe44a9d0987067a01d07 +timeCreated: 1510685488 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Event Logger/Scriptable Variables/StringGameEventLogger.cs b/Event Logger/Scriptable Variables/StringGameEventLogger.cs new file mode 100644 index 0000000000000000000000000000000000000000..5dccdfc1ad954cc10ffe8722abb46ef44b845111 --- /dev/null +++ b/Event Logger/Scriptable Variables/StringGameEventLogger.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using Shared.ScriptableVariables; + +namespace Shared.EventLog { + // Logs a string game event when it is raised + // Depends on ScriptableVariable package + public class StringGameEventLogger : StringGameEventListener { + [Tooltip("The event log to add the event trigger log to")] + public EventLog eventLog; + [Tooltip("The custom key to use in the event log (if not set, the key will be the event name itself)")] + public string customKey; + [Tooltip("The custom format of the event value output (if not set, the value will be the ToString() of the value)")] + public string customValueFormat; + + //--------------------------------------------------------------------------- + // Overridden event listening function to add the event to the event log + public override void OnEventRaised(string value) { + eventLog.Add(string.IsNullOrEmpty(customKey) ? $"{eventToListenTo.name} Triggered" : customKey, !string.IsNullOrEmpty(customValueFormat) ? string.Format(customValueFormat, value) : value); + base.OnEventRaised(value); + } + } +} diff --git a/Event Logger/Scriptable Variables/StringGameEventLogger.cs.meta b/Event Logger/Scriptable Variables/StringGameEventLogger.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..f73156c74aaac196f33d9199df70de81b2664d5c --- /dev/null +++ b/Event Logger/Scriptable Variables/StringGameEventLogger.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 149bda40b8fd7124eb7f66dff5220467 +timeCreated: 1510685488 +licenseType: Pro +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: