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 OnFlowWindow(FD.FlowWindow window) { 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 result = new ScreenResult(); 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 rect = window.rect; this.DrawBubble(new Rect(new Vector2(rect.x + rect.width * 0.5f, rect.y), Vector2.zero), 0, window.id, -1, Vector2.zero, "LabelGreen"); int value; var keyTransition = string.Format("{0}_{1}", item.serviceName, window.id); if (this.resultsTransitionCache.TryGetValue(keyTransition, out value) == true) { result.uniqueCount = value; } if (result.uniqueCount > 0 && result.popup == false) { // Draw exit bubble this.DrawBubble(new Vector2(rect.x + rect.width * 0.5f, rect.y + rect.height), result, Vector2.zero, "LabelRed", "{1}"); } } } } } } }
public override bool IsCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo) { return(windowTo.IsFunction() == true && windowTo.IsSmall() == true && windowTo.IsContainer() == false && windowTo.GetFunctionId() > 0); }
public static string GetDerivedClassName(FD.FlowWindow flowWindow) { if (flowWindow.IsContainer() == true) { return(string.Format("{0}Container", flowWindow.directory.UppercaseFirst())); } return(string.Format("{0}Screen", flowWindow.directory.UppercaseFirst())); }
public override string OnCompilerTransitionTypedAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName, System.Type[] types, string[] names) { if (windowTo.IsFunction() == true && windowTo.IsSmall() == true && windowTo.IsContainer() == false && windowTo.GetFunctionId() > 0) { return(FlowFunctionsTemplateGenerator.GenerateTransitionTypedMethod(this.flowEditor, windowFrom, windowTo, types, names)); } return(base.OnCompilerTransitionTypedAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName, types, names)); }
public static string GetRelativePath(FD.FlowWindow window, string token) { var result = GetParentContainers(window, FlowSystem.GetContainers()) .Reverse() .Select(w => w.directory) .Aggregate(string.Empty, (total, path) => total + token + path); if (string.IsNullOrEmpty(result) == true && window.IsContainer() == false) { result = token + FlowDatabase.OTHER_NAME; } result += token + window.directory; return(result); }
public static string GenerateTransitionMethods(FD.FlowWindow window) { var flowData = FlowSystem.GetData(); var result = string.Empty; var transitions = new List <FlowWindow>(); if (window.IsContainer() == true) { foreach (var attachItem in window.attachItems) { var attachWindow = flowData.GetWindow(attachItem.targetId); if (attachWindow.IsContainer() == true) { continue; } var items = attachWindow.attachItems.Where(x => { var w = flowData.GetWindow(x.targetId); return(w.IsContainer() == false); }).Select(x => flowData.GetWindow(x.targetId)); foreach (var item in items) { if (transitions.Any(x => x.id == item.id) == false) { transitions.Add(item); } } } } else { transitions = flowData.windowAssets.Where(w => window.attachItems.Any((item) => item.targetId == w.id) && !w.IsContainer()).ToList(); } if (transitions == null) { return(result); } foreach (var each in transitions) { var className = each.directory; var classNameWithNamespace = Tpl.GetNamespace(each) + "." + Tpl.GetDerivedClassName(each); if (each.IsShowDefault() == true) { // Collect all default windows foreach (var defaultWindowId in FlowSystem.GetDefaultWindows()) { var defaultWindow = FlowSystem.GetWindow(defaultWindowId); className = defaultWindow.directory; classNameWithNamespace = Tpl.GetNamespace(defaultWindow) + "." + Tpl.GetDerivedClassName(defaultWindow); result += TemplateGenerator.GenerateWindowLayoutTransitionMethod(window, each, className, classNameWithNamespace); FlowEditorUtilities.CollectCallVariations(each.GetScreen().Load <WindowBase>(), (listTypes, listNames) => { result += TemplateGenerator.GenerateWindowLayoutTransitionTypedMethod(window, each, className, classNameWithNamespace, listTypes, listNames); }); } continue; } else { if (each.CanCompiled() == false) { continue; } } result += TemplateGenerator.GenerateWindowLayoutTransitionMethod(window, each, className, classNameWithNamespace); FlowEditorUtilities.CollectCallVariations(each.GetScreen().Load <WindowBase>(), (listTypes, listNames) => { result += TemplateGenerator.GenerateWindowLayoutTransitionTypedMethod(window, each, className, classNameWithNamespace, listTypes, listNames); }); } var c = 0; var everyPlatformHasUniqueName = false; foreach (var attachItem in window.attachItems) { var attachId = attachItem.targetId; var attachedWindow = FlowSystem.GetWindow(attachId); var tmp = UnityEditor.UI.Windows.Plugins.Flow.Flow.IsCompilerTransitionAttachedGeneration(window, attachedWindow); if (tmp == true) { ++c; } } everyPlatformHasUniqueName = c > 1; foreach (var attachItem in window.attachItems) { var attachId = attachItem.targetId; var attachedWindow = FlowSystem.GetWindow(attachId); if (attachedWindow.IsShowDefault() == true) { // Collect all default windows foreach (var defaultWindowId in FlowSystem.GetDefaultWindows()) { var defaultWindow = FlowSystem.GetWindow(defaultWindowId); result += UnityEditor.UI.Windows.Plugins.Flow.Flow.OnCompilerTransitionAttachedGeneration(window, defaultWindow, everyPlatformHasUniqueName); FlowEditorUtilities.CollectCallVariations(attachedWindow.GetScreen().Load <WindowBase>(), (listTypes, listNames) => { result += UnityEditor.UI.Windows.Plugins.Flow.Flow.OnCompilerTransitionTypedAttachedGeneration(window, defaultWindow, everyPlatformHasUniqueName, listTypes, listNames); }); } result += TemplateGenerator.GenerateWindowLayoutTransitionMethodDefault(); } /*if (withFunctionRoot == true) { * * var functionId = attachedWindow.GetFunctionId(); * var functionContainer = flowData.GetWindow(functionId); * if (functionContainer != null) { * * var root = flowData.GetWindow(functionContainer.functionRootId); * if (root != null) { * * attachedWindow = root; * * } * * } * * }*/ result += UnityEditor.UI.Windows.Plugins.Flow.Flow.OnCompilerTransitionAttachedGeneration(window, attachedWindow, everyPlatformHasUniqueName); FlowEditorUtilities.CollectCallVariations(attachedWindow.GetScreen().Load <WindowBase>(), (listTypes, listNames) => { result += UnityEditor.UI.Windows.Plugins.Flow.Flow.OnCompilerTransitionTypedAttachedGeneration(window, attachedWindow, everyPlatformHasUniqueName, listTypes, listNames); }); } // Run addons transition logic result += UnityEditor.UI.Windows.Plugins.Flow.Flow.OnCompilerTransitionGeneration(window); return(result); }
/*public override string OnCompilerTransitionGeneration(FD.FlowWindow window) { * * return Tpl.GenerateTransitionMethods(window); * * } * * public override string OnCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName) { * * if (windowTo.IsFunction() == true && * windowTo.IsSmall() == true && * windowTo.IsContainer() == false && * windowTo.GetFunctionId() > 0) { * * return FlowFunctionsTemplateGenerator.GenerateTransitionMethod(this.flowEditor, windowFrom, windowTo); * * } * * return base.OnCompilerTransitionAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName); * * }*/ /*public override string OnCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName) { * * if (windowTo.IsLinker() == true && * windowTo.GetLinkerId() > 0) { * * var result = string.Empty; * * var linkerWindow = FlowSystem.GetWindow(windowTo.GetLinkerId()); * * var className = linkerWindow.directory; * var classNameWithNamespace = Tpl.GetNamespace(linkerWindow) + "." + Tpl.GetDerivedClassName(linkerWindow); * * result += TemplateGenerator.GenerateWindowLayoutTransitionMethod(windowFrom, linkerWindow, className, classNameWithNamespace); * * WindowSystem.CollectCallVariations(linkerWindow.GetScreen(), (listTypes, listNames) => { * * result += TemplateGenerator.GenerateWindowLayoutTransitionTypedMethod(windowFrom, linkerWindow, className, classNameWithNamespace, listTypes, listNames); * * }); * * return result; * * } * * return base.OnCompilerTransitionAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName); * * }*/ /*public override string OnCompilerTransitionTypedAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName, System.Type[] types, string[] names) { * * if (windowTo.IsLinker() == true && * windowTo.GetLinkerId() > 0) { * * var result = string.Empty; * * var window = FlowSystem.GetWindow(windowTo.GetLinkerId()); * * var className = window.directory; * var classNameWithNamespace = Tpl.GetNamespace(window) + "." + Tpl.GetDerivedClassName(window); * * result += TemplateGenerator.GenerateWindowLayoutTransitionMethod(windowFrom, window, className, classNameWithNamespace); * * WindowSystem.CollectCallVariations(windowTo.GetScreen(), (listTypes, listNames) => { * * result += TemplateGenerator.GenerateWindowLayoutTransitionTypedMethod(windowFrom, window, className, classNameWithNamespace, listTypes, listNames); * * }); * * if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log(className + " :: " + classNameWithNamespace + " == " + result); * * return result; * * } * * return base.OnCompilerTransitionTypedAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName, types, names); * * }*/ public override void OnFlowWindowGUI(FD.FlowWindow window) { var data = FlowSystem.GetData(); if (data == null) { return; } var flag = (window.IsLinker() == true && window.IsSmall() == true && window.IsContainer() == false); if (flag == true) { var alreadyConnectedFunctionIds = new List <int>(); // Find caller window var windowFrom = data.windowAssets.FirstOrDefault((item) => item.HasAttach(window.id)); if (windowFrom != null) { var attaches = windowFrom.GetAttachedWindows(); foreach (var attachWindow in attaches) { if (attachWindow.IsLinker() == true) { alreadyConnectedFunctionIds.Add(attachWindow.GetLinkerId()); } } } foreach (var win in data.windowAssets) { if (win.CanDirectCall() == true) { var count = alreadyConnectedFunctionIds.Count((e) => e == win.id); if ((window.GetLinkerId() == win.id && count == 1) || count == 0) { } else { if (win.id == window.GetLinkerId()) { window.linkerId = 0; } alreadyConnectedFunctionIds.Remove(win.id); } } } var linkerId = window.GetLinkerId(); var linker = linkerId == 0 ? null : data.GetWindow(linkerId); var isActiveSelected = true; var oldColor = GUI.color; GUI.color = isActiveSelected ? Color.white : Color.grey; var result = GUILayout.Button(linker != null ? string.Format("{0} ({1})", linker.title, linker.directory) : "None", FlowSystemEditorWindow.defaultSkin.button, GUILayout.ExpandHeight(true)); GUI.color = oldColor; var rect = GUILayoutUtility.GetLastRect(); rect.y += rect.height; if (result == true) { System.Action <int> onApply = (int id) => { var linkerSources = new List <FD.FlowWindow>(); foreach (var w in data.windowAssets) { if (w.AlreadyAttached(window.id) == true) { linkerSources.Add(w); } } if (window.linkerId != 0) { foreach (var w in linkerSources) { data.Detach(w.id, window.linkerId, oneWay: true); } } window.linkerId = id; if (window.linkerId != 0) { foreach (var w in linkerSources) { data.Attach(w.id, window.linkerId, oneWay: true); } } }; var menu = new GenericMenu(); menu.AddItem(new GUIContent("None"), window.linkerId == 0, () => { onApply(0); }); if (windowFrom != null) { alreadyConnectedFunctionIds.Clear(); var attaches = windowFrom.GetAttachedWindows(); foreach (var attachWindow in attaches) { if (attachWindow.IsLinker() == true) { alreadyConnectedFunctionIds.Add(attachWindow.GetLinkerId()); } } } foreach (var win in data.windowAssets) { if (win.CanDirectCall() == true) { var caption = new GUIContent(string.Format("{0} ({1})", win.title, win.directory)); var count = alreadyConnectedFunctionIds.Count((e) => e == win.id); if (((window.GetLinkerId() == win.id && count == 1) || count == 0) && window.compiled == true) { var id = win.id; menu.AddItem(caption, win.id == window.GetLinkerId(), () => { onApply(id); }); } else { if (window.compiled == false) { caption = new GUIContent(string.Format("{0} (Compilation needed)", caption.text)); } if (win.id == window.GetLinkerId()) { window.linkerId = 0; } alreadyConnectedFunctionIds.Remove(win.id); menu.AddDisabledItem(caption); } } } menu.DropDown(rect); } } }
private static void GenerateWindow(string newPath, FD.FlowWindow window, bool recompile, bool minimalScriptsSize) { if (window.compiled == true && recompile == false) { return; } var oldPath = window.compiledDirectory; var newInfo = new Tpl.Info(Tpl.GetNamespace(window), Tpl.GetDerivedClassName(window), Tpl.GetBaseClassName(window), Tpl.GetContainerClassName(window), window.directory); var oldInfo = new Tpl.Info(window); if (string.IsNullOrEmpty(oldPath) == true) { oldPath = newPath; } var path = oldPath; if (window.compiled == true && (oldPath != newPath)) { // If window is moving and compiled - just rename // Replace in files IO.ReplaceInFiles(CompilerSystem.currentProjectDirectory, (file) => { var text = file.text; return(text.Contains(oldInfo.baseNamespace)); }, (text) => { return(Tpl.ReplaceText(text, oldInfo, newInfo)); }); // Rename base class name IO.RenameFile(oldPath + oldInfo.baseClassnameFile, oldPath + newInfo.baseClassnameFile); // Rename derived class name IO.RenameFile(oldPath + oldInfo.classnameFile, oldPath + newInfo.classnameFile); // Rename main folder IO.RenameDirectory(oldPath, newPath); path = newPath; } // Rebuild without rename //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log(window.title + " :: REBUILD BASE :: " + path); string baseClassTemplate = null; if (window.IsContainer() == true) { baseClassTemplate = TemplateGenerator.GenerateWindowLayoutContainerBaseClass(newInfo.baseClassname, newInfo.baseNamespace, newInfo.containerClassName); } else { baseClassTemplate = TemplateGenerator.GenerateWindowLayoutBaseClass(newInfo.baseClassname, newInfo.baseNamespace, newInfo.containerClassName, Tpl.GenerateTransitionMethods(window)); } var derivedClassTemplate = TemplateGenerator.GenerateWindowLayoutDerivedClass(newInfo.classname, newInfo.baseClassname, newInfo.baseNamespace); //if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true) UnityEngine.Debug.Log(newPath + " :: " + newInfo.containerClassName + " :: " + baseClassTemplate); //return; if (minimalScriptsSize == true) { baseClassTemplate = CompilerSystem.Compress(baseClassTemplate); } if (window.IsContainer() == false) { IO.CreateFile(path, ".uiwspackage", string.Empty, import: false); IO.CreateDirectory(path, string.Empty); IO.CreateDirectory(path, FlowDatabase.COMPONENTS_FOLDER); IO.CreateDirectory(path, FlowDatabase.LAYOUT_FOLDER); IO.CreateDirectory(path, FlowDatabase.SCREENS_FOLDER); } else { IO.CreateFile(path, ".uiwscontainer", string.Empty, import: false); } if (baseClassTemplate != null && derivedClassTemplate != null) { IO.CreateFile(path, newInfo.baseClassnameFile, baseClassTemplate, rewrite: true); IO.CreateFile(path, newInfo.classnameFile, derivedClassTemplate, rewrite: false); } window.compiledNamespace = newInfo.baseNamespace; window.compiledScreenName = newInfo.screenName; window.compiledBaseClassName = newInfo.baseClassname; window.compiledDerivedClassName = newInfo.classname; window.compiledDirectory = path; window.compiled = true; }
public override void OnFlowWindowGUI(FD.FlowWindow window) { var data = FlowSystem.GetData(); if (data == null) { return; } if (data.modeLayer == ModeLayer.Audio) { if (window.IsContainer() == true || window.IsSmall() == true || window.IsShowDefault() == true) { return; } var screen = window.GetScreen(); if (screen != null) { GUILayout.BeginHorizontal(); { var playType = (int)screen.audio.playType; playType = GUILayoutExt.Popup(playType, new string[2] { "Keep Current", "Replace" }, FlowSystemEditorWindow.defaultSkin.label, GUILayout.Width(EditorGUIUtility.labelWidth)); screen.audio.playType = (UnityEngine.UI.Windows.Audio.Window.PlayType)playType; var rect = GUILayoutUtility.GetLastRect(); /*var newId = */ AudioPopupEditor.Draw(new Rect(rect.x + rect.width, rect.y, window.rect.width - EditorGUIUtility.labelWidth - 10f, rect.height), screen.audio.id, (result) => { screen.audio.id = result; window.audioEditor = null; }, screen.audio.clipType, screen.audio.flowData.audio, null); /*if (newId != screen.audio.id) { * * screen.audio.id = newId; * window.audioEditor = null; * * }*/ } GUILayout.EndHorizontal(); var state = data.audio.GetState(screen.audio.clipType, screen.audio.id); if (state != null && state.clip != null) { GUILayout.BeginVertical(); { GUILayout.Box(string.Empty, FlowSystemEditorWindow.styles.layoutBoxStyle, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); var rect = GUILayoutUtility.GetLastRect(); if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition) == true) { window.audioEditor = null; } if (window.audioEditor == null) { EditorPrefs.SetBool("AutoPlayAudio", false); window.audioEditor = Editor.CreateEditor(state.clip); //System.Type.GetType("AudioUtil").InvokeMember("StopClip", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public, null, null, new object[] { state.clip }); } if (Event.current.type != EventType.MouseDrag && Event.current.type != EventType.DragPerform) { window.audioEditor.OnPreviewGUI(rect, EditorStyles.helpBox); GUILayout.BeginHorizontal(); window.audioEditor.OnPreviewSettings(); GUILayout.EndHorizontal(); } } GUILayout.EndVertical(); } } } }
public override void OnFlowWindowLayoutGUI(Rect rect, FD.FlowWindow window) { 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; } LayoutWindowType screen; var layout = HeatmapSystem.GetLayout(window.id, out screen); if (layout == null) { return; } var targetScreenSize = new Vector2(layout.root.editorRect.width, layout.root.editorRect.height); 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); HeatmapResult result; if (this.heatmapResultsCache.TryGetValue(key, out result) == true) { if (result != null) { var texture = this.heatmapTexturesCache[key]; if (texture != null) { var scaleFactor = HeatmapSystem.GetFactor(targetScreenSize, rect.size); //var scaleFactorCanvas = layout.editorScale > 0f ? 1f / layout.editorScale : 1f; //scaleFactor *= scaleFactorCanvas; var r = layout.root.editorRect; 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 c = Color.white; GUI.color = c; GUI.DrawTexture(r, texture, ScaleMode.StretchToFill, alphaBlend: true); GUI.color = Color.white; } else { if (this.noDataTexture != null) { GUI.DrawTexture(rect, this.noDataTexture, ScaleMode.ScaleToFit, alphaBlend: true); } } } else { // still loading... } } else { if (Event.current.type == EventType.Repaint) { var rectSize = targetScreenSize; //rect.size; var rootRect = layout.root.editorRect; this.heatmapResultsCache.Add(key, null); this.heatmapTexturesCache.Add(key, null); service.GetHeatmapData(window.id, (int)targetScreenSize.x, (int)targetScreenSize.y, item.userFilter, (_result) => { var heatmapResult = _result as HeatmapResult; // Convert normalized points to real points for (int i = 0; i < heatmapResult.points.Length; ++i) { var root = layout.GetRootByTag((LayoutTag)heatmapResult.points[i].tag); if (root != null) { var xn = heatmapResult.points[i].x; var yn = heatmapResult.points[i].y; var sourceRect = root.editorRect; var radius = (float)HeatmapVisualizer.GetRadius(); sourceRect.x += radius; sourceRect.y += radius; sourceRect.width -= radius * 2f; sourceRect.height -= radius * 2f; var scaleFactor = HeatmapSystem.GetFactor(targetScreenSize, rectSize); var r = sourceRect; r.x *= scaleFactor; r.y *= scaleFactor; r.x += rootRect.width * 0.5f; r.y = rootRect.height * 0.5f - r.y; r.width *= scaleFactor; r.height *= scaleFactor; heatmapResult.points[i].realPoint = new Vector2(r.x + xn * r.width, r.y - yn * r.height); } } this.heatmapResultsCache[key] = heatmapResult; HeatmapSystem.GenerateTextureFromData((int)targetScreenSize.x, (int)targetScreenSize.y, this.heatmapResultsCache[key], (texture) => { this.heatmapTexturesCache[key] = texture; }); }); } } } } } } } }
/*public override string OnCompilerTransitionTypedAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName, System.Type[] types, string[] names) { * * if (windowTo.IsLinker() == true && * windowTo.GetLinkerId() > 0) { * * var result = string.Empty; * * var window = FlowSystem.GetWindow(windowTo.GetLinkerId()); * * var className = window.directory; * var classNameWithNamespace = Tpl.GetNamespace(window) + "." + Tpl.GetDerivedClassName(window); * * result += TemplateGenerator.GenerateWindowLayoutTransitionMethod(windowFrom, window, className, classNameWithNamespace); * * WindowSystem.CollectCallVariations(windowTo.GetScreen(), (listTypes, listNames) => { * * result += TemplateGenerator.GenerateWindowLayoutTransitionTypedMethod(windowFrom, window, className, classNameWithNamespace, listTypes, listNames); * * }); * * Debug.Log(className + " :: " + classNameWithNamespace + " == " + result); * * return result; * * } * * return base.OnCompilerTransitionTypedAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName, types, names); * * }*/ public override void OnFlowWindowGUI(FD.FlowWindow window) { var data = FlowSystem.GetData(); if (data == null) { return; } var flag = (window.IsLinker() == true && window.IsSmall() == true && window.IsContainer() == false); if (flag == true) { var alreadyConnectedFunctionIds = new List <int>(); // Find caller window var windowFrom = data.windowAssets.FirstOrDefault((item) => item.HasAttach(window.id)); if (windowFrom != null) { var attaches = windowFrom.GetAttachedWindows(); foreach (var attachWindow in attaches) { if (attachWindow.IsLinker() == true) { alreadyConnectedFunctionIds.Add(attachWindow.GetLinkerId()); } } } foreach (var win in data.windowAssets) { if (win.CanDirectCall() == true) { var count = alreadyConnectedFunctionIds.Count((e) => e == win.id); if ((window.GetLinkerId() == win.id && count == 1) || count == 0) { } else { if (win.id == window.GetLinkerId()) { window.linkerId = 0; } alreadyConnectedFunctionIds.Remove(win.id); } } } var linkerId = window.GetLinkerId(); var linker = linkerId == 0 ? null : data.GetWindow(linkerId); var isActiveSelected = true; var oldColor = GUI.color; GUI.color = isActiveSelected ? Color.white : Color.grey; var result = GUILayout.Button(linker != null ? linker.title : "None", FlowSystemEditorWindow.defaultSkin.button, GUILayout.ExpandHeight(true)); GUI.color = oldColor; var rect = GUILayoutUtility.GetLastRect(); rect.y += rect.height; if (result == true) { var menu = new GenericMenu(); menu.AddItem(new GUIContent("None"), window.linkerId == 0, () => { window.linkerId = 0; }); if (windowFrom != null) { alreadyConnectedFunctionIds.Clear(); var attaches = windowFrom.GetAttachedWindows(); foreach (var attachWindow in attaches) { if (attachWindow.IsLinker() == true) { alreadyConnectedFunctionIds.Add(attachWindow.GetLinkerId()); } } } foreach (var win in data.windowAssets) { if (win.CanDirectCall() == true) { var count = alreadyConnectedFunctionIds.Count((e) => e == win.id); if ((window.GetLinkerId() == win.id && count == 1) || count == 0) { var id = win.id; menu.AddItem(new GUIContent(win.title), win.id == window.GetLinkerId(), () => { window.linkerId = id; }); } else { if (win.id == window.GetLinkerId()) { window.linkerId = 0; } alreadyConnectedFunctionIds.Remove(win.id); menu.AddDisabledItem(new GUIContent(win.title)); } } } menu.DropDown(rect); } } }