本文整理汇总了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);
}