示例#1
0
        public bool Add(string define, HighSpeedTimeLineBook timeLineBook, int susTicksPerBeat)
        {
            Valid = false;
            if (define == null || timeLineBook == null)
            {
                return(false);
            }

            if (define.Length == 0)
            {
                Valid = true;
                return(true);
            }

            Match timeLinesMatch = rgxTimeLine.Match(define);

            if (timeLinesMatch.Success)
            {
                CaptureCollection timeLinesCollection = timeLinesMatch.Groups[1].Captures;
                for (int i = 0; i < timeLinesCollection.Count; ++i)
                {
                    Match timeLineMatch = rgxTimeLineBase.Match(timeLinesCollection[i].ToString());
                    if (timeLineMatch.Success)
                    {
                        if (timeLineMatch.Groups[1].ToString() == "inherit")
                        {
                            int defNumber = MyUtil.ToIntAs36(timeLineMatch.Groups[2].ToString());
                            if (timeLineBook.ContainsKey(defNumber))
                            {
                                if (!Add(timeLineBook.Get(defNumber)))
                                {
                                    return(false);
                                }
                            }
                            else
                            {
                                /* 未定義ハイスピ指定の複製は困ります */
                                return(false);
                            }
                            continue;
                        }

                        int    measure           = MyUtil.ToInt(timeLineMatch.Groups[3].ToString());
                        int    tick              = MyUtil.ToInt(timeLineMatch.Groups[4].ToString());
                        double m4pleTicksPerBeat = 48.0;

                        /* measure,tick管理クソみたいになってるけどユルシテ */

                        CaptureCollection      propsCollection = timeLineMatch.Groups[5].Captures;
                        float                  hsValue         = 1;
                        HighSpeed.VisibleState visibleState    = HighSpeed.VisibleState.Visible;
                        for (int j = 0; j < propsCollection.Count; ++j)
                        {
                            string value = propsCollection[j].ToString();
                            if (value == "i" || value == "invisible")
                            {
                                visibleState = HighSpeed.VisibleState.Invisible;
                            }
                            else if (value == "v" || value == "visible")
                            {
                                visibleState = HighSpeed.VisibleState.Invisible;
                            }
                            else
                            {
                                hsValue = (float)MyUtil.ToDouble(value);
                            }
                        }
                        HighSpeed hs = new HighSpeed(new Position(measure, (int)(tick * m4pleTicksPerBeat / susTicksPerBeat)), new PointF(), hsValue, -1)
                        {
                            Visible = visibleState
                        };
                        Add(hs);
                    }
                }
                Valid = true;
                return(true);
            }
            return(false);
        }
示例#2
0
 public HighSpeedTimeLine(string define, HighSpeedTimeLineBook timeLineBook, int ticksPerBeat)
 {
     Add(define, timeLineBook, ticksPerBeat);
 }