예제 #1
0
		private void WriteInputStats(ref FormattedText target, MouseInput input)
		{
			// Initialize the formatted text block we'll write to
			this.PrepareFormattedText(ref target);

			// Determine all pressed mouse buttons
			string activeButtons = "";
			foreach (MouseButton button in Enum.GetValues(typeof(MouseButton)))
			{
				if (input.ButtonPressed(button))
				{
					if (activeButtons.Length != 0)
						activeButtons += ", ";
					activeButtons += button.ToString();
				}
			}

			// Compose the formatted text to display
			target.SourceText = 
				"/f[1]Mouse Stats/f[0]/n/n" +
				string.Format("Description: /cFF8800FF{0}/cFFFFFFFF/n", input.Description) +
				string.Format("IsAvailable: /cFF8800FF{0}/cFFFFFFFF/n", input.IsAvailable) +
				string.Format("X:     /c44AAFFFF{0,4}/cFFFFFFFF | XSpeed:     /c44AAFFFF{1,4}/cFFFFFFFF/n", input.X, input.XSpeed) +
				string.Format("Y:     /c44AAFFFF{0,4}/cFFFFFFFF | YSpeed:     /c44AAFFFF{1,4}/cFFFFFFFF/n", input.Y, input.YSpeed) +
				string.Format("Wheel: /c44AAFFFF{0,4}/cFFFFFFFF | WheelSpeed: /c44AAFFFF{1,4}/cFFFFFFFF/n", input.WheelPrecise, input.WheelSpeedPrecise) +
				string.Format("Buttons: /c44AAFFFF{0}/cFFFFFFFF/n", activeButtons);
		}
예제 #2
0
파일: InputMonitor.cs 프로젝트: pyneer/case
        private void WriteInputStats(ref FormattedText target, MouseInput input)
        {
            // Initialize the formatted text block we'll write to
            this.PrepareFormattedText(ref target);

            // Determine all pressed mouse buttons
            string activeButtons = "";

            foreach (MouseButton button in Enum.GetValues(typeof(MouseButton)))
            {
                if (input.ButtonPressed(button))
                {
                    if (activeButtons.Length != 0)
                    {
                        activeButtons += ", ";
                    }
                    activeButtons += button.ToString();
                }
            }

            // Compose the formatted text to display
            target.SourceText =
                "/f[1]Mouse Stats/f[0]/n/n" +
                string.Format("Id: /cFF8800FF{0}/cFFFFFFFF/n", input.Id) +
                string.Format("ProductId: /cFF8800FF{0}/cFFFFFFFF/n", input.ProductId) +
                string.Format("ProductName: /cFF8800FF{0}/cFFFFFFFF/n", input.ProductName) +
                string.Format("IsAvailable: /cFF8800FF{0}/cFFFFFFFF/n", input.IsAvailable) +
                string.Format("X:     /c44AAFFFF{0,8:F}/cFFFFFFFF | XSpeed:     /c44AAFFFF{1,8:F}/cFFFFFFFF/n", input.Pos.X, input.Vel.X) +
                string.Format("Y:     /c44AAFFFF{0,8:F}/cFFFFFFFF | YSpeed:     /c44AAFFFF{1,8:F}/cFFFFFFFF/n", input.Pos.Y, input.Vel.Y) +
                string.Format("Wheel: /c44AAFFFF{0,8:F}/cFFFFFFFF | WheelSpeed: /c44AAFFFF{1,8:F}/cFFFFFFFF/n", input.Wheel, input.WheelSpeed) +
                string.Format("Buttons: /c44AAFFFF{0}/cFFFFFFFF/n", activeButtons);
        }
예제 #3
0
        public virtual void Logic()
        {
            if (!Enabled)
            {
                return;
            }

            if (!editor.Paused)
            {
                if (!KeyboardInput.Current[Key.LControl])
                {
                    if (KeyboardInput.Current[Key.N] && !KeyboardInput.Previous[Key.N])
                    {
                        useEgdeNormal = !useEgdeNormal;
                    }
                    if (KeyboardInput.Current[Key.S])
                    {
                        snapVertex = null;
                    }
                    if (KeyboardInput.Current[Key.D])
                    {
                        Vertex closest         = null;
                        float  closestDistance = 0;

                        foreach (Vertex v in editor.selectedList)
                        {
                            if (closest == null)
                            {
                                closest         = v;
                                closestDistance = (v.Position - MouseInput.Current.Position).Length;
                            }

                            float vDistance = (v.Position - MouseInput.Current.Position).Length;
                            if (vDistance < closestDistance)
                            {
                                closest         = v;
                                closestDistance = vDistance;
                            }
                        }

                        snapVertex = closest;
                    }
                }

                if (MouseInput.ButtonPressed(MouseButton.Left) && Hovered)
                {
                    Enable(MouseInput.Current.Position);
                }
            }

            if (Active && !MouseInput.Current[MouseButton.Left])
            {
                Disable();
            }

            if (Active)
            {
                Manipulate();
            }
        }