v2.0
This commit is contained in:
parent
af5e74f36a
commit
5e1b43bb06
4 changed files with 23 additions and 13 deletions
|
|
@ -67,11 +67,11 @@ UpdateHeartbeatInterval - the amounts of update calls before sending a heartbeat
|
|||
|
||||
## Example
|
||||
|
||||
No Example yet!
|
||||
Maqsoom's Server List Example - https://github.com/maqsoom/LightReflectiveMirror-Example
|
||||
|
||||
## Credits
|
||||
|
||||
Maqsoom & JesusLuvsYooh - Both really active testers and have been testing it since I pitched the idea. They tested almost all versions of DRM and I assume they will test the crap out of LRM!
|
||||
Maqsoom & JesusLuvsYooh - Both really active testers and have been testing it since I pitched the idea. They tested almost all versions of DRM and I am sure they will test the crap out of LRM!
|
||||
|
||||
All Mirror Transport Creators! - They made all the transports that this thing relies on! Especially the Simple Web Transport by default!
|
||||
|
||||
|
|
|
|||
|
|
@ -78,11 +78,10 @@ namespace LightReflectiveMirror
|
|||
SendServerList(clientId);
|
||||
break;
|
||||
case OpCodes.UpdateRoomData:
|
||||
var room = GetRoomForPlayer(clientId);
|
||||
if (room == null)
|
||||
return;
|
||||
var plyRoom = GetRoomForPlayer(clientId);
|
||||
|
||||
var plyRoom = room.Value;
|
||||
if (plyRoom == null)
|
||||
return;
|
||||
|
||||
bool newName = data.ReadBool(ref pos);
|
||||
if (newName)
|
||||
|
|
@ -138,11 +137,11 @@ namespace LightReflectiveMirror
|
|||
|
||||
void ProcessData(int clientId, byte[] clientData, int channel, int sendTo = -1)
|
||||
{
|
||||
Room? playersRoom = GetRoomForPlayer(clientId);
|
||||
Room playersRoom = GetRoomForPlayer(clientId);
|
||||
|
||||
if(playersRoom != null)
|
||||
{
|
||||
Room room = playersRoom.Value;
|
||||
Room room = playersRoom;
|
||||
|
||||
if(room.hostId == clientId)
|
||||
{
|
||||
|
|
@ -174,7 +173,7 @@ namespace LightReflectiveMirror
|
|||
}
|
||||
}
|
||||
|
||||
Room? GetRoomForPlayer(int clientId)
|
||||
Room GetRoomForPlayer(int clientId)
|
||||
{
|
||||
for(int i = 0; i < rooms.Count; i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using System.Text;
|
|||
|
||||
namespace LightReflectiveMirror
|
||||
{
|
||||
struct Room
|
||||
class Room
|
||||
{
|
||||
public int hostId;
|
||||
public string serverName;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace LightReflectiveMirror
|
|||
{
|
||||
[Header("Connection Variables")]
|
||||
public Transport clientToServerTransport;
|
||||
public string serverIP;
|
||||
public string serverIP = "34.67.125.123";
|
||||
public float heartBeatInterval = 3;
|
||||
public bool connectOnAwake = true;
|
||||
public string authenticationKey = "Secret Auth Key";
|
||||
|
|
@ -168,29 +168,40 @@ namespace LightReflectiveMirror
|
|||
if (_isServer)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
_clientSendBuffer.WriteByte(ref pos, (byte)OpCodes.UpdateRoomData);
|
||||
|
||||
if (!string.IsNullOrEmpty(newServerName))
|
||||
{
|
||||
_clientSendBuffer.WriteBool(ref pos, true);
|
||||
_clientSendBuffer.WriteString(ref pos, newServerName);
|
||||
}
|
||||
else
|
||||
_clientSendBuffer.WriteBool(ref pos, false);
|
||||
|
||||
if (!string.IsNullOrEmpty(newServerData))
|
||||
{
|
||||
_clientSendBuffer.WriteBool(ref pos, true);
|
||||
_clientSendBuffer.WriteString(ref pos, newServerData);
|
||||
}
|
||||
else
|
||||
_clientSendBuffer.WriteBool(ref pos, false);
|
||||
|
||||
if (newServerIsPublic != null)
|
||||
{
|
||||
_clientSendBuffer.WriteBool(ref pos, true);
|
||||
_clientSendBuffer.WriteBool(ref pos, newServerIsPublic.Value);
|
||||
}
|
||||
else
|
||||
_clientSendBuffer.WriteBool(ref pos, false);
|
||||
|
||||
if (newPlayerCap != null)
|
||||
{
|
||||
_clientSendBuffer.WriteBool(ref pos, true);
|
||||
_clientSendBuffer.WriteInt(ref pos, newPlayerCap.Value);
|
||||
}
|
||||
else
|
||||
_clientSendBuffer.WriteBool(ref pos, false);
|
||||
|
||||
clientToServerTransport.ClientSend(0, new ArraySegment<byte>(_clientSendBuffer, 0, pos));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue