Unity Side Fix

This commit is contained in:
Derek S 2021-04-06 20:51:11 -05:00
parent e71ae4f81d
commit a7c0ae976c
9 changed files with 112 additions and 3 deletions

BIN
LRM.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -43,7 +43,7 @@ public class LRMTester : MonoBehaviour
var serverEntry = Instantiate(serverListEntry, serverListParent);
serverEntry.transform.GetChild(0).GetComponent<Text>().text = $"{_LRM.relayServerList[i].serverName + " - " + JsonConvert.SerializeObject(_LRM.relayServerList[i].relayInfo)}";
int serverID = _LRM.relayServerList[i].serverId;
string serverID = _LRM.relayServerList[i].serverId;
serverEntry.GetComponent<Button>().onClick.AddListener(() => { NetworkManager.singleton.networkAddress = serverID.ToString(); NetworkManager.singleton.StartClient(); });
}
}

View file

@ -30,6 +30,12 @@ namespace LightReflectiveMirror
var lrm = (LightReflectiveMirrorTransport)target;
directModule = lrm.GetComponent<LRMDirectConnectModule>();
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Label(Resources.Load<Texture>("LRM"), GUILayout.Height(50), GUILayout.Width(100));
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
if (string.IsNullOrEmpty(lrm.loadBalancerAddress))
{
// First setup screen, ask if they are using LLB or just a single LRM node.
@ -232,7 +238,7 @@ namespace LightReflectiveMirror
GUI.enabled = false;
EditorGUILayout.TextField("Server Status", lrm.serverStatus);
EditorGUILayout.TextField("Server ID", lrm.serverId == -1 ? "Not Hosting" : lrm.serverId.ToString());
EditorGUILayout.TextField("Server ID", string.IsNullOrEmpty(lrm.serverId) ? "Not Hosting." : lrm.serverId);
GUI.enabled = true;
EditorGUILayout.Space();

View file

@ -52,7 +52,7 @@ namespace LightReflectiveMirror
int pos = 0;
_directConnected = false;
_clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.JoinServer);
_clientSendBuffer.WriteInt(ref pos, _cachedHostID);
_clientSendBuffer.WriteString(ref pos, _cachedHostID);
_clientSendBuffer.WriteBool(ref pos, false); // Direct failed, use relay
_isClient = true;

View file

@ -68,6 +68,8 @@ namespace LightReflectiveMirror
if (_isClient || _isServer)
throw new Exception("Cannot connect while hosting/already connected!");
_cachedHostID = address;
var room = GetServerForID(address);
if (!useLoadBalancer || room.relayInfo.Address == serverIP)

View file

@ -50,6 +50,7 @@ namespace LightReflectiveMirror
private bool _isAuthenticated = false;
private int _currentMemberId;
private bool _callbacksInitialized = false;
private string _cachedHostID;
private UdpClient _NATPuncher;
private IPEndPoint _NATIP;
private IPEndPoint _relayPuncherIP;

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 48c208983412ff24abf68dda3691fa07
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,92 @@
fileFormatVersion: 2
guid: f4000c50bdad7994f8425330b81e5d87
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: