public List <ScriptDesc> Process() { GameObjectEventHandlerScriptListBuilder builder = new GameObjectEventHandlerScriptListBuilder(); var typeList = new List <Type>(); switch (Data.Action) { //case AddHandlerAction.MapExistingHandler: default: // list all the handlers from all the scripts attached to this game object MonoBehaviour[] components = GameObject.GetComponents <MonoBehaviour>(); foreach (MonoBehaviour component in components) { typeList.Add(component.GetType()); } break; case AddHandlerAction.AttachExistingScriptAndMapHandler: // list all handlers from the attached script typeList.Add(Data.AttachedScriptType); break; case AddHandlerAction.CreateNewHandlerInExistingScript: // list all handlers from the attached script typeList.Add(Data.AttachedScriptType); break; case AddHandlerAction.CreateNewScriptAndHandler: // display the additional dialog asking for a name of the handler to create //typeList.Add(Data.AttachedScriptType); break; } typeList.Sort(TypeComparison); builder.ComponentTypes = typeList; _scripts = builder.Run(); //Debug.Log("Number of retrieved scripts: " + _scripts.Count); return(_scripts); }
public List<ScriptDesc> Process() { GameObjectEventHandlerScriptListBuilder builder = new GameObjectEventHandlerScriptListBuilder(); var typeList = new List<Type>(); switch (Data.Action) { //case AddHandlerAction.MapExistingHandler: default: // list all the handlers from all the scripts attached to this game object MonoBehaviour[] components = GameObject.GetComponents<MonoBehaviour>(); foreach (MonoBehaviour component in components) { typeList.Add(component.GetType()); } break; case AddHandlerAction.AttachExistingScriptAndMapHandler: // list all handlers from the attached script typeList.Add(Data.AttachedScriptType); break; case AddHandlerAction.CreateNewHandlerInExistingScript: // list all handlers from the attached script typeList.Add(Data.AttachedScriptType); break; case AddHandlerAction.CreateNewScriptAndHandler: // display the additional dialog asking for a name of the handler to create //typeList.Add(Data.AttachedScriptType); break; } typeList.Sort(TypeComparison); builder.ComponentTypes = typeList; _scripts = builder.Run(); //Debug.Log("Number of retrieved scripts: " + _scripts.Count); return _scripts; }