Exemple #1
0
 public CueMusicTreeNode()
 {
     sheet = new NoteSheet
     {
         tracks = new List <NoteTrack>()
     };
 }
Exemple #2
0
            private readonly string filepath;        /* Location where the WAV file should be saved      */

            /* / PROPERTIES */


            /* CONSTRUCTOR */

            public WAVConstructor(string filepath, string filename)
            {
                /* Store the file information */
                this.filepath = filepath;
                this.filename = filename;

                /* Deserialize the compiled NoteSheet and store it */
                noteSheet = Serializer.Deserialize(filepath, filename);
            }
Exemple #3
0
        public void UseCurrentSheet()
        {
            if (assignSong == null)
            {
                return;
            }

            NoteSheet notesheet = assignSong.GetNotesheet(currentDifficulty);

            AddNoteRange(NoteInfo.FromNoteGroups(notesheet.GetNoteGroups, (byte)currentDifficulty, assignSong.BPM));
        }
Exemple #4
0
    private void DrawNoteSheetCurves(Difficulty difficulty, SerializedProperty curvesArrayProp)
    {
        int targetSize = (int)difficulty;

        if (curvesArrayProp.arraySize != targetSize)
        {
            curvesArrayProp.arraySize = targetSize;
        }

        curvesArrayProp.isExpanded = EditorGUILayout.Foldout(curvesArrayProp.isExpanded, "UI personalizada", true);
        if (!curvesArrayProp.isExpanded)
        {
            return;
        }

        EditorGUI.indentLevel++;

        if (GUILayout.Button("Reset"))
        {
            QuadraticCurve[] curves = NoteSheet.GetDefaultCurves(targetSize);
            for (int i = 0; i < targetSize; i++)
            {
                SerializedProperty curveProp = curvesArrayProp.GetArrayElementAtIndex(i);
                curveProp.FindPropertyRelative(curveFromName).vector2Value           = curves[i].FromPoint;
                curveProp.FindPropertyRelative(curveToLocalName).vector2Value        = curves[i].ToLocal;
                curveProp.FindPropertyRelative(curveCurvatureLocalName).vector2Value = curves[i].CurvatureLocal;
            }
        }

        for (int i = 0; i < targetSize; i++)
        {
            //EditorGUILayout.PropertyField(curvesArrayProp.GetArrayElementAtIndex(i),
            //   new GUIContent("Curve " + (i + 1)), true);

            SerializedProperty curveProp = curvesArrayProp.GetArrayElementAtIndex(i);
            curveProp.isExpanded = EditorGUILayout.Foldout(curveProp.isExpanded, "Curve " + (i + 1));
            if (!curveProp.isExpanded)
            {
                continue;
            }

            EditorGUILayout.PropertyField(curveProp.FindPropertyRelative(curveFromName));
            EditorGUILayout.PropertyField(curveProp.FindPropertyRelative(curveToLocalName));
            EditorGUILayout.PropertyField(curveProp.FindPropertyRelative(curveCurvatureLocalName));
        }

        EditorGUI.indentLevel--;
    }
Exemple #5
0
    private void GetNotesheet(Difficulty difficulty, out NoteSheet noteSheet, out SerializedProperty property)
    {
        switch (difficulty)
        {
        case Difficulty.Easy:
            property = serializedObject.FindProperty("easyNoteSheet");
            break;

        case Difficulty.Hard:
            property = serializedObject.FindProperty("hardNoteSheet");
            break;

        default:
            property = null;
            break;
        }
        noteSheet = song.GetNotesheet(difficulty);
    }
Exemple #6
0
    // Cuando la canción se cargue, obtenemos las notas que tenga la misma
    protected override void OnSongLoaded()
    {
        // Almacenamos el momento que empezamos a obtener las notas
        System.Diagnostics.Stopwatch stopwatch = System.Diagnostics.Stopwatch.StartNew();

        // Conseguimos la cantidad máxima cantidad de notas
        // Y seteamos la longitud de los bit array de notas actuales
        currentNoteInputs       = (byte)useDifficulty;
        currentNotesLeft.Length = currentNoteInputs;
        currentLongNotes        = new LongNoteInfo[currentNoteInputs];

        // Obtenemos los grupos de notas, válidos, con tiempos únicos y
        // ordenados para evitar cualquier clase de problemas
        noteSheet    = CurrentSong.GetNotesheet(useDifficulty);
        currentNotes = noteSheet.GetNoteGroupsValidated.Where(g => g.HasNotes)
                       .Distinct(NoteGroup.timeComparer).OrderBy(n => n.Substep).ToArray();

        // Debugeamos cuanto tardamos en obtener las notas
        stopwatch.Stop();
        Debug.LogFormat("Loaded note sheet in {0} ms.", stopwatch.Elapsed.TotalMilliseconds);
    }
Exemple #7
0
        protected override IEnumerable <RushHitObject> ConvertHitObject(HitObject original, IBeatmap beatmap)
        {
            void updatePrevious(LanedHitLane?newLane, HitObjectFlags newFlags)
            {
                previousLane           = newLane;
                previousSourceTime     = original.GetEndTime();
                previousSourcePosition = (original as IHasPosition)?.Position;
                previousFlags          = newFlags;
            }

            // if it's definitely a spinner, return a miniboss
            if (original is IHasDuration && !(original is IHasDistance))
            {
                yield return(createMiniBoss(original));

                updatePrevious(null, HitObjectFlags.None);
                yield break;
            }

            // otherwise do some flag magic
            Random random = new Random((int)original.StartTime);

            HitObjectFlags flags = flagsForHitObject(original, beatmap);

            // if no flags, completely skip this object
            if (flags == HitObjectFlags.None)
            {
                updatePrevious(previousLane, HitObjectFlags.None);
                yield break;
            }

            LanedHitLane?lane           = null;
            var          kiaiMultiplier = original.Kiai ? kiai_multiplier : 1;

            // try to get a lane from the force flags
            if (flags.HasFlag(HitObjectFlags.ForceSameLane) || flags.HasFlag(HitObjectFlags.SuggestSameLane) && random.NextDouble() < suggest_probability)
            {
                lane = previousLane;
            }
            else if (flags.HasFlag(HitObjectFlags.ForceNotSameLane) || flags.HasFlag(HitObjectFlags.SuggestNotSameLane) && random.NextDouble() < suggest_probability)
            {
                lane = previousLane?.Opposite();
            }

            // get the lane from the object
            lane ??= laneForHitObject(original);

            // if we should end a sheet, try to
            if (currentNoteSheets.Count > 0 && (flags.HasFlag(HitObjectFlags.ForceEndNotesheet) || flags.HasFlag(HitObjectFlags.SuggestEndNotesheet) && random.NextDouble() < notesheet_end_probability))
            {
                // TODO: for now we'll end both sheets where they are and ignore snapping logic
                currentNoteSheets.Clear();
            }

            // if we should start a notesheet...
            if (flags.HasFlag(HitObjectFlags.ForceStartNotesheet) || flags.HasFlag(HitObjectFlags.SuggestStartNotesheet) && random.NextDouble() < notesheet_start_probability)
            {
                // TODO: for now, end all existing sheets
                currentNoteSheets.Clear();

                // use the suggested lane or randomly select one
                LanedHitLane sheetLane = lane ?? (random.NextDouble() < 0.5 ? LanedHitLane.Ground : LanedHitLane.Air);

                // create a sheet
                NoteSheet    sheet     = currentNoteSheets[sheetLane] = createNoteSheet(original, sheetLane, original.Samples);
                LanedHitLane otherLane = sheetLane.Opposite();

                // FIXME: surely this is bad, altering the hit object after it's been returned???
                if (sheet != null)
                {
                    yield return(sheet);
                }

                // for sliders with repeats, add extra objects to the lane without a sheet
                if (original is IHasRepeats hasRepeats && hasRepeats.RepeatCount > 0)
                {
                    var duration       = original.GetEndTime() - original.StartTime;
                    var repeatDuration = duration / hasRepeats.SpanCount();
                    var skip           = 1;

                    // Currently an issue where an odd number of repeats (span count) will skip
                    // the final minion if repeats are too short. Not sure what to do here since
                    // it doesn't make rhythmic sense to add an extra hit object.
                    // Examples:
                    //   *-*-*-*-* becomes *---*---* (good)
                    //   *-*-*-*   becomes *---*-- (looks bad) instead of *---*-* (rhythmically worse)
                    while (repeatDuration < min_repeat_time)
                    {
                        repeatDuration *= 2;
                        skip           *= 2;
                    }

                    var repeatCurrent = original.StartTime;
                    var index         = -1;

                    foreach (var nodeSample in hasRepeats.NodeSamples)
                    {
                        index++;

                        if (index % skip != 0)
                        {
                            continue;
                        }

                        yield return(createNormalHit(original, otherLane, nodeSample, repeatCurrent));

                        repeatCurrent += repeatDuration;
                    }
                }
                // otherwise we have a chance to make a dual sheet
                else if (random.NextDouble() < notesheet_dual_probability)
                {
                    currentNoteSheets[otherLane] = createNoteSheet(original, otherLane, null);
                    yield return(currentNoteSheets[otherLane]);
                }

                updatePrevious(sheetLane, flags);
                yield break;
            }