Esempio n. 1
0
        //----------------------------------------------------------------------
        public Button(Screen _screen, ButtonStyle _style, string _strText = "", Texture2D _iconTex = null, Anchor _anchor = Anchor.Center, string _strTooltipText = "", object _tag = null)
            : base(_screen)
        {
            Style = _style;

            mPadding = new Box(0);
            mMargin  = new Box(0);

            mLabel = new Label(_screen);

            mIcon         = new Image(_screen);
            mIcon.Texture = _iconTex;
            mIcon.Padding = new Box(Style.VerticalPadding, 0, Style.VerticalPadding, Style.HorizontalPadding);

            Text      = _strText;
            TextColor = Screen.Style.DefaultTextColor;

            Anchor = _anchor;

            mPressedAnim = new SmoothValue(1f, 0f, 0.2f);
            mPressedAnim.SetTime(mPressedAnim.Duration);

            mTooltip = new Tooltip(Screen, "");

            TooltipText = _strTooltipText;
            Tag         = _tag;

            UpdateContentSize();
        }
Esempio n. 2
0
 public SpinningWheel(IUIStyle style) : base(style)
 {
     fadeInAnim          = new SmoothValue(0, 1, FadeDuration, FadeDelay, AnimationLoop.NoLoop);
     rotationValue       = new LerpValue(0, MathHelper.Pi, 1, AnimationLoop.Loop);
     FadeIn              = true;
     Style.ValueChanged += OnStyleChanged;
 }
Esempio n. 3
0
 public static OsbSpriteWriter CreateWriter(OsbSprite osbSprite, AnimatedValue <CommandPosition> moveTimeline,
                                            AnimatedValue <CommandDecimal> moveXTimeline,
                                            AnimatedValue <CommandDecimal> moveYTimeline,
                                            AnimatedValue <CommandDecimal> scaleTimeline,
                                            AnimatedValue <CommandScale> scaleVecTimeline,
                                            AnimatedValue <CommandDecimal> rotateTimeline,
                                            AnimatedValue <CommandDecimal> fadeTimeline,
                                            AnimatedValue <CommandColor> colorTimeline,
                                            TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 {
     if (osbSprite is OsbAnimation osbAnimation)
     {
         return(new OsbAnimationWriter(osbAnimation, moveTimeline,
                                       moveXTimeline,
                                       moveYTimeline,
                                       scaleTimeline,
                                       scaleVecTimeline,
                                       rotateTimeline,
                                       fadeTimeline,
                                       colorTimeline,
                                       writer, exportSettings, layer));
     }
     else
     {
         return(new OsbSpriteWriter(osbSprite, moveTimeline,
                                    moveXTimeline,
                                    moveYTimeline,
                                    scaleTimeline,
                                    scaleVecTimeline,
                                    rotateTimeline,
                                    fadeTimeline,
                                    colorTimeline,
                                    writer, exportSettings, layer));
     }
 }
Esempio n. 4
0
            public MoveTrait(IItemService itemService, IItem item, DoublePoint start, DoublePoint end)
            {
                this.itemService = itemService;
                this.item        = item;
                var distance = Distance(start, end) * 4;

                lerpX = new LerpValue2((float)start.X, (float)end.X, distance, AnimationLoop.LoopBackAndForth);
                lerpY = new LerpValue2((float)start.Y, (float)end.Y, distance, AnimationLoop.LoopBackAndForth);
            }
Esempio n. 5
0
        //----------------------------------------------------------------------
        public DropDownBox(Screen _screen, List <DropDownItem> _lItems, int _iInitialValueIndex)
            : base(_screen)
        {
            mCurrentItemLabel = new Label(Screen, _anchor: Anchor.Start);

            Items = new ObservableList <DropDownItem>(_lItems);

            Items.ListChanged += delegate(object _source, ObservableList <DropDownItem> .ListChangedEventArgs _args)
            {
                if (_args.Added)
                {
                    _args.Item.DropDownBox = this;
                }

                if (SelectedItemIndex == -1)
                {
                    if (_args.Added)
                    {
                        SelectedItemIndex = _args.Index;
                    }
                }
                else
                if (_args.Index <= SelectedItemIndex)
                {
                    SelectedItemIndex = Math.Min(Items.Count - 1, Math.Max(0, SelectedItemIndex + (_args.Added ? 1 : -1)));
                }
            };

            Items.ListCleared += delegate(object _source, EventArgs _args)
            {
                SelectedItemIndex = -1;
            };

            SelectedItemIndex = _iInitialValueIndex;
            mScrollbar        = new Scrollbar(_screen);
            mScrollbar.Parent = this;

            ScrollItemOffset      = Math.Max(0, Math.Min(SelectedItemIndex, Items.Count - siMaxLineDisplayed));
            mScrollbar.LerpOffset = mScrollbar.Offset;

            Padding     = Screen.Style.DropDownBoxPadding;
            TextPadding = Screen.Style.DropDownBoxTextPadding;

            mPressedAnim = new SmoothValue(1f, 0f, 0.2f);
            mPressedAnim.SetTime(mPressedAnim.Duration);

            ButtonFrame        = Screen.Style.ButtonFrame;
            ButtonFrameDown    = Screen.Style.ButtonDownFrame;
            ButtonFrameHover   = Screen.Style.ButtonHoverOverlay;
            ButtonFramePressed = Screen.Style.ButtonDownOverlay;

            UpdateContentSize();
        }
Esempio n. 6
0
        public ButtonBase(IUIStyle style) : base(style)
        {
            buttonStyle             = StyleSystem.StylesFor <ButtonStyleDefinition>();
            actionPerformedSupport  = new EventSupport <EventArgs>();
            selectionChangedSupport = new EventSupport <EventArgs>();

            pressedAnimation = new SmoothValue(1f, 0f, 0.1f);
            pressedAnimation.FinishAnimation();

            Focusable = true;

            FocusedChanged += (sender, args) => ResetPressState();

            MouseDown    += OnMouseDown;
            MouseUp      += OnMouseUp;
            MouseClicked += OnMouseClick;
            KeyPressed   += OnKeyPressed;
            KeyReleased  += OnKeyReleased;
        }
Esempio n. 7
0
        public override void Start()
        {
            randomSource = new Random();

            mushroomAnim        = new SmoothValue(1f, 0f, 0.3f);
            mushroomOpacityAnim = new SmoothValue(0f, 1f, 0.3f);
            logoAnim            = new LerpValue(0f, 1f, 0.3f, 0.3f);
            titleAnim           = new SmoothValue(0f, 10f, 3f, 0.1f);

            mushroomTex = Content.Load <Texture2D>("Sprites/Mushroom");
            titleTex    = Content.Load <Texture2D>("Sprites/NuclearWinterTitle");
            logoTex     = Content.Load <Texture2D>("Sprites/NuclearWinterLogo");

            sparklinLabsTex = Content.Load <Texture2D>("Sprites/SparklinLabs");

            switchTimer = new LerpValue(0f, 1f, 1f, 1.5f);

            base.Start();
        }
Esempio n. 8
0
        public Splitter(IUIStyle style, Direction direction, bool collapsable = false) : base(style)
        {
            splitterBar = new SplitterBar(style);
            splitterBar.AddNotify(this);
            splitterBar.PropertyChanged += OnSplitterBarPropertyChange;
            RaiseChildAdded(0, splitterBar, null);

            collapseAnim = new SmoothValue(0f, 1f, 0.2f);

            Direction         = direction;
            Collapsable       = collapsable;
            FirstPaneMinSize  = 100;
            Resizable         = true;
            SecondPaneMinSize = 100;

            splitterBar.MouseDragged += OnMouseDragged;
            splitterBar.MouseUp      += OnMouseUp;
            splitterBar.MouseDown    += OnMouseDown;
            splitterBar.MouseClicked += OnMouseClick;
        }
Esempio n. 9
0
 public OsbAnimationWriter(OsbAnimation osbAnimation, AnimatedValue <CommandPosition> moveTimeline,
                           AnimatedValue <CommandDecimal> moveXTimeline,
                           AnimatedValue <CommandDecimal> moveYTimeline,
                           AnimatedValue <CommandDecimal> scaleTimeline,
                           AnimatedValue <CommandScale> scaleVecTimeline,
                           AnimatedValue <CommandDecimal> rotateTimeline,
                           AnimatedValue <CommandDecimal> fadeTimeline,
                           AnimatedValue <CommandColor> colorTimeline,
                           TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
     : base(osbAnimation, moveTimeline,
            moveXTimeline,
            moveYTimeline,
            scaleTimeline,
            scaleVecTimeline,
            rotateTimeline,
            fadeTimeline,
            colorTimeline,
            writer, exportSettings, layer)
 {
     this.osbAnimation = osbAnimation;
 }
Esempio n. 10
0
 public OsbSpriteWriter(OsbSprite osbSprite, AnimatedValue <CommandPosition> moveTimeline,
                        AnimatedValue <CommandDecimal> moveXTimeline,
                        AnimatedValue <CommandDecimal> moveYTimeline,
                        AnimatedValue <CommandDecimal> scaleTimeline,
                        AnimatedValue <CommandScale> scaleVecTimeline,
                        AnimatedValue <CommandDecimal> rotateTimeline,
                        AnimatedValue <CommandDecimal> fadeTimeline,
                        AnimatedValue <CommandColor> colorTimeline,
                        TextWriter writer, ExportSettings exportSettings, OsbLayer layer)
 {
     this.osbSprite        = osbSprite;
     this.moveTimeline     = moveTimeline;
     this.moveXTimeline    = moveXTimeline;
     this.moveYTimeline    = moveYTimeline;
     this.scaleTimeline    = scaleTimeline;
     this.scaleVecTimeline = scaleVecTimeline;
     this.rotateTimeline   = rotateTimeline;
     this.fadeTimeline     = fadeTimeline;
     this.colorTimeline    = colorTimeline;
     TextWriter            = writer;
     ExportSettings        = exportSettings;
     OsbLayer = layer;
 }
Esempio n. 11
0
 private void UpdateFormattedValue()
 {
     SetValue(RadialGaugePiece.FormattedAnimatedValueProperty, AnimatedValue.ToString("F0"));
 }
Esempio n. 12
0
 private void UpdateFormattedValue()
 {
     SetValue(FormattedAnimatedValueProperty, AnimatedValue.ToString("F0"));
 }
Esempio n. 13
0
 public void SetUp()
 {
     lv = new LerpValue(0, 1, 5, 2);
 }