Пример #1
0
                public void AddPoint(Vector2 point, LayoutTag tag, WindowComponent component)
                {
                    this.points.Add(new Point(point, tag, component));
                    this.changed = true;

                    this.UpdateMap();
                }
Пример #2
0
        public static void Send(LayoutTag tag, WindowBase window, WindowComponent component, Vector2 localNormalizedPoint)
        {
            var flowWindow = Flow.FlowSystem.GetWindow(window);

            if (flowWindow == null)
            {
                Debug.LogWarningFormat("[ Heatmap ] FlowWindow not found. Source {0} used ({1}).", window, tag);
                return;
            }

            // Offline
                        #if UNITY_EDITOR
            var modulesPath = FlowSystem.GetData().GetModulesPath();
            var settings    = ME.EditorUtilities.GetAssetsOfType <HeatmapSettings>(modulesPath, useCache: false).FirstOrDefault();
                        #else
            HeatmapSettings settings = null;
                        #endif
            if (settings == null)
            {
                return;
            }

            var data = settings.data.Get(flowWindow);
            data.AddPoint(localNormalizedPoint, new Vector2Int(Screen.width, Screen.height), flowWindow.id, tag, component);
        }
Пример #3
0
            public Point(Vector2 point, LayoutTag tag, WindowComponent component)
            {
                this.x = point.x;
                this.y = point.y;

                this.componentInfo = new ComponentInfo(tag, component);
            }
Пример #4
0
 public Component(LayoutTag tag, string description)
 {
                     #if UNITY_EDITOR
     this.description = description;
                     #endif
     this.tag = tag;
 }
Пример #5
0
        private void AddComponentLink(LayoutTag tag, string description)
        {
            var list = this.components.ToList();

            list.Add(new Component(tag, description));
            this.components = list.ToArray();
        }
Пример #6
0
        private void AddComponentLink(LayoutTag tag)
        {
            var list = this.components.ToList();

            list.Add(new Component(tag));
            this.components = list.ToArray();
        }
			public Point(Vector2 point, LayoutTag tag, WindowComponent component) {
				
				this.x = point.x;
				this.y = point.y;

				this.tag = tag;
				
			}
Пример #8
0
 public ComponentLink(int targetWindowId, LayoutTag sourceComponentTag, string comment)
 {
     this.targetWindowId     = targetWindowId;
     this.sourceComponentTag = sourceComponentTag;
                     #if UNITY_EDITOR
     this.comment = string.IsNullOrEmpty(comment) ? string.Empty : ("On " + comment.ToLower().UppercaseWords().Trim().Replace(" ", "") + " Action");
                     #endif
 }
			public Point(Vector2 point, LayoutTag tag, WindowComponent component) {
				
				this.x = point.x;
				this.y = point.y;

				this.componentInfo = new ComponentInfo(tag, component);
				
			}
Пример #10
0
			public ComponentLink(int targetWindowId, LayoutTag sourceComponentTag, string comment) {

				this.targetWindowId = targetWindowId;
				this.sourceComponentTag = sourceComponentTag;
				#if UNITY_EDITOR
				this.comment = string.IsNullOrEmpty(comment) ? string.Empty : ("On " + comment.ToLower().UppercaseWords().Trim().Replace(" ", "") + " Action");
				#endif

			}
Пример #11
0
        public WindowLayoutElement GetLayoutComponent(LayoutTag tag)
        {
            var screen = this.GetScreen().Load <LayoutWindowType>();

            if (screen != null && screen.GetCurrentLayout().layout != null)
            {
                return(screen.GetCurrentLayout().layout.GetRootByTag(tag));
            }

            return(null);
        }
Пример #12
0
        public WindowLayoutElement GetLayoutComponent(LayoutTag tag)
        {
            var screen = this.GetScreen() as LayoutWindowType;

            if (screen != null && screen.layout.layout != null)
            {
                return(screen.layout.layout.GetRootByTag(tag));
            }

            return(null);
        }
Пример #13
0
        public WindowLayoutElement GetContainer(LayoutTag tag)
        {
            var component = this.components.FirstOrDefault((c) => c.tag == tag);

            if (component != null)
            {
                return(component.GetContainer());
            }

            return(null);
        }
Пример #14
0
            public Point(Vector2 point, Vector2Int screenSize, int screenId, LayoutTag tag, WindowComponent component)
            {
                this.screenId     = screenId;
                this.screenWidth  = screenSize.x;
                this.screenHeight = screenSize.y;

                this.x = point.x;
                this.y = point.y;

                this.tag = tag;
            }
Пример #15
0
            public T Get <T>(LayoutTag tag = LayoutTag.None) where T : WindowComponent
            {
                if (tag != LayoutTag.None)
                {
                    if (this.tag != tag)
                    {
                        return(null);
                    }
                }

                return(this.instance as T);
            }
        public T Get <T>(LayoutTag tag = LayoutTag.None) where T : WindowComponent
        {
            for (var i = 0; i < this.components.Length; ++i)
            {
                var item = this.components[i].Get <T>(tag);
                if (item != null)
                {
                    return(item);
                }
            }

            return(default(T));
        }
Пример #17
0
        public T Get <T>(LayoutTag tag = LayoutTag.None) where T : WindowComponent
        {
            foreach (var component in this.components)
            {
                var item = component.Get <T>(tag);
                if (item != null)
                {
                    return(item);
                }
            }

            return(default(T));
        }
Пример #18
0
        public static void Send(LayoutTag tag, WindowBase window, WindowComponent component, Vector2 localNormalizedPoint)
        {
            var flowWindow = Flow.FlowSystem.GetWindow(window);

            if (flowWindow == null)
            {
                Debug.LogWarningFormat("[ Heatmap ] FlowWindow not found. Source {0} used ({1}).", window, tag);
                return;
            }

            // TODO: Send to server
            // Request the new map from server.
            // Use tag, window and component as a keys.

            // Offline
                        #if UNITY_EDITOR
            var settings = ME.EditorUtilities.GetAssetsOfType <HeatmapSettings>(useCache: false).FirstOrDefault();
                        #else
            HeatmapSettings settings = null;
                        #endif
            if (settings == null)
            {
                return;
            }

            var data = settings.data.Get(flowWindow);

            data.status = HeatmapSettings.WindowsData.Window.Status.Loading;

            data.size = (window as LayoutWindowType).layout.GetLayoutInstance().GetSize();
            data.AddPoint(localNormalizedPoint, tag, component);

                        #if UNITY_EDITOR
            UnityEditor.EditorUtility.SetDirty(settings);
                        #endif

            data.status = HeatmapSettings.WindowsData.Window.Status.Loaded;
        }
Пример #19
0
                public ComponentInfo(LayoutTag tag, WindowComponent component)
                {
                    this.tag = tag;

                    this.x = 0f;
                    this.y = 0f;
                    this.w = 0f;
                    this.h = 0f;

                    //var rect = (component.transform as RectTransform).rect;

                    var corners = new Vector3[4];

                    (component.transform as RectTransform).GetWorldCorners(corners);

                    var leftBottom = this.GetScreenPoint(component, corners[0]);
                    var topRight   = this.GetScreenPoint(component, corners[2]);

                    this.x = leftBottom.x;
                    this.y = leftBottom.y;
                    this.w = topRight.x - leftBottom.x;
                    this.h = topRight.y - leftBottom.y;
                }
				public ComponentInfo(LayoutTag tag, WindowComponent component) {
					
					this.tag = tag;

					this.x = 0f;
					this.y = 0f;
					this.w = 0f;
					this.h = 0f;

					//var rect = (component.transform as RectTransform).rect;

					var corners = new Vector3[4];
					(component.transform as RectTransform).GetWorldCorners(corners);

					var leftBottom = this.GetScreenPoint(component, corners[0]);
					var topRight = this.GetScreenPoint(component, corners[2]);

					this.x = leftBottom.x;
					this.y = leftBottom.y;
					this.w = topRight.x - leftBottom.x;
					this.h = topRight.y - leftBottom.y;

				}
Пример #21
0
 /// <summary>
 /// 分析标签
 /// </summary>
 /// <param name="parser">TemplateParser</param>
 /// <param name="tc">Token集合</param>
 /// <returns></returns>
 public ITag Parse(TemplateParser parser, TokenCollection tc)
 {
     if (tc != null &&
         parser != null &&
         tc.Count > 2 &&
         Utility.IsEqual(tc.First.Text, Field.KEY_LAYOUT) &&
         (tc[1].TokenKind == TokenKind.LeftParentheses) &&
         tc.Last.TokenKind == TokenKind.RightParentheses)
     {
         LayoutTag tag = new LayoutTag();
         tag.Path = parser.Read(new TokenCollection(tc, 2, tc.Count - 2));
         //if(!(path is StringTag))
         //{
         //    throw new Exception("");
         //}
         while (parser.MoveNext())
         {
             tag.Children.Add(parser.Current);
         }
         return(tag);
     }
     return(null);
 }
Пример #22
0
 public void Reset()
 {
     this.tag = LayoutTag.None;
 }
Пример #23
0
		public WindowLayoutElement GetRootByTag(LayoutTag tag) {

			return this.elements.FirstOrDefault((element) => element.tag == tag);

		}
				public void AddPoint(Vector2 point, LayoutTag tag, WindowComponent component) {

					this.points.Add(new Point(point, tag, component));
					this.changed = true;

					this.UpdateMap();

				}
Пример #25
0
 public WindowLayoutElement GetRootByTag(LayoutTag tag)
 {
     return(this.elements.FirstOrDefault((element) => element.tag == tag));
 }
Пример #26
0
		public WindowLayoutElement GetLayoutComponent(LayoutTag tag) {

			var screen = this.GetScreen() as LayoutWindowType;
			if (screen != null && screen.layout.layout != null) {
				
				return screen.layout.layout.GetRootByTag(tag);

			}

			return null;

		}
Пример #27
0
 private void RemoveComponentLink(LayoutTag tag)
 {
     this.components = this.components.Where((c) => c.tag != tag).ToArray();
 }
Пример #28
0
		public static void Send(LayoutTag tag, WindowBase window, WindowComponent component, Vector2 localNormalizedPoint) {

			var flowWindow = Flow.FlowSystem.GetWindow(window);
			if (flowWindow == null) {
				
				Debug.LogWarningFormat("[ Heatmap ] FlowWindow not found. Source {0} used ({1}).", window, tag);
				return;

			}

			// Offline
			#if UNITY_EDITOR
			var modulesPath = FlowSystem.GetData().GetModulesPath();
			var settings = ME.EditorUtilities.GetAssetsOfType<HeatmapSettings>(modulesPath, useCache: false).FirstOrDefault();
			#else
			HeatmapSettings settings = null;
			#endif
			if (settings == null) return;

			var data = settings.data.Get(flowWindow);
			data.AddPoint(localNormalizedPoint, new Vector2Int(Screen.width, Screen.height), flowWindow.id, tag, component);

		}
Пример #29
0
		public static void Send(LayoutTag tag, WindowBase window, WindowComponent component, Vector2 localNormalizedPoint) {

			var flowWindow = Flow.FlowSystem.GetWindow(window);
			if (flowWindow == null) {
				
				Debug.LogWarningFormat("[ Heatmap ] FlowWindow not found. Source {0} used ({1}).", window, tag);
				return;

			}

			// Offline
			#if UNITY_EDITOR
			var settings = ME.EditorUtilities.GetAssetsOfType<HeatmapSettings>(useCache: false).FirstOrDefault();
			#else
			HeatmapSettings settings = null;
			#endif
			if (settings == null) return;

			var data = settings.data.Get(flowWindow);

			data.status = HeatmapSettings.WindowsData.Window.Status.Loading;

			//data.size = new Vector2(Screen.width, Screen.height);
			data.AddPoint(localNormalizedPoint, tag, component);

			//TODO: change to MathX
			//Rounding coords to 2 digets after point
			//var roundedX = Math.Round((double)localNormalizedPoint.x, 2).ToString();
			//var roundedY = Math.Round((double)localNormalizedPoint.y, 2).ToString();
			/*
			HeatmapSystem.sender.Post("http://localhost:8080/hm_save", new Dictionary<string, string>() {
				{"key", settings.authKey},
				{"uid", SystemInfo.deviceUniqueIdentifier},
				{"windowId", data.id.ToString()},
				{"tag", ((int)tag).ToString()},
				{"x",  roundedX},
				{"y",  roundedY}
			}, null);*/

		}
Пример #30
0
 public T GetLayoutComponent <T>(LayoutTag tag = LayoutTag.None) where T : WindowComponent
 {
     return(this.layout.Get <T>(tag));
 }
Пример #31
0
 public WindowLayoutElement GetLayoutContainer(LayoutTag tag)
 {
     return(this.layout.GetContainer(tag));
 }
Пример #32
0
 public Component(LayoutTag tag)
 {
     this.tag = tag;
 }
Пример #33
0
		public static void Send(LayoutTag tag, WindowBase window, WindowComponent component, Vector2 localNormalizedPoint) {

			var flowWindow = Flow.FlowSystem.GetWindow(window);
			if (flowWindow == null) {
				
				Debug.LogWarningFormat("[ Heatmap ] FlowWindow not found. Source {0} used ({1}).", window, tag);
				return;

			}

			// TODO: Send to server
			// Request the new map from server.
			// Use tag, window and component as a keys.

			// Offline
			#if UNITY_EDITOR
			var settings = ME.EditorUtilities.GetAssetsOfType<HeatmapSettings>(useCache: false).FirstOrDefault();
			#else
			HeatmapSettings settings = null;
			#endif
			if (settings == null) return;

			var data = settings.data.Get(flowWindow);

			data.status = HeatmapSettings.WindowsData.Window.Status.Loading;

			data.size = (window as LayoutWindowType).layout.GetLayoutInstance().GetSize();
			data.AddPoint(localNormalizedPoint, tag, component);

			#if UNITY_EDITOR
			UnityEditor.EditorUtility.SetDirty(settings);
			#endif

			data.status = HeatmapSettings.WindowsData.Window.Status.Loaded;

		}
			public Point(Vector2 point, Vector2Int screenSize, int screenId, LayoutTag tag, WindowComponent component) {

				this.screenId = screenId;
				this.screenWidth = screenSize.x;
				this.screenHeight = screenSize.y;

				this.x = point.x;
				this.y = point.y;

				this.tag = tag;
				
			}
				public void AddPoint(Vector2 point, Vector2Int screenSize, int screenId, LayoutTag tag, WindowComponent component) {

					var newPoint = new Point(point, screenSize, screenId, tag, component);
					this.points.Add(newPoint);
					this.changed = true;

					Analytics.Analytics.SendScreenPoint(screenId, newPoint.screenWidth, newPoint.screenHeight, (byte)newPoint.tag, newPoint.x, newPoint.y);

				}
		public void Reset() {

			this.tag = LayoutTag.None;

		}
Пример #37
0
                public void AddPoint(Vector2 point, Vector2Int screenSize, int screenId, LayoutTag tag, WindowComponent component)
                {
                    var newPoint = new Point(point, screenSize, screenId, tag, component);

                    this.points.Add(newPoint);
                    this.changed = true;

                    Analytics.Analytics.SendScreenPoint(screenId, newPoint.screenWidth, newPoint.screenHeight, (byte)newPoint.tag, newPoint.x, newPoint.y);
                }
Пример #38
0
 public void GetLayoutComponent <T>(out T component, LayoutTag tag = LayoutTag.None) where T : WindowComponent
 {
     component = this.GetLayoutComponent <T>(tag);
 }