private void renderListenerObjectSelector (ScreenBreakpointClient sb_client, MonoBehaviour listening_object) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(listener_label); MonoBehaviour new_listening_object = (MonoBehaviour) EditorGUILayout .ObjectField(listening_object, typeof(MonoBehaviour), true); // If we are just redrawing this element they can be equal // if they are literally exactly the same object // then don't reassign if (new_listening_object != this.listening_object) { // regardless of whether or not the new element is null // do the assignment // (null is valid - no object) this.listening_object = new_listening_object; sb_client.ListeningObject = new_listening_object; MSEM.ProvideObjectForMethodsToBeInvokedUpon(new_listening_object); selection_labels = MSEM.SelectionNames; EditorUtility.SetDirty(this); } EditorGUILayout.EndHorizontal(); }
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); } }
/// <summary> /// This is called every time we swap back to this /// i.e. this will be re-entered while it's still active /// </summary> public void OnEnable() { Debug.Log("SBCV enabled"); if (target != null) { sb_client = (ScreenBreakpointClient)target; listening_object = sb_client.ListeningObject; if (listening_object != null) { if (!MSEM.IsInitialised) { MSEM.Initialise(OnBreakpointEntryUpdate); } MSEM.ProvideObjectForMethodsToBeInvokedUpon(listening_object); selection_labels = MSEM.SelectionNames; } } }