提交 fc8f1052 编写于 作者: T tanghai

TBuffer由于KCP也用到了,所以抽出来共用,改名成CircularBuffer

上级 ca3b834d
......@@ -9,7 +9,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">VISIBLE_FILES</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=Unity/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="Unity"&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;DISABLED&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;IMPLICIT_WHEN_INITIALIZER_HAS_TYPE&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;IMPLICIT_EXCEPT_SIMPLE_TYPES&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;CSMakeAutoPropertyGetOnly&gt;True&lt;/CSMakeAutoPropertyGetOnly&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;RemoveCodeRedundancies&gt;True&lt;/RemoveCodeRedundancies&gt;&lt;CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" ArrangeCodeBodyStyle="True" /&gt;&lt;/Profile&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Unity</s:String>
<s:String x:Key="/Default/Housekeeping/Layout/DialogWindows/RefactoringWizardWindow/Location/@EntryValue">247,-4</s:String>
<s:String x:Key="/Default/Housekeeping/Layout/DialogWindows/RefactoringWizardWindow/Location/@EntryValue">247,-23</s:String>
<s:Int64 x:Key="/Default/Environment/SearchAndNavigation/DefaultOccurrencesGroupingIndex/@EntryValue">0</s:Int64>
<s:String x:Key="/Default/Profiling/Configurations/=1/@EntryIndexedValue">&lt;data&gt;&lt;HostParameters type="LocalHostParameters" /&gt;&lt;Argument type="StandaloneArgument"&gt;&lt;Arguments IsNull="False"&gt;&lt;/Arguments&gt;&lt;FileName IsNull="False"&gt;&lt;/FileName&gt;&lt;WorkingDirectory IsNull="False"&gt;&lt;/WorkingDirectory&gt;&lt;Scope&gt;&lt;ProcessFilters /&gt;&lt;/Scope&gt;&lt;/Argument&gt;&lt;Info type="TimelineInfo" /&gt;&lt;HostOptions type="HostOptions"&gt;&lt;HostTempPath IsNull="False"&gt;&lt;/HostTempPath&gt;&lt;/HostOptions&gt;&lt;/data&gt;</s:String>
</wpf:ResourceDictionary>
\ No newline at end of file
......@@ -35,12 +35,12 @@
<Compile Include="..\..\Unity\Assets\Scripts\Base\MultiMap.cs" Link="MultiMap.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\AChannel.cs" Link="Network\AChannel.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\AService.cs" Link="Network\AService.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\Circularbuffer.cs" Link="Network\Circularbuffer.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\KNet\KChannel.cs" Link="Network\KNet\KChannel.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\KNet\Kcp.cs" Link="Network\KNet\Kcp.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\KNet\KService.cs" Link="Network\KNet\KService.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\NetworkHelper.cs" Link="Network\NetworkHelper.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\TNet\PacketParser.cs" Link="Network\TNet\PacketParser.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\TNet\TBuffer.cs" Link="Network\TNet\TBuffer.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\TNet\TChannel.cs" Link="Network\TNet\TChannel.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\TNet\TService.cs" Link="Network\TNet\TService.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Network\UNet\Library.cs" Link="Network\UNet\Library.cs" />
......
......@@ -4,7 +4,7 @@ using System.Linq;
namespace Model
{
public class TBuffer
public class Circularbuffer
{
public int ChunkSize = 8192;
......@@ -16,12 +16,12 @@ namespace Model
public int FirstIndex { get; set; }
public TBuffer()
public Circularbuffer()
{
this.AddLast();
}
public TBuffer(int chunkSize)
public Circularbuffer(int chunkSize)
{
this.ChunkSize = chunkSize;
this.AddLast();
......
......@@ -13,7 +13,7 @@ namespace Model
private Kcp kcp;
private readonly TBuffer recvBuffer = new TBuffer(8 * 1024);
private readonly Circularbuffer recvBuffer = new Circularbuffer(8 * 1024);
private readonly Queue<byte[]> sendBuffer = new Queue<byte[]>();
private readonly PacketParser parser;
......
......@@ -28,14 +28,14 @@ namespace Model
internal class PacketParser
{
private readonly TBuffer buffer;
private readonly Circularbuffer buffer;
private ushort packetSize;
private ParserState state;
private Packet packet = new Packet(8 * 1024);
private bool isOK;
public PacketParser(TBuffer buffer)
public PacketParser(Circularbuffer buffer)
{
this.buffer = buffer;
}
......
......@@ -12,8 +12,8 @@ namespace Model
{
private readonly TcpClient tcpClient;
private readonly TBuffer recvBuffer = new TBuffer();
private readonly TBuffer sendBuffer = new TBuffer();
private readonly Circularbuffer recvBuffer = new Circularbuffer();
private readonly Circularbuffer sendBuffer = new Circularbuffer();
private bool isSending;
private readonly PacketParser parser;
......
......@@ -20,7 +20,7 @@ namespace Model
}
}
public class TimerComponent: Component, IUpdate
public class TimerComponent: Component
{
private readonly Dictionary<long, Timer> timers = new Dictionary<long, Timer>();
......
......@@ -233,7 +233,7 @@
<Compile Include="Assets\Scripts\Base\Network\KNet\KService.cs" />
<Compile Include="Assets\Scripts\Base\Network\NetworkHelper.cs" />
<Compile Include="Assets\Scripts\Base\Network\TNet\PacketParser.cs" />
<Compile Include="Assets\Scripts\Base\Network\TNet\TBuffer.cs" />
<Compile Include="Assets\Scripts\Base\Network\Circularbuffer.cs" />
<Compile Include="Assets\Scripts\Base\Network\TNet\TChannel.cs" />
<Compile Include="Assets\Scripts\Base\Network\TNet\TService.cs" />
<Compile Include="Assets\Scripts\Base\Network\UNet\Library.cs" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册