本文整理汇总了C#中ReceiveDataReader.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# ReceiveDataReader.ReadString方法的具体用法?C# ReceiveDataReader.ReadString怎么用?C# ReceiveDataReader.ReadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReceiveDataReader
的用法示例。
在下文中一共展示了ReceiveDataReader.ReadString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReceiveMessage_TransferMessageToServer
private bool ReceiveMessage_TransferMessageToServer(NetworkNode.ConnectedNode sender,
MessageType messageType, ReceiveDataReader reader, ref string error)
{
string message = reader.ReadString();
string data = reader.ReadString();
if (!reader.Complete())
return false;
if (ReceiveMessage != null)
ReceiveMessage(this, sender, message, data);
return true;
}
示例2: ReceiveMessage_TransferMessageToClient
bool ReceiveMessage_TransferMessageToClient( NetworkNode.ConnectedNode sender,
MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
{
string message = reader.ReadString();
string data = reader.ReadString();
if( !reader.Complete() )
return false;
if( ReceiveMessage != null )
ReceiveMessage( this, message, data );
return true;
}
示例3: ReceiveMessage_TextToClient
bool ReceiveMessage_TextToClient( NetworkNode.ConnectedNode sender,
MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
{
//get data from message
uint fromUserIdentifier = reader.ReadVariableUInt32();
string text = reader.ReadString();
if( !reader.Complete() )
return false;
//get user by identifier
UserManagementClientNetworkService.UserInfo fromUser = userManagementService.GetUser(
fromUserIdentifier );
if( fromUser == null )
{
//error. no such user.
return true;
}
if( ReceiveText != null )
ReceiveText( this, fromUser, text );
return true;
}
示例4: ReceiveMessage_TextToServer
private bool ReceiveMessage_TextToServer(NetworkNode.ConnectedNode sender,
MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
{
//get source user
UserManagementServerNetworkService.UserInfo fromUser = userManagementService.
GetUser(sender);
//get data of message
string text = reader.ReadString();
uint privateToUserIdentifier = reader.ReadVariableUInt32();
if (!reader.Complete())
return false;
//send text to the clients
if (privateToUserIdentifier != 0)
{
//send text to the specific user
UserManagementServerNetworkService.UserInfo privateToUser = userManagementService.
GetUser(privateToUserIdentifier);
if (privateToUser != null)
{
SendText(fromUser, text, privateToUser);
}
else
{
//no user anymore
}
}
else
{
SendText(fromUser, text, null);
}
return true;
}
示例5: Client_ReceiveFaction
void Client_ReceiveFaction(RemoteEntityWorld sender, ReceiveDataReader reader)
{
string s = reader.ReadString();
if (!reader.Complete())
return;
text = s;
}
示例6: ReceiveMessage_WorldCreateBeginToClient
bool ReceiveMessage_WorldCreateBeginToClient( NetworkNode.ConnectedNode sender,
MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
{
string worldTypeName = reader.ReadString();
string mapVirtualFileName = reader.ReadString();
if( !reader.Complete() )
return false;
bool remoteWorldAlreadyExists = EntitySystemWorld.Instance.RemoteEntityWorlds.Contains(
serverRemoteEntityWorld );
if( !remoteWorldAlreadyExists )
{
serverRemoteEntityWorld = new RemoteEntityWorld( "Server remote entity world" );
networkingInterface.ConnectRemoteEntityWorld( serverRemoteEntityWorld );
}
WorldType worldType = EntityTypes.Instance.GetByName( worldTypeName ) as WorldType;
if( worldType == null )
{
Log.Fatal( "EntitySystemClientNetworkService: " +
"ReceiveMessage_WorldCreateBeginToClient: World type \"{0}\" is not exists.",
worldTypeName );
}
if( WorldCreateBegin != null )
WorldCreateBegin( this, worldType, mapVirtualFileName );
return true;
}
示例7: ReceiveMessage_WorldCreateBeginToClient
private bool ReceiveMessage_WorldCreateBeginToClient(NetworkNode.ConnectedNode sender,
MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
{
string worldTypeName = reader.ReadString();
string mapVirtualFileName = reader.ReadString();
int worldCheckIdentifier = reader.ReadInt32();
if (!reader.Complete())
return false;
//send world identifier back to server
{
MessageType messageType2 = GetMessageType("worldIdentifierToServer");
SendDataWriter writer = BeginMessage(messageType2);
writer.Write(worldCheckIdentifier);
EndMessage();
}
bool remoteWorldAlreadyExists = EntitySystemWorld.Instance.RemoteEntityWorlds.Contains(
serverRemoteEntityWorld);
if (!remoteWorldAlreadyExists)
{
serverRemoteEntityWorld = new RemoteEntityWorld("Server remote entity world");
networkingInterface.ConnectRemoteEntityWorld(serverRemoteEntityWorld);
}
WorldType worldType = EntityTypes.Instance.GetByName(worldTypeName) as WorldType;
if (worldType == null)
{
Log.Fatal("EntitySystemClientNetworkService: " +
"ReceiveMessage_WorldCreateBeginToClient: World type \"{0}\" is not exists.",
worldTypeName);
}
if (WorldCreateBegin != null)
WorldCreateBegin(this, worldType, mapVirtualFileName);
return true;
}
示例8: Client_ReceiveSupportedUnits
void Client_ReceiveSupportedUnits(RemoteEntityWorld sender, ReceiveDataReader reader)
{
string supportedTypes = reader.ReadString();
if (!reader.Complete())
return;
char[] supportedUnits = supportedTypes.ToCharArray();
foreach (char c in supportedUnits)
{
int i = int.Parse(c.ToString());
Hangar_Vehicle_Type hvt = (Hangar_Vehicle_Type)i;
if (!VehicleType.Contains(hvt))
VehicleType.Add(hvt);
}
}
示例9: Server_ReceiveSpawnRequest
void Server_ReceiveSpawnRequest(RemoteEntityWorld sender, ReceiveDataReader reader)
{
string unitTypeName = reader.ReadString();
string variantText = reader.ReadString();
if (!reader.Complete())
return;
UnitType ut = (UnitType)EntityTypes.Instance.GetByName(unitTypeName);
string[] broken = variantText.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
int[] finalData = new int[broken.Length];
for (int i = 0; i < broken.Length; i++)
finalData[i] = int.Parse(broken[i]);
SpawnNewUnit(ut, finalData);
}
示例10: ReceiveMessage_AddUserToClient
private bool ReceiveMessage_AddUserToClient(NetworkNode.ConnectedNode sender,
MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
{
//get data from message
uint identifier = reader.ReadVariableUInt32();
string name = reader.ReadString();
bool thisUserFlag = reader.ReadBoolean();
if (!reader.Complete())
return false;
AddUser(identifier, name, thisUserFlag);
return true;
}
示例11: Client_ReceivePropertiesToClient
void Client_ReceivePropertiesToClient( RemoteEntityWorld sender, ReceiveDataReader reader )
{
Size = reader.ReadVec2();
Position = reader.ReadVec3();
Segments = reader.ReadVec2i();
RenderQueueGroup = (RenderQueueGroupID)reader.ReadVariableUInt32();
ReflectionLevel = (ReflectionLevels)reader.ReadVariableUInt32();
PhysicsHeight = reader.ReadSingle();
DeepColor = reader.ReadColorValue();
ShallowColor = reader.ReadColorValue();
ReflectionColor = reader.ReadColorValue();
ReflectionTextureSize = (ReflectionTextureSizes)reader.ReadVariableUInt32();
FixedPipelineMap = reader.ReadString();
FixedPipelineMapTiling = reader.ReadSingle();
FixedPipelineColor = reader.ReadColorValue();
}
示例12: Client_ReceiveAddUser
void Client_ReceiveAddUser( RemoteEntityWorld sender, ReceiveDataReader reader )
{
uint identifier = reader.ReadVariableUInt32();
string name = reader.ReadString();
bool bot = reader.ReadBoolean();
uint userIdentifier = reader.ReadVariableUInt32();
if( !reader.Complete() )
return;
//check for already exists
{
Client_Player playerForCheck = Client_GetPlayer( identifier );
if( playerForCheck != null )
{
Log.Fatal( "PlayerManager: Client_ReceiveAddUserToClient: Player " +
"with identifier \"{0}\" is already exists.", identifier );
}
}
UserManagementClientNetworkService.UserInfo user = null;
if( userIdentifier != 0 )
user = GameNetworkClient.Instance.UserManagementService.GetUser( userIdentifier );
Client_Player player = new Client_Player( identifier, name, bot, user );
client_players.Add( player );
}
示例13: Client_ReceiveHitCall
private void Client_ReceiveHitCall(RemoteEntityWorld sender, ReceiveDataReader reader)
{
Vec3 hitPosition = reader.ReadVec3();
string hitShapeBodyName = reader.ReadString();
string hitShapeName = reader.ReadString();
Vec3 hitNormal = reader.ReadVec3();
MapObject hitMapObject = Entities.Instance.GetByNetworkUIN(reader.ReadVariableUInt32()) as MapObject;
if (!reader.Complete())
return;
Position = hitPosition;
Shape hitShape = null;
if (PhysicsModel != null)
{
Body body = PhysicsModel.GetBody(hitShapeBodyName);
if (body != null)
hitShape = body.GetShape(hitShapeName);
}
OnHit(hitShape, hitNormal, hitMapObject);
}
示例14: Client_ReceiveIntellect
private void Client_ReceiveIntellect(RemoteEntityWorld sender, ReceiveDataReader reader)
{
uint networkUIN = reader.ReadVariableUInt32();
bool shouldDeleteAfterDetach = reader.ReadBoolean();
FactionType ft = null;
if (GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
{
string factionName = reader.ReadString();
if (factionName != string.Empty)
ft = (FactionType)EntityTypes.Instance.GetByName(factionName);
}
if (!reader.Complete())
return;
Intellect i = null;
if (networkUIN != 0)
{
i = (Intellect)Entities.Instance.GetByNetworkUIN(networkUIN);
if (ft != null)
i.Faction = ft;
}
SetIntellect(i, shouldDeleteAfterDetach);
}
示例15: Client_ReceiveFaction
private void Client_ReceiveFaction(RemoteEntityWorld sender, ReceiveDataReader reader)
{
string s = reader.ReadString();
if (!reader.Complete())
return;
faction = (FactionType)EntityTypes.Instance.GetByName(s);
}