Beispiel #1
0
        /// <summary>
        /// Side-effects: changes the entry's values according to user input
        /// </summary>
        /// <param name="entry"></param>
        /// <param name="method_names"></param>
        /// <param name="max_button_width_opt"></param>
        /// <returns></returns>
        private bool renderBreakpointEntry
            (BreakpointEntry entry,
            List <string> method_names,
            GUILayoutOption max_button_width_opt)
        {
            //Debug.Log("Drawing a breakpoint entry");
            Rect rect = EditorGUILayout.BeginHorizontal();

            entry.dimension  = (Dimension)EditorGUILayout.EnumPopup(entry.dimension);
            entry.breakpoint = EditorGUILayout.FloatField(entry.breakpoint);
            // this happens when we are rendering a prefab element
            // i.e. the list has elements already but the viewer isn't set up
            int CurrentMethodIndex =
                MSEM.RetrieveEntrysMemberSelection(
                    entry,
                    entry.handler_function_name
                    );

            int new_method_index
                = EditorGUILayout.Popup(
                      CurrentMethodIndex,
                      MSEM.SelectionNames.ToArray()
                      );

            MSEM.SetMemberSelection(entry, new_method_index);
            bool element_deleted = GUILayout.Button(minus_text, max_button_width_opt);

            EditorGUILayout.EndHorizontal();
            return(element_deleted);
        }
Beispiel #2
0
        OnBreakpointEntryUpdate
            (BreakpointEntry entry, MemberInfo handlerInfo, string newHandlerFunctionName)
        {
            var new_handler = generateMethodCallback(handlerInfo);

            //Debug.Log("new handler generated");
            entry.handler = new_handler;
            entry.handler_function_name = newHandlerFunctionName;
            entry.callback_instance     = listening_object;
            //Debug.Log("Changing entry " + entry.ToString());
            //Debug.Log("Adding handler function \"" + newHandlerFunctionName + "\"");
        }
Beispiel #3
0
        private void displayBreakpointList
            (ScreenBreakpointClient sb_client, List <string> method_names)
        {
            if (KeyLabels == null)
            {
                GUIContent[] Labels =
                {
                    dimension_text, breakpoint_text, callback_text
                };
                KeyLabels = new List <GUIContent>(Labels);
            }
            MyStandardEditorUI.RenderPreListHeaders(header_text, KeyLabels);

            GUILayoutOption max_button_width_opt = GUILayout.MaxWidth(50.0f);

            if (sb_client.BreakpointEntries != null)
            {
                foreach (BreakpointEntry entry in sb_client.BreakpointEntries)
                {
                    bool should_delete_element
                        = renderBreakpointEntry(entry, method_names, max_button_width_opt);
                    if (should_delete_element)
                    {
                        items_to_delete.Push(entry);
                    }
                }
            }
            while (items_to_delete.Count > 0)
            {
                BreakpointEntry item_to_delete = items_to_delete.Pop();
                sb_client.BreakpointEntries.Remove(item_to_delete);
                MSEM.RemoveEntry(item_to_delete);
            }
            EditorGUI.indentLevel--;

            bool should_add_element = MSEM.RenderListButtons();

            if (should_add_element)
            {
                BreakpointEntry new_entry = new BreakpointEntry();
                if (sb_client.BreakpointEntries == null)
                {
                    Debug.Log("sb_client not started yet (but why?). Starting it now");
                    sb_client.Start();
                }
                sb_client.BreakpointEntries.Add(new_entry);
                MSEM.SetMemberSelection(new_entry, DEFAULT_METHOD_INDEX);
                EditorUtility.SetDirty(this);
            }
        }