void DrawSignalNameColumn(Rect rect, float padding, SignalReceiver target, int rowIdx) { using (new EditorGUI.DisabledScope(!enabled)) { if (!readonlySignal) { m_CurrentRowIdx = rowIdx; m_CurrentReceiver = target; rect.x += padding; rect.width -= padding; rect.height = EditorGUIUtility.singleLineHeight; GUI.SetNextControlName(SignalName); SignalUtility.DrawSignalNames(this, rect, GUIContent.none, false); } else { GUI.SetNextControlName(SignalNameReadOnly); var signalAsset = m_Asset.objectReferenceValue; GUI.Label(rect, signalAsset != null ? EditorGUIUtility.TempContent(signalAsset.name) : Styles.EmptySignalList); } } }
void CreateNewSignalAsset() { var path = SignalUtility.GetNewSignalPath(); if (!string.IsNullOrEmpty(path)) { ((ISignalAssetProvider)this).CreateNewSignalAsset(path); } }
protected virtual void DrawSignalNameColumn(Rect rect, float padding, SignalReceiver target, int rowIdx) { m_CurrentRowIdx = rowIdx; m_CurrentReceiver = target; rect.x += padding; rect.width -= padding; rect.height = EditorGUIUtility.singleLineHeight; SignalUtility.DrawSignalNames(this, rect, GUIContent.none, false); }
void DrawReceivers() { if (!m_TargetsHaveTheSameBinding) { EditorGUILayout.HelpBox(Styles.MultiEditNotSupportedOnDifferentBindings, MessageType.None); return; } if (targets.OfType <SignalEmitter>().Select(x => x.asset).Distinct().Count() > 1) { EditorGUILayout.HelpBox(Styles.MultiEditNotSupportedOnDifferentSignals, MessageType.None); return; } //do not display the receiver if the current timeline is not the same as the emitter's timeline //can happen if the inspector is locked if (m_Signal.parent != null && m_Signal.parent.timelineAsset != TimelineEditor.inspectedAsset) { return; } if (m_BoundGameObject != null) { if (!m_Receivers.Any(x => x is SignalReceiver)) { EditorGUILayout.Separator(); var message = string.Format(Styles.NoSignalReceiverComponent, m_BoundGameObject.name); SignalUtility.DrawCenteredMessage(message); if (SignalUtility.DrawCenteredButton(Styles.AddSignalReceiverComponent)) { AddReceiverComponent(); } } foreach (var receiver in m_Receivers) { var editor = GetOrCreateReceiverEditor(receiver); if (DrawReceiverHeader(receiver)) { editor.OnInspectorGUI(); } } } else if (m_AssociatedDirector != null) //not in asset mode { EditorGUILayout.HelpBox(Styles.NoBoundGO, MessageType.None); } }
void DrawEmitterControls() { if (m_Context != null) { var currentSignal = (m_Context as SignalEmitter).asset; if (currentSignal != null && !m_Target.IsSignalAssetHandled(currentSignal)) { EditorGUILayout.Separator(); var message = string.Format("No reaction for {0} has been defined in this receiver", currentSignal.name); SignalUtility.DrawCenteredMessage(message); SignalUtility.DrawCenteredButton(Styles.AddReactionButton, () => m_Target.AddNewReaction(currentSignal)); // Add reaction on the first EditorGUILayout.Separator(); } } }
void DrawSignal() { //should show button to create new signal if there are no signals asset in the project if (!SignalManager.assets.Any()) { using (new EditorGUI.DisabledScope(true)) { DrawNameSelector(); } EditorGUILayout.Separator(); SignalUtility.DrawCenteredMessage(Styles.ProjectHasNoSignalAsset); SignalUtility.DrawCenteredButton(Styles.CreateNewSignal, CreateNewSignalAsset); EditorGUILayout.Separator(); } else { DrawNameSelector(); } }
void DrawEmitterControls() { var context = signalEmitterContext; if (context != null) { var currentSignal = context.asset; if (currentSignal != null && !m_Target.IsSignalAssetHandled(currentSignal)) { EditorGUILayout.Separator(); var message = string.Format(Styles.NoReaction, currentSignal.name); SignalUtility.DrawCenteredMessage(message); if (SignalUtility.DrawCenteredButton(Styles.AddReactionButton)) { m_Target.AddNewReaction(currentSignal); // Add reaction on the first } EditorGUILayout.Separator(); } } }
void DrawReceivers() { if (!m_TargetsHaveTheSameBinding) { EditorGUILayout.HelpBox(Styles.MultiEditNotSupportedOnDifferentBindings, MessageType.None); return; } if (targets.OfType <SignalEmitter>().Select(x => x.asset).Distinct().Count() > 1) { EditorGUILayout.HelpBox(Styles.MultiEditNotSupportedOnDifferentSignals, MessageType.None); return; } if (m_BoundGameObject != null) { if (!m_Receivers.Any(x => x is SignalReceiver)) { EditorGUILayout.Separator(); var message = string.Format(Styles.NoSignalReceiverComponent, m_BoundGameObject.name); SignalUtility.DrawCenteredMessage(message); SignalUtility.DrawCenteredButton(Styles.AddSignalReceiverComponent, AddReceiverComponent); } foreach (var receiver in m_Receivers) { var editor = GetOrCreateReceiverEditor(receiver); if (DrawReceiverHeader(receiver)) { editor.OnInspectorGUI(); } } } else { EditorGUILayout.HelpBox(Styles.NoBoundGO, MessageType.None); } }
void DrawNameSelector() { SignalUtility.DrawSignalNames(this, EditorGUILayout.GetControlRect(), Styles.EmitSignalLabel, !signalAssetSameValue); }