Exemplo n.º 1
0
        public void AddTag(Data.FlowWindow window, FlowTag tag)
        {
            var contains = this.tags.FirstOrDefault((t) => t.title.ToLower() == tag.title.ToLower());

            if (contains == null)
            {
                this.tags.Add(tag);
            }
            else
            {
                tag = contains;
            }

            window.AddTag(tag);

            this.isDirty = true;
        }
Exemplo n.º 2
0
		public void Setup(int id, FlowWindow.Flags flags) {

			this.Init(id, flags: flags);

		}
Exemplo n.º 3
0
 public bool HasContainer(FlowWindow predicate)
 {
     return(this.attachItems.Any((item) => item.targetId == predicate.id && FlowSystem.GetWindow(item.targetId).IsContainer() == true && FlowSystem.GetWindow(item.targetId).IsFunction() == false));
 }
		public FlowSceneItem(FlowSystemEditorWindow rootWindow, FD.FlowWindow window, AnimatedValues.AnimFloat progressValue) {

			this.isLocked = false;

			this.rootWindow = rootWindow;
			this.window = window;
			this.currentScene = EditorApplication.currentScene;
			this.layouts = new List<WindowLayout>();
			this.layoutPrefab = null;

			this.screens = new List<WindowBase>();
			this.screenPrefab = null;

			#if UNITY_5_0
			EditorApplication.NewEmptyScene();
			#else
			EditorApplication.NewScene();
			#endif

			var popupOffset = 100f;
			var popupSize = new Vector2(rootWindow.position.width - popupOffset * 2f, rootWindow.position.height - popupOffset * 2f);
			var popupRect = new Rect(rootWindow.position.x + popupOffset, rootWindow.position.y + popupOffset, popupSize.x, popupSize.y);

			this.view = FlowSceneViewWindow.CreateInstance<FlowSceneViewWindow>();
			FlowSceneView.recompileChecker = this.view;

			var title = "UI.Windows Flow Screen Editor ('{0}')";
			title = string.Format(title, this.window.title);
			#if !UNITY_4
			this.view.titleContent = new GUIContent(string.Format(title, this.window.title));
			#else
			this.view.title = string.Format(title, this.window.title);
			#endif
			this.view.position = popupRect;
			this.view.rootWindow = rootWindow;
			
			/*this.inspector = FlowInspectorWindow.CreateInstance<FlowInspectorWindow>();
			this.inspector.position = popupRect;
			this.inspector.rootWindow = rootWindow;
			this.inspector.Repaint();
			this.inspector.Focus();
			
			this.hierarchy = FlowHierarchyWindow.CreateInstance<FlowHierarchyWindow>();
			this.hierarchy.position = popupRect;
			this.hierarchy.rootWindow = rootWindow;
			this.hierarchy.Repaint();
			this.hierarchy.Focus();*/

			this.Show();

			//this.inspector.Repaint();
			//this.inspector.Focus();
			//this.hierarchy.Repaint();
			//this.hierarchy.Focus();
			this.view.Repaint();
			this.view.Focus();

			this.autoloadedScreen = false;
			this.ReloadScreens();
			this.autoloadedLayout = false;
			this.ReloadLayouts();

			this.defaultRects = false;

			progressValue.valueChanged.AddListener(() => {
				
				this.view.DrawProgress(progressValue.value);
				//this.inspector.DrawProgress(progressValue.value);
				//this.hierarchy.DrawProgress(progressValue.value);

				if (progressValue.value == progressValue.target) {
					
					this.view.Repaint();
					this.view.Focus();

				}

			});

		}
Exemplo n.º 5
0
 public static string GetDerivedClassName(FD.FlowWindow flowWindow)
 {
     return(flowWindow.directory.UppercaseFirst() + "Screen");
 }
Exemplo n.º 6
0
 public static string GetClassNameWithNamespace(FD.FlowWindow window)
 {
     return(Tpl.GetNamespace(window) + "." + Tpl.GetDerivedClassName(window));
 }
Exemplo n.º 7
0
        public static void OnFlowWindowScreenMenuGUI(FlowSystemEditorWindow flowEditor, FD.FlowWindow window, GenericMenu menu)
        {
            var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>();

            foreach (var addon in flowAddons)
            {
                addon.flowEditor = flowEditor;
                addon.OnFlowWindowScreenMenuGUI(window, menu);
            }
        }
Exemplo n.º 8
0
 public static void GenerateByWindow(string pathToData, bool recompile = false, bool minimalScriptsSize = false, FD.FlowWindow window = null)
 {
     CompilerSystem.Generate(pathToData, recompile, minimalScriptsSize, flowWindow => flowWindow == window);
 }
Exemplo n.º 9
0
        public static Vector2 OnDrawNodeCurveOffset(FlowSystemEditorWindow flowEditor, UnityEngine.UI.Windows.AttachItem attachItem, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSide)
        {
            var offset = Vector2.zero;

            var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>();

            foreach (var addon in flowAddons)
            {
                addon.flowEditor = flowEditor;
                offset          += addon.OnFlowDrawNodeCurveOffset(attachItem, fromWindow, toWindow, doubleSide);
            }

            return(offset);
        }
Exemplo n.º 10
0
        public static void OnFlowWindowTransition(FlowSystemEditorWindow flowEditor, int index, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSided, Vector2 centerOffset)
        {
            var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>();

            foreach (var addon in flowAddons)
            {
                addon.flowEditor = flowEditor;
                addon.OnFlowWindowTransition(index, fromWindow, toWindow, doubleSided, centerOffset);
            }
        }
Exemplo n.º 11
0
 public virtual void OnFlowWindowTransition(int index, FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool doubleSided, Vector2 centerOffset)
 {
 }
Exemplo n.º 12
0
 public virtual Vector2 OnFlowDrawNodeCurveOffset(UnityEngine.UI.Windows.AttachItem attachItem, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSide)
 {
     return(Vector2.zero);
 }
Exemplo n.º 13
0
 public virtual bool IsCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo)
 {
     return(false);
 }
Exemplo n.º 14
0
		public bool HasContainer(FlowWindow predicate) {
			
			return this.attachItems.Any((item) => item.targetId == predicate.id && FlowSystem.GetWindow(item.targetId).IsContainer());
			
		}
Exemplo n.º 15
0
        public static bool IsCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo)
        {
            var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>();

            foreach (var addon in flowAddons)
            {
                if (addon.IsCompilerTransitionAttachedGeneration(windowFrom, windowTo) == true)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 16
0
 public virtual string OnCompilerTransitionTypedAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName, System.Type[] types, string[] names)
 {
     return(string.Empty);
 }
Exemplo n.º 17
0
        public static string OnCompilerTransitionTypedAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName, System.Type[] types, string[] names)
        {
            var result     = string.Empty;
            var flowAddons = CoreUtilities.GetAddons <IWindowFlowAddon>();

            foreach (var addon in flowAddons)
            {
                result += addon.OnCompilerTransitionTypedAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName, types, names);
            }

            return(result);
        }
Exemplo n.º 18
0
        public static string GenerateTransitionMethods(FD.FlowWindow window)
        {
            var flowData = FlowSystem.GetData();

            var transitions = flowData.windowAssets.Where(w => window.attachItems.Any((item) => item.targetId == w.id) && !w.IsContainer());

            var result = string.Empty;

            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);
                        WindowSystem.CollectCallVariations(each.GetScreen(), (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);
                WindowSystem.CollectCallVariations(each.GetScreen(), (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);
                        WindowSystem.CollectCallVariations(attachedWindow.GetScreen(), (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);
                WindowSystem.CollectCallVariations(attachedWindow.GetScreen(), (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);
        }
Exemplo n.º 19
0
 public virtual void OnFlowWindowGUI(FD.FlowWindow window)
 {
 }
Exemplo n.º 20
0
 public static string GetNamespace(FD.FlowWindow window)
 {
     return(Tpl.GetNamespace() + IO.GetRelativePath(window, "."));
 }
Exemplo n.º 21
0
 public virtual void OnFlowWindowLayoutGUI(Rect rect, FD.FlowWindow window)
 {
 }
Exemplo n.º 22
0
        public static void CreateTransition <T>(FD.FlowWindow windowWithScreen, FD.FlowWindow flowWindow, FD.FlowWindow toWindow, int attachIndex, string localPath, string namePrefix, System.Action <T> callback = null) where T : TransitionInputTemplateParameters
        {
            if (windowWithScreen.GetScreen() == null)
            {
                return;
            }

            var screenPath = AssetDatabase.GetAssetPath(windowWithScreen.GetScreen().Load <WindowBase>());

            screenPath = System.IO.Path.GetDirectoryName(screenPath);
            var splitted    = screenPath.Split(new string[] { "/" }, System.StringSplitOptions.RemoveEmptyEntries);
            var packagePath = string.Join("/", splitted, 0, splitted.Length - 1);
            var path        = packagePath + localPath;

            FlowChooserFilterWindow.Show <T>(
                root: null,
                onSelect: (element) => {
                // Clean up previous transitions if exists
                var attachItem = flowWindow.GetAttachItem(toWindow.id, (x) => x.index == attachIndex);
                if (attachItem != null)
                {
                    if (FlowSystem.GetData().modeLayer == ModeLayer.Flow)
                    {
                        if (attachItem.transitionParameters != null)
                        {
                            AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(attachItem.transitionParameters.gameObject));
                        }

                        attachItem.transition           = null;
                        attachItem.transitionParameters = null;
                    }
                    else if (FlowSystem.GetData().modeLayer == ModeLayer.Audio)
                    {
                        if (attachItem.audioTransitionParameters != null)
                        {
                            AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(attachItem.audioTransitionParameters.gameObject));
                        }

                        attachItem.audioTransition           = null;
                        attachItem.audioTransitionParameters = null;
                    }
                }

                if (System.IO.Directory.Exists(path) == false)
                {
                    System.IO.Directory.CreateDirectory(path);
                }

                if (element == null)
                {
                    return;
                }

                var prefix = string.Empty;
                if (FlowSystem.GetData().modeLayer == ModeLayer.Flow)
                {
                    prefix = "Transition-" + namePrefix;
                }
                else if (FlowSystem.GetData().modeLayer == ModeLayer.Audio)
                {
                    prefix = "AudioTransition-" + namePrefix;
                }

                var elementPath = AssetDatabase.GetAssetPath(element.gameObject);
                var targetName  = prefix + "-" + element.gameObject.name + "-" + (toWindow.IsFunction() == true ? FlowSystem.GetWindow(toWindow.functionId).directory : toWindow.directory);
                var targetPath  = path + "/" + targetName + ".prefab";

                if (AssetDatabase.CopyAsset(elementPath, targetPath) == true)
                {
                    AssetDatabase.ImportAsset(targetPath);

                    var newInstance        = AssetDatabase.LoadAssetAtPath <GameObject>(targetPath);
                    var instance           = newInstance.GetComponent <T>();
                    instance.useDefault    = false;
                    instance.useAsTemplate = false;
                    EditorUtility.SetDirty(instance);

                    if (FlowSystem.GetData().modeLayer == ModeLayer.Flow)
                    {
                        attachItem.transition           = instance.transition;
                        attachItem.transitionParameters = instance;
                    }
                    else if (FlowSystem.GetData().modeLayer == ModeLayer.Audio)
                    {
                        attachItem.audioTransition           = instance.transition;
                        attachItem.audioTransitionParameters = instance;
                    }

                    if (callback != null)
                    {
                        callback(instance);
                    }
                }
            },
                onEveryGUI: (element) => {
                // on gui

                var style      = new GUIStyle(GUI.skin.label);
                style.wordWrap = true;

                if (element != null)
                {
                    GUILayout.Label(element.name, style);
                }
                else
                {
                    GUILayout.Label("None", style);
                }
            },
                predicate: (element) => {
                var elementPath = AssetDatabase.GetAssetPath(element.gameObject);
                var isInPackage = FlowEditorUtilities.IsValidPackage(elementPath + "/../");

                if (element.transition != null && (isInPackage == true || element.useAsTemplate == true))
                {
                    var name     = element.GetType().FullName;
                    var baseName = name.Substring(0, name.IndexOf("Parameters"));

                    var type = System.Type.GetType(baseName + ", " + element.GetType().Assembly.FullName, throwOnError: true, ignoreCase: true);
                    if (type != null)
                    {
                        var attribute = type.GetCustomAttributes(inherit: true).OfType <TransitionCameraAttribute>().FirstOrDefault();
                        if (attribute != null)
                        {
                            return(true);
                        }
                        else
                        {
                            if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                            {
                                UnityEngine.Debug.Log("No Attribute: " + baseName, element);
                            }
                        }
                    }
                    else
                    {
                        if (UnityEngine.UI.Windows.Constants.LOGS_ENABLED == true)
                        {
                            UnityEngine.Debug.Log("No type: " + baseName);
                        }
                    }
                }

                return(false);
            },
                strongType: false,
                directory: null,
                useCache: false,
                drawNoneOption: true,
                updateRedraw: true);
        }
Exemplo n.º 23
0
 public virtual void OnFlowWindowScreenMenuGUI(FD.FlowWindow window, GenericMenu menu)
 {
 }
Exemplo n.º 24
0
 public static void RemoveTag(Data.FlowWindow window, FlowTag tag)
 {
     FlowSystem.instance.data.RemoveTag(window, tag);
 }
Exemplo n.º 25
0
 public virtual string OnCompilerTransitionGeneration(FD.FlowWindow window)
 {
     return(string.Empty);
 }
Exemplo n.º 26
0
        public void RemoveTag(Data.FlowWindow window, FlowTag tag)
        {
            window.RemoveTag(tag);

            this.isDirty = true;
        }
Exemplo n.º 27
0
        public override void OnFlowWindowTransition(int index, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSided, Vector2 centerOffset)
        {
            var factor = 0.5f;

            if (fromWindow.IsSmall() == true &&
                fromWindow.IsABTest() == true)
            {
                factor = 0.2f;
            }

            var point = Vector2.Lerp(fromWindow.rect.center, toWindow.rect.center, factor) + centerOffset;
            var rect  = new Rect(point, Vector2.zero);

            if (this.flowEditor.ContainsRect(rect) == false)
            {
                return;
            }

            if (doubleSided == true)
            {
                var q = Quaternion.LookRotation(toWindow.rect.center - fromWindow.rect.center, Vector3.back);

                this.DrawBubble(rect, index, fromWindow.id, toWindow.id, q * Vector2.left);

                this.DrawBubble(rect, index, toWindow.id, fromWindow.id, q * Vector2.right);
            }
            else
            {
                this.DrawBubble(rect, index, fromWindow.id, toWindow.id, Vector2.zero);
            }
        }
Exemplo n.º 28
0
 public AttachItem GetAttachItem(FlowWindow window)
 {
     return(this.attachItems.FirstOrDefault((item) => item.targetId == window.id));
 }
Exemplo n.º 29
0
        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; });
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 30
0
		public void Init(int id, FlowWindow.Flags flags = Flags.Default) {
			
			this.states = new CompletedState[STATES_COUNT];
			this.tags = new List<int>();
			
			this.id = id;
			this.flags = flags;

			//this.attaches = new List<int>();
			this.attachItems = new List<AttachItem>();
			this.attachedComponents = new List<ComponentLink>();

			this.rect = new Rect(0f, 0f, 200f, 200f);//new Rect(Screen.width * 0.5f, Screen.height * 0.5f, 200f, 200f);
			this.title = (this.IsContainer() == true ? "Container" : "Window " + this.id.ToString());
			this.directory = (this.IsContainer() == true ? "ContainerDirectory" : "Window" + this.id.ToString() + "Directory");
			this.randomColor = ColorHSV.GetDistinctColor();
			
			this.smallStyleDefault = "flow node 4";
			this.smallStyleSelected = "flow node 4 on";

			this.compiled = false;

		}
Exemplo n.º 31
0
        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), 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
            //Debug.Log(window.title + " :: REBUILD BASE :: " + path);

            IO.CreateDirectory(path, string.Empty);
            IO.CreateDirectory(path, FlowDatabase.COMPONENTS_FOLDER);
            IO.CreateDirectory(path, FlowDatabase.LAYOUT_FOLDER);
            IO.CreateDirectory(path, FlowDatabase.SCREENS_FOLDER);

            var baseClassTemplate    = TemplateGenerator.GenerateWindowLayoutBaseClass(newInfo.baseClassname, newInfo.baseNamespace, Tpl.GenerateTransitionMethods(window));
            var derivedClassTemplate = TemplateGenerator.GenerateWindowLayoutDerivedClass(newInfo.classname, newInfo.baseClassname, newInfo.baseNamespace);

            if (minimalScriptsSize == true)
            {
                baseClassTemplate = CompilerSystem.Compress(baseClassTemplate);
            }

            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;
        }
Exemplo n.º 32
0
		public AttachItem GetAttachItem(FlowWindow window) {

			return this.attachItems.FirstOrDefault((item) => item.targetId == window.id);

		}
Exemplo n.º 33
0
 public virtual string OnCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName)
 {
     return(string.Empty);
 }