Ejemplo n.º 1
0
		public static string GenerateReturnMethod(FlowSystemEditorWindow flowEditor, FD.FlowWindow exitWindow) {
			
			var file = Resources.Load("UI.Windows/Functions/Templates/TemplateReturnMethod") as TextAsset;
			if (file == null) {
				
				Debug.LogError("Functions Template Loading Error: Could not load template 'TemplateReturnMethod'");
				
				return string.Empty;
				
			}
			
			var data = FlowSystem.GetData();
			if (data == null) return string.Empty;
			
			var result = string.Empty;
			var part = file.text;

			var functionContainer = exitWindow.GetFunctionContainer();

			var functionName = functionContainer.title;
			var functionCallName = functionContainer.directory;
			var classNameWithNamespace = Tpl.GetNamespace(exitWindow) + "." + Tpl.GetDerivedClassName(exitWindow);
			
			result +=
				part.Replace("{FUNCTION_NAME}", functionName)
					.Replace("{FUNCTION_CALL_NAME}", functionCallName)
					.Replace("{CLASS_NAME_WITH_NAMESPACE}", classNameWithNamespace);
			
			return result;
			
		}
Ejemplo n.º 2
0
		public override void OnFlowWindowLayoutGUI(Rect rect, FD.FlowWindow window) {
			
			if (Heatmap.settings == null) Heatmap.settings = this.GetSettingsFile();

			var settings = Heatmap.settings;
			if (settings != null) {

				if (settings.show == true) {

					var data = settings.data.Get(window);
					data.UpdateMap();

					if (data != null && data.texture != null && data.status == HeatmapSettings.WindowsData.Window.Status.Loaded) {

						GUI.DrawTexture(rect, data.texture, ScaleMode.StretchToFill, alphaBlend: true);

					} else {
						
						if (this.noDataTexture != null) GUI.DrawTexture(rect, this.noDataTexture, ScaleMode.StretchToFill, alphaBlend: true);

					}

				}

			}

		}
Ejemplo n.º 3
0
			public Info(FD.FlowWindow window) {
				
				this.baseNamespace = window.compiledNamespace;
				this.classname = window.compiledDerivedClassName;
				this.baseClassname = window.compiledBaseClassName;
				this.screenName = window.directory;

			}
Ejemplo n.º 4
0
		public static string GenerateTransitionMethod(FlowSystemEditorWindow flowEditor, FD.FlowWindow windowFrom, FD.FlowWindow windowTo) {
			
			var file = Resources.Load("UI.Windows/ABTesting/Templates/TemplateTransitionMethod") as TextAsset;
			if (file == null) {
				
				Debug.LogError("ABTesting Template Loading Error: Could not load template 'TemplateTransitionMethod'");
				
				return string.Empty;
				
			}
			
			var data = FlowSystem.GetData();
			if (data == null) return string.Empty;
			
			if (windowTo.IsABTest() == false) {
				
				return string.Empty;
				
			}

			var result = string.Empty;
			var part = file.text;

			var methodPattern = "(item, h) => WindowSystemFlow.DoFlow<{0}>(this, item, h, null)";
			var methods = string.Empty;
			var methodList = new List<string>();

			foreach (var item in windowTo.abTests.items) {

				var window = FlowSystem.GetWindow(item.attachItem.targetId);
				if (window == null) {
					
					methodList.Add("null");

				} else {
					
					var classNameWithNamespace = Tpl.GetClassNameWithNamespace(window);
					methodList.Add(string.Format(methodPattern, classNameWithNamespace));

				}

			}

			methods = string.Join(", ", methodList.ToArray());

			result +=
				part.Replace("{METHOD_NAMES}", methods)
					.Replace("{FLOW_FROM_ID}", windowFrom.id.ToString())
					.Replace("{FLOW_TO_ID}", windowTo.id.ToString());
			
			return result;
			
		}
Ejemplo n.º 5
0
		public static string GenerateTransitionMethod(FlowSystemEditorWindow flowEditor, FD.FlowWindow windowFrom, FD.FlowWindow windowTo) {
			
			var file = Resources.Load("UI.Windows/Functions/Templates/TemplateTransitionMethod") as TextAsset;
			if (file == null) {
				
				Debug.LogError("Functions Template Loading Error: Could not load template 'TemplateTransitionMethod'");
				
				return string.Empty;
				
			}
			
			var data = FlowSystem.GetData();
			if (data == null) return string.Empty;
			
			var result = string.Empty;
			var part = file.text;
			
			// Function link
			var functionId = windowTo.GetFunctionId();
			
			// Find function container
			var functionContainer = data.GetWindow(functionId);
			if (functionContainer == null) {
				
				// Function not found
				return string.Empty;
				
			}
			
			// Get function root window
			var root = data.GetWindow(functionContainer.functionRootId);
			//var exit = data.GetWindow(functionContainer.functionExitId);
			
			var functionName = functionContainer.title;
			var functionCallName = functionContainer.directory;
			var classNameWithNamespace = Tpl.GetClassNameWithNamespace(root);
			var transitionMethods = Tpl.GenerateTransitionMethods(windowTo);
			transitionMethods = transitionMethods.Replace("\r\n", "\r\n\t")
				.Replace("\n", "\n\t");
			
			result +=
				part.Replace("{TRANSITION_METHODS}", transitionMethods)
					.Replace("{FUNCTION_NAME}", functionName)
					.Replace("{FUNCTION_CALL_NAME}", functionCallName)
					.Replace("{FLOW_FROM_ID}", windowFrom.id.ToString())
					.Replace("{FLOW_TO_ID}", windowTo.id.ToString())
					.Replace("{CLASS_NAME_WITH_NAMESPACE}", classNameWithNamespace);
			
			return result;
			
		}
		public override void OnFlowWindowLayoutGUI(Rect rect, FD.FlowWindow window) {
			
			if (Heatmap.settings == null) Heatmap.settings = Heatmap.GetSettingsFile();

			var settings = Heatmap.settings;
			if (settings != null) {

				if (settings.show == true) {

					var data = settings.data.Get(window);
					//data.UpdateMap();

					if (data != null && data.texture != null && data.status == HeatmapSettings.WindowsData.Window.Status.Loaded) {

						LayoutWindowType screen;
						var layout = HeatmapSystem.GetLayout(window.id, out screen);
						if (layout == null) return;

						var scaleFactor = HeatmapSystem.GetFactor(new Vector2(layout.root.editorRect.width, layout.root.editorRect.height), 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;
						c.a = 0.5f;
						GUI.color = c;
						GUI.DrawTexture(r, data.texture, ScaleMode.StretchToFill, alphaBlend: false);
						GUI.color = Color.white;

					} else {
						
						if (this.noDataTexture != null) GUI.DrawTexture(rect, this.noDataTexture, ScaleMode.ScaleToFit, alphaBlend: true);

					}

				}

			}

		}
Ejemplo n.º 7
0
		public override string OnCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo, bool everyPlatformHasUniqueName) {

			var settings = Social.settings;
			if (settings != null) {

				var data = settings.data.Get(windowTo);
				if (data != null && data.settings != null && settings.IsPlatformActive(data.settings) == true) {

					return FlowSocialTemplateGenerator.GenerateTransitionMethod(data.settings, everyPlatformHasUniqueName);
				
				}

			}

			return base.OnCompilerTransitionAttachedGeneration(windowFrom, windowTo, everyPlatformHasUniqueName);
			
		} 
Ejemplo n.º 8
0
		private void SelectWindow(FD.FlowWindow window) {

			if (window.compiled == false) {
				
				this.ShowNotification(new GUIContent("You need to compile this window to use `Select` command"));
					
			} else {

				window.Select();

			}

		}
Ejemplo n.º 9
0
		public void DrawWindowLayout(FD.FlowWindow window) {
			
			var flowWindowWithLayout = FlowSystem.GetData().HasView(FlowView.Layout);
			if (flowWindowWithLayout == true) {

				GUILayout.Box(string.Empty, FlowSystemEditorWindow.styles.layoutBoxStyle, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
				var rect = GUILayoutUtility.GetLastRect();
				
				if (window.OnPreviewGUI(rect,
				                        FlowSystemEditorWindow.defaultSkin.button,
				                        FlowSystemEditorWindow.styles.layoutBoxStyle,
				                        drawInfo: true,
				                        selectable: true,
				                        onCreateScreen: () => {
					
					this.SelectWindow(window);
					FlowChooserFilter.CreateScreen(Selection.activeObject, window.compiledNamespace, "/Screens", () => {
						
						this.SelectWindow(window);
						
					});
					
				}, onCreateLayout: () => {
					
					this.SelectWindow(window);
					Selection.activeObject = window.GetScreen();
					FlowChooserFilter.CreateLayout(Selection.activeObject, Selection.activeGameObject, () => {
						
						this.SelectWindow(window);
						
					});
					
				}) == true) {
					
					// Set for waiting connection
					var element = WindowLayoutElement.waitForComponentConnectionElementTemp;
					
					this.WaitForAttach(window.id, element);
					
					WindowLayoutElement.waitForComponentConnectionTemp = false;
					
				}
				
				UnityEditor.UI.Windows.Plugins.Flow.Flow.OnDrawWindowLayoutGUI(rect, window);
				
			}
			
		}
Ejemplo n.º 10
0
		public void DrawTransitionChooser(AttachItem attach, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSided) {
			
			if (this.drawWindowContent == false) return;

			if (toWindow.IsEnabled() == false) return;
			if (toWindow.IsContainer() == true) return;

			var factor = 0.5f;
			var transitionsContainer = fromWindow;
			var namePrefix = string.Empty;

			if (fromWindow.IsSmall() == true &&
				fromWindow.IsABTest() == true) {

				// is ABTest
				//Debug.Log(fromWindow.id + " => " + toWindow.id + " :: " + attach.index + " :: " + doubleSided);
				transitionsContainer = FlowSystem.GetWindow(fromWindow.abTests.sourceWindowId);
				if (transitionsContainer == null) return;

				namePrefix = string.Format("Variant{0}", attach.index.ToString());
				factor = 0.2f;

			} else {

				if (toWindow.IsSmall() == true) {

					if (toWindow.IsFunction() == false) return;

				}

			}

			if (FlowSystem.GetData().modeLayer == ModeLayer.Audio) {

				if (FlowSystem.GetData().HasView(FlowView.AudioTransitions) == false) return;

			} else {
				
				if (FlowSystem.GetData().HasView(FlowView.VideoTransitions) == false) return;

			}

			const float size = 32f;
			const float offset = size * 0.5f + 5f;

			Vector2 centerOffset = Flow.OnDrawNodeCurveOffset(this, attach, fromWindow, toWindow, doubleSided);

			if (doubleSided == true) {

				var q = Quaternion.LookRotation(toWindow.rect.center - fromWindow.rect.center, Vector3.back);
				var attachRevert = FlowSystem.GetAttachItem(toWindow.id, fromWindow.id);
				
				this.DrawTransitionChooser(attachRevert, toWindow, toWindow, fromWindow, centerOffset, q * Vector2.left * offset, size, factor, namePrefix);
				this.DrawTransitionChooser(attach, fromWindow, fromWindow, toWindow, centerOffset, q * Vector2.right * offset, size, factor, namePrefix);

			} else {

				this.DrawTransitionChooser(attach, transitionsContainer, fromWindow, toWindow, centerOffset, Vector2.zero, size, factor, namePrefix);

			}

		}
Ejemplo n.º 11
0
		public bool IsVisible(FD.FlowWindow window) {

			if (window.isMovingState == true) return true;

			if (this.zoomDrawer.GetZoom() < 1f) {

				return true;

			}

			return window.isVisibleState = this.ContainsRect(window.rect);

		}
Ejemplo n.º 12
0
		private void DrawStates(FD.CompletedState[] states, FD.FlowWindow window) {
			
			if (states == null) return;
			
			var oldColor = GUI.color;
			var style = ME.Utilities.CacheStyle("FlowEditor.DrawStates.Styles", "Grad Down Swatch");
			
			var elemWidth = style.fixedWidth - 3f;
			var width = window.rect.width - 6f;
			
			var posY = -9f;
			
			var color = Color.black;
			color.a = 0.6f;
			var posX = width - elemWidth;
			
			var shadowOffset = 1f;
			for (int i = states.Length - 1; i >= 0; --i) {
				
				GUI.color = color;
				GUI.Label(new Rect(posX + shadowOffset, posY + shadowOffset, elemWidth, style.fixedHeight), string.Empty, style);
				posX -= elemWidth;
				
			}
			
			posX = width - elemWidth;
			for (int i = states.Length - 1; i >= 0; --i) {
				
				var state = states[i];
				
				if (state == FD.CompletedState.NotReady) {
					
					color = new Color(1f, 0.3f, 0.3f, 1f);
					
				} else if (state == FD.CompletedState.Ready) {
					
					color = new Color(0.3f, 1f, 0.3f, 1f);
					
				} else if (state == FD.CompletedState.ReadyButWarnings) {
					
					color = new Color(1f, 1f, 0.3f, 1f);
					
				}
				
				GUI.color = color;
				GUI.Label(new Rect(posX, posY, elemWidth, style.fixedHeight), string.Empty, style);
				posX -= elemWidth;
				
			}
			
			GUI.color = oldColor;
			
		}
Ejemplo n.º 13
0
		public void DrawTransitionChooser(FD.FlowWindow.AttachItem attach, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, Vector2 offset, float size) {

			var _size = Vector2.one * size;
			var rect = new Rect(Vector2.Lerp(fromWindow.rect.center, toWindow.rect.center, 0.5f) + offset - _size * 0.5f, _size);

			var transitionStyle = ME.Utilities.CacheStyle("UI.Windows.Styles.DefaultSkin", "TransitionIcon", (name) => FlowSystemEditorWindow.defaultSkin.FindStyle("TransitionIcon"));
			var transitionStyleBorder = ME.Utilities.CacheStyle("UI.Windows.Styles.DefaultSkin", "TransitionIconBorder", (name) => FlowSystemEditorWindow.defaultSkin.FindStyle("TransitionIconBorder"));
			if (transitionStyle != null && transitionStyleBorder != null) {

				if (fromWindow.GetScreen() != null) {

					System.Action onClick = () => {
						
						FlowChooserFilter.CreateTransition(fromWindow, toWindow, "/Transitions", (element) => {
							
							FlowSystem.Save();
							
						});

					};

					// Has transition or not?
					var hasTransition = attach.transition != null && attach.transitionParameters != null;
					if (hasTransition == true) {

						GUI.DrawTexture(rect, Texture2D.blackTexture, ScaleMode.ScaleAndCrop, false);

						var hovered = rect.Contains(Event.current.mousePosition);
						if (attach.editor == null) {

							attach.editor = Editor.CreateEditor(attach.transitionParameters) as IPreviewEditor;
							hovered = true;

						}

						if (attach.editor.HasPreviewGUI() == true) {

							if (hovered == false) {

								attach.editor.OnDisable();

							} else {

								attach.editor.OnEnable();
								
							}

							var style = new GUIStyle(EditorStyles.toolbarButton);
							attach.editor.OnPreviewGUI(Color.white, rect, style, false, false, hovered);

						}

						if (GUI.Button(rect, string.Empty, transitionStyleBorder) == true) {

							onClick();

						}

					} else {
						
						GUI.Box(rect, string.Empty, transitionStyle);
						if (GUI.Button(rect, string.Empty, transitionStyleBorder) == true) {
							
							onClick();

						}

					}

				}

			}

		}
Ejemplo n.º 14
0
		public void DrawTransitionChooser(FD.FlowWindow.AttachItem attach, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, bool doubleSided) {
			
			if (toWindow.IsEnabled() == false) return;
			if (toWindow.IsContainer() == true) return;

			if (toWindow.IsSmall() == true) {

				if (toWindow.IsFunction() == false) return;

			}

			const float size = 32f;
			const float offset = size * 0.5f + 5f;

			if (doubleSided == true) {

				var q = Quaternion.LookRotation(toWindow.rect.center - fromWindow.rect.center, Vector3.back);
				var attachRevert = FlowSystem.GetAttachItem(toWindow.id, fromWindow.id);
				
				this.DrawTransitionChooser(attachRevert, toWindow, fromWindow, q * Vector2.left * offset, size);
				this.DrawTransitionChooser(attach, fromWindow, toWindow, q * Vector2.right * offset, size);

			} else {

				this.DrawTransitionChooser(attach, fromWindow, toWindow, Vector2.zero, size);

			}

		}
Ejemplo n.º 15
0
		public bool IsVisible(FD.FlowWindow window) {

			/*var scrollPos = FlowSystem.GetScrollPosition();
			var rect = new Rect(scrollPos.x - this.scrollRect.width * 0.5f + this.scrollRect.x,
			                    scrollPos.y + this.scrollRect.y,
			                    this.scrollRect.width,
			                    this.scrollRect.height);

			var newState = true;//rect.ScaleSizeBy(this.zoomDrawer.GetZoom()).Overlaps(window.rect.ScaleSizeBy(this.zoomDrawer.GetZoom()));

			if (newState == true &&
				window.isVisibleState == false) {

				window.isVisibleState = true;
				this.Repaint();
				return false;

			}

			return newState;*/

			return true;

		}
Ejemplo n.º 16
0
		public float GetTagsHeight(FD.FlowWindow window) {
			
			var columns = 3;
			var height = 16f;

			return Mathf.CeilToInt(window.tags.Count / (float)columns) * height + height + 2f;

		}
Ejemplo n.º 17
0
		private void DrawTags(FD.FlowWindow window, bool defaultWindow = false) {

			EditorGUIUtility.labelWidth = 35f;
			
			var tagStyles = FlowSystemEditor.GetTagStyles();

			var tagCaptionStyleText = ME.Utilities.CacheStyle("FlowEditor.DrawTags.Styles", "sv_label_0");

			var tagCaptionStyle = ME.Utilities.CacheStyle("FlowEditor.DrawTags.Styles", "tagCaptionStyle", (styleName) => {

				var _tagCaptionStyle = new GUIStyle(GUI.skin.textField);
				_tagCaptionStyle.alignment = TextAnchor.MiddleCenter;
				_tagCaptionStyle.fixedWidth = 90f;
				_tagCaptionStyle.fixedHeight = tagCaptionStyleText.fixedHeight;
				_tagCaptionStyle.stretchWidth = false;
				_tagCaptionStyle.font = tagCaptionStyleText.font;
				_tagCaptionStyle.fontStyle = tagCaptionStyleText.fontStyle;
				_tagCaptionStyle.fontSize = tagCaptionStyleText.fontSize;
				_tagCaptionStyle.normal = tagCaptionStyleText.normal;
				_tagCaptionStyle.focused = tagCaptionStyleText.normal;
				_tagCaptionStyle.active = tagCaptionStyleText.normal;
				_tagCaptionStyle.hover = tagCaptionStyleText.normal;
				_tagCaptionStyle.border = tagCaptionStyleText.border;
				//_tagCaptionStyle.padding = tagCaptionStyleText.padding;
				//_tagCaptionStyle.margin = tagCaptionStyleText.margin;
				_tagCaptionStyle.margin = new RectOffset();

				return _tagCaptionStyle;

			});
			
			var tagStyleAdd = ME.Utilities.CacheStyle("FlowEditor.DrawTags.Styles", "sv_label_3", (styleName) => {
				
				var _tagStyleAdd = new GUIStyle(styleName);
				_tagStyleAdd.margin = new RectOffset(0, 0, 0, 0);
				_tagStyleAdd.padding = new RectOffset(3, 5, 0, 2);
				_tagStyleAdd.alignment = TextAnchor.MiddleCenter;
				_tagStyleAdd.stretchWidth = false;

				return _tagStyleAdd;

			});

			var tagsLabel = ME.Utilities.CacheStyle("FlowEditor.DrawTags.Styles", "defaultLabel", (styleName) => {
				
				var _tagsLabel = new GUIStyle(FlowSystemEditorWindow.defaultSkin.label);
				_tagsLabel.padding = new RectOffset(_tagsLabel.padding.left, _tagsLabel.padding.right, _tagsLabel.padding.top, _tagsLabel.padding.bottom + 4);

				return _tagsLabel;

			});

			var changed = false;
			
			GUILayout.BeginHorizontal();
			{
				GUILayoutExt.LabelWithShadow("Tags:", tagsLabel, GUILayout.Width(EditorGUIUtility.labelWidth));
				
				GUILayout.BeginVertical();
				{
					GUILayout.Space(4f);
					
					var tagCaption = string.Empty;
					if (this.showTagsPopupId == window.id) tagCaption = this.tagCaption;
					
					var isEnter = (Event.current.type == EventType.keyDown && Event.current.keyCode == KeyCode.Return);
					
					GUILayout.BeginVertical();
					{
						
						GUILayout.BeginHorizontal();
						{
							
							var columns = 3;
							var i = 0;
							foreach (var tag in window.tags) {
								
								if (i % columns == 0) {
									
									GUILayout.EndHorizontal();
									GUILayout.BeginHorizontal();
									
								}
								
								var tagInfo = FlowSystem.GetData().GetTag(tag);
								if (tagInfo == null) {
									
									window.tags.Remove(tag);
									break;
									
								}
								
								if (GUILayout.Button(tagInfo.title, tagStyles[tagInfo.color]) == true) {
									
									FlowSystem.RemoveTag(window, tagInfo);
									break;
									
								}
								
								++i;
								
							}
							
							if (i % columns != 0) GUILayout.FlexibleSpace();
							
						}
						GUILayout.EndHorizontal();
						
						GUILayout.BeginHorizontal();
						{
							
							var newTagCaption = string.Empty;
							var rect = new Rect();
							GUILayout.BeginHorizontal();
							{
								
								var oldEnabled = GUI.enabled;
								GUI.enabled = !string.IsNullOrEmpty(this.tagCaption) && (this.showTagsPopupId == window.id);
								if ((GUILayout.Button(new GUIContent("+"), tagStyleAdd) == true || isEnter == true) && GUI.enabled == true) {
									
									FlowSystem.AddTag(window, new FlowTag(FlowSystem.GetData().GetNextTagId(), this.tagCaption));
									this.tagCaption = string.Empty;
									
								}
								GUI.enabled = oldEnabled;
								
								newTagCaption = GUILayout.TextField(tagCaption, tagCaptionStyle);
								rect = GUILayoutUtility.GetLastRect();
								
							}
							GUILayout.EndHorizontal();
							
							if (tagCaption != newTagCaption) {
								
								this.showTagsPopupId = window.id;
								this.tagCaption = newTagCaption;
								
								this.showTagsPopup = false;
								changed = true;
								
							}
							
							if (this.showTagsPopupId == window.id && newTagCaption.Length > 0) {
								
								// Show Tags Popup
								var allTags = FlowSystem.GetTags();
								if (allTags != null) {
									
									this.showTagsPopup = true;
									if (Event.current.type == EventType.Repaint) {
										
										this.showTagsPopupRect = new Rect(window.rect.x + rect.x + FlowSystemEditorWindow.GetSettingsWidth(), window.rect.y + rect.y + (defaultWindow == true ? window.rect.height : 0f), rect.width, rect.height);
										
									}
									
									if (changed == true) this.Repaint();
									
								}
								
							}
							
						}
						GUILayout.EndHorizontal();
						
					}
					GUILayout.EndVertical();
					
				}
				GUILayout.EndVertical();
				
			}
			GUILayout.EndHorizontal();
			
			if (changed == true) {
				
				this.Repaint();
				
			}
			
			EditorGUIUtility.LookLikeControls();
			
		}
		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", "Restart If Equals" }, 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();
						
					}

				}

			}

		}
Ejemplo n.º 19
0
		private void DrawWindowToolbar(FD.FlowWindow window) {

			/*if (FlowSystem.GetData().modeLayer != ModeLayer.Flow) {

				return;

			}*/

			//var edit = false;
			var id = window.id;
			
			var buttonStyle = ME.Utilities.CacheStyle("FlowEditor.DrawWindowToolbar.Styles", "toolbarButton", (name) => {
				
				var _buttonStyle = new GUIStyle(EditorStyles.toolbarButton);
				_buttonStyle.stretchWidth = false;
				
				return _buttonStyle;
				
			});
			
			var buttonDropdownStyle = ME.Utilities.CacheStyle("FlowEditor.DrawWindowToolbar.Styles", "toolbarDropDown", (name) => {
				
				var _buttonStyle = new GUIStyle(EditorStyles.toolbarDropDown);
				_buttonStyle.stretchWidth = false;
				
				return _buttonStyle;
				
			});

			var buttonWarningStyle = ME.Utilities.CacheStyle("FlowEditor.DrawWindowToolbar.Styles", "buttonWarningStyle", (name) => {
				
				var _buttonStyle = new GUIStyle(EditorStyles.toolbarButton);
				_buttonStyle.stretchWidth = false;
				_buttonStyle.fontStyle = FontStyle.Bold;
				
				return _buttonStyle;
				
			});

			GUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
			if (this.waitForAttach == false || this.currentAttachComponent == null) {
				
				if (this.waitForAttach == true) {
					
					if (id != this.currentAttachId) {
						
						var currentAttach = FlowSystem.GetWindow(this.currentAttachId);
						if (currentAttach != null) {
							
							//var attachTo = FlowSystem.GetWindow(id);
							//var hasContainer = currentAttach.HasContainer();
							
							if (currentAttach.IsContainer() == false) {
								
								if (FlowSystem.AlreadyAttached(this.currentAttachId, this.currentAttachIndex, id) == true) {
									
									if (GUILayout.Button(string.Format("Detach Here{0}", (Event.current.alt == true ? " (Double Direction)" : string.Empty)), buttonStyle) == true) {
										
										FlowSystem.Detach(this.currentAttachId, this.currentAttachIndex, id, oneWay: Event.current.alt == false);
										if (this.onAttach != null) this.onAttach(id, this.currentAttachIndex, false);
										if (Event.current.shift == false) this.WaitForAttach(-1);
										
									}
									
								} else {

									var abTests = (window.abTests.sourceWindowId >= 0/* || currentAttach.attachItems.Any(x => FlowSystem.GetWindow(x.targetId).IsABTest() == true) == true*/);

									if (this.currentAttachIndex == 0 && 
									    (currentAttach.IsABTest() == true ||
									    abTests == true)) {
										/*
										if (abTests == true) {

											if (GUILayout.Button("Attach Here", buttonStyle) == true) {

												this.ShowNotification(new GUIContent("You can't connect using this method. Use `Attach` function on `A/B Test Condition`"));

											}

										}*/

									} else {

										if (GUILayout.Button(string.Format("Attach Here{0}", (Event.current.alt == true ? " (Double Direction)" : string.Empty)), buttonStyle) == true) {
											
											FlowSystem.Attach(this.currentAttachId, this.currentAttachIndex, id, oneWay: Event.current.alt == false);
											if (this.onAttach != null) this.onAttach(id, this.currentAttachIndex, true);
											if (Event.current.shift == false) this.WaitForAttach(-1);
											
										}

									}

								}
								
							}
							
						}
						
					} else {
						
						if (GUILayout.Button("Cancel", buttonStyle) == true) {
							
							this.WaitForAttach(-1);
							
						}
						
					}
					
				} else {
					
					if (window.IsSmall() == false ||
					    window.IsFunction() == true ||
					    window.IsABTest() == true) {
						
						if (GUILayout.Button("Attach/Detach", buttonStyle) == true) {
							
							this.ShowNotification(new GUIContent("Use Attach/Detach buttons to Connect/Disconnect a window"));
							this.WaitForAttach(id);
							
						}
						
					}

				}
				
				if (window.IsSmall() == false) {
					
					//var isExit = false;
					
					var functionWindow = window.GetFunctionContainer();
					if (functionWindow != null) {
						
						if (functionWindow.functionRootId == 0) functionWindow.functionRootId = id;
						if (functionWindow.functionExitId == 0) functionWindow.functionExitId = id;
						
						//isExit = (functionWindow.functionExitId == id);
						
					}
					
					var isRoot = (FlowSystem.GetRootWindow() == id || (functionWindow != null && functionWindow.functionRootId == id));
					if (GUILayout.Toggle(isRoot, new GUIContent("R", "Set as root"), buttonStyle) != isRoot) {
						
						if (functionWindow != null) {
							
							if (isRoot == true) {
								
								// Was root
								// Setup root for the first window in function
								functionWindow.functionRootId = window.id;
								
							} else {
								
								// Was not root
								// Setup as root but inside this function only
								functionWindow.functionRootId = window.id;
								
							}
							
						} else {
							
							if (isRoot == true) {
								
								// Was root
								FlowSystem.SetRootWindow(-1);
								
							} else {
								
								// Was not root
								FlowSystem.SetRootWindow(id);
								
							}
							
						}
						
						FlowSystem.SetDirty();
						
					}
					/*
					if (functionWindow != null) {

						if (GUILayout.Toggle(isExit, new GUIContent("E", "Set as exit point"), buttonStyle) != isExit) {

							if (isExit == true) {
								
								// Was exit
								// Setup exit for the first window in function
								functionWindow.functionExitId = window.id;
								
							} else {
								
								// Was not exit
								// Setup as exit but inside this function only
								functionWindow.functionExitId = window.id;
								
							}

							FlowSystem.SetDirty();
							
						}

					}*/
					
					var isDefault = FlowSystem.GetDefaultWindows().Contains(id);
					if (GUILayout.Toggle(isDefault, new GUIContent("D", "Set as default"), buttonStyle) != isDefault) {
						
						if (isDefault == true) {
							
							// Was as default
							FlowSystem.GetDefaultWindows().Remove(id);
							
						} else {
							
							// Was not as default
							FlowSystem.GetDefaultWindows().Add(id);
							
						}
						
						FlowSystem.SetDirty();
						
					}
					
				}
				
				GUILayout.FlexibleSpace();
				
				if (window.IsSmall() == false && FlowSceneView.IsActive() == false && window.storeType == FD.FlowWindow.StoreType.NewScreen) {

					var state = GUILayout.Button("Screen", buttonDropdownStyle);
					if (Event.current.type == EventType.Repaint) {

						this.layoutStateSelectButtonRect = GUILayoutUtility.GetLastRect();

					}

					if (state == true) {

						var menu = new GenericMenu();
						menu.AddItem(new GUIContent("Select Package"), on: false, func: () => { this.SelectWindow(window); });
						
						if (window.compiled == true) {

							menu.AddItem(new GUIContent("Edit..."), on: false, func: () => {

								var path = Path.GetDirectoryName(AssetDatabase.GetAssetPath(window.GetScreen()));
								var filename = window.compiledDerivedClassName + ".cs";
								EditorUtility.OpenWithDefaultApp(string.Format("{0}/../{1}", path, filename));

							});

						}

						menu.AddItem(new GUIContent("Create on Scene"), on: false, func: () => { this.CreateOnScene(window); });

						var screen = window.GetScreen();

						var methodsCount = 0;
						WindowSystem.CollectCallVariations(screen, (types, names) => {

							++methodsCount;

						});

						menu.AddDisabledItem(new GUIContent("Calls/Methods: " + methodsCount.ToString()));
						menu.AddSeparator("Calls/");

						if (window.compiled == true &&
						    screen != null) {

							methodsCount = 0;
							WindowSystem.CollectCallVariations(screen, (types, names) => {

								var parameters = new List<string>();
								for (int i = 0; i < types.Length; ++i) {

									parameters.Add(ME.Utilities.FormatParameter(types[i]) + " " + names[i]);

								}

								var paramsStr = parameters.Count > 0 ? "(" + string.Join(", ", parameters.ToArray()) + ")" : string.Empty;
								menu.AddItem(new GUIContent("Calls/OnParametersPass" + paramsStr), on: false, func: () => {

									Selection.activeObject = screen;

								});

								++methodsCount;

							});

							if (methodsCount == 0) {
								
								menu.AddDisabledItem(new GUIContent("Calls/No `OnParametersPass` Methods Found"));

							}

						} else {
							
							menu.AddDisabledItem(new GUIContent("Calls/You need to compile window"));

						}

						Flow.OnFlowWindowScreenMenuGUI(this, window, menu);

						menu.DropDown(this.layoutStateSelectButtonRect);

					}
					
					/*
					if (GUILayout.Button("Edit", buttonStyle) == true) {
						
						if (window.compiled == false) {
							
							this.ShowNotification(new GUIContent("You need to compile this window to use 'Edit' command"));
							
						} else {
							
							edit = true;
							
						}
						
					}*/
					
				}
				
				if (GUILayout.Button("X", buttonWarningStyle) == true) {
					
					if (EditorUtility.DisplayDialog("Are you sure?", "Current window will be destroyed with all links.", "Yes, destroy", "No") == true) {
						
						this.ShowNotification(new GUIContent(string.Format("The window `{0}` was successfully destroyed", window.title)));
						FlowSystem.DestroyWindow(id);
						return;
						
					}
					
				}

			} else {
				
				// Draw Attach/Detach component link
				
				if (this.currentAttachId == id) {
					
					// Cancel
					if (GUILayout.Button("Cancel", buttonStyle) == true) {
						
						this.WaitForAttach(-1);
						
					}
					
				} else {
					
					// If it's other window
					if (window.IsSmall() == false ||
					    window.IsFunction() == true) {
						
						if (FlowSystem.AlreadyAttached(this.currentAttachId, this.currentAttachIndex, id, this.currentAttachComponent) == true) {
							
							if (GUILayout.Button("Detach Here", buttonStyle) == true) {
								
								FlowSystem.Detach(this.currentAttachId, this.currentAttachIndex, id, oneWay: true, component: this.currentAttachComponent);
								if (this.onAttach != null) this.onAttach(id, this.currentAttachIndex, false);
								if (Event.current.shift == false) this.WaitForAttach(-1);

							}
							
						} else {
							
							if (GUILayout.Button("Attach Here", buttonStyle) == true) {
								
								FlowSystem.Attach(this.currentAttachId, this.currentAttachIndex, id, oneWay: true, component: this.currentAttachComponent);
								if (this.onAttach != null) this.onAttach(id, this.currentAttachIndex, true);
								if (Event.current.shift == false) this.WaitForAttach(-1);
								
							}
							
						}
						
					}
					
				}
				
				GUILayout.FlexibleSpace();
				
			}
			GUILayout.EndHorizontal();
			
			/*if (edit == true) {
				
				FlowSceneView.SetControl(this, window, this.OnItemProgress);

			}*/
			
		}
Ejemplo n.º 20
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);

			}

		}
Ejemplo n.º 21
0
		public Vector2 GetWindowSize(FD.FlowWindow window) {
			
			var flowWindowWithLayout = FlowSystem.GetData().HasView(FlowView.Layout);
			var flowWindowWithLayoutScaleFactor = FlowSystem.GetData().flowWindowWithLayoutScaleFactor;
			if (flowWindowWithLayout == true) {

				return new Vector2(250f, 250f) * (1f + flowWindowWithLayoutScaleFactor);

			}
			
			return new Vector2(250f, 80f + (Mathf.CeilToInt(window.tags.Count / 3f)) * 15f);
			
		}
Ejemplo n.º 22
0
		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}");

								}

							}

						}

					}

				}

			}

		}
Ejemplo n.º 23
0
		public void DrawTransitionChooser(AttachItem attach, FD.FlowWindow transitionsContainer, FD.FlowWindow fromWindow, FD.FlowWindow toWindow, Vector2 centerOffset, Vector2 offset, float size, float factor = 0.5f, string namePrefix = "") {

			var _size = Vector2.one * size;
			var rect = new Rect(Vector2.Lerp(fromWindow.rect.center + centerOffset, toWindow.rect.center, factor) + offset - _size * 0.5f, _size);

			var icon = "TransitionIcon";
			if (FlowSystem.GetData().modeLayer == ModeLayer.Audio) {

				icon = "TransitionIconAudio";

			}

			var transitionStyle = ME.Utilities.CacheStyle("UI.Windows.Styles.DefaultSkin", icon, (name) => FlowSystemEditorWindow.defaultSkin.FindStyle(name));
			var transitionStyleBorder = ME.Utilities.CacheStyle("UI.Windows.Styles.DefaultSkin", "TransitionIconBorder", (name) => FlowSystemEditorWindow.defaultSkin.FindStyle(name));
			if (transitionStyle != null && transitionStyleBorder != null) {

				//if (fromWindow.GetScreen() != null) {

				System.Action onClick = () => {

					if (FlowSystem.GetData().modeLayer == ModeLayer.Flow) {

						FlowChooserFilter.CreateTransition<TransitionVideoInputTemplateParameters>(transitionsContainer, fromWindow, toWindow, attach.index, "/Transitions", namePrefix, (element) => {
							
							FlowSystem.Save();
							
						});

					} else if (FlowSystem.GetData().modeLayer == ModeLayer.Audio) {
						
						FlowChooserFilter.CreateTransition<TransitionAudioInputTemplateParameters>(transitionsContainer, fromWindow, toWindow, attach.index, "/Transitions", namePrefix, (element) => {
							
							FlowSystem.Save();
							
						});

					}

				};

				// Has transition or not?
				TransitionBase transition = null;
				TransitionInputParameters transitionParameters  = null;
				IPreviewEditor editor = null;
				if (FlowSystem.GetData().modeLayer == ModeLayer.Flow) {

					transition = attach.transition;
					transitionParameters = attach.transitionParameters;
					editor = attach.editor;

				} else if (FlowSystem.GetData().modeLayer == ModeLayer.Audio) {
					
					transition = attach.audioTransition;
					transitionParameters = attach.audioTransitionParameters;
					editor = attach.editorAudio;

				}
				
				var hasTransition = transition != null && transitionParameters != null;
				if (hasTransition == true) {

					GUI.DrawTexture(rect, Texture2D.blackTexture, ScaleMode.ScaleAndCrop, false);

					var hovered = GUI.enabled && rect.Contains(Event.current.mousePosition);
					if (editor == null) {

						editor = Editor.CreateEditor(transitionParameters) as IPreviewEditor;
						if (FlowSystem.GetData().modeLayer == ModeLayer.Flow) {
							
							attach.editor = editor;
							
						} else if (FlowSystem.GetData().modeLayer == ModeLayer.Audio) {
							
							attach.editorAudio = editor;
							
						}

						hovered = true;

					}

					if (editor.HasPreviewGUI() == true) {

						if (hovered == false) {

							editor.OnDisable();

						} else {

							editor.OnEnable();
							
						}

						var style = new GUIStyle(EditorStyles.toolbarButton);
						editor.OnPreviewGUI(Color.white, rect, style, false, false, hovered);

					}

					if (GUI.Button(rect, string.Empty, transitionStyleBorder) == true) {

						onClick();

					}

				} else {
					
					GUI.Box(rect, string.Empty, transitionStyle);
					if (GUI.Button(rect, string.Empty, transitionStyleBorder) == true) {
						
						onClick();

					}

				}

				//}

			}

		}
Ejemplo n.º 24
0
		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();

								});

							}

						}

					}

				}

			}

		}
Ejemplo n.º 25
0
		private void CreateOnScene(FD.FlowWindow window) {

			if (window.compiled == false) {
				
				this.ShowNotification(new GUIContent("You need to compile this window to use `Create on Scene` command"));
				
			} else {

				var screen = window.GetScreen();
				if (screen != null) {

					screen.CreateOnScene(callEvents: false);

				}

			}

		}
Ejemplo n.º 26
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; });
											
										});

									}

								}

							}

						}

					}

				}

			}

		}
Ejemplo n.º 27
0
		public override bool IsCompilerTransitionAttachedGeneration(FD.FlowWindow windowFrom, FD.FlowWindow windowTo) {

			var settings = Social.settings;
			if (settings != null) {
				
				var data = settings.data.Get(windowTo);
				if (data != null && data.settings != null && settings.IsPlatformActive(data.settings) == true) {

					return true;

				}

			}

			return false;

		}
Ejemplo n.º 28
0
		private void BringBackOrFront(FD.FlowWindow current, IEnumerable<FD.FlowWindow> windows) {
			
			// Is any of other window has bigger size and collide current
			foreach (var window in windows) {
				
				if (window.id != current.id) {
					
					var p1 = window.rect.width * window.rect.height;
					var p2 = current.rect.width * current.rect.height;
					
					if (p1 > p2 && window.rect.Overlaps(current.rect) == true) {
						
						// Bring window to front
						GUI.BringWindowToFront(current.id);
						
						if (this.bringFront.ContainsKey(current.id) == true) {
							
							foreach (var item in this.bringFront[current.id]) {
								
								GUI.BringWindowToFront(item.id);
								
							}
							
						}
						
						if (this.bringFront.ContainsKey(window.id) == true) {
							
							this.bringFront[window.id].Add(current);
							
						} else {
							
							this.bringFront.Add(window.id, new List<FD.FlowWindow>() { current });
							
						}
						
					}
					
				}
				
			}
			
		}
Ejemplo n.º 29
0
		public override void OnFlowWindowGUI(FD.FlowWindow window) {

			if (Social.settings == null) return;

			var socialFlag = (window.flags & Social.settings.uniqueTag) == Social.settings.uniqueTag;
			if (socialFlag == true) {

				var settings = Social.settings;
				if (settings == null) return;
				
				var data = settings.data.Get(window);
				var isActiveSelected = settings.IsPlatformActive(data.settings);

				var oldColor = GUI.color;
				GUI.color = isActiveSelected ? Color.white : Color.grey;
				var result = GUILayoutExt.LargeButton(data.settings ? data.settings.GetPlatformName() : "None", 60f, 150f);
				GUI.color = oldColor;
				var rect = GUILayoutUtility.GetLastRect();
				rect.y += rect.height;

				if (result == true) {

					var menu = new GenericMenu();
					menu.AddItem(new GUIContent("None"), data.settings == null, () => {

						data.settings = null;

					});

					foreach (var platform in settings.activePlatforms) {

						if (platform.active == true) {

							var item = platform.settings;
							menu.AddItem(new GUIContent(platform.GetPlatformName()), data.settings == platform.settings, () => {

								data.settings = item;

							});
							
						} else {

							menu.AddDisabledItem(new GUIContent(platform.GetPlatformName()));

						}
						
					}

					menu.DropDown(rect);

				}

			}

		}
Ejemplo n.º 30
0
		public void SetCenterTo(FD.FlowWindow window) {

			FlowSystem.SetZoom(1f);
			FlowSystem.SetScrollPosition(-new Vector2(window.rect.x - this.scrollRect.width * 0.5f, window.rect.y - this.scrollRect.height * 0.5f));

		}