コード例 #1
0
        private void AddSelector()
        {
            Selector                         = Content.AddUIComponent <SelectPropertyButton>();
            Selector.text                    = NotSet;
            Selector.atlas                   = CommonTextures.Atlas;
            Selector.normalBgSprite          = CommonTextures.FieldNormal;
            Selector.hoveredBgSprite         = CommonTextures.FieldHovered;
            Selector.disabledBgSprite        = CommonTextures.FieldDisabled;
            Selector.focusedBgSprite         = CommonTextures.FieldFocused;
            Selector.isInteractive           = false;
            Selector.enabled                 = true;
            Selector.autoSize                = false;
            Selector.textHorizontalAlignment = UIHorizontalAlignment.Left;
            Selector.textVerticalAlignment   = UIVerticalAlignment.Middle;
            Selector.height                  = 20;
            Selector.width                   = Width;
            Selector.textScale               = 0.6f;
            Selector.textPadding             = new RectOffset(8, 0, 4, 0);

            Button                         = Selector.AddUIComponent <CustomUIButton>();
            Button.atlas                   = TextureHelper.InGameAtlas;
            Button.text                    = string.Empty;
            Button.size                    = Selector.size;
            Button.relativePosition        = new Vector3(0f, 0f);
            Button.textVerticalAlignment   = UIVerticalAlignment.Middle;
            Button.textHorizontalAlignment = UIHorizontalAlignment.Left;
            Button.normalFgSprite          = "IconDownArrow";
            Button.hoveredFgSprite         = "IconDownArrowHovered";
            Button.pressedFgSprite         = "IconDownArrowPressed";
            Button.focusedFgSprite         = "IconDownArrow";
            Button.foregroundSpriteMode    = UIForegroundSpriteMode.Scale;
            Button.horizontalAlignment     = UIHorizontalAlignment.Right;
            Button.verticalAlignment       = UIVerticalAlignment.Middle;
            Button.textScale               = 0.8f;

            Button.eventClick            += ButtonClick;
            Button.eventMouseEnter       += ButtonMouseEnter;
            Button.eventMouseLeave       += ButtonMouseLeave;
            Button.eventIsEnabledChanged += ButtonIsEnabledChanged;
        }