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


C# Chart.NoteCount方法代码示例

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


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

示例1: Write

        public static void Write(Stream target, Chart chart)
        {
            // I don't know if these are needed, but they are
            // parameters for note count you would typically find
            // in such a chart, so we will include them

            BinaryWriter writer = new BinaryWriter(target);

            writer.Write((Int32)0);
            writer.Write((byte)0x10);    // notecount ID
            writer.Write((byte)0x00);    // player#
            writer.Write((Int16)chart.NoteCount(1));
            writer.Write((Int32)0);
            writer.Write((byte)0x10);    // notecount ID
            writer.Write((byte)0x01);    // player#
            writer.Write((Int16)chart.NoteCount(2));

            foreach (Entry entry in chart.Entries)
            {
                long num;
                long den;
                Int32 entryOffset = (Int32)(entry.LinearOffset);
                byte entryType = 0xFF;
                byte entryParameter = (byte)(entry.Parameter & 0xFF);
                Int16 entryValue = 0;

                switch (entry.Type)
                {
                    case EntryType.EndOfSong:
                        entryType = 0x06;
                        entryParameter = 0;
                        entryValue = 0;
                        break;
                    case EntryType.Judgement:
                        entryType = 0x08;
                        entryParameter = (byte)entry.Parameter;
                        entryValue = (Int16)entry.Value;
                        break;
                    case EntryType.Marker:
                        if (entry.Player < 1)
                        {
                            entryType = 0x07;
                            entryValue = (Int16)entry.Value;
                        }
                        else
                        {
                            entryType = (byte)(entry.Player - 1);
                            entryValue = 0;
                            entryParameter = (byte)entry.Column;
                        }
                        break;
                    case EntryType.Measure:
                        entryType = 0x0C;
                        entryParameter = (byte)(entry.Player - 1);
                        break;
                    case EntryType.Sample:
                        if (entry.Player > 0)
                        {
                            entryType = (byte)(entry.Player + 1);
                            entryValue = (Int16)entry.Value;
                            entryParameter = (byte)entry.Column;
                        }
                        break;
                    case EntryType.Tempo:
                        num = entry.Value.Numerator;
                        den = entry.Value.Denominator;
                        while ((num > 32767) || (den > 255))
                        {
                            num /= 2;
                            den /= 2;
                        }
                        entryValue = (Int16)num;
                        entryParameter = (byte)den;
                        entryType = 0x04;
                        break;
                    default:
                        continue;
                }
                if (entryType == 0xFF)
                    continue;

                writer.Write(entryOffset);
                writer.Write(entryType);
                writer.Write(entryParameter);
                writer.Write(entryValue);
            }
            writer.Write((Int32)0x7FFFFFFF);
            writer.Write((Int32)0);
        }
开发者ID:NoOnes2,项目名称:scharfrichter,代码行数:89,代码来源:BeatmaniaIIDXPC.cs


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