Пример #1
0
        public bool CopyMarkInSame(float time)
        {
            Mark mk = SelectedMark;

            if (mk != null && !data[focusedmark[0]].ContainsKey(time))
            {
                ExMark exmk = mk as ExMark;
                if (exmk != null)
                {
                    if (!checklongmark(focusedmark[0], time))
                    {
                        ExMark newexmk = CreateExMark(exmk.Position.X, exmk.Position.Y, focusedmark[0], time, time + exmk.EndTime - exmk.Time, exmk.Rotation);
                        data[focusedmark[0]].Add(time, newexmk);
                        focusedmark[1] = data[focusedmark[0]].IndexOfKey(time);
                    }
                }
                else
                {
                    Mark newmk = CreateMark(mk.Position.X, mk.Position.Y, focusedmark[0], time, mk.Rotation);
                    data[focusedmark[0]].Add(time, newmk);
                    focusedmark[1] = data[focusedmark[0]].IndexOfKey(time);
                }
                return(true);
            }
            return(false);
        }
Пример #2
0
        public bool CopyMark(int num)
        {
            Mark mk = SelectedMark;

            if (SelectedMark != null)
            {
                if (!data[num].ContainsKey(mk.Time))
                {
                    ExMark exmk = mk as ExMark;
                    if (exmk != null)
                    {
                        ExMark newexmk = CreateExMark(exmk.Position.X, exmk.Position.Y, num, exmk.Time, exmk.EndTime, exmk.Rotation);
                        data[num].Add(newexmk.Time, newexmk);
                        focusedmark[0] = num;
                        focusedmark[1] = data[num].IndexOfKey(newexmk.Time);
                    }
                    else
                    {
                        Mark newmk = CreateMark(mk.Position.X, mk.Position.Y, num, mk.Time, mk.Rotation);
                        data[num].Add(newmk.Time, newmk);
                        focusedmark[0] = num;
                        focusedmark[1] = data[num].IndexOfKey(newmk.Time);
                    }
                    return(true);
                }
            }
            return(false);
        }
Пример #3
0
 public bool[] UpdateMark(float time, float speedscale, EventManager em)
 {
     bool[] ret = new bool[buttonnum];
     if (data != null)
     {
         for (int i = 0; i < 10; i++)
         {
             foreach (Mark mk in data[i].Values)
             {
                 ExMark exmk = mk as ExMark;
                 EventData.DisplayState DState;
                 bool AC;
                 em.GetCorrectInfo(mk.Time, out DState, out AC);
                 if (exmk != null)
                 {
                     ret[i] |= (exmk.ExUpdate(em.GetCorrectTime(time, mk.Time), speedscale * bpm, DState, AC, em.ReleaseSound(mk.Type)) == 1);
                 }
                 else
                 {
                     ret[i] |= (mk.Update(em.GetCorrectTime(time, mk.Time), speedscale * bpm, DState, AC) == 1);
                 }
             }
         }
     }
     return(ret);
 }
Пример #4
0
 public bool FusionMarks()
 {
     if (recstart.X != -1 && recstart.Y != -1)
     {
         Mark[] mks = GetAreaData();
         if (mks.Length == 2 && mks[0].Type == mks[1].Type)
         {
             //cast check
             ExMark exmk = mks[0] as ExMark;
             if (exmk == null)
             {
                 exmk = mks[1] as ExMark;
                 if (exmk == null)
                 {
                     exmk = CreateExMark(mks[0].Position.X, mks[0].Position.Y, mks[0].Type, mks[0].Time, mks[1].Time, mks[0].Rotation);
                     data[mks[0].Type].Remove(mks[0].Time);
                     data[mks[0].Type].Remove(mks[1].Time);
                     data[mks[0].Type].Add(mks[0].Time, exmk);
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Пример #5
0
 private bool checklongmark(int num, float time)
 {
     foreach (Mark mk in data[num].Values)
     {
         ExMark exmk = mk as ExMark;
         if (exmk != null && time == exmk.EndTime)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #6
0
 public bool DeFusionExMark()
 {
     if (focusedmark[0] >= 0 && focusedmark[0] < 10)
     {
         Mark   mk   = data[focusedmark[0]].Values[focusedmark[1]];
         ExMark exmk = mk as ExMark;
         if (exmk != null)
         {
             data[focusedmark[0]].Remove(exmk.Time);
             Mark mk1 = CreateMark(exmk.Position.X, exmk.Position.Y, exmk.Type, exmk.Time, exmk.Rotation);
             Mark mk2 = CreateMark(exmk.Position.X, exmk.Position.Y, exmk.Type, exmk.EndTime, exmk.Rotation);
             data[focusedmark[0]].Add(mk1.Time, mk1);
             data[focusedmark[0]].Add(mk2.Time, mk2);
             return(true);
         }
     }
     return(false);
 }
Пример #7
0
 public void DrawMark()
 {
     if (data != null)
     {
         int   miny = -1, maxy = -1;
         float minx = -1, maxx = -1;
         if (AreaSelectionEnabled && recstart.Y != -1 && recend.Y != -1)
         {
             miny = Math.Min(recstart.Y, recend.Y);
             maxy = Math.Max(recstart.Y, recend.Y);
             minx = Math.Min(recstart.X, recend.X);
             maxx = Math.Max(recstart.X, recend.X);
         }
         for (int i = 0; i < 10; i++)
         {
             bool isin = miny <= i && i <= maxy;
             foreach (Mark mk in data[i].Values)
             {
                 if (mk.Hidden)
                 {
                     if (isin && minx <= mk.Time && mk.Time <= maxx)
                     {
                         mk.DrawOnlyMark();
                     }
                 }
                 else
                 {
                     ExMark exmk = mk as ExMark;
                     if (exmk != null)
                     {
                         exmk.ExDraw();
                     }
                     else
                     {
                         mk.Draw();
                     }
                 }
             }
         }
     }
 }
Пример #8
0
        public void ShiftSelectedMarkTime(float dt)
        {
            Mark mk = null;

            if (data[focusedmark[0]].TryGetValue(data[focusedmark[0]].Keys[focusedmark[1]], out mk))
            {
                data[focusedmark[0]].RemoveAt(focusedmark[1]);
                ExMark exmk = mk as ExMark;
                if (exmk != null)
                {
                    exmk.EndTime += dt - mk.Time;
                }
                mk.Time = dt;
                while (data[focusedmark[0]].ContainsKey(mk.Time))
                {
                    mk.Time -= 0.01f;
                }
                data[focusedmark[0]].Add(mk.Time, mk);
                focusedmark[1] = data[focusedmark[0]].IndexOfKey(mk.Time);
            }
        }
Пример #9
0
 private SortedList <float, Mark>[] copydata(SortedList <float, Mark>[] dat)
 {
     SortedList <float, Mark>[] temp = new SortedList <float, Mark> [10];
     for (int i = 0; i < 10; i++)
     {
         temp[i] = new SortedList <float, Mark>();
         for (int j = 0; j < dat[i].Count; j++)
         {
             ExMark exmk = dat[i].Values[j] as ExMark;
             if (exmk == null)
             {
                 temp[i].Add(dat[i].Values[j].Time, dat[i].Values[j].Clone());
             }
             else
             {
                 temp[i].Add(dat[i].Values[j].Time, exmk.ExClone());
             }
         }
     }
     return(temp);
 }
Пример #10
0
 public void PreserveData()
 {
     SortedList <float, Mark>[] temp = new SortedList <float, Mark> [10];
     for (int i = 0; i < 10; i++)
     {
         temp[i] = new SortedList <float, Mark>();
         for (int j = 0; j < data[i].Count; j++)
         {
             ExMark exmk = data[i].Values[j] as ExMark;
             if (exmk == null)
             {
                 temp[i].Add(data[i].Values[j].Time, data[i].Values[j].Clone());
             }
             else
             {
                 temp[i].Add(data[i].Values[j].Time, exmk.ExClone());
             }
         }
     }
     storeddata.add(temp);
 }
Пример #11
0
        public bool MoveMarkInSame(float time)
        {
            Mark mk = SelectedMark;

            if (mk != null)
            {
                data[focusedmark[0]].RemoveAt(focusedmark[1]);
                ExMark exmk = mk as ExMark;
                if (exmk != null)
                {
                    exmk.EndTime += time - mk.Time;
                }
                mk.Time = time;
                while (data[focusedmark[0]].ContainsKey(mk.Time))
                {
                    mk.Time -= 0.01f;
                }
                data[focusedmark[0]].Add(mk.Time, mk);
                focusedmark[1] = data[focusedmark[0]].IndexOfKey(mk.Time);
                return(true);
            }
            return(false);
        }
Пример #12
0
        public bool SelectMark(float time, int num, float dt)
        {
            bool ret = false;

            foreach (float f in data[num].Keys)
            {
                Mark mk;
                data[num].TryGetValue(f, out mk);
                ExMark exmk = mk as ExMark;
                if (exmk != null)
                {
                    if (f <= time && time <= f + exmk.EndTime - exmk.Time)
                    {
                        focusedmark[0] = num;
                        focusedmark[1] = data[num].IndexOfKey(f);
                        recstart.X     = -1;
                        recstart.Y     = -1;
                        ret            = true;
                        break;
                    }
                }
                else
                {
                    if (f - dt <= time && time <= f + dt)
                    {
                        focusedmark[0] = num;
                        focusedmark[1] = data[num].IndexOfKey(f);
                        recstart.X     = -1;
                        recstart.Y     = -1;
                        ret            = true;
                        break;
                    }
                }
            }
            return(ret);
        }
Пример #13
0
 public void MoveLine(int num, float dt)
 {
     if (num >= 0 && num < 10)
     {
         SortedList <float, Mark> tempdat = new SortedList <float, Mark>(data[num].Count);
         foreach (Mark mk in data[num].Values)
         {
             ExMark exmk = mk as ExMark;
             if (exmk != null)
             {
                 exmk.EndTime += dt;
             }
             mk.Time += dt;
             tempdat.Add(mk.Time, mk);
         }
         data[num] = tempdat;
     }
     else if (num == int.MaxValue)
     {
         for (int i = 0; i < 10; i++)
         {
             SortedList <float, Mark> tempdat = new SortedList <float, Mark>(data[i].Count);
             foreach (Mark mk in data[i].Values)
             {
                 ExMark exmk = mk as ExMark;
                 if (exmk != null)
                 {
                     exmk.EndTime += dt;
                 }
                 mk.Time += dt;
                 tempdat.Add(mk.Time, mk);
             }
             data[i] = tempdat;
         }
     }
 }