当前位置: 首页>>代码示例>>C#>>正文


C# Chart.AddMeasureLines方法代码示例

本文整理汇总了C#中Chart.AddMeasureLines方法的典型用法代码示例。如果您正苦于以下问题:C# Chart.AddMeasureLines方法的具体用法?C# Chart.AddMeasureLines怎么用?C# Chart.AddMeasureLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chart的用法示例。


在下文中一共展示了Chart.AddMeasureLines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read


//.........这里部分代码省略.........
                            case "16": currentPlayer = 1; currentType = EntryType.Marker; currentColumn = 5; break;
                            case "17": currentPlayer = 1; currentType = EntryType.Marker; currentColumn = 8; break;
                            case "18": currentPlayer = 1; currentType = EntryType.Marker; currentColumn = 6; break;
                            case "19": currentPlayer = 1; currentType = EntryType.Marker; currentColumn = 7; break;
                            case "21": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 0; break;
                            case "22": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 1; break;
                            case "23": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 2; break;
                            case "24": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 3; break;
                            case "25": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 4; break;
                            case "26": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 5; break;
                            case "27": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 8; break;
                            case "28": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 6; break;
                            case "29": currentPlayer = 2; currentType = EntryType.Marker; currentColumn = 7; break;
                            case "31": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 0; break;
                            case "32": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 1; break;
                            case "33": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 2; break;
                            case "34": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 3; break;
                            case "35": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 4; break;
                            case "36": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 5; break;
                            case "37": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 8; break;
                            case "38": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 6; break;
                            case "39": currentPlayer = 1; currentType = EntryType.Sample; currentColumn = 7; break;
                            case "41": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 0; break;
                            case "42": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 1; break;
                            case "43": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 2; break;
                            case "44": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 3; break;
                            case "45": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 4; break;
                            case "46": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 5; break;
                            case "47": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 8; break;
                            case "48": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 6; break;
                            case "49": currentPlayer = 2; currentType = EntryType.Sample; currentColumn = 7; break;
                            default: chart.Tags[tag.Key + ":" + tag.Value] = ""; continue; // a little hack to preserve unknown lines
                        }

                        // determine the alphabet used to decode this line
                        string alphabet;
                        int alphabetLength;
                        switch (coding)
                        {
                            case ValueCoding.Hex: alphabet = Util.alphabetHex; break;
                            case ValueCoding.Decimal: alphabet = Util.alphabetDec; break;
                            default: alphabet = Util.alphabetBME; break;
                        }
                        alphabetLength = alphabet.Length;

                        // decode the line
                        int valueLength = (tag.Value.Length | 1) ^ 1; // make an even number
                        for (int i = 0; i < valueLength; i += 2)
                        {
                            string pair = tag.Value.Substring(i, 2);
                            int index0 = alphabet.IndexOf(pair.Substring(0, 1));
                            int index1 = alphabet.IndexOf(pair.Substring(1, 1));
                            int val = 0;

                            if (index0 > 0)
                                val += (index0 * alphabetLength);
                            if (index1 > 0)
                                val += index1;

                            if (val > 0)
                            {
                                Entry entry = new Entry();
                                entry.Column = currentColumn;
                                entry.Player = currentPlayer;
                                entry.MetricMeasure = currentMeasure;
                                entry.Type = currentType;
                                entry.MetricOffset = new Fraction(i, valueLength);

                                if (coding == ValueCoding.BPMTable)
                                {
                                    if (chart.Tags.ContainsKey("BPM" + pair))
                                    {
                                        string bpmValue = chart.Tags["BPM" + pair];
                                        entry.Value = Fraction.Rationalize(Convert.ToDouble(bpmValue));
                                    }
                                    else
                                    {
                                        entry.Type = EntryType.Invalid;
                                    }
                                }
                                else
                                {
                                    entry.Value = new Fraction(val, 1);
                                }

                                if (entry.Type != EntryType.Invalid)
                                    chart.Entries.Add(entry);
                            }
                        }
                    }
                }
            }

            chart.AddMeasureLines();
            chart.AddJudgements();
            chart.CalculateLinearOffsets();

            result.charts = new Chart[] { chart };
            return result;
        }
开发者ID:NoOnes2,项目名称:scharfrichter,代码行数:101,代码来源:BMS.cs


注:本文中的Chart.AddMeasureLines方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。