當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。