/// <summary> /// Sets the emulation properties in <see cref="uLink.NetworkPrefs"/>. /// </summary> /// <remarks> /// The method can't update the saved values in the persistent <see cref="uLink.NetworkPrefs.resourcePath"/> file, /// because that assumes the file is editable (i.e. the running project isn't built) and would require file I/O permission. /// Calling this will only update the values in memory. /// </remarks> public void SetPrefs() { NetworkPrefs.Set("Network.emulation.maxBandwidth", _maxBandwidth); NetworkPrefs.Set("Network.emulation.chanceOfLoss", _chanceOfLoss); NetworkPrefs.Set("Network.emulation.chanceOfDuplicates", _chanceOfDuplicates); NetworkPrefs.Set("Network.emulation.minLatency", _minLatency); NetworkPrefs.Set("Network.emulation.maxLatency", _maxLatency); }
/// <summary> /// Gets the emulation properties from <see cref="uLink.NetworkPrefs"/>. /// </summary> public void GetPrefs() { _maxBandwidth = NetworkPrefs.Get("Network.emulation.maxBandwidth", _maxBandwidth); _chanceOfLoss = NetworkPrefs.Get("Network.emulation.chanceOfLoss", _chanceOfLoss); _chanceOfDuplicates = NetworkPrefs.Get("Network.emulation.chanceOfDuplicates", _chanceOfDuplicates); _minLatency = NetworkPrefs.Get("Network.emulation.minLatency", _minLatency); _maxLatency = NetworkPrefs.Get("Network.emulation.maxLatency", _maxLatency); _Apply(); }
/// <summary> /// Save preferences for master server in PlayerPrefs. /// </summary> public static void SetPrefs() { NetworkPrefs.Set("MasterServer.comment", comment); NetworkPrefs.Set("MasterServer.dedicatedServer", dedicatedServer); NetworkPrefs.Set("MasterServer.gameLevel", gameLevel); NetworkPrefs.Set("MasterServer.gameMode", gameMode); NetworkPrefs.Set("MasterServer.gameName", gameName); NetworkPrefs.Set("MasterServer.gameType", gameType); NetworkPrefs.Set("MasterServer.ipAddress", ipAddress); NetworkPrefs.Set("MasterServer.password", password); NetworkPrefs.Set("MasterServer.port", port); NetworkPrefs.Set("MasterServer.updateRate", updateRate); }
/// <summary> /// Load preferences for master server from the previously stored PlayerPrefs. /// </summary> public static void GetPrefs() { comment = NetworkPrefs.Get("MasterServer.comment", String.Empty); dedicatedServer = NetworkPrefs.Get("MasterServer.dedicatedServer", false); gameLevel = NetworkPrefs.Get("MasterServer.gameLevel", String.Empty); gameMode = NetworkPrefs.Get("MasterServer.gameMode", String.Empty); gameName = NetworkPrefs.Get("MasterServer.gameName", String.Empty); gameType = NetworkPrefs.Get("MasterServer.gameType", String.Empty); ipAddress = NetworkPrefs.Get("MasterServer.ipAddress", ipAddress); password = NetworkPrefs.Get("MasterServer.password", String.Empty); port = NetworkPrefs.Get("MasterServer.port", 23466); updateRate = NetworkPrefs.Get("MasterServer.updateRate", 0.05f); }
/// <summary> /// Sets the NetworkConfig properties in <see cref="uLink.NetworkPrefs"/>. /// </summary> /// <remarks> /// The method can't update the saved values in the persistent <see cref="uLink.NetworkPrefs.resourcePath"/> file, /// because that assumes the file is editable (i.e. the running project isn't built) and would require file I/O permission. /// Calling this will only update the values in memory. /// </remarks> public void SetPrefs() { NetworkPrefs.Set("Network.config.localIP", _localIP); NetworkPrefs.Set("Network.config.sendBufferSize", _sendBufferSize); NetworkPrefs.Set("Network.config.receiveBufferSize", _receiveBufferSize); NetworkPrefs.Set("Network.config.maximumTransmissionUnit", _maximumTransmissionUnit); NetworkPrefs.Set("Network.config.timeBetweenPings", _timeBetweenPings); NetworkPrefs.Set("Network.config.timeoutDelay", _timeoutDelay); NetworkPrefs.Set("Network.config.handshakeRetriesMaxCount", _handshakeRetriesMaxCount); NetworkPrefs.Set("Network.config.handshakeRetryDelay", _handshakeRetryDelay); NetworkPrefs.Set("Network.config.batchSendAtEndOfFrame", batchSendAtEndOfFrame); NetworkPrefs.Set("Network.config.allowInternalUnconnectedMessages", allowInternalUnconnectedMessages); }
/// <summary> /// Gets the NetworkConfig properties from <see cref="uLink.NetworkPrefs"/>. /// </summary> public void GetPrefs() { _localIP = NetworkPrefs.Get("Network.config.localIP", _localIP); _sendBufferSize = NetworkPrefs.Get("Network.config.sendBufferSize", _sendBufferSize); _receiveBufferSize = NetworkPrefs.Get("Network.config.receiveBufferSize", _receiveBufferSize); _maximumTransmissionUnit = NetworkPrefs.Get("Network.config.maximumTransmissionUnit", _maximumTransmissionUnit); _timeBetweenPings = NetworkPrefs.Get("Network.config.timeBetweenPings", _timeBetweenPings); _timeoutDelay = NetworkPrefs.Get("Network.config.timeoutDelay", _timeoutDelay); _handshakeRetriesMaxCount = NetworkPrefs.Get("Network.config.handshakeRetriesMaxCount", _handshakeRetriesMaxCount); _handshakeRetryDelay = NetworkPrefs.Get("Network.config.handshakeRetryDelay", _handshakeRetryDelay); batchSendAtEndOfFrame = NetworkPrefs.Get("Network.config.batchSendAtEndOfFrame", batchSendAtEndOfFrame); _allowInternalUnconnectedMessages = NetworkPrefs.Get("Network.config.allowInternalUnconnectedMessages", allowInternalUnconnectedMessages); _allowConnectionToSelf = NetworkPrefs.Get("Network.config.allowConnectionToSelf", allowConnectionToSelf); _Apply(); }
/// <summary> /// Sets the persistent NetworkTime properties in <see cref="uLink.NetworkPrefs"/>. /// </summary> /// <remarks> /// The method can't update the saved values in the persistent <see cref="uLink.NetworkPrefs.resourcePath"/> file, /// because that assumes the file is editable (i.e. the running project isn't built) and would require file I/O permission. /// Calling this will only update the values in memory. /// </remarks> public static void SetPrefs() { NetworkPrefs.Set("NetworkTime.timeMeasurementFunction", (int)NetTime.timeMeasurementFunction); }
/// <summary> /// Gets the persistent NetworkTime properties from <see cref="uLink.NetworkPrefs"/>. /// </summary> public static void GetPrefs() { timeMeasurementFunction = (NetworkTimeMeasurementFunction)NetworkPrefs.Get("NetworkTime.timeMeasurementFunction", (int)NetworkTimeMeasurementFunction.Stopwatch); }