void OnEnable() { Handler = (DialogHandler)target; Handler.FileList = FileManager.LoadFiles().Clone <string>(); DialogHandler[] handlerList = FindObjectsOfType <DialogHandler>(); foreach (var _handler in handlerList) { if (_handler.gameObject.GetInstanceID() != ((DialogHandler)target).gameObject.GetInstanceID() && _handler.LoadedDialogue == true) { int fileIndex = _handler.FileList.FindIndex(a => a == _handler.SelectedFile); if (fileIndex != -1) { Handler.FileList.RemoveAt(fileIndex); } } } LoadedDialogue = serializedObject.FindProperty("LoadedDialogue"); SelectedDialogIndex = serializedObject.FindProperty("SelectedDialogIndex"); SelectedFile = serializedObject.FindProperty("SelectedFile"); }
override public void ShowGUI(List <AC.ActionParameter> parameters) { parameterID = AC.Action.ChooseParameterGUI("Conversation:", parameters, parameterID, AC.ParameterType.GameObject); if (parameterID >= 0) { constantID = 0; conversation = null; } else { dialogHandler = (DialogHandler)EditorGUILayout.ObjectField("Conversation:", dialogHandler, typeof(DialogHandler), true); if (dialogHandler != null) { dialogLoaded = dialogHandler.LoadedDialogue; if (dialogLoaded == true) { // Gets the first conversation's gameobject GameObject firstDialogObject = dialogHandler.gameObject.transform.FindChild(dialogHandler.GetFirstNode().UniqueID).gameObject; conversation = firstDialogObject.GetComponent <AC.Conversation>(); constantID = FieldToID <AC.Conversation>(conversation, constantID); conversation = IDToField <AC.Conversation>(conversation, constantID, false); } } } if (dialogHandler != null && dialogLoaded == false) { EditorGUILayout.HelpBox("The select conversation it's not properly loaded.", MessageType.Warning); } if (conversation) { conversation.Upgrade(); overrideOptions = EditorGUILayout.Toggle("Override options?", overrideOptions); if (overrideOptions) { numSockets = conversation.options.Count; } else { numSockets = 0; } } else { if (isAssetFile && overrideOptions && constantID != 0) { EditorGUILayout.HelpBox("Cannot find linked Conversation - please open its scene file.", MessageType.Warning); } else { numSockets = 0; } } }