本文整理汇总了C#中NetworkClient.Send方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkClient.Send方法的具体用法?C# NetworkClient.Send怎么用?C# NetworkClient.Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkClient
的用法示例。
在下文中一共展示了NetworkClient.Send方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: pLogin
void pLogin(NetworkClient nc, PLoginRequest request)
{
var entry = checkUserPass(request.Username, request.Password);
if (entry == null)
{
clientList.Remove(nc);
nc.Send(new PLoginResponse { Items = null });
}
else
{
uint id = entry.ID;
clientList[nc] = entry;
nc.ConnectionLost += nec =>
{
HybridObject.UnregisterUser(id);
clientList[nec].Useless(id);
clientList.Remove(nec);
};
nc.Send(entry.Data);
nc.Send(SettingsSingleton.RegisterSettings(id));
}
}
示例2: OnStartLocalPlayer
// Use this for initialization
public override void OnStartLocalPlayer()
{
if (isLocalPlayer)
{
mClient = NetworkManager.singleton.client;
// get the player name entered on the login screen
string playerName = FindObjectOfType<LogonGUI>().playerName;
MessageTypes.JoinLobbyMessage msg = new MessageTypes.JoinLobbyMessage();
msg.playerName = playerName;
Debug.Log(String.Format("Playername={0} ConnectionId={1}", playerName,mClient.connection.connectionId));
mClient.Send((short)MessageTypes.MessageType.JOIN_LOBBY, msg);
}
}
示例3: Initialize
public void Initialize (NetworkClient network_client, string playFabId)
{
_network = network_client;
PlayFabId = playFabId;
//Register for Messages
_network.RegisterHandler(ChatServerMessageTypes.ChannelMessage, OnChannelMessage);
_network.RegisterHandler(ChatServerMessageTypes.JoinChannelResponse, OnJoinChannelResponse);
_network.RegisterHandler(ChatServerMessageTypes.CreateChannelResponse, OnCreateChannelResponse);
Debug.Log ("send create channel");
_network.Send(ChatServerMessageTypes.CreateChannel, new CreateChannelMessage()
{
ChannelId = "General",
MemberId = PlayFabId,
MemberName = PlayerUsername,
IsInviteOnly = false
});
chat_diplay_name_text.text = PlayerUsername;
}
示例4: pChunkReg
void pChunkReg(NetworkClient nc, PChunkRegister chunk)
{
//Stopwatch sw = Stopwatch.StartNew();
if (!isLoggedIn(nc))
throw new Exception("Not logged in.");
nc.Send(new PChunkTransfer
{
Chunk = regChunk(clientList[nc].ID, chunk.Position)
});
//sw.Stop();
//Console.WriteLine(sw.ElapsedMilliseconds.ToString());
}
示例5: SendCityToken
/// <summary>
/// Sends a token to a CityServer, as received by a LoginServer.
/// </summary>
/// <param name="Client">A NetworkClient instance.</param>
public static void SendCityToken(NetworkClient Client)
{
PacketStream Packet = new PacketStream((byte)PacketType.CITY_TOKEN, 0);
Packet.WriteHeader();
byte[] EncryptionKey = Client.ClientEncryptor.GetDecryptionArgsContainer().ARC4DecryptArgs.EncryptionKey;
MemoryStream PacketData = new MemoryStream();
BinaryWriter Writer = new BinaryWriter(PacketData);
Writer.Write((byte)PlayerAccount.Hash.Length);
Writer.Write(PlayerAccount.Hash, 0, PlayerAccount.Hash.Length);
Writer.Write((byte)EncryptionKey.Length);
Writer.Write(EncryptionKey);
Writer.Write(PlayerAccount.CityToken);
Packet.WriteUInt16((ushort)((ushort)PacketHeaders.UNENCRYPTED + PacketData.Length));
Packet.WriteBytes(PacketData.ToArray());
Writer.Close();
Client.Send(Packet.ToArray());
}