示例#1
0
        /// <summary>
        /// Add a noteskin for a particular keymode.
        /// </summary>
        /// <param name="keyMode">The keymode skin.</param>
        public void AddKeyModeSkin(KeyModeSkin keyMode)
        {
            // Check if there is already a skin loaded with the same key count
            if (keyModes.Exists(km => km.KeyCount == keyMode.KeyCount))
            {
                throw new ArgumentException($"Cannot add duplicate keymode (KeyCount={keyMode.KeyCount}) to noteskin '{Name}'.");
            }

            keyModes.Add(keyMode);
        }
        /// <summary>
        /// Loads a single keymode for a particular noteskin.
        /// </summary>
        /// <param name="noteSkin">The NoteSkin object to load the keymode into.</param>
        /// <param name="keyCount">The keymode's key count.</param>
        /// <param name="dir">The noteskin directory path.</param>
        private void loadKeyModeSkin(NoteSkin noteSkin, int keyCount, string dir)
        {
            KeyModeSkin kms = new KeyModeSkin(keyCount);

            for (var i = 1; i <= keyCount; i++)
            {
                NoteSkinKey key = new NoteSkinKey();

                // key.Receptor = new Image(Path.Join(dir, $"receptor_{i}.png"));
                key.TapNote = new ImageAsset(Path.Join(dir, $"tap_{i}.png"));
                // key.HoldNote = new Image(Path.Join(dir, $"hold_{i}.png"));
                // key.HoldNoteBody = new Image(Path.Join(dir, $"hold_body_{i}.png"));

                kms.Set(i - 1, key);
            }

            noteSkin.AddKeyModeSkin(kms);
        }