예제 #1
0
        protected override void OnClickDelete(DialogueEditorWindow window)
        {
            SerializedObject conversation = window.SerializedConversation;

            if (conversation != null)
            {
                // Delete response from conversation
                conversation.Update();
                SerializedProperty entry = SerializedConversationUtility.FindEntry(conversation, entryID);
                entry.FindPropertyRelative("Responses").DeleteArrayElementAtIndex(index);
                conversation.ApplyModifiedProperties();
            }
        }
        protected void OnClickAddResponse(DialogueEditorWindow window)
        {
            SerializedObject conversation = window.SerializedConversation;

            if (conversation != null)
            {
                conversation.Update();
                // Get serialized property for this node
                SerializedProperty serialEntry = SerializedConversationUtility.FindEntry(conversation, entryID);
                if (serialEntry != null)
                {
                    SerializedDialogueEntryUtility.AddResponse(serialEntry);
                }
                conversation.ApplyModifiedProperties();
            }
        }
예제 #3
0
        protected internal override bool ConnectObjectToDialogueEntry(DialogueEditorWindow window, int targetID)
        {
            SerializedObject conversation = window.SerializedConversation;
            bool             success      = false;

            if (conversation != null)
            {
                conversation.Update();
                SerializedProperty serializedEntry    = SerializedConversationUtility.FindEntry(conversation, entryID);
                SerializedProperty serializedResponse = serializedEntry.FindPropertyRelative("Responses").GetArrayElementAtIndex(index);
                SerializedProperty transitions        = serializedResponse.FindPropertyRelative("transitions.transitions");
                //TODO write some SerializedTransitionListUtility with an insert new transition function
                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);
        }