示例#1
0
            // Overrides:
            #region Overrides

            public override void Draw(SpriteBatch b)
            {
                if (!this.IsVisible)
                {
                    return;
                }

                if (this.GetTexture(b.GraphicsDevice) is Texture2D texture)
                {
                    b.Draw(texture, this.Bounds, this.textureTintColourCurrent);
                }

                if (this.cursorStatus != CursorStatus.None && !String.IsNullOrWhiteSpace(this.hoverText))
                {
                    ICustomMenu.DrawHoverText(b, StardewValley.Game1.smallFont, this.hoverText, (8, 8, 8, 8), this.HostMenuItem.Colours.BackgroundColour, this.HostMenuItem.Colours.ForegroundColour);
                }
            }
示例#2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.TabbedPage> e)
        {
            base.OnElementChanged(e);

            if (!_isFirstDesign)
            {
                return;
            }

            if (e.OldElement != null)
            {
                listener.GlobalLayout -= listener_GlobalLayout;
                ViewTreeObserver.RemoveOnGlobalLayoutListener(listener);
            }

            if (e.NewElement != null)
            {
                listener.GlobalLayout += listener_GlobalLayout;
                ViewTreeObserver.AddOnGlobalLayoutListener(listener);
            }

            myTabbedPage = (MvvmAspire.Controls.TabbedPage)Element;

            if (_activity == null)
            {
                _activity = this.Context as Activity;

                if (myTabbedPage.TabScreenLocation == TabGravity.Bottom)
                {
                    mMenu = new CustomMenuPopUp(this.Context, this, _activity.LayoutInflater);
                }
                else
                {
                    mMenu = new CustomMenu(this.Context, this, _activity.LayoutInflater);
                }

                mMenu.SetBadgeLocation(myTabbedPage.BadgeLocation);
                mMenu.SetItemsCountInLine(myTabbedPage.ActiveIcons.Count);
                if (myTabbedPage.BackgroundDrawable != null && myTabbedPage.SelectedDrawable != null)
                {
                    mMenu.SetBackgroundDrawable(myTabbedPage.BackgroundDrawable.File, myTabbedPage.SelectedDrawable.File);
                }

                if (myTabbedPage.TabScreenLocation == TabGravity.Bottom)
                {
                    originalPadding = myTabbedPage.Padding.Bottom;
                }
                else
                {
                    originalPadding = myTabbedPage.Padding.Top;
                }
            }

            if (childrenIcons.Count == 0)
            {
                for (int i = 0; i < myTabbedPage.Children.Count; i++)
                {
                    if (myTabbedPage.Children[i].Icon.File != null)
                    {
                        childrenIcons.Add(myTabbedPage.Children[i].Icon.File);
                    }
                }
            }

            myTabbedPage.Appearing    += myTabbedPage_Appearing;
            myTabbedPage.Disappearing += myTabbedPage_Disappearing;
        }