# Mirror Cloud Services
## Mirror List Server
Example has an API key which can be used as a demo.
To get an API key to use within your game you can subscribe on the [Mirror Networking Website](https://mirror-networking.com/list-server/)
### Key features
- The Cloud Service works via https so it is secure and can be used from any platform.
- It runs on Google Cloud so there is no worry about server downtime.
- It scales really well. Default quota is 1000 API requests per minute. If you have high demands, contact us and we can increase that limit.
## List Server Examples
An example for this can be found in [Mirror/Examples/Cloud/](https://github.com/vis2k/Mirror/tree/master/Assets/Mirror/Examples/Cloud)
*Note: you cannot connect to your own public IP address, you will need at least one other person to test this*
## How to use
Add `ApiConnector` component to an object in your game. It is probably best to put this on the same object as your NetworkManager. Once it has been added set the `ApiAddress` and `ApiKey` fields.
To use `ApiConnector` either directly reference it in an inspector field or get it when your script awakes
```cs
ApiConnector connector;
void Awake()
{
connector = FindObjectOfType<ApiConnector>();
}
```
The Api calls are grouped into objects. `connector.ListServer.ServerApi` has the Server Api calls like `AddServer`. `connector.ListServer.ClientApi` has the Client Api calls like `GetServerList`.
### Server Api Example
Example of how to add server
```cs
void AddServer(int playerCount)
{
Transport transport = Transport.activeTransport;
Uri uri = transport.ServerUri();
int port = uri.Port;
string protocol = uri.Scheme;
connector.ListServer.ServerApi.AddServer(new ServerJson
{
displayName = "Fun game!!!",
protocol = protocol,
port = port,
maxPlayerCount = NetworkManager.singleton.maxConnections,
playerCount = playerCount
});
}
```
### Client Api Example
Example of how to list servers
```cs
ApiConnector connector;
void Awake()
{
connector = FindObjectOfType<ApiConnector>();
// add listener to event that will update UI when Server list is refreshed
connector.ListServer.ClientApi.onServerListUpdated += onServerListUpdated;
// add listen to button so that player can refresh server list
refreshButton.onClick.AddListener(RefreshButtonHandler);
}
public void RefreshButtonHandler()
{
connector.ListServer.ClientApi.GetServerList();
}
void onServerListUpdated()
{
// Update UI here
}
```
## Debug
If something doesn't seem to be working then here are some tips to help solve the problem
### Check logs
Enable `showDebugMessages` on your NetworkManager or use the log level window to enable logging for the cloud scripts
Below are some example logs to look for to check things are working.
#### Add Server
The add request is sent to add a server to the list server
```
Request: POST servers {"protocol":"tcp4","port":7777,"playerCount":0,"maxPlayerCount":4,"displayName":"Tanks Game 521","address":"","customAddress":"","customData":[]}
```
```
Response: POST 200 /servers {"id":"BI6bQQ2TbNiqhdp1D7UB"}
```
#### Update Server
The object sent in update request maybe be empty, this is sent to keep the server record alive so it shows up.
The update request can also be used to change info. For example the player count when someone joins or leaves
```
Request: PATCH servers/BI6bQQ2TbNiqhdp1D7UB {}
```
```
Response: PATCH 204 /servers/BI6bQQ2TbNiqhdp1D7UB
```
#### Remove Server
The remove request is sent to remove a server from the list server. This is automatically called when the ApiConnection is destroyed.
```
Request: DELETE servers/BI6bQQ2TbNiqhdp1D7UB
```
```
Response: DELETE 204 /servers/BI6bQQ2TbNiqhdp1D7UB
```
#### Get Servers
The get request is sent in order to get the list of servers.
The example below shows an array of 2 servers, one with name `Tanks Game 521` and the other with name `Tanks Game 212`
```
Request: GET servers
```
```
Response: GET 200 /servers {"servers":[{"address":"tcp4://xx.xx.xx.xx:7777","displayName":"Tanks Game 521","port":7777,"protocol":"tcp4","playerCount":0,"maxPlayerCount":4,"customAddress":"","customData":[]},{"address":"tcp4://xx.xx.xx.xx:7777","displayName":"Tanks Game 212","port":7777,"protocol":"tcp4","playerCount":0,"maxPlayerCount":4,"customData":[]}]}
```
*xx.xx.xx.xx will be the IP address for the server*
### Use the QuickListServerDebug
The QuickListServerDebug script uses `OnGUI` to show the list of servers. This script can be used to check the server list without using Canvas UI.
没有合适的资源?快使用搜索试试~ 我知道了~
UnityMirrorDemo.zip
共6982个文件
meta:1560个
bin:1477个
cs:971个
需积分: 50 23 下载量 4 浏览量
2021-04-14
09:08:49
上传
评论
收藏 95.46MB ZIP 举报
温馨提示
Unity局域网联机插件,Mirror.包含官方demo,和写的一个Cube联机移动同步的联系场景, https://github.com/kaifeng123/MirrorDemo, 想出积分在这下,去github上下也行
资源推荐
资源详情
资源评论
收起资源包目录
UnityMirrorDemo.zip (6982个子文件)
0007345391b399472c95e0c2eb9213f8 8KB
0021f2ceb47111f519d9c017138ebe3c 4KB
0082f65a7f962319e3b39e6e456badcd 17KB
00bdf810298932ea31674ece9ad3cd45 8KB
00e57f0c082f4d1a97a6c8b10f97626a 6KB
01112d6a866e3e5351e29bb871981ace 4KB
01235d5bc1003f0fbc00c6880a4d3128 7KB
012c4e7ed80308b09d389444902dff1f 178B
014e04d3203047a428b448a6edcb03df 5KB
01ce740d017b80e7147e6e790164e40c 8KB
020751b940f26a44fd91f5fb59928ab7 9KB
0212d8fd49da45bf4ce7ba1f8fab8d3c 16KB
0213e5d7ede59b6e060c2b7043bfc472 4KB
0229dcf03fd75eac4e5f4e7f221f0489 5KB
024197bac029a418e67dd619ac269794 13KB
02a77de758453d06e1e3b0638804270f 4KB
030d088d87f7d2ada2d8a46849bd24cb 4KB
030ebf25b9eedaa0540549067e44c3cd 5KB
0337308776bce3ca57c745b65e7fa26b 4KB
03a4d22ea1a6594a77f10256061c3275 48KB
03aa071c097372d6fb76bb67004bf72c 5KB
0424816a3b79bcc7bad48403e209f78d 5KB
043a7b70c2634cd33d999710f6e26c7f 4KB
048a423e892efd6487a29a188945f19b 11KB
04e5180e2834478c546b33a57038096d 4KB
04f52098f5457472a37922a1c3aac658 7KB
050dd8fee59afda3c41d9da5cb4fa1de 4KB
052895e8d4cf90939f858528ec4e1397 4KB
054c1a50108b09db7974b5a5b71ef196 5KB
05542271c9b4439c073dc94a150c7346 5KB
0557e5e62aef390b2f4df382d3989500 17KB
055e70c6f791a12e38bfbd078f426a32 148B
05879af1a7640397e3db52dd3b999577 10KB
05d524410c36e3d1c6be40c163880aea 10KB
05d94d5c124a68a8db7f45922c9d59ec 18KB
06048fe1b75073d6a325dc33011cc992 4KB
0652ab17cbac29cb8f8f769b1630a3ef 11KB
066daf64a8a3f87d92116fa0fdc77af7 17KB
067020ccd626126aff1d2ce1b249b03a 4KB
06900ab7f902372ff8f644be1fdb09c5 4KB
06a4cd9c098572194d7844f272d1431c 10KB
06ac86f68629764d357e7ce0c59984d1 4KB
06bf2a0ae9ec9349a277f8744e323990 6KB
06e23d2d24e466c13f9f0bd43465be9f 4KB
072927fdd834e24e4cfd4d0539b1cae3 40KB
076d0c3052706b75443e12ca54f3790d 21KB
078d01b270b2dcb95c7e6637d342eb2e 5KB
07c7534827349671e1f721159f924fa6 6KB
07eee7427ee5dcd029b87bc41714cf42 525B
081667044b07a298b22e0a771dc73784 4KB
082b525cd96465bd9de95f4199e015a8 12KB
082c4aea168f1c9ee5ff3f60e412f4dc 6KB
084505db05180c7af18270fc1320fdf1 4KB
084d82187a65dc5a975b3bbf34e12099 17KB
0859da806ec2b54893ea0faf82fd6635 6KB
0861de06f5c3fd85f63b94b8d18dde8c 4KB
088f9f111e065c8ccfd2646f3f01cb4d 17KB
08de01d0dbefdccd314b717e584d36d2 5KB
08fc113403639107fb0d326bc58a206b 6KB
0978e12fc933d41ca222c3d144ce0fb2 4KB
098a6717a489c165af9ec99adc0cb2b3 6KB
099f652e9d46d3f4ae05458e95ab0c6f 6KB
09cfd83d17b043b4a04be608c1435a6a 4KB
09da093cf68f19baa0f4993d5db181ad 17KB
0a047dffcd803a07651f658c6e510151 4KB
0a0f2a276b3b562e8cfa24c229db5a35 7KB
0a21295dfc31620c9919a0f00abe5a36 11KB
0a27588aa503e4503c25044e6cf5f8d2 9KB
0a2c5305832f0ca69da3705e885dd42b 4KB
0a52e2bf52076e174bd0578f4ce3fb7b 5KB
0ad47e724ffecf02099c7cef4fcea26d 27KB
0af6fec30fc56d90a0e9b7280039f12a 5KB
0b26537ab495bcb07939eeaf4f7f0031 14KB
0b2c48b4ca6c24370421cb390a530974 28KB
0b45ea38c099bc45680e87e28a50d958 6KB
0b5a2414256a12a58a2d2083f2fd4572 4KB
0b5ab6b08a034182d646a503daeb0e8f 6KB
0b7e578c81d3148ea862fa1fb19da1b9 17KB
0be2b9a648179f4c611c8ec515420cd2 5KB
0bed380abc40f7cc0e0c1c090ae797ce 17KB
0c0d3d10b361eeace7f8bcda606fe4f2 17KB
0c601d05c56f123841c248190cac93a3 5KB
0c6cd62312062f30bd3459d39f8d6a66 17KB
0c93f18b8e5f9005f21ceae19588d158 200B
0cee6463e6dfeae759216172396e8322 27KB
0d1e3f8180d7084cd904bf7df28fb146 7KB
0d21cc63c7bf8059914f1898703e4761 7KB
0d310d11d44780c21684f81cdafc8c88 8KB
0d40766ad55ceb643915e55b90409584 14KB
0d4854cb54ab61f921fecd4643cb6e29 21KB
0d5b8cb2c29327480009516c1b67b6ab 25KB
0d7b7d099d82456f43844ae9eaa78e62 175B
0d9e4ff1ab956778e52d1990eb740bd5 51KB
0db330f61c529626d4c82b5a9fe3373c 17KB
0de61355159f594a8f3ab14ad65c4146 236B
0e0dd32e1fe5c3cb3aa3e974b2632947 5KB
0e1531a8aa43b892342402599cbf23d0 4KB
0e8136303947d5cb665a7ff31a38e8be 7KB
0e890ff39ba3d6c817c0311439d17e5b 59KB
0eb017a29807fa4acc37c0d3b8475138 4KB
共 6982 条
- 1
- 2
- 3
- 4
- 5
- 6
- 70
资源评论
小灰灰,
- 粉丝: 91
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Vue+Echarts实现风力发电机中传感器的数据展示监控可视化系统+源代码+文档说明(高分课程设计)
- 基于单片机的风力发电机转速控制源码
- 基于C++实现的风力发电气动平衡监测系统+源代码+测量数据(高分课程设计)
- 毕业设计- 基于STM32F103C8T6 单片机,物联网技术的太阳能发电装置+源代码+文档说明+架构图+界面截图
- 基于 LSTM(长短期记忆)(即改进的循环神经网络)预测风力发电厂中风力涡轮机产生的功率+源代码+文档说明
- 基于stm32f103+空心杯电机+oled按键+运动算法
- 《CKA/CKAD应试指南/从docker到kubernetes 完全攻略》学习笔记 第1章docker基础(1.1-1.4)
- 基于python实现的水下压缩空气储能互补系统建模仿真与经济效益分析+源代码+论文
- 华中科技大学-自然语言处理实验,Bi-LSTM+CRF的中文分词框架,并且利用基于深度学习的方法进行中文命名实体识别++源码报告
- 基于动态罚函数的铁路车流分配与径路优化模型python源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功