Пример #1
0
 public UIListBoxTextStyle(TextStyle baseStyle)
 {
     Normal            = baseStyle.Clone();
     Selected          = baseStyle.Clone();
     Selected.Color    = new Color(0, 243, 247);
     Highlighted       = baseStyle.Clone();
     Highlighted.Color = new Color(255, 255, 255);
     Disabled          = baseStyle.Clone();
     Disabled.Color    = new Color(100, 100, 100);
 }
Пример #2
0
        public UIChatBalloon(UIChatPanel owner)
        {
            Owner = owner;
            var gfx = Content.Content.Get().UIGraphics;

            //TODO: switch entire ui onto real content system

            BPointerBottom = GetTexture(0x1AF0856DDBAC);
            BPointerSide   = GetTexture(0x1B00856DDBAC);
            BTiles         = GetTexture(0x1B10856DDBAC);

            if (!ProcessedBGFX)
            {
                ProcessedBGFX = true;
                AlphaCopy(BPointerBottom);
                AlphaCopy(BPointerSide);
                AlphaCopy(BTiles);
            }

            BodyTextStyle       = TextStyle.DefaultLabel.Clone();
            BodyTextStyle.Size  = 12;
            BodyTextStyle.Color = new Color(240, 240, 48);

            ShadowStyle       = BodyTextStyle.Clone();
            ShadowStyle.Color = Color.Black;

            /*
             * if (!GameFacade.Linux && GlobalSettings.Default.EnableTTS)
             * {
             *  TTSContext = (ITTSContext.Provider == null) ? null : ITTSContext.Provider();
             * }*/
        }
Пример #3
0
        /// <summary>
        /// Creates a new Text that is a copy of the current instance.
        /// </summary>
        /// <returns>A new Text that is a copy of this instance.</returns>
        public override object Clone()
        {
            Text entity = new Text
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //Text properties
                Position     = position,
                Rotation     = rotation,
                Height       = height,
                WidthFactor  = widthFactor,
                ObliqueAngle = obliqueAngle,
                Alignment    = alignment,
                Style        = (TextStyle)style.Clone(),
                Value        = text
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
        private static TextStyle Mutate(this TextStyle style, Action <TextStyle> handler)
        {
            style = style.Clone();

            handler(style);
            return(style);
        }
Пример #5
0
        public int ClosestDir = 3; //left, up, right, down, N/A

        public UIChatBalloon(UIChatPanel owner)
        {
            Owner = owner;
            var gfx = Content.Content.Get().UIGraphics;

            //TODO: switch entire ui onto real content system

            BPointerBottom = gfx.Get(0x1AF0856DDBAC);
            BPointerSide   = gfx.Get(0x1B00856DDBAC);
            BTiles         = gfx.Get(0x1B10856DDBAC);

            if (!ProcessedBGFX)
            {
                ProcessedBGFX = true;
                AlphaCopy(BPointerBottom);
                AlphaCopy(BPointerSide);
                AlphaCopy(BTiles);
            }

            BodyTextStyle       = TextStyle.DefaultLabel.Clone();
            BodyTextStyle.Size  = 10;
            BodyTextStyle.Color = new Color(240, 240, 48);

            ShadowStyle       = BodyTextStyle.Clone();
            ShadowStyle.Color = Color.Black;
        }
Пример #6
0
        /// <summary>
        /// Creates a new MText that is a copy of the current instance.
        /// </summary>
        /// <returns>A new MText that is a copy of this instance.</returns>
        public override object Clone()
        {
            MText entity = new MText
            {
                //EntityObject properties
                Layer         = (Layer)Layer.Clone(),
                Linetype      = (Linetype)Linetype.Clone(),
                Color         = (AciColor)Color.Clone(),
                Lineweight    = Lineweight,
                Transparency  = (Transparency)Transparency.Clone(),
                LinetypeScale = LinetypeScale,
                Normal        = Normal,
                IsVisible     = IsVisible,
                //MText properties
                Position          = position,
                Rotation          = rotation,
                Height            = height,
                LineSpacingFactor = lineSpacing,
                LineSpacingStyle  = lineSpacingStyle,
                RectangleWidth    = rectangleWidth,
                AttachmentPoint   = attachmentPoint,
                Style             = (TextStyle)style.Clone(),
                Value             = text
            };

            foreach (XData data in XData.Values)
            {
                entity.XData.Add((XData)data.Clone());
            }

            return(entity);
        }
Пример #7
0
 /// <summary>
 /// Clones shape style.
 /// </summary>
 /// <returns>The new instance of the <see cref="ShapeStyle"/> class.</returns>
 public ShapeStyle Clone()
 {
     return(new ShapeStyle()
     {
         Name = Name,
         Stroke = Stroke.Clone(),
         Fill = Fill.Clone(),
         Thickness = Thickness,
         LineCap = LineCap,
         Dashes = Dashes,
         DashOffset = 0.0,
         LineStyle = _lineStyle.Clone(),
         TextStyle = _textStyle.Clone(),
         StartArrowStyle = _startArrowStyle.Clone(),
         EndArrowStyle = _endArrowStyle.Clone()
     });
 }
Пример #8
0
        public UIPieMenu(List <VMPieMenuInteraction> pie, VMEntity obj, VMEntity caller, UILotControl parent)
        {
            if (FSOEnvironment.UIZoomFactor > 1.33f)
            {
                ScaleX = ScaleY = FSOEnvironment.UIZoomFactor * 0.75f;
            }
            TrueScale        = ScaleX * FSOEnvironment.DPIScaleFactor;
            m_PieButtons     = new List <UIButton>();
            this.m_Obj       = obj;
            this.m_Caller    = caller;
            this.m_Parent    = parent;
            this.ButtonStyle = new TextStyle
            {
                Font          = GameFacade.MainFont,
                VFont         = GameFacade.VectorFont,
                Size          = 12,
                Color         = new Color(0xA5, 0xC3, 0xD6),
                SelectedColor = new Color(0x00, 0xFF, 0xFF),
                CursorColor   = new Color(255, 255, 255)
            };

            HighlightStyle       = ButtonStyle.Clone();
            HighlightStyle.Color = Color.Yellow;

            lerpSpeed = 0.125f * (60.0f / FSOEnvironment.RefreshRate);
            m_Bg      = new UIImage(TextureGenerator.GetPieBG(GameFacade.GraphicsDevice));
            m_Bg.SetSize(0, 0); //is scaled up later
            this.AddAt(0, m_Bg);

            m_PieTree = new UIPieMenuItem()
            {
                Category = true
            };

            for (int i = 0; i < pie.Count; i++)
            {
                string[] depth = (pie[i].Name == null)?new string[] { "???" } :pie[i].Name.Split('/');

                var category = m_PieTree;                  //set category to root
                for (int j = 0; j < depth.Length - 1; j++) //iterate through categories
                {
                    if (category.ChildrenByName.ContainsKey(depth[j]))
                    {
                        category = category.ChildrenByName[depth[j]];
                    }
                    else
                    {
                        var newCat = new UIPieMenuItem()
                        {
                            Category = true,
                            Name     = depth[j],
                            Parent   = category
                        };
                        category.Children.Add(newCat);
                        category.ChildrenByName[depth[j]] = newCat;
                        category = newCat;
                    }
                }
                //we are in the category, put the interaction in here;

                var name     = depth[depth.Length - 1];
                var semiInd  = name.LastIndexOf(';');
                int colorMod = 0;
                if (semiInd > -1)
                {
                    int.TryParse(name.Substring(semiInd + 1), out colorMod);
                    name = name.Substring(0, semiInd);
                }

                var item = new UIPieMenuItem()
                {
                    Category = false,
                    Name     = name,
                    ColorMod = colorMod,
                    ID       = pie[i].ID,
                    Param0   = pie[i].Param0,
                    Global   = pie[i].Global
                };
                category.Children.Add(item);
                category.ChildrenByName[item.Name] = item;
            }

            m_CurrentItem = m_PieTree;
            m_PieButtons  = new List <UIButton>();
            RenderMenu();

            VMAvatar Avatar = (VMAvatar)caller;

            m_Head = new SimAvatar(Avatar.Avatar); //talk about confusing...
            m_Head.StripAllButHead();

            initSimHead();
        }
Пример #9
0
        public void RenderMenu()
        {
            for (int i = 0; i < m_PieButtons.Count; i++) //remove previous buttons
            {
                this.Remove(m_PieButtons[i]);
            }
            m_PieButtons.Clear();

            var elems = m_CurrentItem.Children;
            int dirConfig;

            if (elems.Count > 4)
            {
                dirConfig = 8;
            }
            else if (elems.Count > 2)
            {
                dirConfig = 4;
            }
            else
            {
                dirConfig = 2;
            }

            for (int i = 0; i < dirConfig; i++)
            {
                if (i >= elems.Count)
                {
                    break;
                }
                var elem = elems.ElementAt(i);
                var but  = new UIButton()
                {
                    Caption      = elem.Name + ((elem.Category)?"...":""),
                    CaptionStyle = (elem.ColorMod > 0)?HighlightStyle:ButtonStyle,
                    ImageStates  = 1,
                    Texture      = TextureGenerator.GetPieButtonImg(GameFacade.GraphicsDevice)
                };

                double dir = (((double)i) / dirConfig) * Math.PI * 2;
                but.AutoMargins = 4;

                if (i == 0)   //top
                {
                    but.X = (float)(Math.Sin(dir) * 60 - but.Width / 2);
                    but.Y = (float)((Math.Cos(dir) * -60) - but.Size.Y);
                }
                else if (i == dirConfig / 2)   //bottom
                {
                    but.X = (float)(Math.Sin(dir) * 60 - but.Width / 2);
                    but.Y = (float)((Math.Cos(dir) * -60));
                }
                else if (i < dirConfig / 2) //on right side
                {
                    but.X = (float)(Math.Sin(dir) * 60);
                    but.Y = (float)((Math.Cos(dir) * -60) - but.Size.Y / 2);
                }
                else //on left side
                {
                    but.X = (float)(Math.Sin(dir) * 60 - but.Width);
                    but.Y = (float)((Math.Cos(dir) * -60) - but.Size.Y / 2);
                }

                this.Add(but);
                m_PieButtons.Add(but);
                but.OnButtonClick += new ButtonClickDelegate(PieButtonClick);
                but.OnButtonHover += new ButtonClickDelegate(PieButtonHover);
                but.OnButtonExit  += new ButtonClickDelegate(PieButtonExit);
            }

            bool top = true;

            for (int i = 8; i < elems.Count; i++)
            {
                var elem = elems.ElementAt(i);
                var but  = new UIButton()
                {
                    Caption      = elem.Name + ((elem.Category)?"...":""),
                    CaptionStyle = (elem.ColorMod > 0) ? HighlightStyle : ButtonStyle,
                    ImageStates  = 1,
                    Texture      = TextureGenerator.GetPieButtonImg(GameFacade.GraphicsDevice)
                };
                but.AutoMargins = 4;

                but.X = (float)(-but.Width / 2);
                if (top)
                { //top
                    but.Y = (float)(-60 - but.Size.Y * ((i - 8) / 2 + 2));
                }
                else
                {
                    but.Y = (float)(60 + but.Size.Y * ((i - 8) / 2 + 1));
                }

                this.Add(but);
                m_PieButtons.Add(but);
                but.OnButtonClick += new ButtonClickDelegate(PieButtonClick);
                but.OnButtonHover += new ButtonClickDelegate(PieButtonHover);
                but.OnButtonExit  += new ButtonClickDelegate(PieButtonExit);
                top = !top;
            }

            if (m_CurrentItem.Parent != null)
            {
                var but = new UIButton()
                {
                    Caption      = m_CurrentItem.Name,
                    CaptionStyle = ButtonStyle.Clone(),
                    ImageStates  = 1,
                    Texture      = TextureGenerator.GetPieButtonImg(GameFacade.GraphicsDevice)
                };

                but.CaptionStyle.Color = but.CaptionStyle.SelectedColor;
                but.AutoMargins        = 4;
                but.X = (float)(-but.Width / 2);
                but.Y = (float)(-but.Size.Y / 2);
                this.Add(but);
                m_PieButtons.Add(but);
                but.OnButtonClick += new ButtonClickDelegate(BackButtonPress);
            }
        }