示例#1
0
        public void Initialize(AutomationType selectedAutomationType)
        {
            SelectedAutomationType = selectedAutomationType;
            IsInitialized          = true;

            if (selectedAutomationType == AutomationType.UIA2)
            {
                _automation = new UIA2Automation();
            }
            else
            {
                _automation = new UIA3Automation();
            }
            _rootElement = _automation.GetDesktop();
            var desktopViewModel = new ElementViewModel(_rootElement);

            desktopViewModel.SelectionChanged += DesktopViewModel_SelectionChanged;
            desktopViewModel.LoadChildren(false);
            Elements.Add(desktopViewModel);

            // Initialize TreeWalker
            _treeWalker = _automation.TreeWalkerFactory.GetControlViewWalker();

            // Initialize hover
            _hoverMode = new HoverMode(_automation);
            _hoverMode.ElementHovered += ElementHovered;
        }
示例#2
0
        public void Initialize(AutomationType selectedAutomationType)
        {
            SelectedAutomationType = selectedAutomationType;
            IsInitialized          = true;

            _automation  = selectedAutomationType == AutomationType.UIA2 ? (AutomationBase) new UIA2Automation() : new UIA3Automation();
            _rootElement = _automation.GetDesktop();
            var desktopViewModel = new ElementViewModel(_rootElement);

            desktopViewModel.SelectionChanged += DesktopViewModel_SelectionChanged;
            desktopViewModel.LoadChildren(false);
            Elements.Add(desktopViewModel);
            Elements[0].IsExpanded = true;

            // Initialize TreeWalker
            _treeWalker = _automation.TreeWalkerFactory.GetControlViewWalker();

            // Initialize hover
            _hoverMode = new HoverMode(_automation);
            _hoverMode.ElementHovered += ElementToSelectChanged;

            // Initialize focus tracking
            _focusTrackingMode = new FocusTrackingMode(_automation);
            _focusTrackingMode.ElementFocused += ElementToSelectChanged;
        }
示例#3
0
 public void StartPlayerTurn()
 {
     playerCharacter.currentPM = playerStats.playerStats.startingMP;
     playerCharacter.currentPA = playerStats.playerStats.startingAP;
     hoverMode = HoverMode.MovePath;
     playerCharacter.InitializeAllSkillRange(playerCharacter.GetTile());
 }
        /// <summary>
        /// this method starts hover mode.
        /// </summary>
        public void StartHoverMode()
        {
            if (this._hoverMode == null)
            {
                this._hoverMode = new HoverMode(this);
            }

            this._hoverMode.Start();
        }
示例#5
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (BgColor != null)
         {
             hashCode = hashCode * 59 + BgColor.GetHashCode();
         }
         if (Camera != null)
         {
             hashCode = hashCode * 59 + Camera.GetHashCode();
         }
         if (Domain != null)
         {
             hashCode = hashCode * 59 + Domain.GetHashCode();
         }
         if (AspectMode != null)
         {
             hashCode = hashCode * 59 + AspectMode.GetHashCode();
         }
         if (AspectRatio != null)
         {
             hashCode = hashCode * 59 + AspectRatio.GetHashCode();
         }
         if (XAxis != null)
         {
             hashCode = hashCode * 59 + XAxis.GetHashCode();
         }
         if (YAxis != null)
         {
             hashCode = hashCode * 59 + YAxis.GetHashCode();
         }
         if (ZAxis != null)
         {
             hashCode = hashCode * 59 + ZAxis.GetHashCode();
         }
         if (DragMode != null)
         {
             hashCode = hashCode * 59 + DragMode.GetHashCode();
         }
         if (HoverMode != null)
         {
             hashCode = hashCode * 59 + HoverMode.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (Annotations != null)
         {
             hashCode = hashCode * 59 + Annotations.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#6
0
        /// <summary> 校验鼠标是否进入线段
        /// </summary>
        /// <param name="startpoint">起始点</param>
        /// <param name="endpoint">结束点</param>
        /// <param name="muslocation">鼠标位置坐</param>
        /// <returns>进入返回true,否则返回false</returns>
        protected Boolean LineOver(Point startpoint, Point endpoint, Point muslocation)
        {
            Int32   minpoint = startpoint.X;
            Int32   maxpoint = endpoint.X;
            Boolean flagX    = false;
            Boolean flagY    = false;

            if (minpoint > maxpoint)
            {
                minpoint = endpoint.X;
                maxpoint = startpoint.X;
            }

            if (minpoint <= muslocation.X && muslocation.X <= maxpoint)
            {
                flagX = true;
            }

            if (startpoint.Y == endpoint.Y && flagX && 2 >= Math.Abs(muslocation.Y - startpoint.Y))
            {
                _hoverarea = HoverMode.Line;
                return(true);
            }

            minpoint = startpoint.Y;
            maxpoint = endpoint.Y;
            if (minpoint > maxpoint)
            {
                minpoint = endpoint.Y;
                maxpoint = startpoint.Y;
            }
            if (minpoint <= muslocation.Y && muslocation.Y <= maxpoint)
            {
                flagY = true;
            }

            if (startpoint.X == endpoint.X && flagY && 2 >= Math.Abs(muslocation.X - startpoint.X))
            {
                _hoverarea = HoverMode.Line;
                return(true);
            }

            if (flagX && flagY)
            {
                Double dblele    = Math.Sqrt(Math.Pow(startpoint.X - endpoint.X, 2) + Math.Pow(startpoint.Y - endpoint.Y, 2));
                Double dblmsu    = Math.Sqrt(Math.Pow(startpoint.X - muslocation.X, 2) + Math.Pow(startpoint.Y - muslocation.Y, 2));
                Double dblangle  = Math.Abs(Math.Asin(Math.Abs(startpoint.X - endpoint.X) / dblele) - Math.Asin(Math.Abs(startpoint.X - muslocation.X) / dblmsu));
                Double dbllength = dblmsu * Math.Sin(dblangle);
                if (2 >= dbllength)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#7
0
        private void beginhover(object sender, ElapsedEventArgs e)
        {
            if (prvover != null)
            {
                hovertimer.Enabled = false;
                //toolStripStatusLabel3.Text = "hover";
                hoverMode = HoverMode.Active;
                string msg = "<b>" + htmlEncode(prvover.DebuggerDisplay) + "</b><hr class='hr'/>this is a <span class='c1'>test</span> of the <b>tooltip</b> window.  <span class='b1'>THis is only a test.</span>";

                //toolTip1.ToolTipTitle = prvover.ToString();
                toolTip1.Show(msg, this, this.PointToClient(Control.MousePosition + new SD.Size(0, 50)));
            }
        }
示例#8
0
    public void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        cam = Camera.main;

        hoverMode = HoverMode.NoHover;
    }
示例#9
0
        private void endhover()
        {
            switch (hoverMode)
            {
            case HoverMode.Prehover:         // pre
                hovertimer.Stop();
                //toolStripStatusLabel3.Text = "stop timer";
                hoverMode = HoverMode.Off;
                break;

            case HoverMode.Active:
                toolTip1.Hide(this);
                //toolStripStatusLabel3.Text = "end hover";
                hoverMode = HoverMode.Off;
                break;
            }
            prvover = null;
        }
        internal QuickTask SearchPrevTask(HoverMode mode)
        {
            var       curLoc    = TextEditor.Caret.Offset;
            QuickTask firstTask = null;

            foreach (var task in AllTasks.OrderByDescending(t => t.Location))
            {
                bool isNextTask = task.Location < curLoc;
                if (mode == HoverMode.NextMessage ||
                    mode == HoverMode.NextWarning && task.Severity == DiagnosticSeverity.Warning ||
                    mode == HoverMode.NextError && task.Severity == DiagnosticSeverity.Error)
                {
                    if (isNextTask)
                    {
                        return(task);
                    }
                    if (firstTask == null)
                    {
                        firstTask = task;
                    }
                }
            }
            return(firstTask);
        }
示例#11
0
        internal QuickTask SearchNextTask(HoverMode mode)
        {
            var       curLoc    = (TextLocation)TextEditor.Caret.Location;
            QuickTask firstTask = null;

            foreach (var task in AllTasks.OrderBy(t => t.Location))
            {
                bool isNextTask = task.Location > curLoc;
                if (mode == HoverMode.NextMessage ||
                    mode == HoverMode.NextWarning && task.Severity == Severity.Warning ||
                    mode == HoverMode.NextError && task.Severity == Severity.Error)
                {
                    if (isNextTask)
                    {
                        return(task);
                    }
                    if (firstTask == null)
                    {
                        firstTask = task;
                    }
                }
            }
            return(firstTask);
        }
示例#12
0
        /// <summary>
        /// Draws the Hierarchy window.
        /// </summary>
        /// <param name="windowID">The window ID.</param>
        void HierarchyWindow(int windowID)
        {
            GUILayout.BeginHorizontal();

            GUILayout.Label("Root objects : ", GUILayout.ExpandWidth(false));
            if (GUILayout.Toggle(!allAssetsMode, "Current scene", GUILayout.ExpandWidth(false)))
            {
                allAssetsMode = false;
            }
            if (GUILayout.Toggle(allAssetsMode, "All assets (slow !)", GUILayout.ExpandWidth(false)))
            {
                allAssetsMode = true;
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            showInactive = GUILayout.Toggle(showInactive, "Show <color=orange>inactive</color>", GUILayout.Width(120f));

            hierarchyLocked = !GUILayout.Toggle(!hierarchyLocked, "Watch changes", GUILayout.Width(120f));

            if (drawWireFrame != GUILayout.Toggle(drawWireFrame, "Draw wireframe", GUILayout.Width(120f)))
            {
                RemoveWireFrameFromSelection();
                if (!drawWireFrame)
                {
                    drawWireFrame = true;
                    AddWireFrameToSelection();
                }
                else
                {
                    drawWireFrame = false;
                }
            }

            GUILayout.EndHorizontal();


            GUILayout.BeginHorizontal();

            GUILayout.Label("Alt + hover selection mode : ", GUILayout.ExpandWidth(false));
            if (GUILayout.Toggle(hoverMode == HoverMode.PART, "Part", GUILayout.ExpandWidth(false)))
            {
                hoverMode = HoverMode.PART;
            }
            if (GUILayout.Toggle(hoverMode == HoverMode.UI, "UI", GUILayout.ExpandWidth(false)))
            {
                hoverMode = HoverMode.UI;
            }
            if (GUILayout.Toggle(hoverMode == HoverMode.OBJECT, "GameObject", GUILayout.ExpandWidth(false)))
            {
                hoverMode = HoverMode.OBJECT;
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Label("Search scene and assets ", GUILayout.ExpandWidth(false));

            string newFilter = GUILayout.TextField(searchFilter);

            if (newFilter != searchFilter)
            {
                searchFilter = newFilter;
                ClearSelection();
                if (searchFilter.Length > 2)
                {
                    SearchAllTransforms(searchRootOnly);
                }
            }

            searchRootOnly = GUILayout.Toggle(searchRootOnly, "Root only", GUILayout.ExpandWidth(false));

            GUILayout.EndHorizontal();

            // Begin a scroll view.
            hierarchyScroll = GUILayout.BeginScrollView(hierarchyScroll, HighLogic.Skin.scrollView);

            DrawHierarchy();

            // End the scroll view.
            GUILayout.EndScrollView();

            // Allow the user to drag the window.
            GUI.DragWindow();
        }
示例#13
0
 /// <summary>
 /// When entered = false, means hover e
 /// </summary>
 public MouseHoverOnDocumentationEvent(DocumentationTag tag, HoverMode hoverMode)
 {
     Tag        = tag;
     HoverMode1 = hoverMode;
 }
示例#14
0
		internal QuickTask SearchPrevTask (HoverMode mode)
		{
			var curLoc = (TextLocation)TextEditor.Caret.Location;
			QuickTask firstTask = null;
			foreach (var task in AllTasks.OrderByDescending (t => t.Location) ) {
				bool isNextTask = task.Location < curLoc;
				if (mode == HoverMode.NextMessage ||
				    mode == HoverMode.NextWarning && task.Severity == Severity.Warning ||
				    mode == HoverMode.NextError && task.Severity == Severity.Error) {
					if (isNextTask)
						return task;
					if (firstTask == null)
						firstTask = task;
				}
			}
			return firstTask;
		}
示例#15
0
        public bool Equals([AllowNull] Scene other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((BgColor == other.BgColor && BgColor != null && other.BgColor != null && BgColor.Equals(other.BgColor)) &&
                   (Camera == other.Camera && Camera != null && other.Camera != null && Camera.Equals(other.Camera)) &&
                   (Domain == other.Domain && Domain != null && other.Domain != null && Domain.Equals(other.Domain)) &&
                   (AspectMode == other.AspectMode && AspectMode != null && other.AspectMode != null && AspectMode.Equals(other.AspectMode)) &&
                   (AspectRatio == other.AspectRatio && AspectRatio != null && other.AspectRatio != null && AspectRatio.Equals(other.AspectRatio)) &&
                   (XAxis == other.XAxis && XAxis != null && other.XAxis != null && XAxis.Equals(other.XAxis)) &&
                   (YAxis == other.YAxis && YAxis != null && other.YAxis != null && YAxis.Equals(other.YAxis)) &&
                   (ZAxis == other.ZAxis && ZAxis != null && other.ZAxis != null && ZAxis.Equals(other.ZAxis)) &&
                   (DragMode == other.DragMode && DragMode != null && other.DragMode != null && DragMode.Equals(other.DragMode)) &&
                   (HoverMode == other.HoverMode && HoverMode != null && other.HoverMode != null && HoverMode.Equals(other.HoverMode)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (Equals(Annotations, other.Annotations) || Annotations != null && other.Annotations != null && Annotations.SequenceEqual(other.Annotations)));
        }
		internal QuickTask SearchNextTask (HoverMode mode)
		{
			var curLoc = TextEditor.Caret.Offset;
			QuickTask firstTask = null;
			foreach (var task in AllTasks.OrderBy (t => t.Location) ) {
				bool isNextTask = task.Location > curLoc;
				if (mode == HoverMode.NextMessage ||
					mode == HoverMode.NextWarning && task.Severity == DiagnosticSeverity.Warning ||
					mode == HoverMode.NextError && task.Severity == DiagnosticSeverity.Error) {
					if (isNextTask)
						return task;
					if (firstTask == null)
						firstTask = task;
				}
			}
			return firstTask;
		}
示例#17
0
 public void EndPlayerTurn()
 {
     GridManager.instance.AllTilesBecameNotClickable();
     hoverMode = HoverMode.NoHover;
     GameManager.Instance.CheckIfCompleted(true);
 }
示例#18
0
 public HoverModeCommand(HoverMode mode)
     : base()
 {
     this.mode = mode;
 }
示例#19
0
        private void RC3_MouseMove(object sender, MouseEventArgs e)
        {
            if (hovertimer == null)
            {
                hovertimer                     = new System.Timers.Timer(1000);
                hovertimer.AutoReset           = false;
                hovertimer.Enabled             = false;
                hovertimer.SynchronizingObject = this;
                hovertimer.Elapsed            += beginhover;
            }

            var song = Global.Instance.Song;

            if (song != null)
            {
                if (song.DragMode == DragMode.Predrag)
                {
                    if (!((Math.Abs(e.X - hoverpos.X) < Global.HoverDragSensitivity) && (Math.Abs(e.Y - hoverpos.Y) < Global.HoverDragSensitivity)))
                    {
                        song.DragMode = DragMode.Active;

                        if (!dragShift)
                        {
                            song.Selected.Clear();
                        }

                        dragCount = song.Selected.Count;

                        if ((CurrOver != null) && (CurrOver.IsSelectable))
                        {
                            if ((!song.Selected.Contains(CurrOver)) &&
                                ((song.Selected.Count == 0) ||
                                 ((CurrOver.IsMultiSelectable)
                                  //&& (song.Selected.Count > 0)
                                  && (CurrOver.GetType() == song.Selected[0].GetType()))))
                            {
                                song.Selected.Add(CurrOver);
                            }
                        }
                    }
                }
                if (song.DragMode == DragMode.Active)
                {
                    song.DragEnd = e.Location;
                    var dragBox = song.DragBox;
                    foreach (Viz viz in song.Vizs)
                    {
                        if (dragBox.Contains(viz.Rectangle))
                        {
                            if (!song.Selected.Contains(viz) && ((song.Selected.Count == 0) || (viz.GetType() == song.Selected[0].GetType())))
                            {
                                song.Selected.Add(viz);
                            }
                        }
                        else
                        {
                            if (song.Selected.IndexOf(viz) >= dragCount)
                            {
                                song.Selected.Remove(viz);
                            }
                        }
                    }
                }



                // toolStripStatusLabel2.Text = e.Location.ToString();

                int x = e.X;
                int y = e.Y;
                //int x1 = x + hScrollBar1.Value;
                int x1 = x + prioroffset;

                if (song != null && song.Vizs != null)
                {
                    var over = Enumerable.Reverse(song.Vizs).Where(s => s.StartPoint.X <= x1 && x1 <= s.EndPoint.X && s.StartPoint.Y <= y && y <= s.EndPoint.Y).FirstOrDefault();

                    if (over != CurrOver)
                    {
                        CurrOver = over;

                        //if (dragging)
                        //{
                        //	if ((dragOver != null) && dragOver.IsSelectable)
                        //	{
                        //		dragOver = CurrOver;
                        //		if ((!CurrOver.IsMultiSelectable) || (CurrOver.GetType() != song.Selected[0].GetType()))
                        //		{
                        //			song.Selected.Clear();
                        //		}
                        //		if (song.Selected.Contains(CurrOver))
                        //			song.Selected.Remove(CurrOver);
                        //		else
                        //			song.Selected.Add(CurrOver);
                        //	}
                        //}
                    }

                    if (over != null)
                    {
                        //over = x1 / 100 * 100;

                        if (prvover != over)
                        {
                            if (prvover != null)
                            {
                                //toolStripStatusLabel1.Text = "Leave:" + prvover.ToString();
                                endhover();
                            }
                        }
                        else
                        {
                            if (hoverMode == HoverMode.Prehover)
                            {
                                if ((Math.Abs(e.X - hoverpos.X) < Global.HoverDragSensitivity) && (Math.Abs(e.Y - hoverpos.Y) < Global.HoverDragSensitivity))
                                {
                                    return;
                                }

                                endhover();
                            }
                        }

                        //toolStripStatusLabel1.Text = "Over:" + over.ToString() + ":" + hoverstat.ToString();
                        if (hoverMode == HoverMode.Off)
                        {
                            if (over.HasToolTip)
                            {
                                //toolStripStatusLabel3.Text = "pre hover";
                                prvover   = over;
                                hoverMode = HoverMode.Prehover;
                                hoverpos  = e.Location;
                                hovertimer.Start();
                            }
                        }
                    }
                    else        // not/no longer over
                    {
                        if (prvover == null)
                        {
                            return;
                        }

                        endhover();

                        //toolStripStatusLabel3.Text = "leave:" + prvover.ToString();
                    }
                }
            }
        }