Exemple #1
0
    bool CheckTextureInSkin()
    {
        Skin customSkin = SkinManager.Instance.currentSkin;

        Note note = nCon.note;

        Note.NoteType    noteType    = NoteVisualsManager.GetVisualNoteType(note);
        Note.SpecialType specialType = NoteVisualsManager.IsStarpower(note);

        int arrayPos = NoteVisuals2DManager.GetNoteArrayPos(note);

        Note.NoteType visualNoteType = noteType;

        if (!Globals.ghLiveMode)
        {
            if (noteType == Note.NoteType.Hopo && Globals.drumMode)
            {
                visualNoteType = Note.NoteType.Strum;
            }
        }

        string noteKey = NoteVisuals2DManager.GetSkinKey(arrayPos, noteType, specialType, Globals.ghLiveMode);

        Sprite[] sprites = SkinManager.Instance.currentSkin.GetSprites(noteKey);

        return(sprites != null && sprites.Length > 0);
    }
    bool CheckTextureInSkin()
    {
        Skin customSkin = SkinManager.Instance.currentSkin;

        Note note = nCon.note;

        Note.NoteType    noteType    = NoteVisualsManager.GetVisualNoteType(note);
        Note.SpecialType specialType = NoteVisualsManager.IsStarpower(note);

        int arrayPos = NoteVisuals2DManager.GetNoteArrayPos(note, ChartEditor.Instance.laneInfo);

        Note.NoteType visualNoteType = noteType;

        if (!Globals.ghLiveMode)
        {
            if (noteType == Note.NoteType.Hopo && Globals.drumMode)
            {
                visualNoteType = Note.NoteType.Strum;
            }
        }

        bool isInSkin;
        bool isGhl = Globals.ghLiveMode;
        int  hash  = NoteVisuals2DManager.GetSkinKeyHash(arrayPos, noteType, specialType, isGhl);

        if (textureInSkinCache.TryGetValue(hash, out isInSkin))
        {
            return(isInSkin);
        }
        else
        {
            string   noteKey = NoteVisuals2DManager.GetSkinKey(arrayPos, noteType, specialType, isGhl);
            Sprite[] sprites = SkinManager.Instance.currentSkin.GetSprites(noteKey);

            isInSkin = sprites != null && sprites.Length > 0;
            textureInSkinCache[hash] = isInSkin;

            return(isInSkin);
        }
    }