【发布时间】:2018-01-27 12:36:07
【问题描述】:
我正在使用最新的 .NET 核心目标 Lidgren fork:https://github.com/soccermitchy/lidgren-network-gen3,并且我正在尝试模拟丢包/高延迟。
这里有关于如何执行此操作的文档:https://github.com/lidgren/lidgren-network-gen3/wiki/Lag-Simulation。
这是我设置网络对等配置的方式:
config = new NetPeerConfiguration(name);
// This line breaks
config.SimulatedLoss = 0.5f;
config.Port = NetConfig.port;
config.MaximumConnections = 200;
config.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
这条线:config.SimulatedLoss = 0.5f; 不起作用,因为显然是NetPeerConfiguration does not contain a definition for SimulatedLoss。
当我查看源代码时:https://github.com/soccermitchy/lidgren-network-gen3/blob/master/Lidgren.Network/NetPeerConfiguration.cs#L468 我看到 SimulatedLoss 在 #if DEBUG #endif 指令之间。
如何从仅用于调试的 NuGet 包运行代码?
我尝试在“工具”->“调试”中启用一些选项和其他一些东西,但我真的无法在任何地方找到答案。
如果这个问题之前已经被问过多次,我提前道歉。
【问题讨论】:
标签: c# debugging nuget lidgren