public static string clientConnected() { string id = UnityClientList.registerClient("0"); foreach (var pair in routes) { pair.Value.newConnection(id); } return(id); }
//====================================================================================== // Purpose: rout for unityInfo protobuf updates UnityClientList // ===================================================================================== public override void route(DataWrapper wrapper, string id, SocketHandler sh) { if (!wrapper.UnitySettings.Name.Equals(id)) { string newID = UnityClientList.registerClient(wrapper.UnitySettings.Name); Console.WriteLine($"UCLR: Name Change {id} to {newID}"); ProtoRouter.clientNameChange(id, newID); UnityClientList.removeClient(id); sh.clientID = newID; id = newID; DataWrapper returnWrapper = new DataWrapper { UnitySettings = new UnitySettings { Name = newID } }; sh.sendToServer(returnWrapper); } if (UnityClientList.clientExists(id)) { Console.WriteLine($"UCLR: client {id} state set to {wrapper.UnitySettings.Public}"); UnityClientList.setClientPublic(id, wrapper.UnitySettings.Public); } }