Ejemplo n.º 1
0
        public static int GetLabelSize(LabelSize labelSize)
        {
            int size;

            switch (labelSize)
            {
            case LabelSize.Small:
                size = smallFontSize;
                break;

            default:
            case LabelSize.Normal:
                size = normalFontSize;
                break;

            case LabelSize.Large:
                size = largeFontSize;
                break;

            case LabelSize.VeryLarge:
                size = veryLargeFontSize;
                break;

            case LabelSize.Huge:
                size = hugeFontSize;
                break;
            }
            return(size);
        }
Ejemplo n.º 2
0
        void ReleaseDesignerOutlets()
        {
            if (ImagePuzzle != null)
            {
                ImagePuzzle.Dispose();
                ImagePuzzle = null;
            }

            if (LabelTitle != null)
            {
                LabelTitle.Dispose();
                LabelTitle = null;
            }

            if (LabelSize != null)
            {
                LabelSize.Dispose();
                LabelSize = null;
            }

            if (LabelTime != null)
            {
                LabelTime.Dispose();
                LabelTime = null;
            }

            if (ButtonPlay != null)
            {
                ButtonPlay.Dispose();
                ButtonPlay = null;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns a label control, using the default Font with
 /// the size value defined in the <see>AvengersUTD.Odyssey.UserInterFace.FontManager</see>
 /// class.
 /// </summary>
 /// <param name="id">The id of the control.</param>
 /// <param name="text">Text to be displayed.</param>
 /// <param name="labelSize">Font size.</param>
 /// <param name="horizontalAlign">Horizontal alignment.</param>
 /// <param name="verticalAlign">Vertical alignment.</param>
 /// <param name="position">Absolute position of the control.</param>
 /// <param name="color">Color of the text</param>
 public Label(string id,
              string text,
              LabelSize labelSize,
              Alignment horizontalAlign,
              Alignment verticalAlign,
              Vector2 position,
              Color color)
     : this(id, text, position,
            new TextStyle(false, false, false,
                          color, color, StyleManager.GetLabelSize(labelSize),
                          FontManager.DefaultFontName, horizontalAlign, verticalAlign))
 {
 }
Ejemplo n.º 4
0
        static X3DTransform GetLabel(string text, Vector3 backColor, LabelSize labelSize, Vector3 fontColor)
        {
            X3DTransform p  = new X3DTransform();
            X3DTransform mb = X3DTransform.AddTransFormWithShape(ShapeType.Cube);

            p.AddChild(mb);
            var xScale     = 0.2;
            var yScale     = 0.06;
            var txtTrans   = 0.12;
            var rectLength = 20;

            switch (labelSize)
            {
            case LabelSize.large:
                xScale   = 0.7;
                txtTrans = -0.13;
                break;

            case LabelSize.xLarge:
                xScale     = 0.92;
                txtTrans   = 0;
                rectLength = 44;
                yScale     = 0.1;
                break;

            case LabelSize.xxLarge:
                xScale     = 0.92;
                txtTrans   = 0;
                rectLength = 44;
                yScale     = 0.71;
                break;
            }
            mb.Scale = new Vector3(xScale, yScale, 0.001);
            mb.Shape.Appearance.Material.DiffuseColor = backColor;
            var labeltxt = X3DTransform.AddTransFormWithShape(ShapeType.Text);

            p.AddChild(labeltxt);
            labeltxt.Translation             = new Vector3(txtTrans, 0, -0.012);
            labeltxt.Scale                   = new Vector3(0.02);
            labeltxt.Shape.Text              = text;
            labeltxt.Shape.FontStyle.Justify = Justify.LEFT;
            labeltxt.Shape.RectHeight        = 1;
            labeltxt.Shape.RectLength        = rectLength;
            labeltxt.Shape.Appearance.Material.DiffuseColor = fontColor;
            //labeltxt.Shape.FontStyle.
            return(p);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates a label control using the user specified font information.
 /// </summary>
 /// <param name="id">The id of the control.</param>
 /// <param name="text">Text to be displayed.</param>
 /// <param name="labelSize">Font size.</param>
 /// <param name="horizontalAlign">Horizontal alignment.</param>
 /// <param name="verticalAlign">Vertical alignment.</param>
 /// <param name="position">Absolute position of the control.</param>
 /// <param name="normal">Color of the text.</param>
 /// <param name="highlighted">Highlighted color of the text.</param>
 /// <param name="italic">True if the font should be rendered in italic.</param>
 /// <param name="fontName">Name of the font family</param>
 public Label(string id,
              string text,
              LabelSize labelSize,
              Alignment horizontalAlign,
              Alignment verticalAlign,
              Vector2 position,
              Color normal,
              Color highlighted,
              string fontName,
              bool bold,
              bool italic
              )
     : this(id, text, position,
            new TextStyle(bold, italic, false, normal, highlighted, StyleManager.GetLabelSize(labelSize),
                          fontName, horizontalAlign, verticalAlign))
 {
 }
        private void SetCurrentBox()
        {
            double boxHeight = Double.Parse(txtHeight.Text);
            double boxWidth  = Double.Parse(txtWidth.Text);

            LabelSize labelSize     = LabelSize.dimension4x4;
            int       labelRotation = 0;

            if (_currentBox != null)
            {
                labelSize     = _currentBox.LabelSize;
                labelRotation = _currentBox.CurrentLabelRotation;
            }
            _currentBox                      = new CurrentBox(boxHeight, boxWidth, GetCurrentPictureBox(), pnlBox);
            _currentBox.LabelSize            = labelSize;
            _currentBox.CurrentLabelRotation = labelRotation;
            _currentBox.LabelMoved          += _currentBox_LabelMoved;
        }
Ejemplo n.º 7
0
        public void ChangeLabelSize(LabelSize size)
        {
            var nextLabel = CurrentLabel.Copy();

            if (size == LabelSize.dimension4x4)
            {
                nextLabel.Size = LabelSize.dimension4x4;
            }
            else
            {
                nextLabel.Size = LabelSize.dimension4x6;
            }

            CurrentLabel = nextLabel;

            OnLabelSizeChanged(new LabelServiceEventArgs()
            {
                Label = nextLabel
            });
        }
Ejemplo n.º 8
0
        static GUIStyle SetLabelSize(GUIStyle guiStyle, LabelSize size)
        {
#if UNITY_EDITOR
            switch (size)
            {
            case LabelSize.Small:
                guiStyle.fontSize = smallFontSize;
                break;

            case LabelSize.Large:
                guiStyle.fontSize = largeFontSize;
                break;

            default:
                guiStyle.fontSize = normalFontSize;
                break;
            }
            return(guiStyle);
#endif
        }
Ejemplo n.º 9
0
        public static SCNNode SCLabelNode(string message, LabelSize size, bool isLit)
        {
            var node = SCNNode.Create();

            var text = SCNText.Create(message, 0);

            node.Geometry = text;
            node.Scale    = new SCNVector3((0.01f * (int)size), (0.01f * (int)size), (0.01f * (int)size));
            text.Flatness = 0.4f;

            // Use Myriad it's if available, otherwise Avenir
            text.Font = NSFont.FromFontName("Myriad Set", 50) != null?NSFont.FromFontName("Myriad Set", 50) : NSFont.FromFontName("Avenir Medium", 50);

            if (!isLit)
            {
                text.FirstMaterial.LightingModelName = SCNLightingModel.Constant;
            }

            return(node);
        }
        private void SetRotation(LabelSize size)
        {
            pb4x4.Visible = false;
            pb4x6.Visible = false;
            pb6x4.Visible = false;


            if (size == LabelSize.dimension4x4)
            {
                pb4x4.Visible            = true;
                _currentBox.CurrentLabel = pb4x4;
            }
            else if (size == LabelSize.dimension4x6)
            {
                pb6x4.Visible = true;
                _labelService.CurrentLabel.Size = LabelSize.dimension6x4;
                _currentBox.CurrentLabel        = pb6x4;
            }
            else
            {
                pb4x6.Visible = true;
                _labelService.CurrentLabel.Size = LabelSize.dimension4x6;
                _currentBox.CurrentLabel        = pb4x6;
            }

            Image flipImage = pb4x4.Image;

            flipImage.RotateFlip(RotateFlipType.Rotate270FlipXY);
            pb4x4.Image = flipImage;

            flipImage = pb4x6.Image;
            flipImage.RotateFlip(RotateFlipType.Rotate270FlipXY);
            pb4x6.Image = flipImage;

            flipImage = pb6x4.Image;
            flipImage.RotateFlip(RotateFlipType.Rotate270FlipXY);
            pb6x4.Image = flipImage;

            SetCurrentBox();
            SetLableDistance();
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Creates a font object from the specified type specifying the size value to
 /// use. Use this overload if you don't want to set a font size value for each
 /// label created. Define those amounts by setting their properties in the
 /// FontManager class before creating the labels.
 /// <remarks>For example, if you want to use a bigger screen resolution, you
 /// should increase the font size value stored in the [size]FontSize properties
 /// as needed and then using the related LabelSize enum value to create
 /// the labels you need.</remarks>
 /// </summary>
 /// <param name="fontName">Name of the font family.</param>
 /// <param name="labelSize">Font size.</param>
 /// <param name="weight">Bold/Demi bold, etc.</param>
 /// <param name="italic">True if the text is too be rendered in italic.</param>
 /// <returns>The font object.</returns>
 public static Font CreateFont(string fontName, LabelSize labelSize, FontWeight weight, bool italic)
 {
     return(CreateFont(StyleManager.GetLabelSize(labelSize), weight, italic));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates a font object from the default type specifying the size value to
 /// use. Use this overload if you don't want to set a font size value for each
 /// label created. Define those amounts by setting their properties in the
 /// FontManager class before creating the labels.
 /// <remarks>For example, if you want to use a bigger screen resolution, you
 /// should increase the font size value stored in the [size]FontSize properties
 /// as needed and then using the related LabelSize enum value to create
 /// the labels you need.</remarks>
 /// </summary>
 /// <param name="fontName">Name of the font family.</param>
 /// <param name="labelSize">Font size.</param>
 /// <param name="weight">Bold/Demi bold, etc.</param>
 /// <param name="italic">True if the text is too be rendered in italic.</param>
 /// <returns>The font object.</returns>
 public static Font CreateFont(LabelSize size, FontWeight weight, bool italic)
 {
     return(CreateFont(DefaultFontName, size, weight, italic));
 }
Ejemplo n.º 13
0
        public static void Label(Vector3 position, string text, Color?bgColor = null, Color?textColor = null, LabelSize size = LabelSize.Normal)
        {
#if UNITY_EDITOR
            var style = new EditorLabelStyle(defaultLabelStyle);
            if (bgColor.HasValue)
            {
                style.backgroundColor = bgColor.Value;
            }
            if (textColor.HasValue)
            {
                style.textColor = textColor.Value;
            }
            Label(position, text, style, size);
#endif
        }
Ejemplo n.º 14
0
 public ILabel CreateLabel(string trackingReference, LabelSize labelSize)
 {
     return(new BasicLabel(labelSize, trackingReference));
 }
Ejemplo n.º 15
0
 public SmallLabel(LabelSize size, string trackingReference)
 {
     Size = size;
     TrackingReference = trackingReference;
 }
Ejemplo n.º 16
0
 public Label(LabelSize lableSize, LabelPositon lablePositon)
 {
     Size     = lableSize;
     Position = lablePositon;
 }
Ejemplo n.º 17
0
        public static void Label(Vector3 position, string text, EditorLabelStyle style, LabelSize size = LabelSize.Normal)
        {
#if UNITY_EDITOR
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            var oldBgColor = GUI.backgroundColor;
            GUI.backgroundColor = style.backgroundColor;
            GUIStyle guiStyle = SetLabelSize(style.GetGUIStyle(), size);
            Handles.Label(position, text, guiStyle);
            GUI.backgroundColor = oldBgColor;
#endif
        }
Ejemplo n.º 18
0
		public static SCNNode SCLabelNode (string message, LabelSize size, bool isLit)
		{
			var node = SCNNode.Create ();

			var text = SCNText.Create (message, 0);
			node.Geometry = text;
			node.Scale = new SCNVector3 ((0.01f * (int)size), (0.01f * (int)size), (0.01f * (int)size));
			text.Flatness = 0.4f;

			// Use Myriad it's if available, otherwise Avenir
			text.Font = NSFont.FromFontName ("Myriad Set", 50) != null ? NSFont.FromFontName ("Myriad Set", 50) : NSFont.FromFontName ("Avenir Medium", 50);

			if (!isLit)
				text.FirstMaterial.LightingModelName = SCNLightingModel.Constant;

			return node;
		}
Ejemplo n.º 19
0
 public TextStyle(bool bold, bool italic, LabelSize size, Color standardColor) :
     this(bold, italic, false,
          standardColor, standardColor,
          StyleManager.GetLabelSize(size), FontManager.DefaultFontName, Alignment.Left, Alignment.Top)
 {
 }