Example #1
0
        private static void ProcessSlider(GameObject gameObject, UIStyle backgroundStyle, UIStyle thumbStyle)
        {
            ProcessSelectable(gameObject, thumbStyle);

            var background = gameObject.transform.Find("Background");

            if (background != null)
            {
                ProcessImage(background.gameObject, backgroundStyle);
            }
        }
Example #2
0
 public override void SetStyle(UIStyle style, Font font)
 {
     base.SetStyle(style, font);
     Text[] texts = new Text[] { supportA, supportB, supportC, supportS };
     for (int i = 0; i < texts.Length; i++)
     {
         texts[i].color             = style.fontColor;
         texts[i].font              = font;
         texts[i].resizeTextMaxSize = style.fontMaxSize;
     }
 }
Example #3
0
        private static void ProcessDropdown(GameObject gameObject, UIStyle buttonStyle, UIStyle windowStyle)
        {
            ProcessSelectable(gameObject, buttonStyle);

            var template = gameObject.transform.Find("Template").gameObject;

            if (template != null)
            {
                ProcessImage(template, windowStyle);
            }
        }
Example #4
0
        public static DialogGUILabel GUILabel(Func <String> getString, UIStyle style, Boolean expandW = false, Boolean expandH = false, Modifier <DialogGUILabel> modifier = null)
        {
            DialogGUILabel element = new DialogGUILabel(getString, style, expandW, expandH);

            if (modifier != null)
            {
                element = modifier(element);
            }
            _elements.Add(element);
            return(element);
        }
 public override void ApplyStyle(UIStyle style)
 {
     GetGraphic().colors = new ColorBlock()
     {
         normalColor      = style.GetColor(Normal),
         highlightedColor = style.GetColor(Highlight),
         pressedColor     = style.GetColor(Pressed),
         selectedColor    = style.GetColor(Selected),
         disabledColor    = style.GetColor(Disabled),
     };
 }
Example #6
0
 public PanelResize(int x, int y, int width, int height, UIConfiguration configuration = null,
                    UIStyle style = null, Action <VisualObject, Touch> callback = null)
     : base(x, y, width, height, configuration, style, callback)
 {
     Configuration.UseEnd = true;
     Layer = Int32.MaxValue;
     if (Callback == null)
     {
         Callback = CustomCallback;
     }
 }
Example #7
0
        private static void ProcessToggleButton(GameObject gameObject, UIStyle style)
        {
            ProcessSelectable(gameObject, style);

            var toggle = gameObject.GetComponent <Toggle>();

            if (toggle != null)
            {
                ProcessImage(toggle.graphic as Image, style.active);
            }
        }
Example #8
0
            public override GameObject Create(ref Stack <Transform> layouts, UISkinDef skin)
            {
                UIStyle uistyle = guiStyle ?? skin.button;

                if (image == null)
                {
                    image = uistyle.normal.background;
                }

                return(base.Create(ref layouts, skin));
            }
Example #9
0
        public override void ApplyStyle(UIStyle style)
        {
            Color color = style.GetColor(Slot);

            color = new Color(
                Mathf.Max(color.r, 1 - TintMax),
                Mathf.Max(color.g, 1 - TintMax),
                Mathf.Max(color.b, 1 - TintMax),
                color.a
                );
            GetGraphic().color = color;
        }
Example #10
0
    // 注册UI,所有需要显示的UI都要注册,否则无法显示
    private void AddUI(UIType _type, UIStyle _style, string _path)
    {
        UIInfo uiInfo = new UIInfo();

        {
            uiInfo.type  = _type;
            uiInfo.style = _style;
            uiInfo.path  = _path;
        }

        m_UIDict.Add(_type, uiInfo);
    }
Example #11
0
    public void AssertAllStylePropertiesAreMapped() {
        foreach (var propId in Enum.GetValues(typeof(StylePropertyId))) {
            
            if (propId.ToString().StartsWith("__")) continue;
            
            var propertyNode = StyleASTNodeFactory.PropertyNode(propId.ToString());
            // this node should fail in a compile exception if this property is mapped.
            propertyNode.children.Add(new StyleRootNode());
            UIStyle target = new UIStyle();

            try {
                StylePropertyMappers.MapProperty(target, propertyNode, new StyleCompileContext(default));
Example #12
0
        private string styleColorString(UIStyle style)
        {
            // [#rrggbbaa]
            Color c = style.normal.textColor;

            return(string.Format(
                       "[#{0,2:X}{1,2:X}{2,2:X}ff]",
                       (int)Math.Floor(255 * c.r),
                       (int)Math.Floor(255 * c.g),
                       (int)Math.Floor(255 * c.b)
                       ));
        }
        public void ApplyStyle()
        {
            UIStyle style = GetController().GetCurrentStyle();

            ApplyStyle(style);
            Text text = GetComponent <Text>();

            if (text)
            {
                text.font = GetController().Font;
            }
        }
Example #14
0
 public override void SetStyle(UIStyle style, Font font)
 {
     base.SetStyle(style, font);
     maxCharge.font                 = font;
     maxCharge.color                = style.fontColor;
     maxCharge.resizeTextMaxSize    = style.fontMaxSize;
     maxCharge.resizeTextForBestFit = true;
     cost.font                 = font;
     cost.color                = style.fontColor;
     cost.resizeTextMaxSize    = style.fontMaxSize;
     cost.resizeTextForBestFit = true;
 }
Example #15
0
 public void SetStyle(UIStyle style, Font font)
 {
     buttonImage.sprite           = style.baseImage;
     buttonImage.color            = style.baseColor;
     buttonImage.type             = Image.Type.Sliced;
     highlight.sprite             = style.highImage;
     highlight.color              = style.highColor;
     highlight.type               = Image.Type.Sliced;
     buttonText.font              = font;
     buttonText.color             = style.fontColor;
     buttonText.resizeTextMaxSize = style.fontMaxSize;
 }
Example #16
0
        public static DialogGUIBox GUIBox(String message, UIStyle style, Single w, Single h,
                                          Func <Boolean> EnabledCondition, Action optionBuilder, Modifier <DialogGUIBox> modifier = null)
        {
            DialogGUIBox element = new DialogGUIBox(message, style, w, h, EnabledCondition, Declare(optionBuilder));

            if (modifier != null)
            {
                element = modifier(element);
            }
            _elements.Add(element);
            return(element);
        }
Example #17
0
 /// <summary>
 /// 获取主题样式
 /// </summary>
 /// <param name="style">主题样式名称</param>
 /// <returns>主题样式</returns>
 public static UIBaseStyle GetStyleColor(UIStyle style)
 {
     if (Styles.ContainsKey(style))
     {
         return(Styles[style]);
     }
     else
     {
         Style = UIStyle.Blue;
         return(Styles[Style]);
     }
 }
Example #18
0
        public UIManager(IInputManager inputManager,
                         IBatchedDrawingService drawingService,
                         IGameWindowService windowService,
                         ContentManager contentManager)
        {
            this.inputManager  = inputManager ?? throw new ArgumentNullException(nameof(inputManager));
            DrawingService     = drawingService ?? throw new ArgumentNullException(nameof(drawingService));
            this.windowService = windowService ?? throw new ArgumentNullException(nameof(windowService));

            var cm = contentManager ?? throw new ArgumentNullException(nameof(contentManager));

            UIStyle = new UIStyle(new ContentLoader(cm, drawingService.GraphicsDevice));
        }
Example #19
0
        /// <summary>
        /// Converts FastReport's UIStyle to eColorSchemeStyle.
        /// </summary>
        /// <param name="style">Style to convert.</param>
        /// <returns>Value of eColorSchemeStyle type.</returns>
        public static eColorSchemeStyle GetColorSchemeStyle(UIStyle style)
        {
            switch (style)
            {
            case UIStyle.Office2003:
                return(eColorSchemeStyle.Office2003);

            case UIStyle.VisualStudio2005:
                return(eColorSchemeStyle.VS2005);
            }

            return(eColorSchemeStyle.Office2007);
        }
Example #20
0
        protected override void OnStyleChanged(UIStyle style)
        {
            base.OnStyleChanged(style);

            var background = style?.ImageAndColorSets?["Button.Background"];

            if (background != null)
            {
                Button.Background = Button.Background
                                    .WithHighlightedValue(background.Normal)
                                    .WithActiveValue(background.Active);
            }
        }
Example #21
0
 protected virtual void InitPlain(Color color, UIStyle style, Color foreColor)
 {
     Name = style;
     MenuSelectedColor = RectColor = RectHoverColor = TitleColor = ButtonForeColor = ButtonFillHoverColor = PrimaryColor = color;
     Color[] colors  = GDIEx.GradientColors(Color.White, PrimaryColor, 16);
     Color[] colors1 = GDIEx.GradientColors(PrimaryColor, Color.Black, 16);
     ButtonFillColor         = PlainColor = colors[1];
     SecondaryColor          = colors[5];
     RegularColor            = colors[10];
     ButtonFillSelectedColor = RectPressColor = RectSelectedColor = ButtonFillPressColor = colors1[3];
     GridSelectedColor       = colors[3];
     ButtonForeHoverColor    = ButtonForePressColor = ButtonForeSelectedColor = TitleForeColor = foreColor;
 }
 public override void SetStyle(UIStyle style, Font font)
 {
     base.SetStyle(style, font);
     level.color             = style.fontColor;
     level.font              = font;
     level.resizeTextMaxSize = style.fontMaxSize;
     exp.color                      = style.fontColor;
     exp.font                       = font;
     exp.resizeTextMaxSize          = style.fontMaxSize;
     currentClass.color             = style.fontColor;
     currentClass.font              = font;
     currentClass.resizeTextMaxSize = style.fontMaxSize;
 }
Example #23
0
        public static void SetRawControlStyle(ControlEventArgs e, UIStyle style)
        {
            if (e.Control is TableLayoutPanel)
            {
                List <Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
                foreach (var control in controls)
                {
                    if (control is IStyleInterface item)
                    {
                        if (!item.StyleCustomMode)
                        {
                            item.Style = style;
                        }
                    }
                }

                return;
            }

            if (e.Control is FlowLayoutPanel)
            {
                List <Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
                foreach (var control in controls)
                {
                    if (control is IStyleInterface item)
                    {
                        if (!item.StyleCustomMode)
                        {
                            item.Style = style;
                        }
                    }
                }

                return;
            }

            if (e.Control is Panel)
            {
                List <Control> controls = e.Control.GetUIStyleControls("IStyleInterface");
                foreach (var control in controls)
                {
                    if (control is IStyleInterface item)
                    {
                        if (!item.StyleCustomMode)
                        {
                            item.Style = style;
                        }
                    }
                }
            }
        }
Example #24
0
        public VisualSign(int x, int y, int width, int height, string text, UIConfiguration configuration = null,
                          UIStyle style = null, Action <VisualObject, Touch> callback = null)
            : base(x, y, width, height, configuration, style, callback)
        {
            if (width > 2 || height > 2)
            {
                throw new ArgumentException("Sign can only have one of these sizes: 1x1, 1x2, 2x1, 2x2.");
            }

            RawText = text ?? "";

            // Needed for ApplyTiles() (it checks if any of UIStyle parameters are set)
            Style.Active = true;
        }
Example #25
0
        /// <summary>
        /// 设置主题样式
        /// </summary>
        /// <param name="style">主题样式</param>
        public static void SetStyle(UIStyle style)
        {
            Style = style;

            foreach (var form in Forms.Values)
            {
                form.Style = style;
            }

            foreach (var page in Pages.Values)
            {
                page.Style = style;
            }
        }
Example #26
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="style"></param>
    /// <param name="font"></param>
    public virtual void SetStyle(UIStyle style, Font font)
    {
        background.sprite = style.baseImage;
        background.color  = style.baseColor;
        background.type   = Image.Type.Sliced;
        highlight.sprite  = style.highImage;
        highlight.color   = style.highColor;
        highlight.type    = Image.Type.Sliced;

        entryName.font                 = font;
        entryName.color                = style.fontColor;
        entryName.resizeTextMaxSize    = style.fontMaxSize;
        entryName.resizeTextForBestFit = true;
    }
Example #27
0
        public PreviewTab(PreviewControl preview, PreparedPages preparedPages, string text)
        {
            FPreview       = preview;
            FPreparedPages = preparedPages;

            FWorkspace      = new PreviewWorkspace(this);
            FWorkspace.Dock = DockStyle.Fill;
            AttachedControl = FWorkspace;

            Text  = text;
            Zoom  = preview.Zoom;
            Style = preview.UIStyle;
            First();
        }
Example #28
0
        internal UIStyle CreateNoteStyle()
        {
            const int fontsize = 12;
            UIStyle   style    = new UIStyle
            {
                alignment = TextAnchor.MiddleLeft,
                fontStyle = FontStyle.Bold,
                normal    = new UIStyleState(),
                fontSize  = fontsize
            };

            style.normal.textColor = Color.cyan;
            return(style);
        }
        public void Assign(UIStyle style, Action <UIStyle> callback)
        {
            _style          = style;
            Name.text       = _style.Name;
            Primary.color   = _style.Primary;
            Secondary.color = _style.Secondary;
            Highlight.color = _style.Highlight;
            Detail.color    = _style.Detail;
            Text.color      = _style.Text;
            Contrast.color  = _style.Contrast;

            _callback = callback;

            Button.onClick.AddListener(OnButtonClick);
        }
Example #30
0
        private void Header_MenuItemClick(string text, int menuIndex, int pageIndex)
        {
            switch (menuIndex)
            {
            case 0:
            case 1:
                Aside.SelectPage(pageIndex);
                break;

            case 2:
                UIStyle style = (UIStyle)pageIndex;
                StyleManager.Style = style;
                break;
            }
        }
 public void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     Field1 = buffer.ReadInt64(64);
     Field2 = buffer.ReadCharArray(512);
     Field3 = buffer.ReadInt64(64);
     Field4 = buffer.ReadCharArray(512);
     Field5 = buffer.ReadInt(32);
     Field6 = new UIStyle();
     Field6.Parse(buffer);
     Field7 = new UIAnimationElements();
     Field7.Parse(buffer);
 }
        /// <summary>
        ///     Gets a new ThemeTextStyle created from KSP UIStyle and UIStyleState objects.
        /// </summary>
        private static TextStyle GetTextStyle(UIStyle style, UIStyleState styleState)
        {
            TextStyle textStyle = new TextStyle();

            if (style != null)
            {
                textStyle.Font = style.font;
                textStyle.Style = style.fontStyle;
                textStyle.Size = style.fontSize;
            }

            if (styleState != null)
            {
                textStyle.Colour = styleState.textColor;
            }

            return textStyle;
        }