public override void OnFlowWindowScreenMenuGUI(FD.FlowWindow window, GenericMenu menu) { if (window.isVisibleState == false) { return; } if (window.IsContainer() == true) { return; } if (window.IsSmall() == true && window.IsFunction() == true) { return; } if (window.IsShowDefault() == true) { return; } if (Heatmap.settings == null) { Heatmap.settings = Heatmap.GetSettingsFile(); } var settings = Heatmap.settings; if (settings != null) { var data = settings.data.Get(window); if (data == null) { return; } foreach (var item in settings.items) { if (item.show == true && item.enabled == true) { foreach (var serviceBase in this.editor.services) { var service = serviceBase as IAnalyticsService; if (service.GetServiceName() == item.serviceName) { var key = string.Format("{0}_{1}", item.serviceName, window.id); var windowId = window.id; menu.AddItem(new GUIContent("Open Heatmap..."), false, () => { //this.fullScreenData = this.heatmapResultsCache[key]; this.fullScreenTexture = this.heatmapTexturesCache[key]; this.fullScreenWindowId = windowId; this.fullScreenEditor = null; this.openFullScreen = true; this.flowEditor.SetDisabled(); }); } } } } } }
public bool OnPreviewGUI(Rect rect, GUIStyle background, bool drawInfo, bool selectable) { WindowLayoutElement.waitForComponentConnectionTemp = false; var screen = this.GetScreen() as LayoutWindowType; if (screen != null) { var layout = screen.layout.layout; if (layout != null) { if (this.editorCache == null) { this.editorCache = UnityEditor.Editor.CreateEditor(layout) as IPreviewEditor; } if (this.editorCache != null) { this.editorCache.OnPreviewGUI(Color.white, rect, background, drawInfo, selectable); } if (WindowLayoutElement.waitForComponentConnectionTemp == true) { return(true); } } } return(false); }
public void OnPreviewGUI(Color color, Rect rect, GUIStyle background) { if (this.editor == null) this.editor = Editor.CreateEditor(this.mainComponent) as IPreviewEditor; if (this.editor != null && this.editor.HasPreviewGUI() == true) { this.editor.OnPreviewGUI(color, rect, background, false, false); } }
public void OnPreviewGUI(Color color, Rect rect, GUIStyle background) { if (this.editor == null) { this.editor = Editor.CreateEditor(this.mainComponent) as IPreviewEditor; } if (this.editor != null && this.editor.HasPreviewGUI() == true) { this.editor.OnPreviewGUI(color, rect, background, false, false); } }
public void OnPreviewGUI(Rect rect, GUIStyle background) { if (this.component != null) { if (this.editor == null) { this.editor = UnityEditor.Editor.CreateEditor(this.component) as IPreviewEditor; } if (this.editor != null) { this.editor.OnPreviewGUI(rect, background); } } }
public override void OnPreviewGUI(Rect r, GUIStyle background) { if (this.layout != null) { if (this.editor == null) { this.editor = Editor.CreateEditor(this.layout) as IPreviewEditor; } if (this.editor != null) { this.editor.OnPreviewGUI(Color.white, r, background, drawInfo: false, selectable: false, selectedElement: this._target); } } }
public override void OnFlowWindowScreenMenuGUI(FD.FlowWindow windowSource, GenericMenu menu) { menu.AddItem(new GUIContent("Components Editor..."), on: false, func: (object win) => { var window = win as FD.FlowWindow; var screen = window.GetScreen() as LayoutWindowType; if (screen != null) { this.flowEditor.SetDisabled(); //this.window = window; this.screen = screen; this.editor = Editor.CreateEditor(window.GetScreen()) as IPreviewEditor; this.component = null; this.hovered = null; this.element = null; this.listScrollPosition = Vector2.zero; var serializedObject = new SerializedObject(this.screen); var layout = serializedObject.FindProperty("layout"); var components = layout.FindPropertyRelative("components"); this.props.Clear(); for (int i = 0; i < components.arraySize; ++i) { var component = components.GetArrayElementAtIndex(i); this.props.Add(component); var componentParametersEditor = this.screen.layout.components[i].OnComponentChanged(this.screen, this.screen.layout.components[i].component); if (componentParametersEditor != null) { var e = Editor.CreateEditor(componentParametersEditor) as IParametersEditor; this.screen.layout.components[i].componentParametersEditor = e; } } this.settingsScrollPosition = Vector2.zero; this.opened = true; } }, userData: windowSource); }
public bool OnPreviewGUI(Rect rect, GUIStyle buttonStyle, GUIStyle background, bool drawInfo, bool selectable, System.Action onCreateScreen, System.Action onCreateLayout) { WindowLayoutElement.waitForComponentConnectionTemp = false; var screen = this.GetScreen() as LayoutWindowType; if (screen != null && screen.layout.layout != null) { var layout = screen.layout.layout; if (layout != null) { if (this.editorCache == null) this.editorCache = UnityEditor.Editor.CreateEditor(layout) as IPreviewEditor; if (this.editorCache != null) this.editorCache.OnPreviewGUI(Color.white, rect, background, drawInfo, selectable); if (WindowLayoutElement.waitForComponentConnectionTemp == true) { return true; } } } else { this.editorCache = null; GUI.Box(rect, string.Empty, background); if (this.compiled == false) { GUI.Label(rect, "You need to compile window to start using layout functions.", buttonStyle); } else { if (screen != null) { var layout = screen.layout.layout; if (layout == null) { GUI.BeginGroup(rect); { var width = rect.width * 0.7f; var height = 50f; if (GUI.Button(new Rect(rect.width * 0.5f - width * 0.5f, rect.height * 0.5f - height * 0.5f, width, height), "Create Layout", buttonStyle) == true) { onCreateLayout(); } } GUI.EndGroup(); } } else { GUI.BeginGroup(rect); { var width = rect.width * 0.7f; var height = 50f; if (GUI.Button(new Rect(rect.width * 0.5f - width * 0.5f, rect.height * 0.5f - height * 0.5f, width, height), "Create Screen", buttonStyle) == true) { onCreateScreen(); } } GUI.EndGroup(); } } } return false; }
public override void OnFlowWindowScreenMenuGUI(FD.FlowWindow window, GenericMenu menu) { if (window.isVisibleState == false) return; if (window.IsContainer() == true) return; if (window.IsSmall() == true && window.IsFunction() == true) return; if (window.IsShowDefault() == true) return; if (Heatmap.settings == null) Heatmap.settings = Heatmap.GetSettingsFile(); var settings = Heatmap.settings; if (settings != null) { var data = settings.data.Get(window); if (data == null) return; foreach (var item in settings.items) { if (item.show == true && item.enabled == true) { foreach (var serviceBase in this.editor.services) { var service = serviceBase as IAnalyticsService; if (service.GetServiceName() == item.serviceName) { var key = string.Format("{0}_{1}", item.serviceName, window.id); var windowId = window.id; menu.AddItem(new GUIContent("Open Heatmap..."), false, () => { //this.fullScreenData = this.heatmapResultsCache[key]; this.fullScreenTexture = this.heatmapTexturesCache[key]; this.fullScreenWindowId = windowId; this.fullScreenEditor = null; this.openFullScreen = true; this.flowEditor.SetDisabled(); }); } } } } } }
public override void OnGUI() { if (Heatmap.styles == null) Heatmap.styles = new Styles(); if (this.openFullScreen == true) { var data = FlowSystem.GetData(); if (data == null) return; const float closeSize = 50f; LayoutWindowType screen; var layout = HeatmapSystem.GetLayout(this.fullScreenWindowId, out screen); if (layout == null) return; var window = FlowSystem.GetWindow(this.fullScreenWindowId); if (this.fullScreenEditor == null) this.fullScreenEditor = Editor.CreateEditor(window.GetScreen()) as IPreviewEditor; var rect = new Rect(0f, 0f, 780f, 580f); var scaleFactor = HeatmapSystem.GetFactor(new Vector2(layout.root.editorRectLocal.width, layout.root.editorRectLocal.height), rect.size); var r = layout.root.editorRectLocal; r.x *= scaleFactor; r.y *= scaleFactor; r.x += rect.x + rect.width * 0.5f; r.y += rect.y + rect.height * 0.5f; r.width *= scaleFactor; r.height *= scaleFactor; var screenRect = new Rect(0f, 0f, Screen.width, Screen.height); var settingsSize = rect.size; var settingsRect = new Rect(screenRect.width * 0.5f - settingsSize.x * 0.5f, screenRect.height * 0.5f - settingsSize.y * 0.5f, settingsSize.x, settingsSize.y).PixelPerfect(); var settingsBackRect = new Rect(settingsRect.x - MARGIN, settingsRect.y - MARGIN, settingsRect.width + MARGIN * 2f, settingsRect.height + MARGIN * 2f).PixelPerfect(); var rectCloseButton = new Rect(settingsRect.x + settingsRect.width, settingsRect.y - closeSize * 0.5f, closeSize, closeSize).PixelPerfect(); GUI.Box(screenRect, string.Empty, Heatmap.styles.backLock); GUI.Box(settingsBackRect, string.Empty, Heatmap.styles.dropShadow); GUI.Box(settingsBackRect, string.Empty, Heatmap.styles.contentScreen); var outRect = new Rect(r.x + settingsRect.x, r.y + settingsRect.y, r.width, r.height); GUI.Box(outRect, string.Empty, Heatmap.styles.layoutBack); this.fullScreenEditor.OnPreviewGUI(Color.white, new Rect(outRect.x, outRect.y, outRect.width, outRect.height), GUIStyle.none, selected: null, onSelection: null, highlighted: null); GUI.DrawTexture(outRect, this.fullScreenTexture, ScaleMode.StretchToFill, alphaBlend: true); if (GUI.Button(rectCloseButton, string.Empty, Heatmap.styles.closeButton) == true) { this.flowEditor.SetEnabled(); this.openFullScreen = false; } } }
public bool OnPreviewGUI(Rect rect, GUIStyle buttonStyle, GUIStyle background, bool drawInfo, bool selectable, System.Action onCreateScreen, System.Action onCreateLayout) { WindowLayoutElement.waitForComponentConnectionTemp = false; var screenInfo = this.GetScreen(); if (screenInfo != null && screenInfo.IsEmpty() == false && screenInfo.IsType <LayoutWindowType>() == false) { UnityEditor.EditorGUI.HelpBox(rect, "This window doesn't have `LayoutWindowType` inheritance.", UnityEditor.MessageType.Info); } else { if (screenInfo != null && screenInfo.IsEmpty() == false && screenInfo.Load <LayoutWindowType>().GetCurrentLayout().layout != null) { var screen = screenInfo.Load <LayoutWindowType>(); var layout = screen.GetCurrentLayout().layout; if (layout != null) { if (this.editorCacheScreen != screen || this.editorCacheLayout != layout) { this.editorCache = null; } this.editorCacheScreen = screen; this.editorCacheLayout = layout; if (this.editorCache == null) { this.editorCache = UnityEditor.Editor.CreateEditor(layout) as IPreviewEditor; } if (this.editorCache != null) { this.editorCache.OnPreviewGUI(Color.white, rect, background, drawInfo, selectable); } if (WindowLayoutElement.waitForComponentConnectionTemp == true) { return(true); } } } else { this.editorCache = null; GUI.Box(rect, string.Empty, background); if (this.compiled == false) { UnityEditor.EditorGUI.HelpBox(rect, "You need to compile window to start using layout functions.", UnityEditor.MessageType.Warning); } else { if (screenInfo != null && screenInfo.IsEmpty() == false) { var layout = screenInfo.Load <LayoutWindowType>().GetCurrentLayout().layout; if (layout == null) { GUI.BeginGroup(rect); { var width = rect.width * 0.7f; var height = 50f; if (GUI.Button(new Rect(rect.width * 0.5f - width * 0.5f, rect.height * 0.5f - height * 0.5f, width, height), "Create Layout", buttonStyle) == true) { onCreateLayout(); } } GUI.EndGroup(); } } else { GUI.BeginGroup(rect); { var width = rect.width * 0.7f; var height = 50f; if (GUI.Button(new Rect(rect.width * 0.5f - width * 0.5f, rect.height * 0.5f - height * 0.5f, width, height), "Create Screen", buttonStyle) == true) { onCreateScreen(); } } GUI.EndGroup(); } } } } return(false); }
public override void OnPreviewGUI(Rect r, GUIStyle background) { if (this.layout != null) { if (this.editor == null) this.editor = Editor.CreateEditor(this.layout) as IPreviewEditor; if (this.editor != null) { this.editor.OnPreviewGUI(Color.white, r, background, drawInfo: false, selectable: false, selectedElement: this._target); } } }
public override void OnGUI() { if (Heatmap.styles == null) { Heatmap.styles = new Styles(); } if (this.openFullScreen == true) { var data = FlowSystem.GetData(); if (data == null) { return; } const float closeSize = 50f; LayoutWindowType screen; var layout = HeatmapSystem.GetLayout(this.fullScreenWindowId, out screen); if (layout == null) { return; } var window = FlowSystem.GetWindow(this.fullScreenWindowId); if (this.fullScreenEditor == null) { this.fullScreenEditor = Editor.CreateEditor(window.GetScreen().Load <WindowBase>()) as IPreviewEditor; } var rect = new Rect(0f, 0f, 780f, 580f); var scaleFactor = HeatmapSystem.GetFactor(new Vector2(layout.root.editorRectLocal.width, layout.root.editorRectLocal.height), rect.size); var r = layout.root.editorRectLocal; r.x *= scaleFactor; r.y *= scaleFactor; r.x += rect.x + rect.width * 0.5f; r.y += rect.y + rect.height * 0.5f; r.width *= scaleFactor; r.height *= scaleFactor; var screenRect = new Rect(0f, 0f, Screen.width, Screen.height); var settingsSize = rect.size; var settingsRect = new Rect(screenRect.width * 0.5f - settingsSize.x * 0.5f, screenRect.height * 0.5f - settingsSize.y * 0.5f, settingsSize.x, settingsSize.y).PixelPerfect(); var settingsBackRect = new Rect(settingsRect.x - MARGIN, settingsRect.y - MARGIN, settingsRect.width + MARGIN * 2f, settingsRect.height + MARGIN * 2f).PixelPerfect(); var rectCloseButton = new Rect(settingsRect.x + settingsRect.width, settingsRect.y - closeSize * 0.5f, closeSize, closeSize).PixelPerfect(); GUI.Box(screenRect, string.Empty, Heatmap.styles.backLock); GUI.Box(settingsBackRect, string.Empty, Heatmap.styles.dropShadow); GUI.Box(settingsBackRect, string.Empty, Heatmap.styles.contentScreen); var outRect = new Rect(r.x + settingsRect.x, r.y + settingsRect.y, r.width, r.height); GUI.Box(outRect, string.Empty, Heatmap.styles.layoutBack); this.fullScreenEditor.OnPreviewGUI(Color.white, new Rect(outRect.x, outRect.y, outRect.width, outRect.height), GUIStyle.none, selected: null, onSelection: null, highlighted: null); GUI.DrawTexture(outRect, this.fullScreenTexture, ScaleMode.StretchToFill, alphaBlend: true); if (GUI.Button(rectCloseButton, string.Empty, Heatmap.styles.closeButton) == true) { this.flowEditor.SetEnabled(); this.openFullScreen = false; } } }
public override void OnFlowWindowScreenMenuGUI(FD.FlowWindow windowSource, GenericMenu menu) { menu.AddItem(new GUIContent("Components Editor..."), on: false, func: (object win) => { var window = win as FD.FlowWindow; var screen = window.GetScreen() as LayoutWindowType; if (screen != null) { FlowSystemEditorWindow.GetWindow<FlowSystemEditorWindow>().SetDisabled(); //this.window = window; this.screen = screen; this.editor = Editor.CreateEditor(window.GetScreen()) as IPreviewEditor; this.component = null; this.hovered = null; this.element = null; this.listScrollPosition = Vector2.zero; var serializedObject = new SerializedObject(this.screen); var layout = serializedObject.FindProperty("layout"); var components = layout.FindPropertyRelative("components"); this.props.Clear(); for (int i = 0; i < components.arraySize; ++i) { var component = components.GetArrayElementAtIndex(i); this.props.Add(component); this.screen.layout.components[i].OnComponentChanged(this.screen, this.screen.layout.components[i].component); } this.settingsScrollPosition = Vector2.zero; this.opened = true; } }, userData: windowSource); }
public bool OnPreviewGUI(Rect rect, GUIStyle buttonStyle, GUIStyle background, bool drawInfo, bool selectable, System.Action onCreateScreen, System.Action onCreateLayout) { WindowLayoutElement.waitForComponentConnectionTemp = false; var screen = this.GetScreen() as LayoutWindowType; if (screen != null && screen.layout.layout != null) { var layout = screen.layout.layout; if (layout != null) { if (this.editorCache == null) { this.editorCache = UnityEditor.Editor.CreateEditor(layout) as IPreviewEditor; } if (this.editorCache != null) { this.editorCache.OnPreviewGUI(Color.white, rect, background, drawInfo, selectable); } if (WindowLayoutElement.waitForComponentConnectionTemp == true) { return(true); } } } else { this.editorCache = null; GUI.Box(rect, string.Empty, background); if (this.compiled == false) { GUI.Label(rect, "You need to compile window to start using layout functions.", buttonStyle); } else { if (screen != null) { var layout = screen.layout.layout; if (layout == null) { GUI.BeginGroup(rect); { var width = rect.width * 0.7f; var height = 50f; if (GUI.Button(new Rect(rect.width * 0.5f - width * 0.5f, rect.height * 0.5f - height * 0.5f, width, height), "Create Layout", buttonStyle) == true) { onCreateLayout(); } } GUI.EndGroup(); } } else { GUI.BeginGroup(rect); { var width = rect.width * 0.7f; var height = 50f; if (GUI.Button(new Rect(rect.width * 0.5f - width * 0.5f, rect.height * 0.5f - height * 0.5f, width, height), "Create Screen", buttonStyle) == true) { onCreateScreen(); } } GUI.EndGroup(); } } } return(false); }