예제 #1
0
        static public void ConvertMacro(
            ref Js_macro_OBJ _macros,
            string[] _score,
            string _song_name,
            ref DiffName _diff)
        {
            ((Js_macro_OBJ.class_Primitive_Combo)_macros.Primitives[0]).Description = _song_name + "_" + _diff.shortName + " (left)";
            ((Js_macro_OBJ.class_Primitive_Combo)_macros.Primitives[1]).Description = _song_name + "_" + _diff.shortName + " (right)";

            List <Js_macro_OBJ.class_Primitive_Combo.class_Event>[] events =
            {
                new List <Js_macro_OBJ.class_Primitive_Combo.class_Event>(0x400),
                new List <Js_macro_OBJ.class_Primitive_Combo.class_Event>(0x400),
            };

            for (int i0 = 0; i0 < _score.Length; ++i0)
            {
                InsertNoteMacroFromString(events, _score[i0], ref _diff);
            }

            PostProcessMacro(ref _macros, events);
        }
예제 #2
0
        static void InsertNoteMacroFromString(
            List <Js_macro_OBJ.class_Primitive_Combo.class_Event>[] _e,
            string _score_line,
            ref DiffName _d)
        {
            int    time, type, lr;
            double x;
            Match  m_u;

            if ((m_u = Regex.Match(_score_line, "^[0-9:.]+(?=,)")).Success)
            {
                time = ParseTime(m_u.Value);
                for (int i0 = m_u.Index + m_u.Length + 1; i0 < _score_line.Length;)
                {
                    if ((m_u = Regex.Match(_score_line.Substring(i0), "(\\d|\\(\\d+\\.\\d+\\))([sdSD]?)([+\\-=uUlLrR!]?)")).Success)
                    {
                        i0 += m_u.Index + m_u.Length;

                        if (m_u.Groups[1].Value[0] == '(')
                        {
                            x = Convert.ToDouble(m_u.Groups[1].Value.Substring(1, m_u.Groups[1].Value.Length - 2));
                        }
                        else
                        {
                            x = Convert.ToDouble(m_u.Groups[1].Value);
                        }
                        --x;

                        if (m_u.Groups[2].Value.Length == 0)
                        {
                            lr = _d.IsLeft(x) ? 0 : 1;
                        }
                        else if (m_u.Groups[2].Value[0] == 's' || m_u.Groups[2].Value[0] == 'S')
                        {
                            lr = 0;
                        }
                        else
                        {
                            lr = 1;
                        }

                        if (m_u.Groups[3].Value.Length == 0)
                        {
                            type = 0;
                        }
                        else
                        {
                            switch (m_u.Groups[3].Value[0])
                            {
                            default: type = 0; break;

                            case 'l':
                            case 'L': type = 1; break;

                            case 'u':
                            case 'U': type = 2; break;

                            case 'r':
                            case 'R': type = 3; break;

                            case '+': type = 4; break;

                            case '=': type = 5; break;

                            case '-': type = 6; break;

                            case '!': type = 7; break;
                            }
                        }

                        InsertNoteMacro(ref _e[lr], time, x, type, ref _d);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else if (Regex.Match(_score_line, "\\S").Success)
            {
                throw new Exception("Invalid Input Line: \"" + _score_line + "\".");
            }
        }
예제 #3
0
        static public void ConvertMacro(
            ref Js_macro_OBJ _macros,
            ref Js_notes_OBJ _notes,
            ref SongName _song,
            ref DiffName _diff)
        {
            ((Js_macro_OBJ.class_Primitive_Combo)_macros.Primitives[0]).Description = _song.urlName + "_" + _diff.shortName + " (left)";
            ((Js_macro_OBJ.class_Primitive_Combo)_macros.Primitives[1]).Description = _song.urlName + "_" + _diff.shortName + " (right)";

            List <Js_macro_OBJ.class_Primitive_Combo.class_Event>[] events =
            {
                new List <Js_macro_OBJ.class_Primitive_Combo.class_Event>(0x400),
                new List <Js_macro_OBJ.class_Primitive_Combo.class_Event>(0x400),
            };
            StateTimeline[] Handbusy =
            {
                new StateTimeline(),
                new StateTimeline(),
            };

            for (int i0 = 0, _lr, _fl, _time; i0 < _notes.Notes.Length; ++i0)
            {
                _lr =
                    _diff.IsLeft(_notes.Notes[i0].EndX) &&
                    !Handbusy[0].IsIn(_notes.Notes[i0].Ticks) ||
                    Handbusy[1].IsIn(_notes.Notes[i0].Ticks) ?
                    0 : 1;
                _fl   = _notes.Notes[i0].FollowingNotes == null ? 0 : _notes.Notes[i0].FollowingNotes.Length;
                _time = FromTicksToMilisecond(_notes.Notes[i0].Ticks, _notes.Conductors);
                if (_fl == 0)
                {
                    InsertNoteMacro(
                        ref events[_lr],
                        _time,
                        _notes.Notes[i0].EndX,
                        _notes.Notes[i0].Type == 100 ? 7 : _notes.Notes[i0].FlickDirection,
                        ref _diff);
                    if (_notes.Notes[i0].FlickDirection == 0)
                    {
                        Handbusy[_lr].Insert(_notes.Notes[i0].Ticks, _notes.Notes[i0].Ticks + 5);
                    }
                    else
                    {
                        Handbusy[_lr].Insert(_notes.Notes[i0].Ticks - 20, _notes.Notes[i0].Ticks + 20);
                    }
                }
                else
                {
                    InsertNoteMacro(
                        ref events[_lr],
                        _time,
                        _notes.Notes[i0].EndX,
                        4,
                        ref _diff);
                    for (int i1 = 0; i1 < _fl; ++i1)
                    {
                        _time = FromTicksToMilisecond(_notes.Notes[i0].FollowingNotes[i1].Ticks, _notes.Conductors);
                        InsertNoteMacro(
                            ref events[_lr],
                            _time,
                            _notes.Notes[i0].FollowingNotes[i1].EndX,
                            _notes.Notes[i0].FollowingNotes[i1].FlickDirection != 0 ? _notes.Notes[i0].FollowingNotes[i1].FlickDirection : i1 + 1 == _fl ? 6 : 5,
                            ref _diff);
                    }
                    Handbusy[_lr].Insert(_notes.Notes[i0].Ticks, _notes.Notes[i0].FollowingNotes.Last().Ticks);
                }
            }

            PostProcessMacro(ref _macros, events);
        }
예제 #4
0
        static void InsertNoteMacro(
            ref List <Js_macro_OBJ.class_Primitive_Combo.class_Event> _e,
            int _time,
            double _x,
            int _type,
            ref DiffName _d)
        {
            double _X = _d.GetX(_x);
            double _Y = _d.GetY(_x);

            switch (_type)
            {
            default: break;

            case 0:
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseDown",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 5,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseUp",
                });
                break;

            case 1:
            case 2:
            case 3:
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time - 20,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 5,
                    X         = Math.Round(_X + _d.x_flick[_type] * 1, 2),
                    Y         = Math.Round(_Y + _d.y_flick[_type] * 1, 2),
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 10,
                    X         = Math.Round(_X + _d.x_flick[_type] * 2, 2),
                    Y         = Math.Round(_Y + _d.y_flick[_type] * 2, 2),
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 15,
                    X         = Math.Round(_X + _d.x_flick[_type] * 3, 2),
                    Y         = Math.Round(_Y + _d.y_flick[_type] * 3, 2),
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 19,
                    X         = Math.Round(_X + _d.x_flick[_type] * 4, 2),
                    Y         = Math.Round(_Y + _d.y_flick[_type] * 4, 2),
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 20,
                    X         = Math.Round(_X + _d.x_flick[_type] * 4, 2),
                    Y         = Math.Round(_Y + _d.y_flick[_type] * 4, 2),
                    Delta     = 0,
                    EventType = "MouseUp",
                });
                break;

            case 4:
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseDown",
                });
                break;

            case 5:
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                break;

            case 6:
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseMove",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 5,
                    X         = _X,
                    Y         = _Y,
                    Delta     = 0,
                    EventType = "MouseUp",
                });
                break;

            case 7:
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time,
                    X         = _d.x_center,
                    Y         = _d.y_center,
                    Delta     = 0,
                    EventType = "MouseDown",
                });
                _e.Add(new Js_macro_OBJ.class_Primitive_Combo.class_Event {
                    Timestamp = _time + 5,
                    X         = _d.x_center,
                    Y         = _d.y_center,
                    Delta     = 0,
                    EventType = "MouseUp",
                });
                break;
            }
        }