コード例 #1
0
ファイル: MarkManager.cs プロジェクト: KHCmaster/PPD
        private void CheckConnection(Mark mk)
        {
            if (!gameutility.Connect && !gameutility.Profile.Connect)
            {
                return;
            }
            MarkConnection foundmc = null;

            foreach (MarkConnection mc in connections)
            {
                if (mc.Contains(mk))
                {
                    foundmc = mc;
                    break;
                }
            }
            if (foundmc != null)
            {
                connections.Remove(foundmc);
            }
        }
コード例 #2
0
ファイル: MarkManager.cs プロジェクト: KHCmaster/PPD
        private void readppddata(float maintime)
        {
            while (iter < ppdat.Length)
            {
                if (ppdat[iter].Time - 10 < maintime)
                {
                    List <IPPDData> group = markgroups[ppdat[iter].Time] as List <IPPDData>;
                    if (group != null)
                    {
                        List <Vector2> poses      = new List <Vector2>(group.Count);
                        List <Vector2> colorposes = new List <Vector2>(group.Count);

                        int currentSim = simtype;
                        MarkComparer.Comparer.Table = em.GetInitlaizeOrder(ppdat[iter].Time);
                        group.Sort(MarkComparer.Comparer);
                        for (int i = 0; i < group.Count; i++)
                        {
                            Mark mk = CreateMark(group[i]);
                            mk.CaliculateColorPosition(maintime, em.BPM);
                            mk.SimType = currentSim;
                            poses.Add(mk.Position);
                            colorposes.Add(mk.ColorPosition);
                            if (mk.AC)
                            {
                                mk.ChangeColorPosition += new Mark.ColorPositionDelegate(mk_ChangeColorPosition);
                            }
                            iter++;
                        }
                        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());
                            }

                            MarkConnection mkc    = new MarkConnection();
                            Mark[]         orders = new Mark[convex.Length];
                            for (int i = marks.Count - 1; i >= 0 && marks.Count - i <= group.Count; i--)
                            {
                                int index = -1;
                                if (useColorPosition)
                                {
                                    index = Array.IndexOf(convex, (marks[i] as Mark).ColorPosition);
                                }
                                else
                                {
                                    index = Array.IndexOf(convex, (marks[i] as Mark).Position);
                                }
                                if (index >= 0)
                                {
                                    while (index < orders.Length)
                                    {
                                        if (orders[index] == null)
                                        {
                                            orders[index] = marks[i] as Mark;
                                            break;
                                        }
                                        else
                                        {
                                            index++;
                                        }
                                    }
                                }
                                else
                                {
                                    mkc.AddIn(marks[i] as Mark);
                                }
                            }
                            foreach (Mark mk in orders)
                            {
                                if (mk != null)
                                {
                                    mkc.AddConvex(mk);
                                }
                            }
                            connections.Add(mkc);
                        }
                        else
                        {
                            MarkConnection mkc = new MarkConnection();
                            for (int i = marks.Count - 1; i >= 0 && marks.Count - i <= group.Count; i--)
                            {
                                mkc.AddConvex(marks[i] as Mark);
                            }
                            connections.Add(mkc);
                        }
                    }
                    else
                    {
                        CreateMark(ppdat[iter]);
                        iter++;
                    }
                }
                else
                {
                    break;
                }
            }
        }