示例#1
0
        private Dictionary <float, SameTimingMarks> GetGroups(IEnumerable <MarkDataBase> list)
        {
            float lastTime = -1;
            var   group    = new SameTimingMarks();
            var   ret      = new Dictionary <float, SameTimingMarks>();

            foreach (MarkDataBase ipdata in list)
            {
                if (ipdata.Time >= lastTime + sametimeing)
                {
                    if (group.Count > 1)
                    {
                        ret.Add(lastTime, group);
                        group = new SameTimingMarks();
                    }
                    else
                    {
                        group.Clear();
                    }
                    group.Add(ipdata);
                    lastTime = ipdata.Time;
                }
                else
                {
                    group.Add(ipdata);
                }
            }
            if (group.Count > 1)
            {
                ret.Add(lastTime, group);
            }

            return(ret);
        }
示例#2
0
 public MarkGroupData(float time, MarkDataBase[] data)
 {
     Key         = time;
     this.data   = data;
     SameTimings = new SameTimingMarks();
     foreach (var ppdData in data)
     {
         SameTimings.Add(ppdData);
     }
 }
示例#3
0
        private void ProcessGroup(SameTimingMarks group, float mainTime)
        {
            var poses      = new List <Vector2>(group.Count);
            var colorposes = new List <Vector2>(group.Count);

            int currentSim = simtype;

            group.Sort(EventManager.GetInitlaizeOrder(group[0].Time));
            for (int i = 0; i < group.Count; i++)
            {
                var mk = CreateMark(group[i], true, group.SameTimings);
                mk.UpdateColorPosition(mainTime, EventManager.BPM);
                mk.SimType = currentSim;
                poses.Add(mk.Position);
                colorposes.Add(mk.ColorPosition);
                if (mk.NoteType == NoteType.AC || mk.NoteType == NoteType.ACFT)
                {
                    mk.ChangeColorPosition += mk_ChangeColorPosition;
                }
            }
            simtype++;
            if (simtype > simpiclist.Count)
            {
                simtype = 1;
            }
            if (poses.Count >= 3)
            {
                bool useColorPosition = true;
                for (int i = 0; i < poses.Count; i++)
                {
                    if (poses[i] != poses[0])
                    {
                        useColorPosition = false;
                        break;
                    }
                }

                Vector2[] convex = null;
                if (useColorPosition)
                {
                    convex = ConvexHull.Convex_Hull(colorposes.ToArray());
                }
                else
                {
                    convex = ConvexHull.Convex_Hull(poses.ToArray());
                }

                var    mkc    = new MarkConnection(device, markConnectionCommon);
                Mark[] orders = new Mark[convex.Length];
                for (int i = 0; i < MarkLayer.ChildrenCount && i < group.Count; i++)
                {
                    var mark  = MarkLayer[i] as Mark;
                    int index = -1;
                    if (useColorPosition)
                    {
                        index = Array.IndexOf(convex, mark.ColorPosition);
                    }
                    else
                    {
                        index = Array.IndexOf(convex, mark.Position);
                    }
                    if (index >= 0)
                    {
                        while (index < orders.Length)
                        {
                            if (orders[index] == null)
                            {
                                orders[index] = mark;
                                break;
                            }
                            else
                            {
                                index++;
                            }
                        }
                    }
                    else
                    {
                        mkc.AddIn(mark);
                    }
                }
                foreach (Mark mk in orders)
                {
                    if (mk != null)
                    {
                        mkc.AddConvex(mk);
                    }
                }
                mkc.Initialize();
                ConnectLayer.AddChild(mkc);
            }
            else
            {
                var mkc = new MarkConnection(device, markConnectionCommon);
                for (int i = 0; i < MarkLayer.ChildrenCount && i < group.Count; i++)
                {
                    mkc.AddConvex(MarkLayer[i] as Mark);
                }
                mkc.Initialize();
                ConnectLayer.AddChild(mkc);
            }
        }