示例#1
0
        internal pDrawable Add(OsuTexture tabTexture, List <pDrawable> sprites)
        {
            pSprite tab = new pSprite(TextureManager.Load(tabTexture), FieldTypes.StandardSnapTopCentre, OriginTypes.TopCentre, ClockTypes.Mode, new Vector2(0, -100), 0.41f, true, Color4.Gray);

            tab.OnClick     += onTabClick;
            tab.OnHover     += delegate { tab.FadeColour(Color4.White, 100); };
            tab.OnHoverLost += delegate { tab.FadeColour(Color4.Gray, 100); };

            spriteManager.Add(tab);

            spriteManagers.Add(tab, sprites != null ? new SpriteManager(sprites) : new SpriteManager());

            if (tabs.Count == 0)
            {
                tab.Click();
            }

            tabs.Add(tab);

            float x = -(Math.Max(0, tabs.Count - 1) * 200f) / 2;

            for (int i = 0; i < tabs.Count; i++)
            {
                tabs[i].Offset = new Vector2(x, 0);
                x += 200;
            }

            return(tab);
        }