本文整理汇总了C#中KBEngine.MemoryStream.readInt8方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryStream.readInt8方法的具体用法?C# MemoryStream.readInt8怎么用?C# MemoryStream.readInt8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KBEngine.MemoryStream
的用法示例。
在下文中一共展示了MemoryStream.readInt8方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Client_onEntityEnterWorld
/*
服务端通知一个实体进入了世界(如果实体是当前玩家则玩家第一次在一个space中创建了, 如果是其他实体则是其他实体进入了玩家的AOI)
*/
public void Client_onEntityEnterWorld(MemoryStream stream)
{
Int32 eid = stream.readInt32();
if(entity_id > 0 && entity_id != eid)
_entityIDAliasIDList.Add(eid);
UInt16 uentityType;
if(EntityDef.idmoduledefs.Count > 255)
uentityType = stream.readUint16();
else
uentityType = stream.readUint8();
sbyte isOnGround = 1;
if(stream.length() > 0)
isOnGround = stream.readInt8();
string entityType = EntityDef.idmoduledefs[uentityType].name;
// Dbg.DEBUG_MSG("KBEngine::Client_onEntityEnterWorld: " + entityType + "(" + eid + "), spaceID(" + KBEngineApp.app.spaceID + ")!");
Entity entity = null;
if(!entities.TryGetValue(eid, out entity))
{
MemoryStream entityMessage = null;
if(!_bufferedCreateEntityMessage.TryGetValue(eid, out entityMessage))
{
Dbg.ERROR_MSG("KBEngine::Client_onEntityEnterWorld: entity(" + eid + ") not found!");
return;
}
ScriptModule module = null;
if(!EntityDef.moduledefs.TryGetValue(entityType, out module))
{
Dbg.ERROR_MSG("KBEngine::Client_onEntityEnterWorld: not found module(" + entityType + ")!");
}
Type runclass = module.script;
if(runclass == null)
return;
entity = (Entity)Activator.CreateInstance(runclass);
entity.id = eid;
entity.className = entityType;
entity.cellMailbox = new Mailbox();
entity.cellMailbox.id = eid;
entity.cellMailbox.className = entityType;
entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;
entities[eid] = entity;
Client_onUpdatePropertys(entityMessage);
_bufferedCreateEntityMessage.Remove(eid);
entity.isOnGround = isOnGround > 0;
entity.set_direction(entity.getDefinedPropterty("direction"));
entity.set_position(entity.getDefinedPropterty("position"));
entity.__init__();
entity.enterWorld();
}
else
{
if(!entity.inWorld)
{
// 安全起见, 这里清空一下
// 如果服务端上使用giveClientTo切换控制权
// 之前的实体已经进入世界, 切换后的实体也进入世界, 这里可能会残留之前那个实体进入世界的信息
_entityIDAliasIDList.Clear();
clearEntities(false);
entities[entity.id] = entity;
entity.cellMailbox = new Mailbox();
entity.cellMailbox.id = eid;
entity.cellMailbox.className = entityType;
entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;
entity.set_direction(entity.getDefinedPropterty("direction"));
entity.set_position(entity.getDefinedPropterty("position"));
_entityServerPos = entity.position;
entity.isOnGround = isOnGround > 0;
entity.enterWorld();
}
}
}
示例2: Client_onUpdateData_r
public void Client_onUpdateData_r(MemoryStream stream)
{
Int32 eid = getAoiEntityIDFromStream(stream);
SByte r = stream.readInt8();
_updateVolatileData(eid, 0.0f, 0.0f, 0.0f, KBEDATATYPE_BASE.KBE_FLT_MAX, KBEDATATYPE_BASE.KBE_FLT_MAX, r, -1);
}
示例3: onImportClientMessages
public void onImportClientMessages(MemoryStream stream)
{
UInt16 msgcount = stream.readUint16();
Dbg.DEBUG_MSG(string.Format("KBEngine::Client_onImportClientMessages: start currserver=" + currserver + "(msgsize={0})...", msgcount));
while(msgcount > 0)
{
msgcount--;
MessageID msgid = stream.readUint16();
Int16 msglen = stream.readInt16();
string msgname = stream.readString();
sbyte argstype = stream.readInt8();
Byte argsize = stream.readUint8();
List<Byte> argstypes = new List<Byte>();
for(Byte i=0; i<argsize; i++)
{
argstypes.Add(stream.readUint8());
}
System.Reflection.MethodInfo handler = null;
bool isClientMethod = msgname.Contains("Client_");
if(isClientMethod)
{
handler = typeof(KBEngineApp).GetMethod(msgname);
if(handler == null)
{
Dbg.WARNING_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: interface({1}/{2}/{3}) no implement!",
currserver, msgname, msgid, msglen));
handler = null;
}
else
{
//Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages: imported({0}/{1}/{2}) successfully!",
// msgname, msgid, msglen));
}
}
if(msgname.Length > 0)
{
Message.messages[msgname] = new Message(msgid, msgname, msglen, argstype, argstypes, handler);
//if(!isClientMethod)
// Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: imported({1}/{2}/{3}) successfully!",
// currserver, msgname, msgid, msglen));
if(isClientMethod)
{
Message.clientMessages[msgid] = Message.messages[msgname];
}
else
{
if(currserver == "loginapp")
Message.loginappMessages[msgid] = Message.messages[msgname];
else
Message.baseappMessages[msgid] = Message.messages[msgname];
}
}
else
{
Message msg = new Message(msgid, msgname, msglen, argstype, argstypes, handler);
//if(!isClientMethod)
// Dbg.DEBUG_MSG(string.Format("KBEngine::onImportClientMessages[{0}]: imported({1}/{2}/{3}) successfully!",
// currserver, msgname, msgid, msglen));
if(currserver == "loginapp")
Message.loginappMessages[msgid] = msg;
else
Message.baseappMessages[msgid] = msg;
}
};
onImportClientMessagesCompleted();
}
示例4: Client_onEntityEnterSpace
/*
服务端通知当前玩家进入了一个新的space
*/
public void Client_onEntityEnterSpace(MemoryStream stream)
{
Int32 eid = stream.readInt32();
spaceID = stream.readUint32();
sbyte isOnGround = 1;
if(stream.length() > 0)
isOnGround = stream.readInt8();
Entity entity = null;
if(!entities.TryGetValue(eid, out entity))
{
Dbg.ERROR_MSG("KBEngine::Client_onEntityEnterSpace: entity(" + eid + ") not found!");
return;
}
entity.isOnGround = isOnGround > 0;
_entityServerPos = entity.position;
entity.enterSpace();
}
示例5: Client_onUpdateData_xz_yp
public void Client_onUpdateData_xz_yp(MemoryStream stream)
{
Int32 eid = stream.readInt32();
Vector2 xz = stream.readPackXZ();
SByte y = stream.readInt8();
SByte p = stream.readInt8();
_updateVolatileData(eid, xz[0], 0.0f, xz[1], y, p, KBE_FLT_MAX);
}
示例6: Client_onUpdateData_ypr
public void Client_onUpdateData_ypr(MemoryStream stream)
{
Int32 eid = getAoiEntityIDFromStream(stream);
SByte y = stream.readInt8();
SByte p = stream.readInt8();
SByte r = stream.readInt8();
_updateVolatileData(eid, 0.0f, 0.0f, 0.0f, y, p, r, -1);
}
示例7: Client_onUpdateData_r
public void Client_onUpdateData_r(MemoryStream stream)
{
Int32 eid = stream.readInt32();
SByte r = stream.readInt8();
_updateVolatileData(eid, 0.0f, 0.0f, 0.0f, KBE_FLT_MAX, KBE_FLT_MAX, r);
}
示例8: createFromStream
public override object createFromStream(MemoryStream stream)
{
return stream.readInt8();
}
示例9: Client_onUpdateData_xyz_ypr
public void Client_onUpdateData_xyz_ypr(MemoryStream stream)
{
Int32 eid = getAoiEntityIDFromStream(stream);
Vector2 xz = stream.readPackXZ();
float y = stream.readPackY();
SByte yaw = stream.readInt8();
SByte p = stream.readInt8();
SByte r = stream.readInt8();
_updateVolatileData(eid, xz[0], y, xz[1], yaw, p, r);
}
示例10: Client_onUpdateData_ypr
public void Client_onUpdateData_ypr(MemoryStream stream)
{
Int32 eid = stream.readInt32();
SByte y = stream.readInt8();
SByte p = stream.readInt8();
SByte r = stream.readInt8();
_updateVolatileData(eid, 0.0f, 0.0f, 0.0f, y, p, r);
}
示例11: Client_onUpdateData_p
public void Client_onUpdateData_p(MemoryStream stream)
{
Int32 eid = getAoiEntityIDFromStream(stream);
SByte p = stream.readInt8();
_updateVolatileData(eid, 0.0f, 0.0f, 0.0f, KBE_FLT_MAX, p, KBE_FLT_MAX);
}
示例12: Client_onUpdateData_xz_y
public void Client_onUpdateData_xz_y(MemoryStream stream)
{
Int32 eid = getAoiEntityIDFromStream(stream);
Vector2 xz = stream.readPackXZ();
SByte yaw = stream.readInt8();
_updateVolatileData(eid, xz[0], 0.0f, xz[1], yaw, KBE_FLT_MAX, KBE_FLT_MAX);
}
示例13: Client_onEntityEnterWorld
public void Client_onEntityEnterWorld(MemoryStream stream)
{
Int32 eid = stream.readInt32();
if(entity_id > 0 && entity_id != eid)
entityIDAliasIDList.Add(eid);
UInt16 uentityType;
if(EntityDef.idmoduledefs.Count > 255)
uentityType = stream.readUint16();
else
uentityType = stream.readUint8();
sbyte isOnGound = 1;
if(stream.opsize() > 0)
isOnGound = stream.readInt8();
string entityType = EntityDef.idmoduledefs[uentityType].name;
Dbg.DEBUG_MSG("KBEngine::Client_onEntityEnterWorld: " + entityType + "(" + eid + "), spaceID(" + KBEngineApp.app.spaceID + ")!");
Entity entity = null;
if(!entities.TryGetValue(eid, out entity))
{
MemoryStream entityMessage = null;
if(!bufferedCreateEntityMessage.TryGetValue(eid, out entityMessage))
{
Dbg.ERROR_MSG("KBEngine::Client_onEntityEnterWorld: entity(" + eid + ") not found!");
return;
}
Type runclass = EntityDef.moduledefs[entityType].script;
if(runclass == null)
return;
entity = (Entity)Activator.CreateInstance(runclass);
entity.id = eid;
entity.classtype = entityType;
entity.cellMailbox = new Mailbox();
entity.cellMailbox.id = eid;
entity.cellMailbox.classtype = entityType;
entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;
entities[eid] = entity;
Client_onUpdatePropertys(entityMessage);
bufferedCreateEntityMessage.Remove(eid);
entity.isOnGound = isOnGound > 0;
entity.__init__();
entity.onEnterWorld();
Event.fireOut("set_direction", new object[]{entity});
Event.fireOut("set_position", new object[]{entity});
}
else
{
if(!entity.inWorld)
{
entity.cellMailbox = new Mailbox();
entity.cellMailbox.id = eid;
entity.cellMailbox.classtype = entityType;
entity.cellMailbox.type = Mailbox.MAILBOX_TYPE.MAILBOX_TYPE_CELL;
entityServerPos = entity.position;
entity.isOnGound = isOnGound > 0;
entity.onEnterWorld();
}
}
}
示例14: Client_onUpdateData_xyz_yr
public void Client_onUpdateData_xyz_yr(MemoryStream stream)
{
Int32 eid = getAoiEntityIDFromStream(stream);
Vector2 xz = stream.readPackXZ();
float y = stream.readPackY();
SByte yaw = stream.readInt8();
SByte r = stream.readInt8();
_updateVolatileData(eid, xz[0], y, xz[1], yaw, KBEDATATYPE_BASE.KBE_FLT_MAX, r, 0);
}
示例15: Client_onUpdateData_xyz_yr
public void Client_onUpdateData_xyz_yr(MemoryStream stream)
{
Int32 eid = stream.readInt32();
Vector2 xz = stream.readPackXZ();
float y = stream.readPackY();
SByte yaw = stream.readInt8();
SByte r = stream.readInt8();
_updateVolatileData(eid, xz[0], y, xz[1], yaw, KBE_FLT_MAX, r);
}