コード例 #1
0
ファイル: TileMap.cs プロジェクト: Maseya/MushROMs
 /// <summary>
 /// Raises the <see cref="ViewSizeChanged"/> event.
 /// </summary>
 /// <param name="e">
 /// An <see cref="EventArgs"/> that contains the event data.
 /// </param>
 protected virtual void OnViewSizeChanged(EventArgs e)
 {
     ViewSizeChanged?.Invoke(this, e);
 }
コード例 #2
0
 protected override void OnSizeAllocated(double width, double height)
 {
     base.OnSizeAllocated(width, height);
     ViewSizeChanged?.Invoke(this, new EventArgs());
 }
コード例 #3
0
        public void ViewUpdate(float time)
        {
            _forceUpdate = false;

            if (_shouldRecalculateFrames > 0)
            {
                _shouldRecalculateFrames--;
            }

            if (_updateController && _controller != null)
            {
                _controller.UpdateInternal(time);
            }

            float opacity = Visible ? 1 : 0;

            bool visible = DisplayVisibility > 0;

            float oldDisplayVisibility = DisplayVisibility;

            if (DisplayVisibility < opacity)
            {
                DisplayVisibility += _showSpeed * time;
                DisplayVisibility  = Math.Min(DisplayVisibility, opacity);
            }
            else if (DisplayVisibility > opacity)
            {
                DisplayVisibility -= _hideSpeed * time;
                DisplayVisibility  = Math.Max(DisplayVisibility, opacity);
            }

            if (DisplayVisibility != oldDisplayVisibility)
            {
                ForceUpdate();
            }

            if (!visible && IsShown && Parent != null)
            {
                SetForceRecalcFlag();
                RecalcLayout();
                Parent.RecalcLayout(this);
            }

            if (IsShown)
            {
                bool sizeStable = true;

                if (_lastSize != Bounds)
                {
                    if (_lastSize.Height != Bounds.Height || _lastSize.Width != Bounds.Width)
                    {
                        CallDelegate("ViewResized", new InvokeParam("bounds", Bounds), new InvokeParam("size", new Point(Bounds.Width, Bounds.Height)),
                                     new InvokeParam("width", Bounds.Width), new InvokeParam("height", Bounds.Height));

                        OnSizeChanged();

                        ViewSizeChanged?.Invoke(Bounds);

                        if (_lastSize.Height != Bounds.Height && !_sizeCanChange.HasFlag(SizeChangeDimension.Height))
                        {
                            sizeStable = false;
                        }

                        if (_lastSize.Width != Bounds.Width && !_sizeCanChange.HasFlag(SizeChangeDimension.Width))
                        {
                            sizeStable = false;
                        }
                    }

                    _lastSize = Bounds;
                    AppMain.Redraw(this);
                }

                _sizeCanChange = SizeChangeDimension.None;
                IsSizeStable   = sizeStable;


                Update(time);


                while (!IsSizeStable)
                {
                    IsSizeStable = true;
                    Update(0);

                    if (_lastSize.Width != Bounds.Width || _lastSize.Height != Bounds.Height)
                    {
                        OnSizeChanged();

                        ViewSizeChanged?.Invoke(Bounds);

                        IsSizeStable = false;
                        _lastSize    = Bounds;
                    }
                    else
                    {
                        SetForceRecalcFlag();
                    }
                }
            }
        }