protected internal override bool ConnectObjectToDialogueEntry(DialogueEditorWindow window, int targetID) { // Get Conversation object from window SerializedObject conversation = window.SerializedConversation; bool success = false; if (conversation != null) { conversation.Update(); SerializedProperty entries = conversation.FindProperty("Entries"); // HACK use SerializedConversationUtility to find entries // Find own entry and target entry properties in conversation SerializedProperty serializedEntry = SerializedArrayUtility.FindPropertyByValue(entries, "ID", entryID); SerializedProperty serializedTarget = SerializedArrayUtility.FindPropertyByValue(entries, "ID", targetID); SerializedProperty transitions = serializedEntry.FindPropertyRelative("transitions.transitions"); int oldSize = transitions.arraySize; transitions.InsertArrayElementAtIndex(oldSize); SerializedProperty newTransition = transitions.GetArrayElementAtIndex(oldSize); newTransition.FindPropertyRelative("condition").objectReferenceValue = null; newTransition.FindPropertyRelative("transition.TargetID").intValue = targetID; conversation.ApplyModifiedProperties(); success = true; } return(success); }
public static SerializedProperty FindEntry(SerializedObject serialConversation, int ID) { SerializedProperty dialogueEntry = null; if (IsConversation(serialConversation)) { dialogueEntry = SerializedArrayUtility.FindPropertyByValue(serialConversation.FindProperty("Entries"), "ID", ID); } return(dialogueEntry); }
public override SerializedProperty ContentsAsProperty(SerializedObject conversation) { return(SerializedArrayUtility.FindPropertyByValue(conversation.FindProperty("Entries"), "ID", entryID)); }
public override SerializedProperty ContentsAsProperty(SerializedObject conversation) { SerializedProperty entry = SerializedArrayUtility.FindPropertyByValue(conversation.FindProperty("Entries"), "ID", entryID); return(entry.FindPropertyRelative("Responses").GetArrayElementAtIndex(index)); }