RenderOutputObjectSelector (EventSwitchboard switchboard) { MonoBehaviour CurrentOutputObject = switchboard.Target; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(TriggerLabel); MonoBehaviour NewOutputObject = (MonoBehaviour) EditorGUILayout .ObjectField(CurrentOutputObject, 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 (NewOutputObject != CurrentOutputObject) { // regardless of whether or not the new element is null // do the assignment // (null is valid - no object) switchboard.Target = NewOutputObject; InitialiseTargetSelectionModules(NewOutputObject); EditorUtility.SetDirty(this); } EditorGUILayout.EndHorizontal(); }
private void AddCordCircuit(EventSwitchboard switchboard) { CordCircuit NewEntry = new CordCircuit(); if (switchboard.CordCircuits == null) { Debug.Log("CordCircuits null - creating list"); switchboard.CordCircuits = new List <EventSwitchboard.CordCircuit>(); } switchboard.CordCircuits.Add(NewEntry); NewEntry.RearJackType = EventSwitchboard.JackType.Method; //TargetMSEM.SetMemberSelection(NewEntry, DefaultMethodIndex); EditorUtility.SetDirty(target); }
RenderRegistryKeyTypeSelector (EventSwitchboard switchboard) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(EnumLabel); if (SelectableEnumNames == null) { SelectableEnumNames = SelectableEnums .Select(t => t.ToString()) .ToArray(); } int OldIndex = SelectedEnumIndex; SelectedEnumIndex = EditorGUILayout.Popup( SelectedEnumIndex, SelectableEnumNames ); // If we are just redrawing this element they can be equal // if they are literally exactly the same object // then don't reassign if (switchboard.RegistryKeyType == null || OldIndex != SelectedEnumIndex) { // regardless of whether or not the new element is null // do the assignment // (null is valid - no object) switchboard.RegistryKeyType = SelectableEnums[SelectedEnumIndex]; Debug.Log("Setting registry key type to " + SelectableEnums[SelectedEnumIndex]); EditorUtility.SetDirty(this); } EditorGUILayout.EndHorizontal(); }
public void Awake() { if (!UiObjectsInstantiated) { InitialiseUIElementAll(); SSCManager = GetComponent <ScreenSizeChangeManager>(); InstantiateUIObjects(); ComponentRegistry.RegisterTransitions(this); InitialiseManagerFields(); InitialiseGameplayUi(); InitialiseSettingsMenu(); EventSwitchboard Switchboard = GetComponent <EventSwitchboard>(); Switchboard.ConnectCords(ComponentRegistry); InitialiseUICameras(); InitialiseScreenFader(); if (DontDestroyOnLoad) { UnityEngine.Object.DontDestroyOnLoad(PlayerScreenCanvas); UnityEngine.Object.DontDestroyOnLoad(gameObject); } if (PrintScreenSizeDebugText) { InitialiseDebugTextUiObject(); } UiObjectsInstantiated = true; // DEBUG DebugInitialTime = DateTime.Now; } }
//private void //RenderCordCircuitList //(EventSwitchboard switchboard, List<string> method_names) //{ // if (switchboard.CordCircuits != null) // { // for (int CircuitIndex = 0; // CircuitIndex < switchboard.CordCircuits.Count; // CircuitIndex++) // { // CordCircuit Circuit // = switchboard.CordCircuits[CircuitIndex]; // bool ShouldDeleteElement // = RenderCircuitEntry(Circuit, CircuitIndex); // if (ShouldDeleteElement) // { // CircuitsToDelete.Push(Circuit); // } // } // } // while (CircuitsToDelete.Count > 0) // { // CordCircuit ItemToDelete = CircuitsToDelete.Pop(); // DeleteCircuit(switchboard, ItemToDelete); // } // EditorGUI.indentLevel--; // // static call to EventSelectionEditorModule<CordCircuit>, // // but this is shorter // bool ShouldAddEntry = TargetMSEM.RenderListButtons(); // if (ShouldAddEntry) // { // AddCordCircuit(switchboard); // } //} private void DeleteCircuit(EventSwitchboard switchboard, CordCircuit ItemToDelete) { switchboard.CordCircuits.Remove(ItemToDelete); RemoveFromSelectionModules(ItemToDelete); EditorUtility.SetDirty(target); }