本文整理汇总了C#中ByteReader.SHORT方法的典型用法代码示例。如果您正苦于以下问题:C# ByteReader.SHORT方法的具体用法?C# ByteReader.SHORT怎么用?C# ByteReader.SHORT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ByteReader
的用法示例。
在下文中一共展示了ByteReader.SHORT方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SkillFile
public SkillFile(CTF.File ctf, string filename)
{
FileName = filename;
var br = new ByteReader(File.ReadAllBytes(FileName));
if (br.STRING() != FileID)
{
throw new Exception("Invalid file format.");
}
var messages = new List<CTF.Message>();
foreach (var msg in ctf.Messages)
{
if (msg.SubCategory.Category.Name != "Skills")
{
continue;
}
messages.Add(msg);
}
var skill_count = br.UINT();
Skills = new List<Skill>();
for (int i = 0; i < skill_count; i++)
{
var s = new Skill();
s.Type = (SkillType)br.BYTE();
var message_id = br.STRING();
if (message_id == "")
{
Skills.Add(null);
br.Skip(39);
continue;
}
var class_id = br.STRING();
foreach (var message in messages)
{
if (message.SubCategory.ID == uint.Parse(class_id) &&
message.ID == uint.Parse(message_id))
{
s.Message = message;
break;
}
}
if (s.Message == null)
{
throw new Exception("Failed to find message.");
}
s.IconIndex = br.UINT();
s.ProjectileAnimation = br.USHORT();
s.CharacterAnimation = br.UINT();
s.Honor = br.INT();
s.Level = br.UINT();
s.CharacterType = br.BYTE();
var mana = br.UINT();
if (mana > 1000000000)
{
s.ManaUsageStyle = ManaUsageStyle.Percentage;
s.ManaUsage = mana - 1000000000;
}
else
{
s.ManaUsageStyle = ManaUsageStyle.Fixed;
s.ManaUsage = mana;
}
var range = br.SHORT();
if (range > 10000)
{
s.IsAOE = true;
s.Range = (short)(range - 10000);
}
else
{
s.IsAOE = false;
s.Range = range;
}
s.NeedsTarget = br.BYTE();
s.Unused1 = br.BYTE();
s.Unused2 = br.BYTE();
s.Unused3 = br.BYTE();
s.EffectType = br.BYTE();
s.Multiplier = br.UINT();
s.Unknown5 = br.UINT();
//.........这里部分代码省略.........