Ejemplo n.º 1
0
        UILabel CreateLabel(string text, int width, int height, UIComponent parentComponent, Vector3 offset,
                            UIAlignAnchor anchor)
        {
            var label = UIView.GetAView().AddUIComponent(typeof(UILabel)) as UILabel;

            label.text      = text;
            label.name      = "ModTools Label";
            label.width     = width;
            label.height    = height;
            label.textColor = new Color32(255, 255, 255, 255);
            label.AlignTo(parentComponent, anchor);
            label.relativePosition += offset;
            return(label);
        }
Ejemplo n.º 2
0
 UIButton CreateButton(string text, int width, int height, UIComponent parentComponent, Vector3 offset, UIAlignAnchor anchor, MouseEventHandler handler)
 {
     var button = uiView.AddUIComponent(typeof(UIButton)) as UIButton;
     button.name = "ModTools Button";
     button.text = text;
     button.textScale = 0.8f;
     button.width = width;
     button.height = height;
     button.normalBgSprite = "ButtonMenu";
     button.disabledBgSprite = "ButtonMenuDisabled";
     button.hoveredBgSprite = "ButtonMenuHovered";
     button.focusedBgSprite = "ButtonMenu";
     button.pressedBgSprite = "ButtonMenuPressed";
     button.textColor = new Color32(255, 255, 255, 255);
     button.disabledTextColor = new Color32(7, 7, 7, 255);
     button.hoveredTextColor = new Color32(255, 255, 255, 255);
     button.focusedTextColor = new Color32(255, 255, 255, 255);
     button.pressedTextColor = new Color32(30, 30, 44, 255);
     button.eventClick += handler;
     button.AlignTo(parentComponent, anchor);
     button.relativePosition += offset;
     return button;
 }
Ejemplo n.º 3
0
        public static UIButton CreateToggleButton(UIComponent parentComponent, Vector3 offset, UIAlignAnchor anchor,
                                                  MouseEventHandler handler)
        {
            var uibutton = UIView.GetAView().AddUIComponent(typeof(UIButton)) as UIButton;

            uibutton.name             = "AdvancedDistrictOptionsButton";
            uibutton.width            = 26f;
            uibutton.height           = 26f;
            uibutton.normalFgSprite   = "Options";
            uibutton.disabledFgSprite = "OptionsDisabled";
            uibutton.hoveredFgSprite  = "OptionsHovered";
            uibutton.focusedFgSprite  = "OptionsFocused";
            uibutton.pressedFgSprite  = "OptionsPressed";
            uibutton.normalBgSprite   = "OptionBase";
            uibutton.disabledBgSprite = "OptionBaseDisabled";
            uibutton.hoveredBgSprite  = "OptionBaseHovered";
            uibutton.focusedBgSprite  = "OptionBaseFocused";
            uibutton.pressedBgSprite  = "OptionBasePressed";
            uibutton.AlignTo(parentComponent, anchor);
            uibutton.eventClick       += handler;
            uibutton.relativePosition += offset;

            return(uibutton);
        }
Ejemplo n.º 4
0
        UIButton CreateButton(string text, int width, int height, UIComponent parentComponent, Vector3 offset, UIAlignAnchor anchor, MouseEventHandler handler)
        {
            var button = UIView.GetAView().AddUIComponent(typeof(UIButton)) as UIButton;

            button.name              = "ModTools Button";
            button.text              = text;
            button.textScale         = 0.8f;
            button.width             = width;
            button.height            = height;
            button.normalBgSprite    = "ButtonMenu";
            button.disabledBgSprite  = "ButtonMenuDisabled";
            button.hoveredBgSprite   = "ButtonMenuHovered";
            button.focusedBgSprite   = "ButtonMenu";
            button.pressedBgSprite   = "ButtonMenuPressed";
            button.textColor         = new Color32(255, 255, 255, 255);
            button.disabledTextColor = new Color32(7, 7, 7, 255);
            button.hoveredTextColor  = new Color32(255, 255, 255, 255);
            button.focusedTextColor  = new Color32(255, 255, 255, 255);
            button.pressedTextColor  = new Color32(30, 30, 44, 255);
            button.eventClick       += handler;
            button.AlignTo(parentComponent, anchor);
            button.relativePosition += offset;
            return(button);
        }
Ejemplo n.º 5
0
 UILabel CreateLabel(string text, int width, int height, UIComponent parentComponent, Vector3 offset,
     UIAlignAnchor anchor)
 {
     var label = uiView.AddUIComponent(typeof (UILabel)) as UILabel;
     label.text = text;
     label.name = "ModTools Label";
     label.width = width;
     label.height = height;
     label.textColor = new Color32(255, 255, 255, 255);
     label.AlignTo(parentComponent, anchor);
     label.relativePosition += offset;
     return label;
 }
        public static UILabel CreateDefaultNameLabel(UIComponent parent, Vector3 offset, UIAlignAnchor anchor)
        {
            var label = parent.AddUIComponent <UILabel>();

            label.name      = "DefaultNameLabel";
            label.text      = "Use as Default Name?";
            label.textScale = 0.8f;

            label.AlignTo(parent, anchor);
            label.relativePosition += offset;

            return(label);
        }
        public static UICheckBox CreateDefaultNameCheckbox(UIComponent parent, Vector3 offset, UIAlignAnchor anchor,
                                                           PropertyChangedEventHandler <bool> handler)
        {
            var checkBox = parent.AddUIComponent <UICheckBox>();

            checkBox.name             = "DefaultNameCheckbox";
            checkBox.width            = 20f;
            checkBox.height           = 20f;
            checkBox.relativePosition = Vector3.zero;

            var sprite = checkBox.AddUIComponent <UISprite>();

            sprite.spriteName       = "ToggleBase";
            sprite.size             = new Vector2(16f, 16f);
            sprite.relativePosition = new Vector3(2f, 2f);

            checkBox.checkedBoxObject = sprite.AddUIComponent <UISprite>();
            ((UISprite)checkBox.checkedBoxObject).spriteName = "ToggleBaseFocused";
            checkBox.checkedBoxObject.size             = new Vector2(16f, 16f);
            checkBox.checkedBoxObject.relativePosition = Vector3.zero;

            checkBox.eventCheckChanged += handler;
            checkBox.AlignTo(parent, anchor);
            checkBox.relativePosition += offset;
            checkBox.text              = "Use as Default Name?";

            return(checkBox);
        }
Ejemplo n.º 8
0
        public static UIButton CreateToggleButton(UIComponent parent, Vector3 offset, UIAlignAnchor anchor,
                                                  MouseEventHandler handler)
        {
            var button = UIView.GetAView().AddUIComponent(typeof(UIButton)) as UIButton;

            button.name                  = "ServiceRestrictionToggleButton";
            button.text                  = "Districts";
            button.width                 = FieldWidth;
            button.height                = FieldHeight;
            button.textPadding           = new RectOffset(0, 0, 5, 0);
            button.horizontalAlignment   = UIHorizontalAlignment.Center;
            button.textVerticalAlignment = UIVerticalAlignment.Middle;
            button.textScale             = 0.8f;
            button.atlas                 = UIView.GetAView().defaultAtlas;
            button.normalBgSprite        = "ButtonMenu";
            button.disabledBgSprite      = "ButtonMenuDisabled";
            button.hoveredBgSprite       = "ButtonMenuHovered";
            button.focusedBgSprite       = "ButtonMenu";
            button.pressedBgSprite       = "ButtonMenuPressed";
            button.eventClick           += handler;
            button.AlignTo(parent, anchor);
            button.relativePosition += offset;

            return(button);
        }