Пример #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);
        }
Пример #2
0
        public static void Dispose(OsuTexture texture)
        {
            SpriteSheetTexture info;

            if (textureLocations.TryGetValue(texture, out info))
            {
                TextureGl tex;
                if (SpriteTextureCache.TryGetValue(info.SheetName, out tex))
                {
                    tex.Delete();
                }
            }
        }
Пример #3
0
        internal static pTexture[] LoadAnimation(OsuTexture osuTexture, int count)
        {
            pTexture[] textures;

            string name = osuTexture.ToString();

            if (AnimationCache.TryGetValue(name, out textures))
            {
                return(textures);
            }

            textures = new pTexture[count];

            for (int i = 0; i < count; i++)
            {
                textures[i] = Load(osuTexture + i);
            }

            AnimationCache.Add(name, textures);
            return(textures);
        }
Пример #4
0
        internal static pTexture Load(OsuTexture texture)
        {
            SpriteSheetTexture info;

            if (textureLocations.TryGetValue(texture, out info))
            {
                pTexture tex = Load(info.SheetName);
                tex.OsuTextureInfo = texture;

                //necessary?
                tex.X      = info.X;
                tex.Y      = info.Y;
                tex.Width  = info.Width;
                tex.Height = info.Height;

                return(tex);
            }

            //fallback to separate files (or don't!)
            return(null);
        }