本文整理汇总了C#中BinaryReader.ReadSByte方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadSByte方法的具体用法?C# BinaryReader.ReadSByte怎么用?C# BinaryReader.ReadSByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadSByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecodePackedFile
private void DecodePackedFile(BinaryReader reader)
{
reader.ReadSByte();
Packed_Section packedSection = new Packed_Section();
List<string> dictionary = packedSection.readDictionary(reader);
XmlNode xmlroot = xDoc.CreateNode(XmlNodeType.Element, PackedFileName, "");
packedSection.readElement(reader, xmlroot, xDoc, dictionary);
xDoc.AppendChild(xmlroot);
}
示例2: UserItem
public UserItem(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
{
UniqueID = reader.ReadUInt64();
ItemIndex = reader.ReadInt32();
CurrentDura = reader.ReadUInt16();
MaxDura = reader.ReadUInt16();
Count = reader.ReadUInt32();
AC = reader.ReadByte();
MAC = reader.ReadByte();
DC = reader.ReadByte();
MC = reader.ReadByte();
SC = reader.ReadByte();
Accuracy = reader.ReadByte();
Agility = reader.ReadByte();
HP = reader.ReadByte();
MP = reader.ReadByte();
AttackSpeed = reader.ReadSByte();
Luck = reader.ReadSByte();
if (version <= 19) return;
SoulBoundId = reader.ReadInt32();
byte Bools = reader.ReadByte();
Identified = (Bools & 0x01) == 0x01;
Cursed = (Bools & 0x02) == 0x02;
Strong = reader.ReadByte();
MagicResist = reader.ReadByte();
PoisonResist = reader.ReadByte();
HealthRecovery = reader.ReadByte();
ManaRecovery = reader.ReadByte();
PoisonRecovery = reader.ReadByte();
CriticalRate = reader.ReadByte();
CriticalDamage = reader.ReadByte();
Freezing = reader.ReadByte();
PoisonAttack = reader.ReadByte();
if (version <= 31) return;
int count = reader.ReadInt32();
for (int i = 0; i < count; i++)
{
if (reader.ReadBoolean()) continue;
UserItem item = new UserItem(reader, version, Customversion);
Slots[i] = item;
}
if (version <= 38) return;
GemCount = reader.ReadUInt32();
if (version <= 40) return;
Awake = new Awake(reader);
if (version <= 56) return;
RefinedValue = (RefinedValue)reader.ReadByte();
RefineAdded = reader.ReadByte();
if (version < 60) return;
WeddingRing = reader.ReadInt32();
if (version < 65) return;
if (reader.ReadBoolean())
{
ExpireInfo = new ExpireInfo(reader, version, Customversion);
}
}
示例3: ItemInfo
public ItemInfo(BinaryReader reader, int version = int.MaxValue, int Customversion = int.MaxValue)
{
Index = reader.ReadInt32();
Name = reader.ReadString();
Type = (ItemType) reader.ReadByte();
if (version >= 40) Grade = (ItemGrade)reader.ReadByte();
RequiredType = (RequiredType) reader.ReadByte();
RequiredClass = (RequiredClass) reader.ReadByte();
RequiredGender = (RequiredGender) reader.ReadByte();
if(version >= 17) Set = (ItemSet)reader.ReadByte();
Shape = version >= 30 ? reader.ReadInt16() : reader.ReadSByte();
Weight = reader.ReadByte();
Light = reader.ReadByte();
RequiredAmount = reader.ReadByte();
Image = reader.ReadUInt16();
Durability = reader.ReadUInt16();
StackSize = reader.ReadUInt32();
Price = reader.ReadUInt32();
MinAC = reader.ReadByte();
MaxAC = reader.ReadByte();
MinMAC = reader.ReadByte();
MaxMAC = reader.ReadByte();
MinDC = reader.ReadByte();
MaxDC = reader.ReadByte();
MinMC = reader.ReadByte();
MaxMC = reader.ReadByte();
MinSC = reader.ReadByte();
MaxSC = reader.ReadByte();
if (version < 25)
{
HP = reader.ReadByte();
MP = reader.ReadByte();
}
else
{
HP = reader.ReadUInt16();
MP = reader.ReadUInt16();
}
Accuracy = reader.ReadByte();
Agility = reader.ReadByte();
Luck = reader.ReadSByte();
AttackSpeed = reader.ReadSByte();
StartItem = reader.ReadBoolean();
BagWeight = reader.ReadByte();
HandWeight = reader.ReadByte();
WearWeight = reader.ReadByte();
if (version >= 9) Effect = reader.ReadByte();
if (version >= 20)
{
Strong = reader.ReadByte();
MagicResist = reader.ReadByte();
PoisonResist = reader.ReadByte();
HealthRecovery = reader.ReadByte();
SpellRecovery = reader.ReadByte();
PoisonRecovery = reader.ReadByte();
HPrate = reader.ReadByte();
MPrate = reader.ReadByte();
CriticalRate = reader.ReadByte();
CriticalDamage = reader.ReadByte();
byte bools = reader.ReadByte();
NeedIdentify = (bools & 0x01) == 0x01;
ShowGroupPickup = (bools & 0x02) == 0x02;
ClassBased = (bools & 0x04) == 0x04;
LevelBased = (bools & 0x08) == 0x08;
CanMine = (bools & 0x10) == 0x10;
MaxAcRate = reader.ReadByte();
MaxMacRate = reader.ReadByte();
Holy = reader.ReadByte();
Freezing = reader.ReadByte();
PoisonAttack = reader.ReadByte();
if (version < 55)
{
Bind = (BindMode)reader.ReadByte();
}
else
{
Bind = (BindMode)reader.ReadInt16();
}
}
if (version >= 21)
{
Reflect = reader.ReadByte();
HpDrainRate = reader.ReadByte();
Unique = (SpecialItemMode)reader.ReadInt16();
}
if (version >= 24)
{
RandomStatsId = reader.ReadByte();
}
else
{
//.........这里部分代码省略.........
示例4: LoadLevel
IEnumerator LoadLevel(string name)
{
GameObject[] gameobjects = GameObject.FindGameObjectsWithTag("CUBE");
BLOCK.electrics = new List<GameObject>();
int maxX = 0;
int minX = 0;
int maxY = 0;
int minY = 0;
int maxZ = 0;
int minZ = 0;
Debug.Log("Starting to load level");
float start = Time.realtimeSinceStartup;
WWW blockswww = new WWW(address + levelname + ".blocks");
yield return blockswww;
byte[] block = blockswww.bytes;
WWW metawww = new WWW(address + levelname + ".meta");
yield return metawww;
byte[] meta = metawww.bytes;
using (MemoryStream stream = new MemoryStream(block))
{
using (BinaryReader reader = new BinaryReader(stream))
{
using (MemoryStream metastream = new MemoryStream(meta))
{
using (BinaryReader metareader = new BinaryReader(metastream))
{
maxX = reader.ReadInt16();
maxY = reader.ReadInt16();
maxZ = reader.ReadInt16();
minX = reader.ReadInt16();
minY = reader.ReadInt16();
minZ = reader.ReadInt16();
//int xlenght = maxX - minX;
//int ylenght = maxY - minY;
//int zlenght = maxZ - minZ;
int x = minX;
int y = minY;
int z = minZ;
int cnt = 0;
int total = 0;
foreach (GameObject obj in gameobjects)
{
Destroy(obj);
}
blocks = new List<BLOCK>();
while (stream.Position < stream.Length)
{
sbyte id = reader.ReadSByte();
int metadata = 0;
if (id >= 0)
{
cnt++;
total++;
if (GlobalSettings.UsesMetaData[id])
{
try
{
metadata = metareader.ReadInt32();
}
catch { }
}
AddBlock(new Vector3(x, y, z), id, metadata);
z += 1;
if (z > maxZ)
{
z = minZ;
y += 1;
if (y > maxY)
{
y = minY;
x += 1;
if (x > maxX)
break;
}
}
}
else
{
cnt += 1;
int amount = -id;
for (int i = 0; i < amount; i++)
{
z += 1;
if (z > maxZ)
{
int diff = maxZ - minZ;
z = minZ;
y += 1;
if (y > maxY)
{
y = minY;
x += 1;
if (x > maxX)
break;
}
}
}
}
//.........这里部分代码省略.........
示例5: StreamTest
public static async Task StreamTest(Stream stream, Boolean fSuppress)
{
string strValue;
int iValue;
//[] We will first use the stream's 2 writing methods
int iLength = 1 << 10;
stream.Seek(0, SeekOrigin.Begin);
for (int i = 0; i < iLength; i++)
stream.WriteByte((byte)i);
byte[] btArr = new byte[iLength];
for (int i = 0; i < iLength; i++)
btArr[i] = (byte)i;
stream.Write(btArr, 0, iLength);
//we will write many things here using a binary writer
BinaryWriter bw1 = new BinaryWriter(stream);
bw1.Write(false);
bw1.Write(true);
for (int i = 0; i < 10; i++)
{
bw1.Write((byte)i);
bw1.Write((sbyte)i);
bw1.Write((short)i);
bw1.Write((char)i);
bw1.Write((UInt16)i);
bw1.Write(i);
bw1.Write((uint)i);
bw1.Write((Int64)i);
bw1.Write((ulong)i);
bw1.Write((float)i);
bw1.Write((double)i);
}
//Some strings, chars and Bytes
char[] chArr = new char[iLength];
for (int i = 0; i < iLength; i++)
chArr[i] = (char)i;
bw1.Write(chArr);
bw1.Write(chArr, 512, 512);
bw1.Write(new string(chArr));
bw1.Write(new string(chArr));
//[] we will now read
stream.Seek(0, SeekOrigin.Begin);
for (int i = 0; i < iLength; i++)
{
Assert.Equal(i % 256, stream.ReadByte());
}
btArr = new byte[iLength];
stream.Read(btArr, 0, iLength);
for (int i = 0; i < iLength; i++)
{
Assert.Equal((byte)i, btArr[i]);
}
//Now, for the binary reader
BinaryReader br1 = new BinaryReader(stream);
Assert.False(br1.ReadBoolean());
Assert.True(br1.ReadBoolean());
for (int i = 0; i < 10; i++)
{
Assert.Equal( (byte)i, br1.ReadByte());
Assert.Equal((sbyte)i, br1.ReadSByte());
Assert.Equal((short)i, br1.ReadInt16());
Assert.Equal((char)i, br1.ReadChar());
Assert.Equal((UInt16)i, br1.ReadUInt16());
Assert.Equal(i, br1.ReadInt32());
Assert.Equal((uint)i, br1.ReadUInt32());
Assert.Equal((Int64)i, br1.ReadInt64());
Assert.Equal((ulong)i, br1.ReadUInt64());
Assert.Equal((float)i, br1.ReadSingle());
Assert.Equal((double)i, br1.ReadDouble());
}
chArr = br1.ReadChars(iLength);
for (int i = 0; i < iLength; i++)
{
Assert.Equal((char)i, chArr[i]);
}
chArr = new char[512];
chArr = br1.ReadChars(iLength / 2);
for (int i = 0; i < iLength / 2; i++)
{
Assert.Equal((char)(iLength / 2 + i), chArr[i]);
}
chArr = new char[iLength];
for (int i = 0; i < iLength; i++)
//.........这里部分代码省略.........
示例6: runTest
public bool runTest()
{
Console.WriteLine(s_strTFPath + "\\" + s_strTFName + " , for " + s_strClassMethod + " , Source ver " + s_strDtTmVer);
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
String strValue = String.Empty;
try
{
BinaryWriter dw2 = null;
Stream fs2 = null;
BinaryReader dr2 = null;
FileInfo fil2 = null;
MemoryStream mstr = null;
SByte sbyt2 = 0;
int ii = 0;
String filName = s_strTFAbbrev+"Test.tmp";
if(File.Exists(filName))
File.Delete(filName);
strLoc = "Loc_8yfv7";
fil2 = new FileInfo(filName);
fs2 = fil2.Open(FileMode.Create);
dw2 = new BinaryWriter(fs2);
try
{
for(ii = 0 ; ii < sbArr.Length ; ii++)
dw2.Write(sbArr[ii]);
dw2.Flush();
fs2.Close();
strLoc = "Loc_987hg";
fs2 = fil2.Open(FileMode.Open);
dr2 = new BinaryReader(fs2);
for(ii = 0 ; ii < sbArr.Length ;ii++)
{
iCountTestcases++;
if((sbyt2 = dr2.ReadSByte()) != sbArr[ii])
{
iCountErrors++;
printerr( "Error_298hg_"+ii+"! Expected=="+sbArr[ii]+" , got=="+sbyt2);
}
}
iCountTestcases++;
try
{
sbyt2 = dr2.ReadSByte();
iCountErrors++;
printerr( "Error_2389! Expected exception not thrown, sbyt2=="+sbyt2);
}
catch (EndOfStreamException)
{
}
catch (Exception exc)
{
iCountErrors++;
printerr( "Error_3298h! Unexpected exception thrown, exc=="+exc.ToString());
}
}
catch (Exception exc)
{
iCountErrors++;
printerr( "Error_278gy! Unexpected exception, exc=="+exc.ToString());
}
fs2.Close();
fil2.Delete();
strLoc = "Loc_98yss";
mstr = new MemoryStream();
dw2 = new BinaryWriter(mstr);
try
{
for(ii = 0 ; ii < sbArr.Length ; ii++)
dw2.Write(sbArr[ii]);
dw2.Flush();
mstr.Position = 0;
strLoc = "Loc_287y5";
dr2 = new BinaryReader(mstr);
for(ii = 0 ; ii < sbArr.Length ;ii++)
{
iCountTestcases++;
if((sbyt2 = dr2.ReadSByte()) != sbArr[ii])
{
iCountErrors++;
printerr( "Error_48yf4_"+ii+"! Expected=="+sbArr[ii]+" , got=="+sbyt2);
}
}
iCountTestcases++;
try
{
sbyt2 = dr2.ReadSByte();
iCountErrors++;
printerr( "Error_2d847! Expected exception not thrown, sbyt2=="+sbyt2);
}
catch (EndOfStreamException)
{
}
catch (Exception exc)
{
iCountErrors++;
printerr( "Error_238gy! Unexpected exception thrown, exc=="+exc.ToString());
}
}
catch (Exception exc)
//.........这里部分代码省略.........
示例7: StartListeningTcp
public static void StartListeningTcp()
{
TcpThreadListener listener = new TcpThreadListener(0);
NetworkStream ns = null;
BinaryReader br = null;
try
{
listener.Start();
IPEndPoint ipe = (IPEndPoint) listener.LocalEndpoint;
Interlocked.Exchange(ref iPortNumber, ipe.Port);
Console.WriteLine("Using port: {0}", iPortNumber);
m_PortSetEvent.Set();
Socket s = listener.AcceptSocket();
ns = new NetworkStream(s);
br = new BinaryReader( ns );
SByte iTemp ;
for(int i = 0 ; i < sbArr.Length ; i++)
{
iTemp = br.ReadSByte();
if(iTemp != sbArr[i])
{
iCountErrors++;
Console.WriteLine( "Error_0000_"+i+"! Expected=="+sbArr[i]+", got=="+iTemp);
}
}
Console.WriteLine("We are done with the listening");
}
catch(Exception e)
{
iCountErrors++ ;
Console.WriteLine("Exception receiving Teleportation: " + e.Message + Environment.NewLine + e.StackTrace);
m_PortSetEvent.Set();
}
finally
{
if (listener != null)
{
listener.Stop();
}
if (ns != null)
{
ns.Close();
}
if(br != null)
{
br.Close();
}
} //finally
}
示例8: StreamTest
private Boolean StreamTest(Stream stream, Boolean fSuppress){
if(!fSuppress)
Console.WriteLine("Testing " + stream.GetType() + " for read/write tests");
String strValue;
Int32 iValue;
Int32 iLength = 1 << 10;
stream.Seek(0, SeekOrigin.Begin);
for(int i=0; i<iLength; i++)
stream.WriteByte((Byte)i);
Byte[] btArr = new Byte[iLength];
for(int i=0; i<iLength; i++)
btArr[i] = (Byte)i;
stream.Write(btArr, 0, iLength);
BinaryWriter bw1 = new BinaryWriter(stream);
bw1.Write(false);
bw1.Write(true);
for(int i=0; i<10; i++){
bw1.Write((Byte)i);
bw1.Write((SByte)i);
bw1.Write((Int16)i);
bw1.Write((Char)i);
bw1.Write((UInt16)i);
bw1.Write(i);
bw1.Write((UInt32)i);
bw1.Write((Int64)i);
bw1.Write((UInt64)i);
bw1.Write((Single)i);
bw1.Write((Double)i);
}
Char[] chArr = new Char[iLength];
for(int i=0; i<iLength;i++)
chArr[i] = (Char)i;
bw1.Write(chArr);
bw1.Write(chArr, 512, 512);
bw1.Write(new String(chArr));
bw1.Write(new String(chArr));
stream.Seek(0, SeekOrigin.Begin);
for(int i=0; i<iLength; i++){
if(stream.ReadByte() != i%256){
return false;
}
}
btArr = new Byte[iLength];
stream.Read(btArr, 0, iLength);
for(int i=0; i<iLength; i++){
if(btArr[i] != (Byte)i){
Console.WriteLine(i + " " + btArr[i] + " " + (Byte)i);
return false;
}
}
BinaryReader br1 = new BinaryReader(stream);
if(br1.ReadBoolean())
return false;
if(!br1.ReadBoolean())
return false;
for(int i=0; i<10; i++){
if(br1.ReadByte() != (Byte)i)
return false;
if(br1.ReadSByte() != (SByte)i)
return false;
if(br1.ReadInt16() != (Int16)i)
return false;
if(br1.ReadChar() != (Char)i)
return false;
if(br1.ReadUInt16() != (UInt16)i)
return false;
if(br1.ReadInt32() != i)
return false;
if(br1.ReadUInt32() != (UInt32)i)
return false;
if(br1.ReadInt64() != (Int64)i)
return false;
if(br1.ReadUInt64() != (UInt64)i)
return false;
if(br1.ReadSingle() != (Single)i)
return false;
if(br1.ReadDouble() != (Double)i)
return false;
}
chArr = br1.ReadChars(iLength);
for(int i=0; i<iLength;i++){
if(chArr[i] != (Char)i)
return false;
}
chArr = new Char[512];
chArr = br1.ReadChars(iLength/2);
for(int i=0; i<iLength/2;i++){
if(chArr[i] != (Char)(iLength/2+i))
return false;
}
chArr = new Char[iLength];
for(int i=0; i<iLength;i++)
chArr[i] = (Char)i;
strValue = br1.ReadString();
if(!strValue.Equals(new String(chArr)))
return false;
strValue = br1.ReadString();
if(!strValue.Equals(new String(chArr))){
return false;
}
//.........这里部分代码省略.........
示例9: runTest
//.........这里部分代码省略.........
sr2.ReadInt16();
iCountErrors++;
printerr( "Error_92889! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo("Info_768g8! Caught expected exception, exc=="+iexc.Message);
} catch(Exception exc) {
iCountErrors++;
printerr( "Error_0160t! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadInt32();
iCountErrors++;
printerr( "Error_109g7! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_0198v! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_10796! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadInt64();
iCountErrors++;
printerr( "Error_967gb! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_10860! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_1067b! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadSByte();
iCountErrors++;
printerr( "Error_16908! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_1768b! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_1769g! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadString();
iCountErrors++;
printerr( "Error_t5087! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_35987! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_t87bb! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
sr2.ReadSingle();
iCountErrors++;
printerr( "Error_5698v! Expected exception not thrown");
} catch (ObjectDisposedException iexc) {
printinfo( "Info_6987y! Caught expected exception, exc=="+iexc.Message);
} catch (Exception exc) {
iCountErrors++;
printerr( "Error_298xa! Incorrect exception thrown, exc=="+exc.ToString());
}
iCountTestcases++;
try {
示例10: InternalDeserializeInstance
private static object InternalDeserializeInstance( BinaryReader reader, object o, Type t )
{
if( o != null )
t = o.GetType( );
if( o != null && ( o.GetType( ) != t ) )
throw new ArgumentException( "type 't' doesn't match provided object 'o'" );
if( t == typeof( Boolean ) )
return reader.ReadBoolean( );
if( t == typeof( Char ) )
return reader.ReadChar( );
if( t == typeof( SByte ) )
return reader.ReadSByte( );
if( t == typeof( Byte ) )
return reader.ReadByte( );
if( t == typeof( Int16 ) )
return reader.ReadInt16( );
if( t == typeof( UInt16 ) )
return reader.ReadUInt16( );
if( t == typeof( Int32 ) )
return reader.ReadInt32( );
if( t == typeof( UInt32 ) )
return reader.ReadUInt32( );
if( t == typeof( Int64 ) )
return reader.ReadInt64( );
if( t == typeof( UInt64 ) )
return reader.ReadUInt64( );
//
// if(t==typeof(Single))
// return reader.ReadSingle();
//
// if(t==typeof(Double))
// return reader.ReadDouble();
if( t == typeof( String ) )
return reader.ReadString( );
// arrays introduce too many complications to support at this time
// far to many border or special case considerations need to be accounted
// for; the entire implementation of this class needs a re-design to
// do that adequately.
if( t.IsArray )
throw new ArgumentException( "Arrays are not supported for serialization" );
if( !t.IsValueType && !t.IsClass )
throw new ArgumentException( "unsupported type for parameter 'o'" );
BinarySerializer.DeserializeFields( reader, o );
return o;
}
示例11: UserItem
public UserItem(BinaryReader reader, int version = int.MaxValue)
{
UniqueID = reader.ReadUInt64();
ItemIndex = reader.ReadInt32();
CurrentDura = reader.ReadUInt16();
MaxDura = reader.ReadUInt16();
Count = reader.ReadUInt32();
AC = reader.ReadByte();
MAC = reader.ReadByte();
DC = reader.ReadByte();
MC = reader.ReadByte();
SC = reader.ReadByte();
Accuracy = reader.ReadByte();
Agility = reader.ReadByte();
HP = reader.ReadByte();
MP = reader.ReadByte();
AttackSpeed = reader.ReadSByte();
Luck = reader.ReadSByte();
}
示例12: ItemInfo
public ItemInfo(BinaryReader reader, int version = int.MaxValue)
{
Index = reader.ReadInt32();
Name = reader.ReadString();
Type = (ItemType) reader.ReadByte();
RequiredType = (RequiredType) reader.ReadByte();
RequiredClass = (RequiredClass) reader.ReadByte();
RequiredGender = (RequiredGender) reader.ReadByte();
Shape = reader.ReadSByte();
Weight = reader.ReadByte();
Light = reader.ReadByte();
RequiredAmount = reader.ReadByte();
Image = reader.ReadUInt16();
Durability = reader.ReadUInt16();
StackSize = reader.ReadUInt32();
Price = reader.ReadUInt32();
MinAC = reader.ReadByte();
MaxAC = reader.ReadByte();
MinMAC = reader.ReadByte();
MaxMAC = reader.ReadByte();
MinDC = reader.ReadByte();
MaxDC = reader.ReadByte();
MinMC = reader.ReadByte();
MaxMC = reader.ReadByte();
MinSC = reader.ReadByte();
MaxSC = reader.ReadByte();
HP = reader.ReadByte();
MP = reader.ReadByte();
Accuracy = reader.ReadByte();
Agility = reader.ReadByte();
Luck = reader.ReadSByte();
AttackSpeed = reader.ReadSByte();
StartItem = reader.ReadBoolean();
BagWeight = reader.ReadByte();
HandWeight = reader.ReadByte();
WearWeight = reader.ReadByte();
if (version >= 9) Effect = reader.ReadByte();
}
示例13: ItemData
public ItemData(BinaryReader br)
{
m_iID = br.ReadInt32();
m_iNameID = br.ReadInt32();
m_iDestID = br.ReadInt32();
m_eItemType = (Item.eITEM_TYPE)br.ReadInt32();
m_iSubType = br.ReadInt32();
m_GoodsType = (Item.eGOODS_TYPE)br.ReadInt32();
m_eGrade = (Item.eGRADE)br.ReadInt32();
m_iBuyAmount = br.ReadInt32();
m_iSellAmount = br.ReadInt32();
m_iRankPoint = br.ReadInt32();
m_eGender = (eGENDER)br.ReadInt32();
m_iLevelLimit = br.ReadInt32();
#region - eCLASS parsing within PET -
if( CheckPetItem() == true)
{
petClass_ = br.ReadString();
m_eNeedClass = eCLASS.PET;
}
else
m_eNeedClass = (eCLASS)br.ReadInt32();
#endregion
m_iOverlapCount = br.ReadInt32();
m_sbItemTradeLimit = br.ReadSByte();
m_eUseTimeType = (Item.eUSE_TIME_TYPE)br.ReadInt32();
m_iItemUseTime = br.ReadInt32();
// m_bItem_Onlyone = br.ReadBoolean();
m_bItem_Storage_Limit = br.ReadBoolean();
m_bDropSeal = br.ReadBoolean();
m_bDump = br.ReadBoolean();
m_bItemStrengthen = br.ReadBoolean();
m_bShopSell = br.ReadBoolean();
m_iItem_PatkDmg_Min = br.ReadInt32();
m_iItem_PatkDmg_Max = br.ReadInt32();
m_iItem_MatkDmg_Min = br.ReadInt32();
m_iItem_MatkDmg_Max = br.ReadInt32();
m_iItem_Pdef = br.ReadInt32();
m_iItem_Mdef = br.ReadInt32();
m_iItem_SkilI_ID = br.ReadInt32();
m_iItem_Skill_Level = br.ReadInt32();
m_isItem_OptionType = br.ReadBoolean();
m_iItem_Fix1_ID = (eITEM_EFFECT)br.ReadInt32();
m_iItem_Fix1_Value = br.ReadInt32();
m_iItem_Fix2_ID = (eITEM_EFFECT)br.ReadInt32();
m_iItem_Fix2_Value = br.ReadInt32();
m_iItem_Rand_ID = br.ReadInt32();
m_iItem_SetGroup_ID = br.ReadInt32();
m_strIcon = br.ReadString();
m_strDropItem = br.ReadString();
m_iItem_Buy_Limit = br.ReadInt32();
m_strPartsItem_M = br.ReadString();
m_strPartsItem_W = br.ReadString();
m_strPartsDiff_M = br.ReadString();
m_strPartsDiff_W = br.ReadString();
m_strDropSound = br.ReadString();
//m_strRootSound = br.ReadString();//kij
m_strUseSound = br.ReadString();
//m_strItemHitSound = br.ReadString();//kij
//m_strItem_Root_Effect = br.ReadString();//kij
//m_strItem_Hit_Effect = br.ReadString();//kij
m_Item_Costume_PatkDmg = br.ReadInt32();
m_Item_Costume_MatkDmg = br.ReadInt32();
m_Item_Costume_Pdef = br.ReadInt32();
m_Item_Costume_Mdef = br.ReadInt32();
m_Item_Disassemble = (eItem_Disassemble)br.ReadInt32();
m_Item_MixEnchant = br.ReadBoolean();
m_AbsorbExp = br.ReadInt32();
}
示例14: UserItem
public UserItem(BinaryReader reader, int version = int.MaxValue)
{
UniqueID = reader.ReadUInt64();
ItemIndex = reader.ReadInt32();
CurrentDura = reader.ReadUInt16();
MaxDura = reader.ReadUInt16();
Count = reader.ReadUInt32();
AC = reader.ReadByte();
MAC = reader.ReadByte();
DC = reader.ReadByte();
MC = reader.ReadByte();
SC = reader.ReadByte();
Accuracy = reader.ReadByte();
Agility = reader.ReadByte();
HP = reader.ReadByte();
MP = reader.ReadByte();
AttackSpeed = reader.ReadSByte();
Luck = reader.ReadSByte();
if (version <= 19) return;
SoulBoundId = reader.ReadInt32();
byte Bools = reader.ReadByte();
Identified = (Bools & 0x01) == 0x01;
Cursed = (Bools & 0x02) == 0x02;
Strong = reader.ReadByte();
MagicResist = reader.ReadByte();
PoisonResist = reader.ReadByte();
HealthRecovery = reader.ReadByte();
ManaRecovery = reader.ReadByte();
PoisonRecovery = reader.ReadByte();
CriticalRate = reader.ReadByte();
CriticalDamage = reader.ReadByte();
Freezing = reader.ReadByte();
PoisonAttack = reader.ReadByte();
if (version <= 22) return;
}
示例15: OnPrtc_GameDataSend
public static int OnPrtc_GameDataSend(IntPtr L)
{
IntPtr objptr = LuaDLL.lua_touserdata(L, 1);
GNET.CommonData proto = null;
System.Object temp = default(System.Object);
if (LuaStatic.GetObj(objptr, out temp))
{
proto = (GNET.CommonData)temp;
}
else
{
LuaStatic.traceback(L);
LuaDLL.lua_error(L);
return 1;
}
OctetsStream os = proto.GetData();
Octets data = os.unmarshal_Octets();
//UInt16 server_send_time = os.unmarshal_ushort();
//UInt16 client_send_time = os.unmarshal_ushort();
MemoryStream mms = new MemoryStream(data.buffer(), 0, data.size());
BinaryReader br = new BinaryReader(mms);
UInt16 cmd_type = br.ReadUInt16();
//double dt = server_send_time - ECTimeManager.GetMillisecondsFromEpoch();
//ECTimeManager.ServerDeltaTime = dt;
double dt = 0;
if (m_bProtoStaticEnable)
{
if (!protocols.ContainsKey(cmd_type))
protocols[cmd_type] = 1;
else
protocols[cmd_type] = protocols[cmd_type] + 1;
if (!proto_times.ContainsKey(cmd_type))
proto_times[cmd_type] = 0;
}
int start = DateTime.Now.Millisecond;
//Debug.LogWarning("cmd " + cmd_type);
if (ECGameSession.GameDataSendFilterList.ContainsKey(cmd_type))
{
LuaDLL.lua_getglobal(L, "ProcessGameDataSend");
LuaDLL.lua_pushnumber(L, cmd_type);
LuaStatic.addGameObject2Lua(L, br, "BinaryReader");
LuaDLL.lua_pushnumber(L, dt);
wLua.L.Call(3);
}
else if (cmd_type == 26) // OBJECT_MOVE
{
int new_who = br.ReadInt32();
float x = br.ReadSingle();
float y = br.ReadSingle();
float z = br.ReadSingle();
UInt16 flags = br.ReadUInt16();
UInt16 move_dir = br.ReadUInt16();
//UInt16 use_time = br.ReadUInt16();
UInt16 speed = br.ReadUInt16();
LuaDLL.lua_getglobal(L, "OnObjectMove");
LuaDLL.lua_pushnumber(L, dt);
LuaDLL.lua_pushnumber(L, new_who);
LuaDLL.lua_pushnumber(L, x);
LuaDLL.lua_pushnumber(L, y);
LuaDLL.lua_pushnumber(L, z);
LuaDLL.lua_pushnumber(L, flags);
LuaDLL.lua_pushnumber(L, move_dir);
//LuaDLL.lua_pushnumber(L, use_time);
LuaDLL.lua_pushnumber(L, speed);
wLua.L.Call(8);
}
else if (cmd_type == 27) // OBJECT_TURN
{
int new_who = br.ReadInt32();
UInt16 flags = br.ReadUInt16();
UInt16 dir = br.ReadUInt16();
LuaDLL.lua_getglobal(L, "OnObjectTurn");
LuaDLL.lua_pushnumber(L, dt);
LuaDLL.lua_pushnumber(L, new_who);
LuaDLL.lua_pushnumber(L, flags);
LuaDLL.lua_pushnumber(L, dir);
wLua.L.Call(4);
}
else if (cmd_type == 36) // OBJECT_NOTIFY_PROP_DELTA
{
int new_who = br.ReadInt32();
sbyte count = br.ReadSByte();
LuaDLL.lua_getglobal(L, "OnObjectNotifyPropDelta");
LuaDLL.lua_pushnumber(L, dt);
LuaDLL.lua_pushinteger(L, new_who);
LuaDLL.lua_pushinteger(L, count * 2);
CreateCacheTable(L, "ct36");
int j = 1;
//.........这里部分代码省略.........