當前位置: 首頁>>代碼示例>>C#>>正文


C# NetworkClient.Send方法代碼示例

本文整理匯總了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));
            }
        }
開發者ID:olydis,項目名稱:FineCraft,代碼行數:23,代碼來源:MainWindow.cs

示例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);
        }
    }
開發者ID:waferthinninja,項目名稱:ProjectNeptune,代碼行數:15,代碼來源:PlayerController.cs

示例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;
	}
開發者ID:PlayFab,項目名稱:PlayFabGameServer,代碼行數:20,代碼來源:ChatInterfaceLogic.cs

示例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());
        }
開發者ID:olydis,項目名稱:FineCraft,代碼行數:13,代碼來源:MainWindow.cs

示例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());
        }
開發者ID:Blayer98,項目名稱:Project-Dollhouse,代碼行數:26,代碼來源:UIPacketSenders.cs


注:本文中的NetworkClient.Send方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。