孙广东 2015.7.21

本节提供了与网络系统一起使用的组件的具体信息。

3、NetworkClient

NetworkClient 是一个 HLAPI 类,管理网络连接到服务器 — — 相应着 UNET NetworkServer。它能够用于将消息发送到服务器和从服务器接收消息。NetworkClient 还能够帮助管理衍生的网络对象和 RPC 消息和网络事件的路由。

Properties

Property: Function:
serverIP The IP address of the server that this client is connected to.
serverPort The port of the server that this client is connected to.
connection The NetworkConnection object this client is using.
handlers The set of registered message handler functions.
numChannels The number of configured NetworkTransport QoS channels.
isConnected True if the client is connected to a server.
allClients List of active network clients (static).
active True if any network clients are active (static).

4、NetworkConnection

NetworkConnection是一个 HLAPI 类。封装了网络连接。NetworkClient 对象具有一个NetworkConnections,和 NetworkServers 有多个NetworkConnections------来自每一个客户端。   网络连接已能发送字节数组,或序列化的对象作为 网络消息。

Properties

Property: Function:
hostId The NetworkTransport hostId for this connection.
connectionId The NetworkTransport connectionId for this connection.
isReady Flag to control whether state updates are sent to this client.
address The IP address of the end-point that this connection is connected to.
playerControllers The set of players that have been added with AddPlayer().

5、NetworkIdentity

NetworkIdentity 组件是Unity 组件,它是 新网络系统的核心 。

它能够被加入到对象。

从-AddComponents->Network->NetworkIdentity 菜单项 。此组件控制对象的网络标识。这表明 NetworkIdentity 组件在一个对象上例如以下所看到的:


与Unity Network System的 服务器权威系统,网络的对象的NetworkIdentities 必须是由服务器使用 NetworkServer.Spawn()所  “spawned” 。这会导致他们被分配NetworkInstanceId。在连接到服务器的客户端上创建。

场景物体比动态实例化对象有点差别对待。

这些对象是全部  出如今客户端和服务器上的场景中。然而。当建设游戏 的全部场景对象的identities 将被都禁用。

当客户端连接到服务器时,服务器将通知客户端应启用哪些场景对象 和其最新的状态信息是通过 spawn 消息。这可确保客户端将不会包括对象放置在如今不对的位置。当他開始playing。或 甚至对象会马上被删除连接由于一些事件中移除他们之前客户端连接。

"ServerOnly"  复选框将确保这某一特定对象不会催生了或在客户端上启用。

此组件包括像什么场景 ID,网络 ID 和 资产 ID 已分配给对象的跟踪信息。场景 ID 是一个在 NetworkIdentity 组件的全部场景物体中有效。网络 ID 是此特定对象实例的 ID,可能有多个对象的特定对象类型的实例化和  网络 ID 用于的标识的对象,比如,网络更新应适用。资产 ID 是指什么源资产对象被实例化。

这是内部使用。当特定对象预置被网络spawned 。

此信息被公开的预览面板底部的Inspector:


在执行时是要在此处显示的具体信息 (disabled  NetworkBehaviour 显示 非粗体):


Properties

Property: Function:
netId A unique identifier for this network session, assigned when spawned.
sceneId A unique identifier for networked objects in a scene. This is only populated in play-mode.
isClient True if this object is running on a client.
isServer True if this object is running on the server, and has been spawned.
hasAuthority True if this object is the authoritative version of the object. So either on a the server, or on the client with localPlayerAuthority.
localPlayerAuthority True if this object is controlled by the client that owns it - the local player object on that client has authority over it. This is used by other components such as NetworkTransform.
serverOnly A flag to make this object not be spawned on clients.
assetId This identifies the prefab associated with this object (for spawning).
playerControllerId The identifier of the controller associated with this object. Only valid for player objects.
observers The list of client NetworkConnections that are able to see this object. This is read-only.

Hints

  • Put a NetworkIdentity component on prefabs that will be spawned.
  • A NetworkIdentity is required for every object that is networked.

6、Network Lobby Manager

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Your name Your email Suggestion *Submit suggestion

Cancel

NetworkLobbyManager 是一种特殊的网络管理器。主要玩游戏进入主场景之前的提供一个多层的大堂。

• 提供网络大厅的player限制
• 游戏開始时全部玩家都是准备好了
• 玩家不能加入game-in-progress
• 支持“Couch Multiplayer”
• 可自己定义的方式为玩家选择在大厅中的选项

有两种类型的球员与 NetworkLobbyManager 的对象:
LobbyPlayer 对象
• 对于每一个玩家
• 创建客户端连接,或player被加入时
• 持续,直到客户端断开连接
• 拥有准备flag和配置数据
• 处理在大厅里的命令
• 应该使用 NetworkLobbyPlayer 组件

GamePlayer 对象
• 对于每一个玩家
• 開始游戏场景时被创建
• 又一次进入大厅时被摧毁
• 处理在游戏中命令

Properties

Property: Function:
showLobbyGUI Show the legacy OnGUI controls for the lobby.
maxPlayers The maximum number of players allowed in the lobby.
maxPlayersPerConnection The maximum number of players allowed to be added for each client connection.
lobbyPlayerPrefab The prefab to create for players when they enter the lobby.
gamePlayerPrefab The prefab to create for players when the game starts.
lobbyScene The scene to use for the lobby.
playScene The scene to use for main game play.

Details

  • LobbyPlayerPrefab 插槽应填写。一个对象的 NetworkLobbyPlayer 组件。
  • 有一个lobby manager GUI。看到多人游戏大厅资产包。

7、Network Lobby Player

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Your name Your email Suggestion *Submit suggestion

Cancel

NetworkLobbyPlayer 是 NetworkLobbyManager 用于存储在大厅中的每一个球员状态。

Properties

Property: Function:
ShowLobbyGUI True to show the legacy user interface for players in the lobby.
slot The slot that this player was allocated too. Only one player can be in each lobby slot.
readyToBegin Flag to control if the player is ready for the game to start.

8、Network Manager UNet

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Your name Your email Suggestion *Submit suggestion

Cancel

网络 管理器是一个更高的水平类  使您能够控制一个网络游戏的状态 。

它提供了界面编辑器用于 ,和场景。以用于不同的网络游戏状态的预置控制网络的配置中。

Properties

Property: Function:
networkPort The network port used to listen on and connect to.
networkAddress The network address to connect to.
dontDestroyOnLoad Flag to make the NetworkManager persist between scenes.
runInBackground Flag to make the player run in the background by default.
sendPeerInfo Flag to have network information on all peers sent to all participating clients.
maxDelay The maximum time in seconds to delay buffered messages.
logLevel The level of network logging to write.
playerPrefab The prefab to instantiate for players when a client connects.
autoCreatePlayer Flag to automatically add a player when a client connects.
playerSpawnMethod How to spawn players at StartPositions.
offlineScene The scene to switch to when the network goes off-line.
onlineScene The scene to switch to when the network goes on-line.
spawnPrefabs The set of registered spawnable prefabs.
startPositions The set of NetworkStartPosition objects found in the scene.
customConfig Flag to use custom network configuration (advanced).
connectionConfig Advanced custom network configuration data.
maxConnections The maximum number of connections allowed by the server.
channels The number of transport layer QoS Channels.
secureTunnelEndpoint End point for XBox Live connectivity.
useSimulator Flag to use network conditions simulation.
simulatedLatency Latency in milliseconds to add when network simulator active.
packetLossPercentage The percentage of packet loss to add when network simulator active
matchHost Matchmaker host address.
matchPort Matchmaker host port.

9、Network Manager HUD

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Your name Your email Suggestion *Submit suggestion

Cancel


控制游戏的网络状态提供了默认的用户界面。它还在编辑器中显示有关网络管理器的当前状态信息。

Properties

Property: Function:
showGUI Flag to show the default UI.
offsetX The horizontal pixel offset of the UI.
offsetY The vertical pixel offset of the UI..

Details

NetworkManagerHUD 同意您查看在编辑器中,比如connections,非常多细节 列出 已知的网络的对象,和激活 玩家对象。




Unity5.1 新的网络引擎UNET(十五) Networking 引用--中相关推荐

  1. Unity5.1 新的网络引擎UNET(十五) Networking 引用--下

     孙广东 2015.7.21 本节提供了与网络系统一起使用的组件的具体信息. 10.Network Proximity Checker Suggest a change Success! Than ...

  2. HTML5游戏引擎(十五)-时间控制——Timer计时器 Ticker心跳-startTick-stopTick 帧事件-ENTER_FRAME

    HTML5游戏引擎(十五)-时间控制--Timer计时器 & Ticker心跳-startTick-stopTick & 帧事件-ENTER_FRAME 时间控制 Timer计时器 假 ...

  3. 【Microsoft Azure 的1024种玩法】四十五.在Azure中快速创建Azure AD Domain Services

    [简介] Azure Active Directory (Azure AD) 是一种基于云的标识和访问管理服务. Azure Active Directory 可帮助相关企业访问内部资源,例如企业 I ...

  4. 二十五、Java中的网络编程

    1.什么是网络? 概念:在计算机领域中网络是信息传输,接收,共享的虚拟平台,通过它把各个点,面,体的联系到一起,从而实现这些资源的共享. 作用:信息传输,资源共享 优点: 资源共享免费 2.OSI七层 ...

  5. 28家中国域名商保有量统计:有孚网络升至第十五

    IDC评述网(idcps.com)12月23日报道:根据RegistrarStats公布的实时数据显示,截止至2015年12月19日,在国内域名注册市场上,阿里云(万网)以域名保有量4,995,257 ...

  6. 对抗生成网络学习(十五)——starGAN实现人脸属性修改(tensorflow实现)

    一.背景 最近事情比较多,一个多月没写CSDN了,最近打算做一做satrGAN. starGAN是Yunjey Choi等人于17年11月提出的一个模型[1].该模型可以实现人脸的属性修改,原理上来说 ...

  7. 一张图看懂阿里云网络产品【十五】IPv6 解决方案

    摘要:作为国内首家全面支持IPv6的云厂商,阿里云12月再次推出全栈IPv6解决方案,核心产品已全面支持,协助客户小时/天级即可完成IPv6 访问.方案成功历经优酷.淘宝.天猫.双十一考验.SLB I ...

  8. Android12之OpenSL ES中IObject_GetInterface获取引擎接口(十五)

    简介: CSDN博客专家,专注Android/Linux系统,分享多mic语音方案.音视频.编解码等技术,与大家一起成长! 优质专栏:Audio工程师进阶系列[原创干货持续更新中--]

  9. 【小白学习C++ 教程】十五、C++ 中的template模板和泛型

    @Author:Runsen template模板在 C++ 中一个简单但非常强大的工具.简单的想法是将数据类型作为参数传递,这样我们就不需要为不同的数据类型编写相同的代码. C++ 添加了两个新关键 ...

最新文章

  1. linux 反弹shell(二)反弹shell的本质
  2. python应用实战案例:python如何实现异步爬虫?
  3. 基于数据接口文件读取的自动轨迹绘制
  4. 100万并发连接服务器笔记之处理端口数量受限问题
  5. jsp为什么不加虚拟路径都能访问_JavaWeb学习笔记一(环境配置/jsp基本介绍)
  6. CentOS7 FTP安装与配置
  7. SQL中的全文检索(转帖)
  8. 对称加密算法在C#中的踩坑日常
  9. MES系统源码 MES系统功能介绍
  10. php制作多媒体课件,网络自主学习型多媒体课件设计与制作PPT.ppt
  11. 关于双层原子台阶的形成机制
  12. mac使用开源方案实现读取ntfs
  13. SpringCloud微服务实战——搭建企业级开发框架(三十一):自定义MybatisPlus代码生成器实现前后端代码自动生成
  14. 计算机硬盘read,电脑硬盘一直吱吱的响的解决办法
  15. python每日一题:爬虫电影的动态票房信息
  16. 【NRF51822】百度手环开源源码分析--数据自动同步部分
  17. 模仿微信声音锁的实现(运用DTW算法)
  18. 尚学堂Java第八章编码题
  19. 如何下载西青区卫星地图高清版大图
  20. 利用EXCEL获取字段的拼音首字母

热门文章

  1. CSS 滚动条样式修改(详细)
  2. 09、IO流—File类与IO流
  3. Scaled-YOLOv4: Scaling Cross Stage Partial Network 论文翻译
  4. 说一说Glide.with()
  5. 《万万没想到》读书笔记及读后感作文3500字
  6. IC验证之UART模块
  7. css 文字中间 两边横线
  8. 手机计算机应用会横屏,北京市大学生计算机应用大赛——3g智能手机创意设计作品提交书模板(游戏类).pdf...
  9. 什么是合成孔径雷达(SAR)
  10. 推荐一个博客工具——Boke宝贝