json integration and fixes
This commit is contained in:
parent
f31bdad4c8
commit
28e84741c5
29 changed files with 30 additions and 24465 deletions
|
|
@ -40,6 +40,7 @@ namespace LightReflectiveMirror.LoadBalancing
|
|||
}
|
||||
|
||||
[Serializable]
|
||||
[JsonObject(MemberSerialization.OptOut)]
|
||||
public struct Room
|
||||
{
|
||||
public string serverId;
|
||||
|
|
@ -47,7 +48,10 @@ namespace LightReflectiveMirror.LoadBalancing
|
|||
public string serverName;
|
||||
public string serverData;
|
||||
public bool isPublic;
|
||||
public int currentPlayers { get => clients.Count + 1; }
|
||||
public int maxPlayers;
|
||||
|
||||
[JsonIgnore]
|
||||
public List<int> clients;
|
||||
|
||||
public RelayAddress relayInfo;
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 07be693ce1685a54c9bc5608bf627573
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 577d9725f58264943855b8ac185531fe
|
||||
folderAsset: yes
|
||||
timeCreated: 1466788344
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 14f21d7a1e53a8c4e87b25526a7eb63c
|
||||
folderAsset: yes
|
||||
timeCreated: 1466788345
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: aadad8ac54f29e44583510294ac5c312
|
||||
timeCreated: 1466788355
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -1,109 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6a3c684705042f345975d924f6983e36
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Linux
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
: OSXIntel
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
: OSXIntel64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
: SamsungTV
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
STV_MODEL: STANDARD_13
|
||||
- first:
|
||||
: Tizen
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
WebGL: WebGL
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DontProcess: False
|
||||
PlaceholderPath: Assets/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll
|
||||
SDK: AnySDK
|
||||
ScriptingBackend: Il2Cpp
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 01ef782d02bb1994dbe418b69432552b
|
||||
folderAsset: yes
|
||||
timeCreated: 1466788344
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d6807fedb8dcaf04682d2c84f0ab753f
|
||||
timeCreated: 1466788355
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -1,106 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 17aef65a15b471f468b5fbeb4ff0c6a1
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Linux
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
: LinuxUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
: OSXIntel
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
: OSXIntel64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
: SamsungTV
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
STV_MODEL: STANDARD_13
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DontProcess: False
|
||||
PlaceholderPath:
|
||||
SDK: AnySDK
|
||||
ScriptingBackend: Il2Cpp
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1418141139a6ac443b18cb05c0643a29
|
||||
folderAsset: yes
|
||||
timeCreated: 1466788345
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 36f7323c55864364d8bb88c736e4bca6
|
||||
timeCreated: 1466788355
|
||||
licenseType: Store
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -1,94 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9b6ba260dada0ea4a871a42011f8b87d
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Linux
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
: OSXIntel
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
: OSXIntel64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
: SamsungTV
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
STV_MODEL: STANDARD_13
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DontProcess: False
|
||||
PlaceholderPath: Assets/JsonDotNet/Assemblies/Standalone/Newtonsoft.Json.dll
|
||||
SDK: AnySDK
|
||||
ScriptingBackend: DotNet
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 76f828f47ce26cc43991113c6a39dbbf
|
||||
folderAsset: yes
|
||||
timeCreated: 1466010535
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4e7d9a07cc3f02a41a575406e7230846
|
||||
timeCreated: 1466788421
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9a6f8c7c1ea72ce46831c5e1b6150d0c
|
||||
timeCreated: 1466790933
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="System">
|
||||
<type fullname="System.ComponentModel.TypeConverter" preserve="all" />
|
||||
<!-- <namespace fullname="System.ComponentModel" preserve="all" /> -->
|
||||
</assembly>
|
||||
</linker>
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 06314f49bdda26043963578d60a0a7ee
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -1238,7 +1238,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
clientToServerTransport: {fileID: 1521806211}
|
||||
serverIP: 127.0.0.1
|
||||
serverIP: 68.174.160.78
|
||||
serverPort: 7777
|
||||
endpointServerPort: 8080
|
||||
heartBeatInterval: 3
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Mirror;
|
||||
using Newtonsoft.Json;
|
||||
using LightReflectiveMirror;
|
||||
|
||||
public class LRMTester : MonoBehaviour
|
||||
|
|
@ -40,9 +39,11 @@ public class LRMTester : MonoBehaviour
|
|||
|
||||
for(int i = 0; i < _LRM.relayServerList.Count; i++)
|
||||
{
|
||||
print(_LRM.relayServerList[i].relayInfo.address + " ADDRESS");
|
||||
|
||||
var serverEntry = Instantiate(serverListEntry, serverListParent);
|
||||
|
||||
serverEntry.transform.GetChild(0).GetComponent<Text>().text = $"{_LRM.relayServerList[i].serverName + " - " + JsonConvert.SerializeObject(_LRM.relayServerList[i].relayInfo)}";
|
||||
serverEntry.transform.GetChild(0).GetComponent<Text>().text = $"{_LRM.relayServerList[i].serverName + " - " + JsonUtility.ToJson(_LRM.relayServerList[i].relayInfo)}";
|
||||
string serverID = _LRM.relayServerList[i].serverId;
|
||||
serverEntry.GetComponent<Button>().onClick.AddListener(() => { NetworkManager.singleton.networkAddress = serverID.ToString(); NetworkManager.singleton.StartClient(); });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ namespace LightReflectiveMirror
|
|||
|
||||
yield return webRequest.SendWebRequest();
|
||||
var result = webRequest.downloadHandler.text;
|
||||
|
||||
print("RECIEVED INFO: " + result);
|
||||
|
||||
#if UNITY_2020_1_OR_NEWER
|
||||
switch (webRequest.result)
|
||||
{
|
||||
|
|
@ -55,9 +58,9 @@ namespace LightReflectiveMirror
|
|||
else
|
||||
{
|
||||
// join here
|
||||
var parsedAddress = JsonUtility.FromJson<RelayAddress>(result.Decompress());
|
||||
Connect(parsedAddress.Address, parsedAddress.Port);
|
||||
endpointServerPort = parsedAddress.EndpointPort;
|
||||
var parsedAddress = JsonUtility.FromJson<RelayAddress>(result);
|
||||
Connect(parsedAddress.address, parsedAddress.port);
|
||||
endpointServerPort = parsedAddress.endpointPort;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -97,8 +100,8 @@ namespace LightReflectiveMirror
|
|||
while (IsAuthenticated())
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
||||
endpointServerPort = room.relayInfo.EndpointPort;
|
||||
Connect(room.relayInfo.Address, room.relayInfo.Port);
|
||||
endpointServerPort = room.relayInfo.endpointPort;
|
||||
Connect(room.relayInfo.address, room.relayInfo.port);
|
||||
|
||||
while (!IsAuthenticated())
|
||||
yield return new WaitForEndOfFrame();
|
||||
|
|
|
|||
|
|
@ -131,8 +131,16 @@ namespace LightReflectiveMirror
|
|||
clientToServerTransport.ClientSend(0, new ArraySegment<byte>(_clientSendBuffer, 0, pos));
|
||||
|
||||
// If NAT Puncher is initialized, send heartbeat on that as well.
|
||||
if (_NATPuncher != null)
|
||||
_NATPuncher.Send(new byte[] { 0 }, 1, _relayPuncherIP);
|
||||
|
||||
try
|
||||
{
|
||||
if (_NATPuncher != null)
|
||||
_NATPuncher.Send(new byte[] { 0 }, 1, _relayPuncherIP);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
print(e);
|
||||
}
|
||||
|
||||
// Check if any server-side proxies havent been used in 10 seconds, and timeout if so.
|
||||
var keys = new List<IPEndPoint>(_serverProxies.GetAllKeys());
|
||||
|
|
@ -438,19 +446,15 @@ namespace LightReflectiveMirror
|
|||
public List<int> clients;
|
||||
public int currentPlayers;
|
||||
public RelayAddress relayInfo;
|
||||
|
||||
/// <summary>
|
||||
/// This variable is only available on the client
|
||||
/// </summary>
|
||||
//public int currentPlayers { get => clients.Count + 1; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct RelayAddress
|
||||
{
|
||||
public ushort Port;
|
||||
public ushort EndpointPort;
|
||||
public string Address;
|
||||
public ushort port;
|
||||
public ushort endpointPort;
|
||||
public string address;
|
||||
public LRMRegions serverRegion;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue