├── .gitignore ├── Build ├── Source Code │ └── Assets │ │ ├── Editor │ │ └── EventBinder │ │ │ ├── EventBinderBehaviourEditor.cs │ │ │ ├── EventBinderBehaviourEditor.cs.meta │ │ │ ├── EventTriggerBehaviourEditor.cs │ │ │ └── EventTriggerBehaviourEditor.cs.meta │ │ └── Plugins │ │ └── EventBinder │ │ ├── Controllers.meta │ │ ├── Controllers │ │ ├── EventBinderBehaviour.cs │ │ └── EventBinderBehaviour.cs.meta │ │ ├── Editor.meta │ │ ├── Extensions.meta │ │ ├── Extensions │ │ ├── Extensions.cs │ │ └── Extensions.cs.meta │ │ ├── Model.meta │ │ ├── Model │ │ ├── EventBinderModel.cs │ │ ├── EventBinderModel.cs.meta │ │ ├── EventsCollection.cs │ │ ├── EventsCollection.cs.meta │ │ ├── TriggersCollection.cs │ │ └── TriggersCollection.cs.meta │ │ ├── Sample.meta │ │ ├── Sample │ │ ├── EventBinderSampleListenerController.cs │ │ ├── EventBinderSampleListenerController.cs.meta │ │ ├── EventBinderSampleScene.unity │ │ └── EventBinderSampleScene.unity.meta │ │ ├── Utils.meta │ │ └── Utils │ │ ├── SerializableSystemType.cs │ │ └── SerializableSystemType.cs.meta └── Unity Asset │ └── EventBinder 07.03.2018 - 02.unitypackage ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /Assets/AssetStoreTools* 5 | 6 | # Visual Studio 2015 cache directory 7 | /.vs/ 8 | 9 | # Autogenerated VS/MD/Consulo solution and project files 10 | ExportedObj/ 11 | .consulo/ 12 | *.csproj 13 | *.unityproj 14 | *.sln 15 | *.suo 16 | *.tmp 17 | *.user 18 | *.userprefs 19 | *.pidb 20 | *.booproj 21 | *.svd 22 | *.pdb 23 | 24 | # Unity3D generated meta files 25 | *.pidb.meta 26 | 27 | # Unity3D Generated File On Crash Reports 28 | sysinfo.txt 29 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Editor/EventBinder/EventBinderBehaviourEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Runtime.Serialization; 7 | using UnityEditor; 8 | using UnityEditor.SceneManagement; 9 | using UnityEngine; 10 | using UnityEngine.Events; 11 | using UnityEngine.EventSystems; 12 | using UnityEngine.SceneManagement; 13 | 14 | namespace EventBinder 15 | { 16 | [CustomEditor(typeof(EventBinderBehaviour))] 17 | public class EventBinderBehaviourEditor: Editor 18 | { 19 | private static List actionsList = new List(); 20 | private static List actionsNamesList = new List(); 21 | 22 | private bool showArguments; 23 | 24 | // Called everytime the Component is in focus 25 | public override void OnInspectorGUI() 26 | { 27 | if (Application.isPlaying) return; 28 | 29 | Undo.RecordObject(target, "EventTriggerBehaviour"); 30 | 31 | EventBinderBehaviour behaviour = target as EventBinderBehaviour; 32 | 33 | DrawDefaultInspector(); 34 | 35 | EditorGUILayout.Space(); 36 | 37 | // Select the EventsCollection class - let the user add his own class 38 | behaviour.eventsCollectionScript = EditorGUILayout.ObjectField ("Events Class", behaviour.eventsCollectionScript, typeof(MonoScript), true) as TextAsset; 39 | 40 | MonoScript eventsScript = null; 41 | try 42 | { 43 | eventsScript = (MonoScript) behaviour.eventsCollectionScript; 44 | } 45 | // If no class was selected, select the default class, with the name "EventsCollection" 46 | catch (Exception e) 47 | { 48 | string[] assets = AssetDatabase.FindAssets ("EventsCollection"); 49 | string guid = AssetDatabase.GUIDToAssetPath (assets[0]); 50 | 51 | eventsScript = AssetDatabase.LoadAssetAtPath (guid); 52 | behaviour.eventsCollectionScript = eventsScript; 53 | } 54 | 55 | behaviour.eventsCollectionClassType = new SerializableSystemType(eventsScript.GetClass()); 56 | 57 | // Add a GUI Space 58 | EditorGUILayout.Space(); 59 | 60 | 61 | // Check if behaviour is null & Setup Target GameObject 62 | if (behaviour != null && behaviour.targetObject == null) 63 | behaviour.targetObject = behaviour.gameObject; 64 | 65 | // Set the EventTypeIndex , Between: "From Target Object" & "EventTrigger" 66 | // 1. From Target Object - gets an UI Event from every component of the object (eg: onClick event from Button) 67 | // 2. EventTrigger - displays and listens to any event from the EventTriggerType class 68 | behaviour.eventTypeIndex = EditorGUILayout.Popup ("Event Type", behaviour.eventTypeIndex, new []{"From Target Object - UnityEvent", "EventTrigger Type"}); 69 | 70 | bool eventsFound = true; 71 | 72 | // If "From Target Object" is selected 73 | if (behaviour.eventTypeIndex == 0) 74 | { 75 | behaviour.ClearEventTrigger(); 76 | 77 | List componentNames = new List(); 78 | List componentsList = new List(); 79 | 80 | List propertiesNames = new List(); 81 | 82 | foreach (Component loopComponent in behaviour.targetObject.GetComponents(typeof(Component))) 83 | { 84 | componentsList.Add (loopComponent); 85 | componentNames.Add (loopComponent.GetType().ToString()); 86 | } 87 | 88 | behaviour.eventComponentIndex = EditorGUILayout.Popup ("Component", behaviour.eventComponentIndex, componentNames.ToArray()); 89 | 90 | if (behaviour.eventComponentIndex != -1 && behaviour.eventComponentIndex < componentsList.Count) 91 | { 92 | Component eventComponent = componentsList.ElementAt (behaviour.eventComponentIndex); 93 | 94 | // Iterate through all Properties of the selected component 95 | foreach (PropertyInfo propertyInfo in eventComponent.GetType().GetProperties (BindingFlags.Instance | BindingFlags.Public)) 96 | { 97 | // If the property is an UnityEvent -> Add the name to the "propertiesNames" list 98 | if (propertyInfo.PropertyType.BaseType == typeof(UnityEvent)) propertiesNames.Add (propertyInfo.Name); 99 | } 100 | 101 | // If the "propertiesNames" list is Empty -> tell the user that no events have been found 102 | if (propertiesNames.Count == 0) 103 | { 104 | eventsFound = false; 105 | EditorGUILayout.LabelField ("No Events found"); 106 | } 107 | // If at least one event has been found 108 | else 109 | { 110 | // Display a Popup Dropdown with the events found for the user to select 111 | behaviour.eventPropertyIndex = EditorGUILayout.Popup ("Event Property", behaviour.eventPropertyIndex, propertiesNames.ToArray()); 112 | 113 | if (behaviour.eventPropertyIndex != -1 && propertiesNames.Count > behaviour.eventPropertyIndex) 114 | { 115 | behaviour.selectedUnityEventBase = eventComponent.GetType().GetProperty (propertiesNames.ElementAt (behaviour.eventPropertyIndex)).GetValue (eventComponent, null) as UnityEventBase; 116 | behaviour.RefreshUnityEventBase(); 117 | } 118 | } 119 | } 120 | } 121 | // If an event from the "EventTriggerType" class is selected 122 | else if (behaviour.eventTypeIndex == 1) 123 | { 124 | behaviour.eventTriggerType = (EventTriggerType) behaviour.eventIndex; 125 | 126 | if (!Application.isPlaying) behaviour.RefreshEventTriggerList(); 127 | 128 | behaviour.eventIndex = EditorGUILayout.Popup ("Event Trigger", behaviour.eventIndex, Enum.GetNames (typeof(EventTriggerType))); 129 | } 130 | 131 | // If no event is found, Save GUI and Stop 132 | if (!eventsFound) 133 | { 134 | if (!Application.isPlaying) EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); 135 | return; 136 | } 137 | 138 | // Get actions list 139 | // Save the Actions in "actionsList" 140 | // Save the Action names in the "actionNamesList" 141 | 142 | actionsList = new List(); 143 | actionsNamesList = new List(); 144 | FieldInfo[] fieldsCollection = behaviour.eventsCollectionClassType.SystemType.GetFields (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); 145 | foreach (FieldInfo fieldInfo in fieldsCollection) 146 | { 147 | actionsList.Add (fieldInfo.GetValue (null) as Delegate); 148 | actionsNamesList.Add (fieldInfo.Name); 149 | } 150 | 151 | // Adds 2 vertical spaces to the GUI 152 | EditorGUILayout.Space(); EditorGUILayout.Space(); 153 | 154 | // Save the deleateIndex and the targetDelegate to the Behaviour class after the user has made a choice 155 | if (behaviour.delegateIndex > actionsNamesList.Count) behaviour.delegateIndex = 0; 156 | behaviour.delegateIndex = EditorGUILayout.Popup ("Event Delegate", behaviour.delegateIndex, actionsNamesList.ToArray()); 157 | behaviour.targetDelegate = actionsList[behaviour.delegateIndex]; 158 | 159 | // Initializez all List components from the behaviour 160 | CreateArgumentsLists (behaviour); 161 | 162 | // If TargetDelegate from Behaviour is not null 163 | if(behaviour.targetDelegate != null) 164 | { 165 | ParameterInfo[] parametersList = behaviour.targetDelegate.Method.GetParameters(); 166 | 167 | // If the selected TargetDelegate has any parameters -> Add 2 spaces to the GUI 168 | if (parametersList.Length > 0) 169 | { 170 | EditorGUILayout.Space(); 171 | EditorGUILayout.Space(); 172 | 173 | showArguments = EditorGUILayout.Foldout (showArguments,"Arguments"); 174 | 175 | if (showArguments) 176 | { 177 | // Iterate through all parameters 178 | for (int index = 0; index < parametersList.Length; index++) 179 | { 180 | ParameterInfo parameterInfo = parametersList[index]; 181 | 182 | string textFieldName = parameterInfo.Name; 183 | if (textFieldName == "") textFieldName = "Argument " + (index + 1); 184 | 185 | // Show the NAME and the TYPE of the parameter 186 | EditorGUILayout.LabelField (textFieldName + ": " + parameterInfo.ParameterType, EditorStyles.boldLabel); 187 | 188 | behaviour.argsChoiceIndexList[index] = EditorGUILayout.Popup ("Argument type", behaviour.argsChoiceIndexList[index], Enum.GetNames (typeof(EventArgumentKind))); 189 | //STRING 190 | if (parameterInfo.ParameterType == typeof(string)) 191 | { 192 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.stringArgs[index] = EditorGUILayout.TextField ("Value", behaviour.stringArgs[index]); 193 | else SetupDynamicArgument (behaviour, index, typeof(string)); 194 | 195 | behaviour.argumentTypes[index] = EventArgumentType.String; 196 | } 197 | 198 | /**SYSTEM TYPE ARGUMENTS*/ 199 | 200 | //BOOLEAN 201 | if (parameterInfo.ParameterType == typeof(bool)) 202 | { 203 | if (behaviour.argsChoiceIndexList[index] == 0) 204 | { 205 | if (string.IsNullOrEmpty (behaviour.stringArgs[index])) behaviour.stringArgs[index] = "false"; 206 | behaviour.stringArgs[index] = EditorGUILayout.Toggle ("Value", Convert.ToBoolean (behaviour.stringArgs[index])).ToString(); 207 | } 208 | else SetupDynamicArgument (behaviour, index, typeof(bool)); 209 | 210 | behaviour.argumentTypes[index] = EventArgumentType.Boolean; 211 | } 212 | 213 | /**NUMBER TYPE ARGUMENTS*/ 214 | 215 | //INT 216 | else if (parameterInfo.ParameterType == typeof(int)) 217 | { 218 | if (behaviour.argsChoiceIndexList[index] == 0) 219 | { 220 | if (string.IsNullOrEmpty (behaviour.stringArgs[index])) behaviour.stringArgs[index] = "0"; 221 | behaviour.stringArgs[index] = EditorGUILayout.IntField ("Value", behaviour.stringArgs[index].ParseToInt()).ToString(); 222 | } 223 | else SetupDynamicArgument (behaviour, index, typeof(int)); 224 | 225 | behaviour.argumentTypes[index] = EventArgumentType.Int; 226 | } 227 | //FLOAT 228 | else if (parameterInfo.ParameterType == typeof(float)) 229 | { 230 | if (behaviour.argsChoiceIndexList[index] == 0) 231 | { 232 | if (string.IsNullOrEmpty (behaviour.stringArgs[index])) behaviour.stringArgs[index] = "0"; 233 | behaviour.stringArgs[index] = EditorGUILayout.FloatField ("Value", behaviour.stringArgs[index].ParseToFloat()).ToString (CultureInfo.InvariantCulture); 234 | } 235 | else SetupDynamicArgument (behaviour, index, typeof(float)); 236 | 237 | behaviour.argumentTypes[index] = EventArgumentType.Float; 238 | } 239 | //DOUBLE 240 | else if (parameterInfo.ParameterType == typeof(double)) 241 | { 242 | if (behaviour.argsChoiceIndexList[index] == 0) 243 | { 244 | if (string.IsNullOrEmpty (behaviour.stringArgs[index])) behaviour.stringArgs[index] = "0"; 245 | behaviour.stringArgs[index] = EditorGUILayout.DoubleField ("Value", behaviour.stringArgs[index].ParseToDouble()).ToString (CultureInfo.InvariantCulture); 246 | } 247 | else SetupDynamicArgument (behaviour, index, typeof(double)); 248 | 249 | behaviour.argumentTypes[index] = EventArgumentType.Double; 250 | } 251 | 252 | /**VECTOR TYPE ARGUMENTS*/ 253 | 254 | //VECTOR 2 255 | else if (parameterInfo.ParameterType == typeof(Vector2)) 256 | { 257 | if (behaviour.argsChoiceIndexList[index] == 0) 258 | { 259 | if (string.IsNullOrEmpty (behaviour.stringArgs[index]) || !behaviour.stringArgs[index].CanDeserializeToVector2()) 260 | behaviour.stringArgs[index] = new Vector2().SerializeToString(); 261 | behaviour.stringArgs[index] = EditorGUILayout.Vector2Field ("Value", behaviour.stringArgs[index].DeserializeToVector2()).SerializeToString(); 262 | } 263 | else SetupDynamicArgument (behaviour, index, typeof(Vector2)); 264 | 265 | behaviour.argumentTypes[index] = EventArgumentType.Vector2; 266 | } 267 | //VECTOR 3 268 | else if (parameterInfo.ParameterType == typeof(Vector3)) 269 | { 270 | if (behaviour.argsChoiceIndexList[index] == 0) 271 | { 272 | if (string.IsNullOrEmpty (behaviour.stringArgs[index]) || !behaviour.stringArgs[index].CanDeserializeToVector3()) 273 | behaviour.stringArgs[index] = new Vector3().SerializeToString(); 274 | behaviour.stringArgs[index] = EditorGUILayout.Vector3Field ("Value", behaviour.stringArgs[index].DeserializeToVector3()).SerializeToString(); 275 | } 276 | else SetupDynamicArgument (behaviour, index, typeof(Vector3)); 277 | 278 | behaviour.argumentTypes[index] = EventArgumentType.Vector3; 279 | } 280 | //VECTOR 4 281 | else if (parameterInfo.ParameterType == typeof(Vector4)) 282 | { 283 | if (behaviour.argsChoiceIndexList[index] == 0) 284 | { 285 | if (string.IsNullOrEmpty (behaviour.stringArgs[index]) || !behaviour.stringArgs[index].CanDeserializeToVector4()) 286 | behaviour.stringArgs[index] = new Vector4().SerializeToString(); 287 | behaviour.stringArgs[index] = EditorGUILayout.Vector4Field ("Value", behaviour.stringArgs[index].DeserializeToVector4()).SerializeToString(); 288 | } 289 | else SetupDynamicArgument (behaviour, index, typeof(Vector4)); 290 | 291 | behaviour.argumentTypes[index] = EventArgumentType.Vector4; 292 | } 293 | 294 | /**GAME OBJECT TYPE ARGUMENTS*/ 295 | 296 | //GAME OBJECT 297 | else if (parameterInfo.ParameterType == typeof(GameObject)) 298 | { 299 | if (behaviour.argsChoiceIndexList[index] == 0) 300 | behaviour.gameObjectArgs[index] = EditorGUILayout.ObjectField ("Value", behaviour.gameObjectArgs[index], typeof(GameObject), true) as GameObject; 301 | else SetupDynamicArgument (behaviour, index, typeof(GameObject)); 302 | 303 | behaviour.argumentTypes[index] = EventArgumentType.GameObject; 304 | } 305 | 306 | //COMPONENT 307 | else if (parameterInfo.ParameterType == typeof(Component)) 308 | { 309 | if (behaviour.argsChoiceIndexList[index] == 0) 310 | behaviour.componentArgs[index] = EditorGUILayout.ObjectField ("Value", behaviour.componentArgs[index], typeof(Component), true) as Component; 311 | else SetupDynamicArgument (behaviour, index, typeof(Component)); 312 | 313 | behaviour.argumentTypes[index] = EventArgumentType.Component; 314 | } 315 | 316 | /**OTHER TYPE ARGUMENTS*/ 317 | 318 | //COLOR 319 | else if (parameterInfo.ParameterType == typeof(Color)) 320 | { 321 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.colorArgs[index] = EditorGUILayout.ColorField ("Value", behaviour.colorArgs[index]); 322 | else SetupDynamicArgument (behaviour, index, typeof(Color)); 323 | 324 | behaviour.argumentTypes[index] = EventArgumentType.Color; 325 | } 326 | 327 | //ENUM 328 | else if (parameterInfo.ParameterType.BaseType == typeof(Enum)) 329 | { 330 | if (behaviour.argsChoiceIndexList[index] == 0) 331 | { 332 | string[] enumNames = Enum.GetNames (parameterInfo.ParameterType); 333 | int indexPrevSelectedArg = Array.IndexOf (enumNames, behaviour.stringArgs[index]); 334 | if (indexPrevSelectedArg == -1) indexPrevSelectedArg = 0; 335 | behaviour.stringArgs[index] = enumNames.GetValue (EditorGUILayout.Popup ("Value", indexPrevSelectedArg, enumNames)).ToString(); 336 | } 337 | else SetupDynamicArgument (behaviour, index, parameterInfo.ParameterType); 338 | 339 | behaviour.argumentTypes[index] = EventArgumentType.Enum; 340 | } 341 | 342 | if (index < parametersList.Length - 1) 343 | { 344 | EditorGUILayout.Space(); 345 | EditorGUILayout.Space(); 346 | } 347 | } 348 | } 349 | } 350 | 351 | } 352 | 353 | if (!Application.isPlaying) EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); 354 | } 355 | 356 | private void SetupDynamicArgument(EventBinderBehaviour behaviour, int index, Type argumentType) 357 | { 358 | behaviour.argsGameObjectTarget = EditorGUILayout.ObjectField ("Game Object", behaviour.argsGameObjectTarget, typeof(GameObject), true) as GameObject; 359 | 360 | if (behaviour.argsGameObjectTarget == null) return; 361 | 362 | List propertiesNames = new List(); 363 | List componentNames = new List(); 364 | List componentsList = new List(); 365 | 366 | 367 | foreach (Component loopComponent in behaviour.argsGameObjectTarget.GetComponents(typeof(Component))) 368 | { 369 | componentsList.Add (loopComponent); 370 | componentNames.Add (loopComponent.GetType().ToString()); 371 | } 372 | 373 | behaviour.argsComponentIndexes[index] = EditorGUILayout.Popup ("Component", behaviour.argsComponentIndexes[index], componentNames.ToArray()); 374 | behaviour.argsTargetsProperties[index] = null; 375 | 376 | if (behaviour.argsComponentIndexes[index] != -1 && componentsList.Count > behaviour.argsComponentIndexes[index]) 377 | { 378 | behaviour.argsComponents[index] = componentsList.ElementAt (behaviour.argsComponentIndexes[index]); 379 | 380 | foreach (PropertyInfo propertyInfo in behaviour.argsComponents[index].GetType().GetProperties (BindingFlags.Instance | BindingFlags.Public)) 381 | if(propertyInfo.PropertyType == argumentType) propertiesNames.Add (propertyInfo.Name); 382 | 383 | if (propertiesNames.Count == 0) 384 | { 385 | EditorGUILayout.LabelField ("No properties of type [" + argumentType + "] found", EditorStyles.label); 386 | } 387 | else 388 | { 389 | behaviour.argsTargetsPropertiesIndexes[index] = EditorGUILayout.Popup ("Property", behaviour.argsTargetsPropertiesIndexes[index], propertiesNames.ToArray()); 390 | 391 | if (behaviour.argsTargetsPropertiesIndexes[index] != -1 && propertiesNames.Count > behaviour.argsTargetsPropertiesIndexes[index]) 392 | behaviour.argsTargetsProperties[index] = propertiesNames.ElementAt (behaviour.argsTargetsPropertiesIndexes[index]); 393 | } 394 | } 395 | } 396 | 397 | 398 | private void CreateArgumentsLists(EventBinderBehaviour behaviour) 399 | { 400 | if (behaviour.targetDelegate == null) 401 | return; 402 | 403 | int length = behaviour.targetDelegate.Method.GetParameters().Length; 404 | 405 | 406 | //todo: Add || ( OR ) for every if - combining them; 407 | 408 | 409 | if(behaviour.argumentTypes == null || behaviour.argumentTypes.Length != length) behaviour.argumentTypes = new EventArgumentType[length]; 410 | // if() behaviour.argumentTypes = new EventArgumentType[length]; 411 | 412 | if(behaviour.argsChoiceIndexList == null) behaviour.argsChoiceIndexList = new int[length]; 413 | if(behaviour.argsChoiceIndexList.Length != length) behaviour.argsChoiceIndexList = new int[length]; 414 | 415 | 416 | if(behaviour.argsComponents == null) behaviour.argsComponents = new Component[length]; 417 | if(behaviour.argsComponents.Length != length) behaviour.argsComponents = new Component[length]; 418 | 419 | 420 | if(behaviour.argsTargetsProperties == null) behaviour.argsTargetsProperties = new string[length]; 421 | if(behaviour.argsTargetsProperties.Length != length) behaviour.argsTargetsProperties = new string[length]; 422 | 423 | if(behaviour.argsComponentIndexes == null) behaviour.argsComponentIndexes = new int[length]; 424 | if(behaviour.argsComponentIndexes.Length != length) behaviour.argsComponentIndexes = new int[length]; 425 | 426 | if(behaviour.argsTargetsPropertiesIndexes == null) behaviour.argsTargetsPropertiesIndexes = new int[length]; 427 | if(behaviour.argsTargetsPropertiesIndexes.Length != length) behaviour.argsTargetsPropertiesIndexes = new int[length]; 428 | 429 | 430 | /**TYPE OF ARGUMENTS*/ 431 | if(behaviour.stringArgs == null) behaviour.stringArgs = new string[length]; 432 | if(behaviour.stringArgs.Length != length) behaviour.stringArgs = new string[length]; 433 | 434 | if(behaviour.gameObjectArgs == null) behaviour.gameObjectArgs = new GameObject[length]; 435 | if(behaviour.gameObjectArgs.Length != length) behaviour.gameObjectArgs = new GameObject[length]; 436 | 437 | if(behaviour.componentArgs == null) behaviour.componentArgs = new Component[length]; 438 | if(behaviour.componentArgs.Length != length) behaviour.componentArgs = new Component[length]; 439 | 440 | if(behaviour.colorArgs == null) behaviour.colorArgs = new Color[length]; 441 | if(behaviour.colorArgs.Length != length) behaviour.colorArgs = new Color[length]; 442 | } 443 | 444 | } 445 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Editor/EventBinder/EventBinderBehaviourEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd6c44540d418c841865cef34e730ea5 3 | timeCreated: 1518790330 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Editor/EventBinder/EventTriggerBehaviourEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Runtime.Serialization; 6 | using UnityEditor; 7 | using UnityEditor.SceneManagement; 8 | using UnityEngine; 9 | using UnityEngine.Events; 10 | using UnityEngine.EventSystems; 11 | using UnityEngine.SceneManagement; 12 | using UnityEngine.UI; 13 | 14 | namespace EventBinder 15 | { 16 | [CustomEditor(typeof(EventTriggerBehaviour))] 17 | public class EventTriggerBehaviourEditor: Editor 18 | { 19 | private readonly List actionsList = new List(); 20 | private readonly List actionsNamesList = new List(); 21 | 22 | public override void OnInspectorGUI() 23 | { 24 | if (Application.isPlaying) return; 25 | 26 | Debug.Log ("ON INSPECTOR GUI"); 27 | 28 | Undo.RecordObject(target, "EventTriggerBehaviour"); 29 | 30 | EventTriggerBehaviour behaviour = target as EventTriggerBehaviour; 31 | 32 | DrawDefaultInspector(); 33 | 34 | EditorGUILayout.Space(); 35 | 36 | //Setup Target GameObject 37 | if (behaviour.targetObject == null) behaviour.targetObject = behaviour.gameObject; 38 | 39 | behaviour.eventTypeIndex = EditorGUILayout.Popup ("Event Type", behaviour.eventTypeIndex, new []{"From Target Object", "From EventTriggerType"}); 40 | 41 | 42 | bool eventsFound = true; 43 | 44 | if (behaviour.eventTypeIndex == 0) 45 | { 46 | behaviour.ClearEventTrigger(); 47 | 48 | List componentNames = new List(); 49 | List componentsList = new List(); 50 | 51 | List propertiesNames = new List(); 52 | 53 | foreach (Component loopComponent in behaviour.targetObject.GetComponents(typeof(Component))) 54 | { 55 | componentsList.Add (loopComponent); 56 | componentNames.Add (loopComponent.GetType().ToString()); 57 | } 58 | 59 | behaviour.eventComponentIndex = EditorGUILayout.Popup ("Component", behaviour.eventComponentIndex, componentNames.ToArray()); 60 | 61 | if (behaviour.eventComponentIndex != -1 && behaviour.eventComponentIndex < componentsList.Count) 62 | { 63 | behaviour.eventComponent = componentsList.ElementAt (behaviour.eventComponentIndex); 64 | 65 | foreach (PropertyInfo propertyInfo in behaviour.eventComponent.GetType().GetProperties (BindingFlags.Instance | BindingFlags.Public)) 66 | { 67 | if (propertyInfo.PropertyType.BaseType == typeof(UnityEvent)) 68 | propertiesNames.Add (propertyInfo.Name); 69 | } 70 | 71 | 72 | if (propertiesNames.Count == 0) 73 | { 74 | eventsFound = false; 75 | EditorGUILayout.LabelField ("No Events found"); 76 | } 77 | else 78 | { 79 | behaviour.eventPropertyIndex = EditorGUILayout.Popup ("Property", behaviour.eventPropertyIndex, propertiesNames.ToArray()); 80 | 81 | if (behaviour.eventPropertyIndex != -1 && propertiesNames.Count > behaviour.eventPropertyIndex) 82 | { 83 | behaviour.eventProperty = propertiesNames.ElementAt (behaviour.eventPropertyIndex); 84 | 85 | behaviour.selectedUnityEventBase = behaviour.eventComponent.GetType().GetProperty (behaviour.eventProperty).GetValue (behaviour.eventComponent, null) as UnityEventBase; 86 | 87 | behaviour.RefreshUnityEventBase(); 88 | } 89 | } 90 | } 91 | 92 | EditorGUILayout.Space(); 93 | } 94 | else if (behaviour.eventTypeIndex == 1) 95 | { 96 | behaviour.eventTriggerType = (EventTriggerType) behaviour.eventIndex; 97 | 98 | if (!Application.isPlaying) behaviour.RefreshEventTriggerList(); 99 | 100 | EditorGUILayout.Space(); 101 | behaviour.eventIndex = EditorGUILayout.Popup ("Event", behaviour.eventIndex, Enum.GetNames (typeof(EventTriggerType))); 102 | } 103 | 104 | 105 | if (!eventsFound) 106 | { 107 | if (!Application.isPlaying) EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); 108 | return; 109 | } 110 | 111 | // Get actions list 112 | FieldInfo[] fieldsCollection = typeof(TriggersCollection).GetFields (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); 113 | foreach (FieldInfo fieldInfo in fieldsCollection) 114 | { 115 | actionsList.Add (fieldInfo.GetValue (null) as Delegate); 116 | actionsNamesList.Add (fieldInfo.Name); 117 | } 118 | 119 | behaviour.actionIndex = EditorGUILayout.Popup ("Action", behaviour.actionIndex, actionsNamesList.ToArray()); 120 | behaviour.targetDelegate = actionsList[behaviour.actionIndex]; 121 | 122 | CreateArgumentsLists (behaviour); 123 | 124 | if(behaviour.targetDelegate != null) 125 | { 126 | if (behaviour.targetDelegate.Method.GetParameters().Length > 0) 127 | { 128 | EditorGUILayout.Space(); 129 | EditorGUILayout.LabelField ("Arguments"); 130 | EditorGUILayout.Space(); 131 | } 132 | 133 | 134 | for (int index = 0; index < behaviour.targetDelegate.Method.GetParameters().Length; index++) 135 | { 136 | ParameterInfo parameterInfo = behaviour.targetDelegate.Method.GetParameters()[index]; 137 | // Debug.Log ("Parameter for Delegate: " + parameterInfo.ParameterType + "|" + parameterInfo.Name); 138 | 139 | string textFieldName = parameterInfo.Name; 140 | if (textFieldName == "") textFieldName = "Argument " + (index + 1); 141 | 142 | EditorGUILayout.LabelField (textFieldName + ": " + parameterInfo.ParameterType); 143 | 144 | behaviour.argsChoiceIndexList[index] = EditorGUILayout.Popup ("Argument type", behaviour.argsChoiceIndexList[index], Enum.GetNames (typeof(EventTriggerArgumentKind))); 145 | 146 | /**STRING TYPE ARGUMENTS*/ 147 | 148 | //STRING 149 | if (parameterInfo.ParameterType == typeof(string)) 150 | { 151 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.stringArgs[index] = EditorGUILayout.TextField ("Value", behaviour.stringArgs[index]); 152 | else SetupDynamicArgument (behaviour, index, typeof(string)); 153 | 154 | behaviour.argumentTypes[index] = EventTriggerArgumentType.String; 155 | } 156 | 157 | /**NUMBER TYPE ARGUMENTS*/ 158 | 159 | //INT 160 | else if (parameterInfo.ParameterType == typeof(int)) 161 | { 162 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.intArgs[index] = EditorGUILayout.IntField ("Value", behaviour.intArgs[index]); 163 | else SetupDynamicArgument (behaviour, index, typeof(int)); 164 | 165 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Int; 166 | } 167 | //FLOAT 168 | else if (parameterInfo.ParameterType == typeof(float)) 169 | { 170 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.floatArgs[index] = EditorGUILayout.FloatField ("Value", behaviour.floatArgs[index]); 171 | else SetupDynamicArgument (behaviour, index, typeof(float)); 172 | 173 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Float; 174 | } 175 | //DOUBLE 176 | else if (parameterInfo.ParameterType == typeof(double)) 177 | { 178 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.doubleArgs[index] = EditorGUILayout.DoubleField ("Value", behaviour.doubleArgs[index]); 179 | else SetupDynamicArgument (behaviour, index, typeof(double)); 180 | 181 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Double; 182 | } 183 | 184 | /**VECTOR TYPE ARGUMENTS*/ 185 | 186 | //VECTOR 2 187 | else if (parameterInfo.ParameterType == typeof(Vector2)) 188 | { 189 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.vector2Args[index] = EditorGUILayout.Vector2Field ("Value", behaviour.vector2Args[index]); 190 | else SetupDynamicArgument (behaviour, index, typeof(Vector2)); 191 | 192 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Vector2; 193 | } 194 | //VECTOR 3 195 | else if (parameterInfo.ParameterType == typeof(Vector3)) 196 | { 197 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.vector3Args[index] = EditorGUILayout.Vector3Field ("Value", behaviour.vector3Args[index]); 198 | else SetupDynamicArgument (behaviour, index, typeof(Vector3)); 199 | 200 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Vector3; 201 | } 202 | //VECTOR 4 203 | else if (parameterInfo.ParameterType == typeof(Vector4)) 204 | { 205 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.vector4Args[index] = EditorGUILayout.Vector4Field ("Value", behaviour.vector4Args[index]); 206 | else SetupDynamicArgument (behaviour, index, typeof(Vector4)); 207 | 208 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Vector4; 209 | } 210 | 211 | /**GAME OBJECT TYPE ARGUMENTS*/ 212 | 213 | //GAME OBJECT 214 | else if (parameterInfo.ParameterType == typeof(GameObject)) 215 | { 216 | if (behaviour.argsChoiceIndexList[index] == 0) 217 | behaviour.gameObjectArgs[index] = EditorGUILayout.ObjectField ("Value", behaviour.gameObjectArgs[index], typeof(GameObject), true) as GameObject; 218 | else SetupDynamicArgument (behaviour, index, typeof(GameObject)); 219 | 220 | behaviour.argumentTypes[index] = EventTriggerArgumentType.GameObject; 221 | } 222 | 223 | //COMPONENT 224 | else if (parameterInfo.ParameterType == typeof(Component)) 225 | { 226 | if (behaviour.argsChoiceIndexList[index] == 0) 227 | behaviour.componentArgs[index] = EditorGUILayout.ObjectField ("Value", behaviour.componentArgs[index], typeof(Component), true) as Component; 228 | else SetupDynamicArgument (behaviour, index, typeof(Component)); 229 | 230 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Component; 231 | } 232 | 233 | /**OTHER TYPE ARGUMENTS*/ 234 | 235 | //COLOR 236 | else if (parameterInfo.ParameterType == typeof(Color)) 237 | { 238 | if (behaviour.argsChoiceIndexList[index] == 0) behaviour.colorArgs[index] = EditorGUILayout.ColorField ("Value", behaviour.colorArgs[index]); 239 | else SetupDynamicArgument (behaviour, index, typeof(Color)); 240 | 241 | behaviour.argumentTypes[index] = EventTriggerArgumentType.Color; 242 | } 243 | 244 | 245 | EditorGUILayout.Space(); 246 | } 247 | 248 | } 249 | 250 | if (!Application.isPlaying) EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); 251 | } 252 | 253 | private void SetupDynamicArgument(EventTriggerBehaviour behaviour, int index, Type argumentType) 254 | { 255 | behaviour.argsGameObjectTarget = EditorGUILayout.ObjectField ("Game Object", behaviour.argsGameObjectTarget, typeof(GameObject), true) as GameObject; 256 | 257 | if (behaviour.argsGameObjectTarget == null) return; 258 | 259 | List propertiesNames = new List(); 260 | List componentNames = new List(); 261 | List componentsList = new List(); 262 | 263 | 264 | foreach (Component loopComponent in behaviour.argsGameObjectTarget.GetComponents(typeof(Component))) 265 | { 266 | componentsList.Add (loopComponent); 267 | componentNames.Add (loopComponent.GetType().ToString()); 268 | } 269 | 270 | behaviour.argsComponentIndexes[index] = EditorGUILayout.Popup ("Component", behaviour.argsComponentIndexes[index], componentNames.ToArray()); 271 | 272 | if (behaviour.argsComponentIndexes[index] != -1 && componentsList.Count > behaviour.argsComponentIndexes[index]) 273 | { 274 | behaviour.argsComponents[index] = componentsList.ElementAt (behaviour.argsComponentIndexes[index]); 275 | 276 | foreach (PropertyInfo propertyInfo in behaviour.argsComponents[index].GetType().GetProperties (BindingFlags.Instance | BindingFlags.Public)) 277 | if(propertyInfo.PropertyType == argumentType) propertiesNames.Add (propertyInfo.Name); 278 | 279 | behaviour.argsTargetsPropertiesIndexes[index] = EditorGUILayout.Popup ("Property", behaviour.argsTargetsPropertiesIndexes[index], propertiesNames.ToArray()); 280 | 281 | if(behaviour.argsTargetsPropertiesIndexes[index] != -1 && propertiesNames.Count > behaviour.argsTargetsPropertiesIndexes[index]) 282 | behaviour.argsTargetsProperties[index] = propertiesNames.ElementAt (behaviour.argsTargetsPropertiesIndexes[index]); 283 | } 284 | } 285 | 286 | 287 | private void CreateArgumentsLists(EventTriggerBehaviour behaviour) 288 | { 289 | if (behaviour.targetDelegate == null) 290 | return; 291 | 292 | int length = behaviour.targetDelegate.Method.GetParameters().Length; 293 | 294 | if(behaviour.argumentTypes == null) behaviour.argumentTypes = new EventTriggerArgumentType[length]; 295 | if(behaviour.argumentTypes.Length != length) behaviour.argumentTypes = new EventTriggerArgumentType[length]; 296 | 297 | if(behaviour.argsChoiceIndexList == null) behaviour.argsChoiceIndexList = new int[length]; 298 | if(behaviour.argsChoiceIndexList.Length != length) behaviour.argsChoiceIndexList = new int[length]; 299 | 300 | 301 | if(behaviour.argsComponents == null) behaviour.argsComponents = new Component[length]; 302 | if(behaviour.argsComponents.Length != length) behaviour.argsComponents = new Component[length]; 303 | 304 | 305 | if(behaviour.argsTargetsProperties == null) behaviour.argsTargetsProperties = new string[length]; 306 | if(behaviour.argsTargetsProperties.Length != length) behaviour.argsTargetsProperties = new string[length]; 307 | 308 | if(behaviour.argsComponentIndexes == null) behaviour.argsComponentIndexes = new int[length]; 309 | if(behaviour.argsComponentIndexes.Length != length) behaviour.argsComponentIndexes = new int[length]; 310 | 311 | if(behaviour.argsTargetsPropertiesIndexes == null) behaviour.argsTargetsPropertiesIndexes = new int[length]; 312 | if(behaviour.argsTargetsPropertiesIndexes.Length != length) behaviour.argsTargetsPropertiesIndexes = new int[length]; 313 | 314 | 315 | /**TYPE OF ARGUMENTS*/ 316 | if(behaviour.stringArgs == null) behaviour.stringArgs = new string[length]; 317 | if(behaviour.stringArgs.Length != length) behaviour.stringArgs = new string[length]; 318 | 319 | 320 | if(behaviour.intArgs == null) behaviour.intArgs = new int[length]; 321 | if(behaviour.intArgs.Length != length) behaviour.intArgs = new int[length]; 322 | 323 | if(behaviour.floatArgs == null) behaviour.floatArgs = new float[length]; 324 | if(behaviour.floatArgs.Length != length) behaviour.floatArgs = new float[length]; 325 | 326 | if(behaviour.doubleArgs == null) behaviour.doubleArgs = new double[length]; 327 | if(behaviour.doubleArgs.Length != length) behaviour.doubleArgs = new double[length]; 328 | 329 | 330 | if(behaviour.vector2Args == null) behaviour.vector2Args = new Vector2[length]; 331 | if(behaviour.vector2Args.Length != length) behaviour.vector2Args = new Vector2[length]; 332 | 333 | if(behaviour.vector3Args == null) behaviour.vector3Args = new Vector3[length]; 334 | if(behaviour.vector3Args.Length != length) behaviour.vector3Args = new Vector3[length]; 335 | 336 | if(behaviour.vector4Args == null) behaviour.vector4Args = new Vector4[length]; 337 | if(behaviour.vector4Args.Length != length) behaviour.vector4Args = new Vector4[length]; 338 | 339 | 340 | if(behaviour.gameObjectArgs == null) behaviour.gameObjectArgs = new GameObject[length]; 341 | if(behaviour.gameObjectArgs.Length != length) behaviour.gameObjectArgs = new GameObject[length]; 342 | 343 | if(behaviour.componentArgs == null) behaviour.componentArgs = new Component[length]; 344 | if(behaviour.componentArgs.Length != length) behaviour.componentArgs = new Component[length]; 345 | 346 | if(behaviour.colorArgs == null) behaviour.colorArgs = new Color[length]; 347 | if(behaviour.colorArgs.Length != length) behaviour.colorArgs = new Color[length]; 348 | } 349 | 350 | } 351 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Editor/EventBinder/EventTriggerBehaviourEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd6c44540d418c841865cef34e730ea5 3 | timeCreated: 1518790330 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Controllers.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e660cce7880f5c44dab4376ecde42700 3 | folderAsset: yes 4 | timeCreated: 1518737283 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Controllers/EventBinderBehaviour.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using UnityEngine; 6 | using UnityEngine.Events; 7 | using UnityEngine.EventSystems; 8 | #if UNITY_EDITOR 9 | using UnityEditor.Events; 10 | #endif 11 | 12 | namespace EventBinder 13 | { 14 | [RequireComponent(typeof(EventTrigger))] 15 | public class EventBinderBehaviour : MonoBehaviour 16 | { 17 | /**PROPERTIES*/ 18 | 19 | // The GameObject that will be listened to for UI events 20 | public GameObject targetObject; 21 | 22 | // The class collection with all the events 23 | [HideInInspector] public TextAsset eventsCollectionScript = null; 24 | [HideInInspector] public SerializableSystemType eventsCollectionClassType = null; 25 | 26 | /**EVENTS & ACTIONS*/ 27 | [HideInInspector] public int eventTypeIndex = 0; 28 | 29 | [HideInInspector] public int eventIndex = 0; 30 | [HideInInspector] public int delegateIndex = 0; 31 | [HideInInspector] public EventTriggerType eventTriggerType; 32 | [HideInInspector] public Delegate targetDelegate; // The delegate that will be called after an UI event is proccessed 33 | 34 | [HideInInspector] public int eventComponentIndex; 35 | 36 | [HideInInspector] public int eventPropertyIndex; 37 | 38 | [HideInInspector] public UnityEventBase selectedUnityEventBase; 39 | [HideInInspector] public EventTriggerType selectedEventTriggerType; 40 | [HideInInspector] public EventTrigger.Entry eventEntry = null; 41 | 42 | /**ARGUMENTS*/ 43 | [HideInInspector] public GameObject argsGameObjectTarget; 44 | [HideInInspector] public Component[] argsComponents; 45 | [HideInInspector] public int[] argsComponentIndexes; 46 | [HideInInspector] public int[] argsTargetsPropertiesIndexes; 47 | [HideInInspector] public string[] argsTargetsProperties; 48 | 49 | [HideInInspector] public EventArgumentType[] argumentTypes; 50 | 51 | [HideInInspector] public int[] argsChoiceIndexList; 52 | 53 | // STRING TYPE ARGUMENTS 54 | // All the arguments that were parsed to String 55 | [HideInInspector] public string[] stringArgs; 56 | 57 | //GAME OBJECT TYPE ARGUMENTS 58 | // GameObject arguments that couldn't be serialized to String 59 | [HideInInspector] public GameObject[] gameObjectArgs; 60 | [HideInInspector] public Component[] componentArgs; 61 | 62 | //OTHER TYPE ARGUMENTS 63 | [HideInInspector] public Color[] colorArgs; 64 | 65 | 66 | // Quick accessor to get The EventTrigger Component 67 | public List triggers 68 | { 69 | get { return GetComponent().triggers; } 70 | } 71 | 72 | 73 | /**METHODS*/ 74 | 75 | private void Start() 76 | { 77 | RefreshTargetDelegate(); 78 | Debug.Log ("TYPE : " + eventsCollectionClassType); 79 | } 80 | 81 | #if UNITY_EDITOR 82 | 83 | // Sets the Taret delegate using the "actionIndex" property 84 | private void RefreshTargetDelegate() 85 | { 86 | FieldInfo[] fieldsCollection = eventsCollectionClassType.SystemType.GetFields (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); 87 | targetDelegate = fieldsCollection[delegateIndex].GetValue (null) as Delegate; 88 | } 89 | 90 | public void RefreshUnityEventBase() 91 | { 92 | if(selectedUnityEventBase is UnityEvent) 93 | { 94 | UnityEventTools.RemovePersistentListener ((UnityEvent) selectedUnityEventBase, EventTriggerHandler); 95 | UnityEventTools.AddPersistentListener ((UnityEvent) selectedUnityEventBase, EventTriggerHandler); 96 | } 97 | } 98 | 99 | public void RefreshEventTriggerList () 100 | { 101 | if (eventEntry != null && selectedEventTriggerType == eventTriggerType) return; 102 | 103 | ClearEventTrigger(); 104 | 105 | eventEntry = triggers.FirstOrDefault (entry => entry.eventID == eventTriggerType); 106 | 107 | if (eventEntry == null) 108 | { 109 | eventEntry = new EventTrigger.Entry {eventID = eventTriggerType}; 110 | triggers.Add (eventEntry); 111 | } 112 | 113 | selectedEventTriggerType = eventTriggerType; 114 | UnityEventTools.AddPersistentListener (eventEntry.callback, EventTriggerHandler); 115 | } 116 | 117 | //Removes any event attached to the EventTrigger with connection to this object 118 | public void ClearEventTrigger() 119 | { 120 | if (eventEntry == null) return; 121 | 122 | //REMOVING OLD LISTENERS 123 | UnityEventTools.RemovePersistentListener (eventEntry.callback, EventTriggerHandler); 124 | 125 | //CLEARING EMPTY EVENT ENTRIES 126 | for (int i = 0; i < triggers.Count; i++) 127 | { 128 | int indexToRemove = -1; 129 | EventTrigger.Entry loopEntry = triggers[i]; 130 | 131 | for (int j = 0; j < loopEntry.callback.GetPersistentEventCount(); j++) 132 | { 133 | Component targetComponent = loopEntry.callback.GetPersistentTarget (j) as Component; 134 | 135 | if (targetComponent == null || targetComponent.GetInstanceID() == GetInstanceID()) 136 | indexToRemove = i; 137 | } 138 | 139 | // IF AN EVENT WAS FOUND OR THE ENTRY LIST IS EMPTY -> REMOVE THE ENTRY 140 | if (loopEntry.eventID == eventEntry.eventID && loopEntry.callback.GetPersistentEventCount() == 0) 141 | indexToRemove = i; 142 | 143 | if (indexToRemove == -1) continue; 144 | 145 | triggers.RemoveAt (i); 146 | i--; 147 | } 148 | } 149 | 150 | #endif 151 | 152 | /*Dispatch the action with the selected arguments*/ 153 | private void DispatchAction() 154 | { 155 | ParameterInfo[] parametersList = targetDelegate.Method.GetParameters(); 156 | object[] argumentsObjectsList = new object[argumentTypes.Length]; 157 | for (var index = 0; index < argumentTypes.Length; index++) 158 | { 159 | switch (argsChoiceIndexList[index]) 160 | { 161 | case (int)EventArgumentKind.Static: 162 | switch (argumentTypes[index]) 163 | { 164 | case EventArgumentType.String: argumentsObjectsList[index] = stringArgs[index]; break; 165 | 166 | case EventArgumentType.Boolean: argumentsObjectsList[index] = Convert.ToBoolean(stringArgs[index]); break; 167 | 168 | case EventArgumentType.Int: argumentsObjectsList[index] = stringArgs[index].ParseToInt(); break; 169 | case EventArgumentType.Float: argumentsObjectsList[index] = stringArgs[index].ParseToFloat(); break; 170 | case EventArgumentType.Double: argumentsObjectsList[index] = stringArgs[index].ParseToDouble(); break; 171 | 172 | case EventArgumentType.Vector2: argumentsObjectsList[index] = stringArgs[index].DeserializeToVector2(); break; 173 | case EventArgumentType.Vector3: argumentsObjectsList[index] = stringArgs[index].DeserializeToVector3(); break; 174 | case EventArgumentType.Vector4: argumentsObjectsList[index] = stringArgs[index].DeserializeToVector4(); break; 175 | 176 | case EventArgumentType.GameObject: argumentsObjectsList[index] = gameObjectArgs[index]; break; 177 | case EventArgumentType.Component: argumentsObjectsList[index] = componentArgs[index]; break; 178 | 179 | case EventArgumentType.Color: argumentsObjectsList[index] = colorArgs[index]; break; 180 | 181 | case EventArgumentType.Enum: argumentsObjectsList[index] = Enum.Parse(parametersList[index].ParameterType, stringArgs[index]); break; 182 | default: throw new ArgumentOutOfRangeException(); 183 | } 184 | break; 185 | case (int) EventArgumentKind.Dynamic: 186 | if (argsGameObjectTarget != null && argsComponents[index] != null && !string.IsNullOrEmpty (argsTargetsProperties[index])) 187 | argumentsObjectsList[index] = argsComponents[index].GetType().GetProperty (argsTargetsProperties[index]).GetValue (argsComponents[index], null); 188 | 189 | break; 190 | } 191 | } 192 | 193 | targetDelegate.DynamicInvoke(argumentsObjectsList); 194 | } 195 | 196 | 197 | /**EVENT HANDLER*/ 198 | private void EventTriggerHandler() 199 | { 200 | DispatchAction(); 201 | } 202 | 203 | private void EventTriggerHandler(BaseEventData baseEventData) 204 | { 205 | DispatchAction(); 206 | } 207 | 208 | 209 | } 210 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Controllers/EventBinderBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d11df88199b8a64abab7ca18d6febea 3 | timeCreated: 1518738737 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e57abc7b9e390424fa945ab09854f817 3 | folderAsset: yes 4 | timeCreated: 1518737266 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Extensions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1854f536b20c430eb7cacca02ade2c8e 3 | timeCreated: 1519564260 -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Extensions/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using UnityEngine; 4 | 5 | namespace EventBinder 6 | { 7 | public static class Extensions 8 | { 9 | private static readonly char[] vectorStringSeparator = {' '}; 10 | 11 | /**STRING*/ 12 | 13 | public static int ParseToInt(this string target) 14 | { 15 | int returnValue = 0; 16 | int.TryParse (target, out returnValue); 17 | 18 | return returnValue; 19 | } 20 | 21 | public static float ParseToFloat(this string target) 22 | { 23 | float returnValue = 0; 24 | float.TryParse (target, out returnValue); 25 | 26 | return returnValue; 27 | } 28 | 29 | public static double ParseToDouble(this string target) 30 | { 31 | double returnValue = 0; 32 | double.TryParse (target, out returnValue); 33 | 34 | return returnValue; 35 | } 36 | 37 | 38 | public static bool CanDeserializeToVector2(this string target) 39 | { 40 | return target.Split (vectorStringSeparator).Length == 2; 41 | } 42 | 43 | public static bool CanDeserializeToVector3(this string target) 44 | { 45 | return target.Split (vectorStringSeparator).Length == 3; 46 | } 47 | 48 | public static bool CanDeserializeToVector4(this string target) 49 | { 50 | return target.Split (vectorStringSeparator).Length == 4; 51 | } 52 | 53 | public static Vector2 DeserializeToVector2(this string target) 54 | { 55 | string[] values = target.Split(vectorStringSeparator); 56 | if (values.Length != 2) throw new FormatException("component count mismatch. Expected 2 components but got " + values.Length); 57 | Vector2 result = new Vector2(float.Parse(values[0]), float.Parse(values[1])); 58 | return result; 59 | } 60 | 61 | public static Vector3 DeserializeToVector3(this string target) 62 | { 63 | string[] values = target.Split(vectorStringSeparator); 64 | if (values.Length != 3) throw new FormatException("component count mismatch. Expected 3 components but got " + values.Length); 65 | Vector3 result = new Vector3(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2])); 66 | return result; 67 | } 68 | 69 | public static Vector4 DeserializeToVector4(this string target) 70 | { 71 | string[] values = target.Split(vectorStringSeparator); 72 | if (values.Length != 4) throw new FormatException("component count mismatch. Expected 4 components but got " + values.Length); 73 | Vector4 result = new Vector4(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2]), float.Parse(values[3])); 74 | return result; 75 | } 76 | 77 | 78 | /**VECTOR 2*/ 79 | public static string SerializeToString(this Vector2 target) 80 | { 81 | StringBuilder sb = new StringBuilder(); 82 | sb.Append (target.x).Append (" ").Append (target.y); 83 | 84 | return sb.ToString(); 85 | } 86 | 87 | /**VECTOR 3*/ 88 | public static string SerializeToString(this Vector3 target) 89 | { 90 | StringBuilder sb = new StringBuilder(); 91 | sb.Append(target.x).Append(" ").Append(target.y).Append(" ").Append(target.z); 92 | 93 | return sb.ToString(); 94 | } 95 | 96 | /**VECTOR 4*/ 97 | public static string SerializeToString(this Vector4 target) 98 | { 99 | StringBuilder sb = new StringBuilder(); 100 | sb.Append(target.x).Append(" ").Append(target.y).Append(" ").Append(target.z).Append(" ").Append(target.w); 101 | 102 | return sb.ToString(); 103 | } 104 | 105 | } 106 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Extensions/Extensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5091ec7becc64a92bf9301e41f3492c8 3 | timeCreated: 1519564267 -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c46d42821161ccf47aeffc840535bf80 3 | folderAsset: yes 4 | timeCreated: 1518737278 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Model/EventBinderModel.cs: -------------------------------------------------------------------------------- 1 | namespace EventBinder 2 | { 3 | 4 | public enum EventArgumentType 5 | { 6 | String, 7 | 8 | Boolean, 9 | 10 | Int, 11 | Float, 12 | Double, 13 | 14 | Vector2, 15 | Vector3, 16 | Vector4, 17 | 18 | GameObject, 19 | Component, 20 | 21 | Color, 22 | 23 | Enum 24 | } 25 | 26 | 27 | public enum EventArgumentKind 28 | { 29 | Static = 0, 30 | Dynamic = 1 31 | } 32 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Model/EventBinderModel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a91bede7db95492296ff9c1f6feb0412 3 | timeCreated: 1519073045 -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Model/EventsCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace EventBinder 5 | { 6 | public class EventsCollection 7 | { 8 | //SAMPLE 9 | public static event Action eventEmpty = delegate { }; 10 | 11 | public static event Action eventWithStringArgs = delegate (string testValue) {}; 12 | 13 | public static event Action eventWithBoolArgs = delegate (bool boolValue1, bool boolValue2) {}; 14 | 15 | public static event Action eventWithNumbersArgs = delegate(int intValue, float floatArg, double doubleArg) { }; 16 | public static event Action eventWithVectorsArgs = delegate(Vector2 v2Value, Vector3 v3Value, Vector4 v4Value) { }; 17 | public static event Action eventWithGoArgs = delegate(GameObject gameObjectValue, Component componentValue) { }; 18 | 19 | public static event Action eventWithEnumsArgs = delegate(EventEnum enumValue) { }; 20 | } 21 | 22 | 23 | public enum EventEnum 24 | { 25 | FirstEnum, 26 | ASecondEnum, 27 | ThirdEnum, 28 | TestingForFourEnum 29 | } 30 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Model/EventsCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0901526afc4a488ba4b6f19c81d789ad 3 | timeCreated: 1518738959 -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Model/TriggersCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace EventBinder 5 | { 6 | public static class TriggersCollection 7 | { 8 | //GENERAL 9 | 10 | //SAMPLE 11 | public static event Action testAction = delegate { }; 12 | 13 | public static event Action testActionWithStringParam = delegate (string testValue) {}; 14 | 15 | public static event Action actionWithNumbersArgs = delegate(int intValue, float floatArg, double doubleArg) { }; 16 | public static event Action actionWithVectorsArgs = delegate(Vector2 v2Value, Vector3 v3Value, Vector4 v4Value) { }; 17 | public static event Action actionWithGoArgs = delegate(GameObject gameObjectValue, Component componentValue) { }; 18 | } 19 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Model/TriggersCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0901526afc4a488ba4b6f19c81d789ad 3 | timeCreated: 1518738959 -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Sample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 150ad7d6ccb2e3946859d26006401521 3 | folderAsset: yes 4 | timeCreated: 1518734973 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Sample/EventBinderSampleListenerController.cs: -------------------------------------------------------------------------------- 1 | using EventBinder; 2 | using UnityEngine; 3 | 4 | public class EventBinderSampleListenerController : MonoBehaviour { 5 | 6 | // Use this for initialization 7 | private void Start () 8 | { 9 | AddListeners(); 10 | AddListenersStatic(); 11 | } 12 | 13 | /**EVENT REGISTRATION*/ 14 | private void AddListeners() 15 | { 16 | EventsCollection.eventEmpty += OnEventEmptyHandler; 17 | EventsCollection.eventWithStringArgs += OnEventWithStringArgsHandler; 18 | EventsCollection.eventWithBoolArgs += OnEventWithBoolArgsHandler; 19 | EventsCollection.eventWithNumbersArgs += OnEventWithNumberArgsHandler; 20 | EventsCollection.eventWithVectorsArgs += OnEventWithVectorsARgsHandler; 21 | EventsCollection.eventWithGoArgs += OnEventWithGoArgsHandler; 22 | EventsCollection.eventWithEnumsArgs += OnEventWithEnumsArgsHandler; 23 | } 24 | 25 | private static void AddListenersStatic() 26 | { 27 | EventsCollection.eventEmpty += OnStaticEventEmptyHandler; 28 | EventsCollection.eventWithStringArgs += OnStaticEventWithStringArgsHandler; 29 | EventsCollection.eventWithBoolArgs += OnStaticEventWithBoolArgsHandler; 30 | EventsCollection.eventWithNumbersArgs += OnStaticEventWithNumberArgsHandler; 31 | EventsCollection.eventWithVectorsArgs += OnStaticEventWithVectorsARgsHandler; 32 | EventsCollection.eventWithGoArgs += OnStaticEventWithGoArgsHandler; 33 | EventsCollection.eventWithEnumsArgs += OnStaticEventWithEnumsArgsHandler; 34 | } 35 | 36 | /**EVENT HANDLERS*/ 37 | public void OnEventEmptyHandler() 38 | { 39 | Debug.Log ("We got a new message "); 40 | } 41 | 42 | public void OnEventWithStringArgsHandler(string value) 43 | { 44 | Debug.Log ("We got a new message with a String parameter: " + value); 45 | } 46 | 47 | public void OnEventWithBoolArgsHandler(bool boolValue1, bool boolValue2) 48 | { 49 | Debug.Log ("We got a new message with Boolean type parameters: " + boolValue1 + " | " + boolValue2); 50 | } 51 | 52 | public void OnEventWithNumberArgsHandler(int intValue, float floatValue, double doubleValue) 53 | { 54 | Debug.Log ("We got a new message with Number type parameters: " + intValue + " | " + floatValue + " | " + doubleValue); 55 | } 56 | 57 | public void OnEventWithVectorsARgsHandler(Vector2 v2Value, Vector3 v3Value, Vector4 v4Value) 58 | { 59 | Debug.Log ("We got a new message with Vector type parameters: " + v2Value + " | " + v3Value + " | " + v4Value); 60 | } 61 | 62 | public void OnEventWithGoArgsHandler(GameObject gameObjectValue, Component componentValue) 63 | { 64 | Debug.Log ("We got a new message with a GameObject and a Component parameter: " + gameObjectValue + " | " + componentValue); 65 | } 66 | 67 | public void OnEventWithEnumsArgsHandler(EventEnum value) 68 | { 69 | Debug.Log ("We got a new message with an EventEnum parameter: " + value); 70 | } 71 | 72 | 73 | /**EVENT HANDLERS STATIC*/ 74 | public static void OnStaticEventEmptyHandler() 75 | { 76 | Debug.Log ("[STATIC] We got a new message "); 77 | } 78 | 79 | public static void OnStaticEventWithStringArgsHandler(string value) 80 | { 81 | Debug.Log ("[STATIC] We got a new message with a String parameter: " + value); 82 | } 83 | 84 | public static void OnStaticEventWithBoolArgsHandler(bool boolValue1, bool boolValue2) 85 | { 86 | Debug.Log ("[STATIC] We got a new message with Boolean type parameters: " + boolValue1 + " | " + boolValue2); 87 | } 88 | 89 | public static void OnStaticEventWithNumberArgsHandler(int intValue, float floatValue, double doubleValue) 90 | { 91 | Debug.Log ("[STATIC] We got a new message with Number type parameters: " + intValue + " | " + floatValue + " | " + doubleValue); 92 | } 93 | 94 | public static void OnStaticEventWithVectorsARgsHandler(Vector2 v2Value, Vector3 v3Value, Vector4 v4Value) 95 | { 96 | Debug.Log ("[STATIC] We got a new message with Vector type parameters: " + v2Value + " | " + v3Value + " | " + v4Value); 97 | } 98 | 99 | public static void OnStaticEventWithGoArgsHandler(GameObject gameObjectValue, Component componentValue) 100 | { 101 | Debug.Log ("[STATIC] We got a new message with a GameObject and a Component parameter: " + gameObjectValue + " | " + componentValue); 102 | } 103 | 104 | public static void OnStaticEventWithEnumsArgsHandler(EventEnum value) 105 | { 106 | Debug.Log ("We got a new message with an EventEnum parameter: " + value); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Sample/EventBinderSampleListenerController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc74bae34cfe11e4cb8902f48cd5876b 3 | timeCreated: 1519125201 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Sample/EventBinderSampleScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 8 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 11 46 | m_GIWorkflowMode: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_TemporalCoherenceThreshold: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 9 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_TextureWidth: 1024 61 | m_TextureHeight: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 0 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &111871403 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_PrefabParentObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 5 122 | m_Component: 123 | - component: {fileID: 111871407} 124 | - component: {fileID: 111871406} 125 | - component: {fileID: 111871405} 126 | - component: {fileID: 111871404} 127 | m_Layer: 0 128 | m_Name: Main Camera 129 | m_TagString: MainCamera 130 | m_Icon: {fileID: 0} 131 | m_NavMeshLayer: 0 132 | m_StaticEditorFlags: 0 133 | m_IsActive: 1 134 | --- !u!81 &111871404 135 | AudioListener: 136 | m_ObjectHideFlags: 0 137 | m_PrefabParentObject: {fileID: 0} 138 | m_PrefabInternal: {fileID: 0} 139 | m_GameObject: {fileID: 111871403} 140 | m_Enabled: 1 141 | --- !u!124 &111871405 142 | Behaviour: 143 | m_ObjectHideFlags: 0 144 | m_PrefabParentObject: {fileID: 0} 145 | m_PrefabInternal: {fileID: 0} 146 | m_GameObject: {fileID: 111871403} 147 | m_Enabled: 1 148 | --- !u!20 &111871406 149 | Camera: 150 | m_ObjectHideFlags: 0 151 | m_PrefabParentObject: {fileID: 0} 152 | m_PrefabInternal: {fileID: 0} 153 | m_GameObject: {fileID: 111871403} 154 | m_Enabled: 1 155 | serializedVersion: 2 156 | m_ClearFlags: 1 157 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 158 | m_NormalizedViewPortRect: 159 | serializedVersion: 2 160 | x: 0 161 | y: 0 162 | width: 1 163 | height: 1 164 | near clip plane: 0.3 165 | far clip plane: 1000 166 | field of view: 60 167 | orthographic: 0 168 | orthographic size: 5 169 | m_Depth: -1 170 | m_CullingMask: 171 | serializedVersion: 2 172 | m_Bits: 4294967295 173 | m_RenderingPath: -1 174 | m_TargetTexture: {fileID: 0} 175 | m_TargetDisplay: 0 176 | m_TargetEye: 3 177 | m_HDR: 1 178 | m_AllowMSAA: 1 179 | m_AllowDynamicResolution: 0 180 | m_ForceIntoRT: 0 181 | m_OcclusionCulling: 1 182 | m_StereoConvergence: 10 183 | m_StereoSeparation: 0.022 184 | --- !u!4 &111871407 185 | Transform: 186 | m_ObjectHideFlags: 0 187 | m_PrefabParentObject: {fileID: 0} 188 | m_PrefabInternal: {fileID: 0} 189 | m_GameObject: {fileID: 111871403} 190 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 191 | m_LocalPosition: {x: 0, y: 1, z: -10} 192 | m_LocalScale: {x: 1, y: 1, z: 1} 193 | m_Children: [] 194 | m_Father: {fileID: 0} 195 | m_RootOrder: 0 196 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 197 | --- !u!1 &551782211 198 | GameObject: 199 | m_ObjectHideFlags: 0 200 | m_PrefabParentObject: {fileID: 0} 201 | m_PrefabInternal: {fileID: 0} 202 | serializedVersion: 5 203 | m_Component: 204 | - component: {fileID: 551782212} 205 | - component: {fileID: 551782215} 206 | - component: {fileID: 551782214} 207 | - component: {fileID: 551782213} 208 | m_Layer: 5 209 | m_Name: InputField 210 | m_TagString: Untagged 211 | m_Icon: {fileID: 0} 212 | m_NavMeshLayer: 0 213 | m_StaticEditorFlags: 0 214 | m_IsActive: 1 215 | --- !u!224 &551782212 216 | RectTransform: 217 | m_ObjectHideFlags: 0 218 | m_PrefabParentObject: {fileID: 0} 219 | m_PrefabInternal: {fileID: 0} 220 | m_GameObject: {fileID: 551782211} 221 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 222 | m_LocalPosition: {x: 0, y: 0, z: 0} 223 | m_LocalScale: {x: 1, y: 1, z: 1} 224 | m_Children: 225 | - {fileID: 983195768} 226 | - {fileID: 913064723} 227 | m_Father: {fileID: 1137215122} 228 | m_RootOrder: 2 229 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 230 | m_AnchorMin: {x: 0.5, y: 0.5} 231 | m_AnchorMax: {x: 0.5, y: 0.5} 232 | m_AnchoredPosition: {x: 0, y: 400} 233 | m_SizeDelta: {x: 160, y: 30} 234 | m_Pivot: {x: 0.5, y: 0.5} 235 | --- !u!114 &551782213 236 | MonoBehaviour: 237 | m_ObjectHideFlags: 0 238 | m_PrefabParentObject: {fileID: 0} 239 | m_PrefabInternal: {fileID: 0} 240 | m_GameObject: {fileID: 551782211} 241 | m_Enabled: 1 242 | m_EditorHideFlags: 0 243 | m_Script: {fileID: 575553740, guid: f70555f144d8491a825f0804e09c671c, type: 3} 244 | m_Name: 245 | m_EditorClassIdentifier: 246 | m_Navigation: 247 | m_Mode: 3 248 | m_SelectOnUp: {fileID: 0} 249 | m_SelectOnDown: {fileID: 0} 250 | m_SelectOnLeft: {fileID: 0} 251 | m_SelectOnRight: {fileID: 0} 252 | m_Transition: 1 253 | m_Colors: 254 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 255 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 256 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 257 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 258 | m_ColorMultiplier: 1 259 | m_FadeDuration: 0.1 260 | m_SpriteState: 261 | m_HighlightedSprite: {fileID: 0} 262 | m_PressedSprite: {fileID: 0} 263 | m_DisabledSprite: {fileID: 0} 264 | m_AnimationTriggers: 265 | m_NormalTrigger: Normal 266 | m_HighlightedTrigger: Highlighted 267 | m_PressedTrigger: Pressed 268 | m_DisabledTrigger: Disabled 269 | m_Interactable: 1 270 | m_TargetGraphic: {fileID: 551782214} 271 | m_TextComponent: {fileID: 913064724} 272 | m_Placeholder: {fileID: 0} 273 | m_ContentType: 0 274 | m_InputType: 0 275 | m_AsteriskChar: 42 276 | m_KeyboardType: 0 277 | m_LineType: 0 278 | m_HideMobileInput: 0 279 | m_CharacterValidation: 0 280 | m_CharacterLimit: 0 281 | m_OnEndEdit: 282 | m_PersistentCalls: 283 | m_Calls: [] 284 | m_TypeName: UnityEngine.UI.InputField+SubmitEvent, UnityEngine.UI, Version=1.0.0.0, 285 | Culture=neutral, PublicKeyToken=null 286 | m_OnValueChanged: 287 | m_PersistentCalls: 288 | m_Calls: [] 289 | m_TypeName: UnityEngine.UI.InputField+OnChangeEvent, UnityEngine.UI, Version=1.0.0.0, 290 | Culture=neutral, PublicKeyToken=null 291 | m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 292 | m_CustomCaretColor: 0 293 | m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} 294 | m_Text: 295 | m_CaretBlinkRate: 0.85 296 | m_CaretWidth: 1 297 | m_ReadOnly: 0 298 | --- !u!114 &551782214 299 | MonoBehaviour: 300 | m_ObjectHideFlags: 0 301 | m_PrefabParentObject: {fileID: 0} 302 | m_PrefabInternal: {fileID: 0} 303 | m_GameObject: {fileID: 551782211} 304 | m_Enabled: 1 305 | m_EditorHideFlags: 0 306 | m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} 307 | m_Name: 308 | m_EditorClassIdentifier: 309 | m_Material: {fileID: 0} 310 | m_Color: {r: 1, g: 1, b: 1, a: 1} 311 | m_RaycastTarget: 1 312 | m_OnCullStateChanged: 313 | m_PersistentCalls: 314 | m_Calls: [] 315 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 316 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 317 | m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} 318 | m_Type: 1 319 | m_PreserveAspect: 0 320 | m_FillCenter: 1 321 | m_FillMethod: 4 322 | m_FillAmount: 1 323 | m_FillClockwise: 1 324 | m_FillOrigin: 0 325 | --- !u!222 &551782215 326 | CanvasRenderer: 327 | m_ObjectHideFlags: 0 328 | m_PrefabParentObject: {fileID: 0} 329 | m_PrefabInternal: {fileID: 0} 330 | m_GameObject: {fileID: 551782211} 331 | --- !u!1 &694045611 332 | GameObject: 333 | m_ObjectHideFlags: 0 334 | m_PrefabParentObject: {fileID: 0} 335 | m_PrefabInternal: {fileID: 0} 336 | serializedVersion: 5 337 | m_Component: 338 | - component: {fileID: 694045613} 339 | - component: {fileID: 694045612} 340 | m_Layer: 0 341 | m_Name: Directional Light 342 | m_TagString: Untagged 343 | m_Icon: {fileID: 0} 344 | m_NavMeshLayer: 0 345 | m_StaticEditorFlags: 0 346 | m_IsActive: 1 347 | --- !u!108 &694045612 348 | Light: 349 | m_ObjectHideFlags: 0 350 | m_PrefabParentObject: {fileID: 0} 351 | m_PrefabInternal: {fileID: 0} 352 | m_GameObject: {fileID: 694045611} 353 | m_Enabled: 1 354 | serializedVersion: 8 355 | m_Type: 1 356 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 357 | m_Intensity: 1 358 | m_Range: 10 359 | m_SpotAngle: 30 360 | m_CookieSize: 10 361 | m_Shadows: 362 | m_Type: 2 363 | m_Resolution: -1 364 | m_CustomResolution: -1 365 | m_Strength: 1 366 | m_Bias: 0.05 367 | m_NormalBias: 0.4 368 | m_NearPlane: 0.2 369 | m_Cookie: {fileID: 0} 370 | m_DrawHalo: 0 371 | m_Flare: {fileID: 0} 372 | m_RenderMode: 0 373 | m_CullingMask: 374 | serializedVersion: 2 375 | m_Bits: 4294967295 376 | m_Lightmapping: 4 377 | m_AreaSize: {x: 1, y: 1} 378 | m_BounceIntensity: 1 379 | m_ColorTemperature: 6570 380 | m_UseColorTemperature: 0 381 | m_ShadowRadius: 0 382 | m_ShadowAngle: 0 383 | --- !u!4 &694045613 384 | Transform: 385 | m_ObjectHideFlags: 0 386 | m_PrefabParentObject: {fileID: 0} 387 | m_PrefabInternal: {fileID: 0} 388 | m_GameObject: {fileID: 694045611} 389 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 390 | m_LocalPosition: {x: 0, y: 3, z: 0} 391 | m_LocalScale: {x: 1, y: 1, z: 1} 392 | m_Children: [] 393 | m_Father: {fileID: 0} 394 | m_RootOrder: 1 395 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 396 | --- !u!1 &741667414 397 | GameObject: 398 | m_ObjectHideFlags: 0 399 | m_PrefabParentObject: {fileID: 0} 400 | m_PrefabInternal: {fileID: 0} 401 | serializedVersion: 5 402 | m_Component: 403 | - component: {fileID: 741667415} 404 | - component: {fileID: 741667417} 405 | - component: {fileID: 741667416} 406 | m_Layer: 5 407 | m_Name: Background 408 | m_TagString: Untagged 409 | m_Icon: {fileID: 0} 410 | m_NavMeshLayer: 0 411 | m_StaticEditorFlags: 0 412 | m_IsActive: 1 413 | --- !u!224 &741667415 414 | RectTransform: 415 | m_ObjectHideFlags: 0 416 | m_PrefabParentObject: {fileID: 0} 417 | m_PrefabInternal: {fileID: 0} 418 | m_GameObject: {fileID: 741667414} 419 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 420 | m_LocalPosition: {x: 0, y: 0, z: 0} 421 | m_LocalScale: {x: 1, y: 1, z: 1} 422 | m_Children: [] 423 | m_Father: {fileID: 1137215122} 424 | m_RootOrder: 0 425 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 426 | m_AnchorMin: {x: 0, y: 0} 427 | m_AnchorMax: {x: 1, y: 1} 428 | m_AnchoredPosition: {x: 0, y: 0} 429 | m_SizeDelta: {x: 0, y: 0} 430 | m_Pivot: {x: 0.5, y: 0.5} 431 | --- !u!114 &741667416 432 | MonoBehaviour: 433 | m_ObjectHideFlags: 0 434 | m_PrefabParentObject: {fileID: 0} 435 | m_PrefabInternal: {fileID: 0} 436 | m_GameObject: {fileID: 741667414} 437 | m_Enabled: 1 438 | m_EditorHideFlags: 0 439 | m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} 440 | m_Name: 441 | m_EditorClassIdentifier: 442 | m_Material: {fileID: 0} 443 | m_Color: {r: 1, g: 1, b: 1, a: 1} 444 | m_RaycastTarget: 1 445 | m_OnCullStateChanged: 446 | m_PersistentCalls: 447 | m_Calls: [] 448 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 449 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 450 | m_Sprite: {fileID: 0} 451 | m_Type: 0 452 | m_PreserveAspect: 0 453 | m_FillCenter: 1 454 | m_FillMethod: 4 455 | m_FillAmount: 1 456 | m_FillClockwise: 1 457 | m_FillOrigin: 0 458 | --- !u!222 &741667417 459 | CanvasRenderer: 460 | m_ObjectHideFlags: 0 461 | m_PrefabParentObject: {fileID: 0} 462 | m_PrefabInternal: {fileID: 0} 463 | m_GameObject: {fileID: 741667414} 464 | --- !u!1 &913064722 465 | GameObject: 466 | m_ObjectHideFlags: 0 467 | m_PrefabParentObject: {fileID: 0} 468 | m_PrefabInternal: {fileID: 0} 469 | serializedVersion: 5 470 | m_Component: 471 | - component: {fileID: 913064723} 472 | - component: {fileID: 913064725} 473 | - component: {fileID: 913064724} 474 | m_Layer: 5 475 | m_Name: Text 476 | m_TagString: Untagged 477 | m_Icon: {fileID: 0} 478 | m_NavMeshLayer: 0 479 | m_StaticEditorFlags: 0 480 | m_IsActive: 1 481 | --- !u!224 &913064723 482 | RectTransform: 483 | m_ObjectHideFlags: 0 484 | m_PrefabParentObject: {fileID: 0} 485 | m_PrefabInternal: {fileID: 0} 486 | m_GameObject: {fileID: 913064722} 487 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 488 | m_LocalPosition: {x: 0, y: 0, z: 0} 489 | m_LocalScale: {x: 1, y: 1, z: 1} 490 | m_Children: [] 491 | m_Father: {fileID: 551782212} 492 | m_RootOrder: 1 493 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 494 | m_AnchorMin: {x: 0, y: 0} 495 | m_AnchorMax: {x: 1, y: 1} 496 | m_AnchoredPosition: {x: 0, y: -0.5} 497 | m_SizeDelta: {x: -20, y: -13} 498 | m_Pivot: {x: 0.5, y: 0.5} 499 | --- !u!114 &913064724 500 | MonoBehaviour: 501 | m_ObjectHideFlags: 0 502 | m_PrefabParentObject: {fileID: 0} 503 | m_PrefabInternal: {fileID: 0} 504 | m_GameObject: {fileID: 913064722} 505 | m_Enabled: 1 506 | m_EditorHideFlags: 0 507 | m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} 508 | m_Name: 509 | m_EditorClassIdentifier: 510 | m_Material: {fileID: 0} 511 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 512 | m_RaycastTarget: 1 513 | m_OnCullStateChanged: 514 | m_PersistentCalls: 515 | m_Calls: [] 516 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 517 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 518 | m_FontData: 519 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 520 | m_FontSize: 14 521 | m_FontStyle: 0 522 | m_BestFit: 0 523 | m_MinSize: 10 524 | m_MaxSize: 40 525 | m_Alignment: 0 526 | m_AlignByGeometry: 0 527 | m_RichText: 0 528 | m_HorizontalOverflow: 1 529 | m_VerticalOverflow: 0 530 | m_LineSpacing: 1 531 | m_Text: 532 | --- !u!222 &913064725 533 | CanvasRenderer: 534 | m_ObjectHideFlags: 0 535 | m_PrefabParentObject: {fileID: 0} 536 | m_PrefabInternal: {fileID: 0} 537 | m_GameObject: {fileID: 913064722} 538 | --- !u!1 &983195767 539 | GameObject: 540 | m_ObjectHideFlags: 0 541 | m_PrefabParentObject: {fileID: 0} 542 | m_PrefabInternal: {fileID: 0} 543 | serializedVersion: 5 544 | m_Component: 545 | - component: {fileID: 983195768} 546 | - component: {fileID: 983195770} 547 | - component: {fileID: 983195769} 548 | m_Layer: 5 549 | m_Name: Placeholder 550 | m_TagString: Untagged 551 | m_Icon: {fileID: 0} 552 | m_NavMeshLayer: 0 553 | m_StaticEditorFlags: 0 554 | m_IsActive: 1 555 | --- !u!224 &983195768 556 | RectTransform: 557 | m_ObjectHideFlags: 0 558 | m_PrefabParentObject: {fileID: 0} 559 | m_PrefabInternal: {fileID: 0} 560 | m_GameObject: {fileID: 983195767} 561 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 562 | m_LocalPosition: {x: 0, y: 0, z: 0} 563 | m_LocalScale: {x: 1, y: 1, z: 1} 564 | m_Children: [] 565 | m_Father: {fileID: 551782212} 566 | m_RootOrder: 0 567 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 568 | m_AnchorMin: {x: 0, y: 0} 569 | m_AnchorMax: {x: 1, y: 1} 570 | m_AnchoredPosition: {x: 0, y: -0.5} 571 | m_SizeDelta: {x: -20, y: -13} 572 | m_Pivot: {x: 0.5, y: 0.5} 573 | --- !u!114 &983195769 574 | MonoBehaviour: 575 | m_ObjectHideFlags: 0 576 | m_PrefabParentObject: {fileID: 0} 577 | m_PrefabInternal: {fileID: 0} 578 | m_GameObject: {fileID: 983195767} 579 | m_Enabled: 1 580 | m_EditorHideFlags: 0 581 | m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} 582 | m_Name: 583 | m_EditorClassIdentifier: 584 | m_Material: {fileID: 0} 585 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} 586 | m_RaycastTarget: 1 587 | m_OnCullStateChanged: 588 | m_PersistentCalls: 589 | m_Calls: [] 590 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 591 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 592 | m_FontData: 593 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 594 | m_FontSize: 14 595 | m_FontStyle: 2 596 | m_BestFit: 0 597 | m_MinSize: 10 598 | m_MaxSize: 40 599 | m_Alignment: 0 600 | m_AlignByGeometry: 0 601 | m_RichText: 1 602 | m_HorizontalOverflow: 0 603 | m_VerticalOverflow: 0 604 | m_LineSpacing: 1 605 | m_Text: Enter text... 606 | --- !u!222 &983195770 607 | CanvasRenderer: 608 | m_ObjectHideFlags: 0 609 | m_PrefabParentObject: {fileID: 0} 610 | m_PrefabInternal: {fileID: 0} 611 | m_GameObject: {fileID: 983195767} 612 | --- !u!1 &1056778078 613 | GameObject: 614 | m_ObjectHideFlags: 0 615 | m_PrefabParentObject: {fileID: 0} 616 | m_PrefabInternal: {fileID: 0} 617 | serializedVersion: 5 618 | m_Component: 619 | - component: {fileID: 1056778079} 620 | - component: {fileID: 1056778080} 621 | m_Layer: 0 622 | m_Name: ListenerObject 623 | m_TagString: Untagged 624 | m_Icon: {fileID: 0} 625 | m_NavMeshLayer: 0 626 | m_StaticEditorFlags: 0 627 | m_IsActive: 1 628 | --- !u!4 &1056778079 629 | Transform: 630 | m_ObjectHideFlags: 0 631 | m_PrefabParentObject: {fileID: 0} 632 | m_PrefabInternal: {fileID: 0} 633 | m_GameObject: {fileID: 1056778078} 634 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 635 | m_LocalPosition: {x: 0, y: 0, z: 0} 636 | m_LocalScale: {x: 1, y: 1, z: 1} 637 | m_Children: [] 638 | m_Father: {fileID: 0} 639 | m_RootOrder: 4 640 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 641 | --- !u!114 &1056778080 642 | MonoBehaviour: 643 | m_ObjectHideFlags: 0 644 | m_PrefabParentObject: {fileID: 0} 645 | m_PrefabInternal: {fileID: 0} 646 | m_GameObject: {fileID: 1056778078} 647 | m_Enabled: 1 648 | m_EditorHideFlags: 0 649 | m_Script: {fileID: 11500000, guid: bc74bae34cfe11e4cb8902f48cd5876b, type: 3} 650 | m_Name: 651 | m_EditorClassIdentifier: 652 | --- !u!1 &1137215118 653 | GameObject: 654 | m_ObjectHideFlags: 0 655 | m_PrefabParentObject: {fileID: 0} 656 | m_PrefabInternal: {fileID: 0} 657 | serializedVersion: 5 658 | m_Component: 659 | - component: {fileID: 1137215122} 660 | - component: {fileID: 1137215121} 661 | - component: {fileID: 1137215120} 662 | - component: {fileID: 1137215119} 663 | m_Layer: 5 664 | m_Name: Canvas 665 | m_TagString: Untagged 666 | m_Icon: {fileID: 0} 667 | m_NavMeshLayer: 0 668 | m_StaticEditorFlags: 0 669 | m_IsActive: 1 670 | --- !u!114 &1137215119 671 | MonoBehaviour: 672 | m_ObjectHideFlags: 0 673 | m_PrefabParentObject: {fileID: 0} 674 | m_PrefabInternal: {fileID: 0} 675 | m_GameObject: {fileID: 1137215118} 676 | m_Enabled: 1 677 | m_EditorHideFlags: 0 678 | m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} 679 | m_Name: 680 | m_EditorClassIdentifier: 681 | m_IgnoreReversedGraphics: 1 682 | m_BlockingObjects: 0 683 | m_BlockingMask: 684 | serializedVersion: 2 685 | m_Bits: 4294967295 686 | --- !u!114 &1137215120 687 | MonoBehaviour: 688 | m_ObjectHideFlags: 0 689 | m_PrefabParentObject: {fileID: 0} 690 | m_PrefabInternal: {fileID: 0} 691 | m_GameObject: {fileID: 1137215118} 692 | m_Enabled: 1 693 | m_EditorHideFlags: 0 694 | m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} 695 | m_Name: 696 | m_EditorClassIdentifier: 697 | m_UiScaleMode: 1 698 | m_ReferencePixelsPerUnit: 100 699 | m_ScaleFactor: 1 700 | m_ReferenceResolution: {x: 1000, y: 1000} 701 | m_ScreenMatchMode: 0 702 | m_MatchWidthOrHeight: 0 703 | m_PhysicalUnit: 3 704 | m_FallbackScreenDPI: 96 705 | m_DefaultSpriteDPI: 96 706 | m_DynamicPixelsPerUnit: 1 707 | --- !u!223 &1137215121 708 | Canvas: 709 | m_ObjectHideFlags: 0 710 | m_PrefabParentObject: {fileID: 0} 711 | m_PrefabInternal: {fileID: 0} 712 | m_GameObject: {fileID: 1137215118} 713 | m_Enabled: 1 714 | serializedVersion: 3 715 | m_RenderMode: 1 716 | m_Camera: {fileID: 111871406} 717 | m_PlaneDistance: 100 718 | m_PixelPerfect: 0 719 | m_ReceivesEvents: 1 720 | m_OverrideSorting: 0 721 | m_OverridePixelPerfect: 0 722 | m_SortingBucketNormalizedSize: 0 723 | m_AdditionalShaderChannelsFlag: 0 724 | m_SortingLayerID: 0 725 | m_SortingOrder: 0 726 | m_TargetDisplay: 0 727 | --- !u!224 &1137215122 728 | RectTransform: 729 | m_ObjectHideFlags: 0 730 | m_PrefabParentObject: {fileID: 0} 731 | m_PrefabInternal: {fileID: 0} 732 | m_GameObject: {fileID: 1137215118} 733 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 734 | m_LocalPosition: {x: 0, y: 0, z: 0} 735 | m_LocalScale: {x: 0, y: 0, z: 0} 736 | m_Children: 737 | - {fileID: 741667415} 738 | - {fileID: 1711205324} 739 | - {fileID: 551782212} 740 | m_Father: {fileID: 0} 741 | m_RootOrder: 2 742 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 743 | m_AnchorMin: {x: 0, y: 0} 744 | m_AnchorMax: {x: 0, y: 0} 745 | m_AnchoredPosition: {x: 0, y: 0} 746 | m_SizeDelta: {x: 0, y: 0} 747 | m_Pivot: {x: 0, y: 0} 748 | --- !u!1 &1605200421 749 | GameObject: 750 | m_ObjectHideFlags: 0 751 | m_PrefabParentObject: {fileID: 0} 752 | m_PrefabInternal: {fileID: 0} 753 | serializedVersion: 5 754 | m_Component: 755 | - component: {fileID: 1605200422} 756 | - component: {fileID: 1605200424} 757 | - component: {fileID: 1605200423} 758 | m_Layer: 5 759 | m_Name: Text 760 | m_TagString: Untagged 761 | m_Icon: {fileID: 0} 762 | m_NavMeshLayer: 0 763 | m_StaticEditorFlags: 0 764 | m_IsActive: 1 765 | --- !u!224 &1605200422 766 | RectTransform: 767 | m_ObjectHideFlags: 0 768 | m_PrefabParentObject: {fileID: 0} 769 | m_PrefabInternal: {fileID: 0} 770 | m_GameObject: {fileID: 1605200421} 771 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 772 | m_LocalPosition: {x: 0, y: 0, z: 0} 773 | m_LocalScale: {x: 1, y: 1, z: 1} 774 | m_Children: [] 775 | m_Father: {fileID: 1711205324} 776 | m_RootOrder: 0 777 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 778 | m_AnchorMin: {x: 0, y: 0} 779 | m_AnchorMax: {x: 1, y: 1} 780 | m_AnchoredPosition: {x: 0, y: 0} 781 | m_SizeDelta: {x: 0, y: 0} 782 | m_Pivot: {x: 0.5, y: 0.5} 783 | --- !u!114 &1605200423 784 | MonoBehaviour: 785 | m_ObjectHideFlags: 0 786 | m_PrefabParentObject: {fileID: 0} 787 | m_PrefabInternal: {fileID: 0} 788 | m_GameObject: {fileID: 1605200421} 789 | m_Enabled: 1 790 | m_EditorHideFlags: 0 791 | m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} 792 | m_Name: 793 | m_EditorClassIdentifier: 794 | m_Material: {fileID: 0} 795 | m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} 796 | m_RaycastTarget: 1 797 | m_OnCullStateChanged: 798 | m_PersistentCalls: 799 | m_Calls: [] 800 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 801 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 802 | m_FontData: 803 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 804 | m_FontSize: 24 805 | m_FontStyle: 0 806 | m_BestFit: 0 807 | m_MinSize: 2 808 | m_MaxSize: 40 809 | m_Alignment: 4 810 | m_AlignByGeometry: 0 811 | m_RichText: 1 812 | m_HorizontalOverflow: 0 813 | m_VerticalOverflow: 0 814 | m_LineSpacing: 1 815 | m_Text: Button 816 | --- !u!222 &1605200424 817 | CanvasRenderer: 818 | m_ObjectHideFlags: 0 819 | m_PrefabParentObject: {fileID: 0} 820 | m_PrefabInternal: {fileID: 0} 821 | m_GameObject: {fileID: 1605200421} 822 | --- !u!1 &1711205323 823 | GameObject: 824 | m_ObjectHideFlags: 0 825 | m_PrefabParentObject: {fileID: 0} 826 | m_PrefabInternal: {fileID: 0} 827 | serializedVersion: 5 828 | m_Component: 829 | - component: {fileID: 1711205324} 830 | - component: {fileID: 1711205327} 831 | - component: {fileID: 1711205326} 832 | - component: {fileID: 1711205325} 833 | - component: {fileID: 1711205329} 834 | - component: {fileID: 1711205328} 835 | m_Layer: 5 836 | m_Name: Button 837 | m_TagString: Untagged 838 | m_Icon: {fileID: 0} 839 | m_NavMeshLayer: 0 840 | m_StaticEditorFlags: 0 841 | m_IsActive: 1 842 | --- !u!224 &1711205324 843 | RectTransform: 844 | m_ObjectHideFlags: 0 845 | m_PrefabParentObject: {fileID: 0} 846 | m_PrefabInternal: {fileID: 0} 847 | m_GameObject: {fileID: 1711205323} 848 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 849 | m_LocalPosition: {x: 0, y: 0, z: 0} 850 | m_LocalScale: {x: 1, y: 1, z: 1} 851 | m_Children: 852 | - {fileID: 1605200422} 853 | m_Father: {fileID: 1137215122} 854 | m_RootOrder: 1 855 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 856 | m_AnchorMin: {x: 0.5, y: 0.5} 857 | m_AnchorMax: {x: 0.5, y: 0.5} 858 | m_AnchoredPosition: {x: 0, y: 0} 859 | m_SizeDelta: {x: 300, y: 80} 860 | m_Pivot: {x: 0.5, y: 0.5} 861 | --- !u!114 &1711205325 862 | MonoBehaviour: 863 | m_ObjectHideFlags: 0 864 | m_PrefabParentObject: {fileID: 0} 865 | m_PrefabInternal: {fileID: 0} 866 | m_GameObject: {fileID: 1711205323} 867 | m_Enabled: 1 868 | m_EditorHideFlags: 0 869 | m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} 870 | m_Name: 871 | m_EditorClassIdentifier: 872 | m_Navigation: 873 | m_Mode: 3 874 | m_SelectOnUp: {fileID: 0} 875 | m_SelectOnDown: {fileID: 0} 876 | m_SelectOnLeft: {fileID: 0} 877 | m_SelectOnRight: {fileID: 0} 878 | m_Transition: 1 879 | m_Colors: 880 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 881 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 882 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 883 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 884 | m_ColorMultiplier: 1 885 | m_FadeDuration: 0.1 886 | m_SpriteState: 887 | m_HighlightedSprite: {fileID: 0} 888 | m_PressedSprite: {fileID: 0} 889 | m_DisabledSprite: {fileID: 0} 890 | m_AnimationTriggers: 891 | m_NormalTrigger: Normal 892 | m_HighlightedTrigger: Highlighted 893 | m_PressedTrigger: Pressed 894 | m_DisabledTrigger: Disabled 895 | m_Interactable: 1 896 | m_TargetGraphic: {fileID: 1711205326} 897 | m_OnClick: 898 | m_PersistentCalls: 899 | m_Calls: 900 | - m_Target: {fileID: 1711205328} 901 | m_MethodName: EventTriggerHandler 902 | m_Mode: 0 903 | m_Arguments: 904 | m_ObjectArgument: {fileID: 0} 905 | m_ObjectArgumentAssemblyTypeName: 906 | m_IntArgument: 0 907 | m_FloatArgument: 0 908 | m_StringArgument: 909 | m_BoolArgument: 0 910 | m_CallState: 2 911 | m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, 912 | Culture=neutral, PublicKeyToken=null 913 | --- !u!114 &1711205326 914 | MonoBehaviour: 915 | m_ObjectHideFlags: 0 916 | m_PrefabParentObject: {fileID: 0} 917 | m_PrefabInternal: {fileID: 0} 918 | m_GameObject: {fileID: 1711205323} 919 | m_Enabled: 1 920 | m_EditorHideFlags: 0 921 | m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} 922 | m_Name: 923 | m_EditorClassIdentifier: 924 | m_Material: {fileID: 0} 925 | m_Color: {r: 1, g: 1, b: 1, a: 1} 926 | m_RaycastTarget: 1 927 | m_OnCullStateChanged: 928 | m_PersistentCalls: 929 | m_Calls: [] 930 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 931 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 932 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 933 | m_Type: 1 934 | m_PreserveAspect: 0 935 | m_FillCenter: 1 936 | m_FillMethod: 4 937 | m_FillAmount: 1 938 | m_FillClockwise: 1 939 | m_FillOrigin: 0 940 | --- !u!222 &1711205327 941 | CanvasRenderer: 942 | m_ObjectHideFlags: 0 943 | m_PrefabParentObject: {fileID: 0} 944 | m_PrefabInternal: {fileID: 0} 945 | m_GameObject: {fileID: 1711205323} 946 | --- !u!114 &1711205328 947 | MonoBehaviour: 948 | m_ObjectHideFlags: 0 949 | m_PrefabParentObject: {fileID: 0} 950 | m_PrefabInternal: {fileID: 0} 951 | m_GameObject: {fileID: 1711205323} 952 | m_Enabled: 1 953 | m_EditorHideFlags: 0 954 | m_Script: {fileID: 11500000, guid: 8d11df88199b8a64abab7ca18d6febea, type: 3} 955 | m_Name: 956 | m_EditorClassIdentifier: 957 | targetObject: {fileID: 1711205323} 958 | eventsCollectionScript: {fileID: 11500000, guid: 860bb2b80267e0444972e73bf91f9fb8, 959 | type: 3} 960 | eventsCollectionClassType: 961 | m_Name: SampleScript 962 | m_AssemblyQualifiedName: SampleScript, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, 963 | PublicKeyToken=null 964 | m_AssemblyName: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 965 | eventTypeIndex: 0 966 | eventIndex: 4 967 | delegateIndex: 0 968 | eventTriggerType: 4 969 | eventComponentIndex: 3 970 | eventPropertyIndex: 0 971 | selectedEventTriggerType: 4 972 | eventEntry: 973 | eventID: 4 974 | callback: 975 | m_PersistentCalls: 976 | m_Calls: [] 977 | m_TypeName: UnityEngine.EventSystems.EventTrigger+TriggerEvent, UnityEngine.UI, 978 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 979 | argsGameObjectTarget: {fileID: 111871403} 980 | argsComponents: [] 981 | argsComponentIndexes: 982 | argsTargetsPropertiesIndexes: 983 | argsTargetsProperties: [] 984 | argumentTypes: 985 | argsChoiceIndexList: 986 | stringArgs: [] 987 | gameObjectArgs: [] 988 | componentArgs: [] 989 | colorArgs: [] 990 | --- !u!114 &1711205329 991 | MonoBehaviour: 992 | m_ObjectHideFlags: 0 993 | m_PrefabParentObject: {fileID: 0} 994 | m_PrefabInternal: {fileID: 0} 995 | m_GameObject: {fileID: 1711205323} 996 | m_Enabled: 1 997 | m_EditorHideFlags: 0 998 | m_Script: {fileID: -1862395651, guid: f70555f144d8491a825f0804e09c671c, type: 3} 999 | m_Name: 1000 | m_EditorClassIdentifier: 1001 | m_Delegates: [] 1002 | delegates: [] 1003 | --- !u!1 &1882926679 1004 | GameObject: 1005 | m_ObjectHideFlags: 0 1006 | m_PrefabParentObject: {fileID: 0} 1007 | m_PrefabInternal: {fileID: 0} 1008 | serializedVersion: 5 1009 | m_Component: 1010 | - component: {fileID: 1882926682} 1011 | - component: {fileID: 1882926681} 1012 | - component: {fileID: 1882926680} 1013 | m_Layer: 0 1014 | m_Name: EventSystem 1015 | m_TagString: Untagged 1016 | m_Icon: {fileID: 0} 1017 | m_NavMeshLayer: 0 1018 | m_StaticEditorFlags: 0 1019 | m_IsActive: 1 1020 | --- !u!114 &1882926680 1021 | MonoBehaviour: 1022 | m_ObjectHideFlags: 0 1023 | m_PrefabParentObject: {fileID: 0} 1024 | m_PrefabInternal: {fileID: 0} 1025 | m_GameObject: {fileID: 1882926679} 1026 | m_Enabled: 1 1027 | m_EditorHideFlags: 0 1028 | m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} 1029 | m_Name: 1030 | m_EditorClassIdentifier: 1031 | m_HorizontalAxis: Horizontal 1032 | m_VerticalAxis: Vertical 1033 | m_SubmitButton: Submit 1034 | m_CancelButton: Cancel 1035 | m_InputActionsPerSecond: 10 1036 | m_RepeatDelay: 0.5 1037 | m_ForceModuleActive: 0 1038 | --- !u!114 &1882926681 1039 | MonoBehaviour: 1040 | m_ObjectHideFlags: 0 1041 | m_PrefabParentObject: {fileID: 0} 1042 | m_PrefabInternal: {fileID: 0} 1043 | m_GameObject: {fileID: 1882926679} 1044 | m_Enabled: 1 1045 | m_EditorHideFlags: 0 1046 | m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} 1047 | m_Name: 1048 | m_EditorClassIdentifier: 1049 | m_FirstSelected: {fileID: 0} 1050 | m_sendNavigationEvents: 1 1051 | m_DragThreshold: 5 1052 | --- !u!4 &1882926682 1053 | Transform: 1054 | m_ObjectHideFlags: 0 1055 | m_PrefabParentObject: {fileID: 0} 1056 | m_PrefabInternal: {fileID: 0} 1057 | m_GameObject: {fileID: 1882926679} 1058 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1059 | m_LocalPosition: {x: 0, y: 0, z: 0} 1060 | m_LocalScale: {x: 1, y: 1, z: 1} 1061 | m_Children: [] 1062 | m_Father: {fileID: 0} 1063 | m_RootOrder: 3 1064 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1065 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Sample/EventBinderSampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c8514aae79d5d8428941bc770a0ff37 3 | timeCreated: 1518734965 4 | licenseType: Pro 5 | DefaultImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d0bf692d08d1f14aa1b9e0a1e4c357f 3 | folderAsset: yes 4 | timeCreated: 1520427466 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Utils/SerializableSystemType.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Runtime.Serialization; 3 | 4 | [System.Serializable] 5 | public class SerializableSystemType 6 | { 7 | [SerializeField] 8 | private string m_Name; 9 | 10 | public string Name 11 | { 12 | get { return m_Name; } 13 | } 14 | 15 | [SerializeField] 16 | private string m_AssemblyQualifiedName; 17 | 18 | public string AssemblyQualifiedName 19 | { 20 | get { return m_AssemblyQualifiedName; } 21 | } 22 | 23 | [SerializeField] 24 | private string m_AssemblyName; 25 | 26 | public string AssemblyName 27 | { 28 | get { return m_AssemblyName; } 29 | } 30 | 31 | private System.Type m_SystemType; 32 | public System.Type SystemType 33 | { 34 | get 35 | { 36 | if (m_SystemType == null) 37 | { 38 | GetSystemType(); 39 | } 40 | return m_SystemType; 41 | } 42 | } 43 | 44 | private void GetSystemType() 45 | { 46 | m_SystemType = System.Type.GetType(m_AssemblyQualifiedName); 47 | } 48 | 49 | public SerializableSystemType( System.Type _SystemType ) 50 | { 51 | m_SystemType = _SystemType; 52 | m_Name = _SystemType.Name; 53 | m_AssemblyQualifiedName = _SystemType.AssemblyQualifiedName; 54 | m_AssemblyName = _SystemType.Assembly.FullName; 55 | } 56 | 57 | public override bool Equals( System.Object obj ) 58 | { 59 | SerializableSystemType temp = obj as SerializableSystemType; 60 | if ((object)temp == null) 61 | { 62 | return false; 63 | } 64 | return this.Equals(temp); 65 | } 66 | 67 | public bool Equals( SerializableSystemType _Object ) 68 | { 69 | //return m_AssemblyQualifiedName.Equals(_Object.m_AssemblyQualifiedName); 70 | return _Object.SystemType.Equals(SystemType); 71 | } 72 | 73 | public static bool operator ==( SerializableSystemType a, SerializableSystemType b ) 74 | { 75 | // If both are null, or both are same instance, return true. 76 | if (System.Object.ReferenceEquals(a, b)) 77 | { 78 | return true; 79 | } 80 | 81 | // If one is null, but not both, return false. 82 | if (((object)a == null) || ((object)b == null)) 83 | { 84 | return false; 85 | } 86 | 87 | return a.Equals(b); 88 | } 89 | 90 | public static bool operator !=( SerializableSystemType a, SerializableSystemType b ) 91 | { 92 | return !(a == b); 93 | } 94 | } -------------------------------------------------------------------------------- /Build/Source Code/Assets/Plugins/EventBinder/Utils/SerializableSystemType.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ae8d34833a4ff34d895a909020c970e 3 | timeCreated: 1520427475 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Build/Unity Asset/EventBinder 07.03.2018 - 02.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GeorgeDascalu/Unity-EventBinder/7d7a35a7890b6fa400f47770f1c7cffb9d014057/Build/Unity Asset/EventBinder 07.03.2018 - 02.unitypackage -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 George Dascalu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity-EventBinder-Asset 2 | EventBinder asset for Unity 3 | 4 | ## Event binder Mini-Framework for Unity3D 5 | 6 | ## Introduction 7 | 8 | The Unity-EventBinder plugin is a de-coupling event framework built to specifically to target Unity 3D. It can be used to separate the event triggers (ex: Button "onClick") from the event listeners. 9 | 10 | This project is open source. You can find the officical repository [here](https://github.com/GeorgeDascalu/Unity-EventBinder-Asset) 11 | 12 | For general troubleshooting / support, please post to [stack overflow](https://stackoverflow.com/questions/ask) using the tag 'UnityEventBinder'. 13 | 14 | Or, if you have found a bug, you are also welcome to create an issue on the [github page](https://github.com/GeorgeDascalu/Unity-EventBinder-Asset), or a pull request if you have a fix / extension. 15 | 16 | 17 | ## Features 18 | 19 | * De-coupling 20 | * Separates the event "triggers" from the event "listeners" 21 | * Uses specific Actions to connect the triggers to the listeners 22 | * Multiple listeners for an UI event 23 | * Ability to add static event handlers for events - something that you cannot do with default Unity events 24 | * Ability to select Events 25 | * From "EventTriggerType": PointerDown, PointerUp, PointerClick...etc 26 | * From a specific GameObject (ex: **onClick** from **Button**, or **onValueChanged** from **InputField**) 27 | * Ability to add custom arguments including: "String", "int", "float", "double", "Vector2", "Vector3", "Vector4", "GameObject", "Component", "Color". More argument types will come in the future. 28 | * Ability to select a dynamic argument 29 | * Example: select the "text" property of a "InputField" component 30 | 31 | 32 | ## Installation 33 | 34 | You can install Unity-EventBinder using the following method: 35 | 36 | 1. From [Github Page](https://github.com/GeorgeDascalu/Unity-EventBinder-Asset). Here you can choose between the following: 37 | 38 | * Unity Package: /Unity Asset/ **EventBinder[date]-[build].unitypackage** - Including a sample scene 39 | * Source Code: /Source Code/Assets.. 40 | 41 | 42 | ## Usage 43 | 44 | There are 3 main components for the EventBinder plugin 45 | 46 | 1. The **EventsCollection** class 47 | * This is a collection with all the events that the plugin will search, display and use throughout the framework. 48 | * You can remove the events provided and add new ones as you would add an event normally 49 | * The events are **Action** type, they should be **static** & **public**. 50 | * It is best (yet optional) to name the arguments in your declaration (eg: **delegate (string testValue)**"). 51 | ```csharp 52 | public static event Action EventWithStringArgument = delegate (string stringArgument) {}; 53 | ``` 54 | 55 | 56 | 2. The **EventBinderBehaviour** class 57 | * Attach this to any GameObject in your scene 58 | * Set the **Target Object** from which the user event should be listened from. Will default to the GameObject attached. 59 | * Select the **Event Type** that will be listened 60 | * From TargetObject: Will display a list of components and a list of Events for that component 61 | Currently it only supports events extending **UnityEvent**, will add support for **UnityEvent** in future releases. 62 | * EventTrigger Type: Will listen to any event supported by the **EventTrigger** component (PointerDown, PointerEnter, PointerClick...etc) 63 | * Select the **Event Delegate** 64 | * This will be an event from the **EventsCollection** class 65 | * If the event has arguments you will need to populate the arguments with values 66 | * **Static** - A static, hard-coded value written in the Inspector 67 | * **Dynamic** - The value will be retrieved at runtime from the specified component. For example: the **text** property of a **InputField** or the rotation of an object, or the position of an object..etc. 68 | Combine this with the ability of adding limitless listeners to the events and you can more easily modularize your project. 69 | 70 | 71 | ![EventBinderBehaviour](https://i.imgur.com/uzQnLFj.png) 72 | 73 | 3. The listener class - In the sample **EventBinderSampleListenerController** 74 | * Add a listener to any event from the class as written below: 75 | ```csharp 76 | public class EventBinderSampleListenerController : MonoBehaviour 77 | { 78 | /**LIFECYCLE*/ 79 | private void Start () 80 | { 81 | AddListeners(); 82 | AddListenersStatic(); 83 | } 84 | 85 | 86 | /**EVENT REGISTRATION*/ 87 | private void AddListeners() 88 | { 89 | EventsCollection.eventWithStringArgs += OnEventWithStringArgsHandler; 90 | } 91 | 92 | private static void AddListenersStatic() 93 | { 94 | EventsCollection.eventWithStringArgs += OnStaticEventWithStringArgsHandler; 95 | } 96 | 97 | 98 | 99 | /**EVENT HANDLERS*/ 100 | public void OnEventWithStringArgsHandler(string value) 101 | { 102 | Debug.Log ("We got a new message with a String parameter: " + value); 103 | } 104 | 105 | 106 | public void OnStaticEventWithStringArgsHandler(string value) 107 | { 108 | Debug.Log ("[STATIC] We got a new message with a String parameter: " + value); 109 | } 110 | } 111 | ``` 112 | 113 | 114 | 115 | ## License 116 | 117 | The MIT License (MIT) 118 | 119 | Copyright (c) 2018 George Dascalu 120 | 121 | Permission is hereby granted, free of charge, to any person obtaining a copy 122 | of this software and associated documentation files (the "Software"), to deal 123 | in the Software without restriction, including without limitation the rights 124 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 125 | copies of the Software, and to permit persons to whom the Software is 126 | furnished to do so, subject to the following conditions: 127 | 128 | The above copyright notice and this permission notice shall be included in all 129 | copies or substantial portions of the Software. 130 | 131 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 132 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 133 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 134 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 135 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 136 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 137 | SOFTWARE. 138 | --------------------------------------------------------------------------------