Skip to content

Commit b630ef5

Browse files
committed
1.1.0
- Changed methods names from `ReadSerializable` to `ReadSerializableSmart` - Changed methods names from `Write` to `WriteSmart` - Fixed WriteSmart(ISync sync, int tag, bool sendTag = false, bool sendTypeID = false) not writing the correct `ExtraDataSync`. - Added descriptions to `SyncTypes`, `TypeID`, `SerializeOptional`, `DeserializeOptional` and `ExtraDataSync`.
1 parent 84a82f7 commit b630ef5

File tree

116 files changed

+7198
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+7198
-15
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29123.88
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DarkRiftLibary-MLAPI-Test-Client", "DarkRiftLibary-MLAPI-Test-Client\DarkRiftLibary-MLAPI-Test-Client.csproj", "{7CC57DF7-56B7-4DEC-9E09-8FC9B76D6D2F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{7CC57DF7-56B7-4DEC-9E09-8FC9B76D6D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{7CC57DF7-56B7-4DEC-9E09-8FC9B76D6D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{7CC57DF7-56B7-4DEC-9E09-8FC9B76D6D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{7CC57DF7-56B7-4DEC-9E09-8FC9B76D6D2F}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {070EE5D0-C3D8-4BD2-B973-FDC5022CF874}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{7CC57DF7-56B7-4DEC-9E09-8FC9B76D6D2F}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>DarkRiftLibary_MLAPI_Test_Client</RootNamespace>
10+
<AssemblyName>DarkRiftLibary-MLAPI-Test-Client</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="DarkRift, Version=2.3.1.0, Culture=neutral, processorArchitecture=MSIL">
37+
<SpecificVersion>False</SpecificVersion>
38+
<HintPath>..\..\ClickGamePlugin\ClickGamePlugin\ClickGamePlugin\bin\Debug\DarkRift.dll</HintPath>
39+
</Reference>
40+
<Reference Include="DarkRift.Client, Version=2.3.1.0, Culture=neutral, processorArchitecture=MSIL">
41+
<SpecificVersion>False</SpecificVersion>
42+
<HintPath>..\..\..\Unity Projects\PP\Assets\DarkRift\DarkRift\Plugins\Client\DarkRift.Client.dll</HintPath>
43+
</Reference>
44+
<Reference Include="DarkRiftLibrary-MLAPI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
45+
<SpecificVersion>False</SpecificVersion>
46+
<HintPath>..\..\DarkRiftLibrary-MLAPI\DarkRiftLibrary-MLAPI\bin\Debug\DarkRiftLibrary-MLAPI.dll</HintPath>
47+
</Reference>
48+
<Reference Include="System" />
49+
<Reference Include="System.Core" />
50+
<Reference Include="System.Xml.Linq" />
51+
<Reference Include="System.Data.DataSetExtensions" />
52+
<Reference Include="Microsoft.CSharp" />
53+
<Reference Include="System.Data" />
54+
<Reference Include="System.Net.Http" />
55+
<Reference Include="System.Xml" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<Compile Include="House.cs" />
59+
<Compile Include="Program.cs" />
60+
<Compile Include="Properties\AssemblyInfo.cs" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<None Include="App.config" />
64+
</ItemGroup>
65+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
66+
</Project>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using DarkRift;
7+
using DarkRift.Client;
8+
using Penca53.DarkRift.MLAPI;
9+
10+
namespace DarkRiftLibary_MLAPI_Test_Client
11+
{
12+
public class House : ISync
13+
{
14+
public int TypeID { get; set; } = 1;
15+
16+
public float Width;
17+
public float Height;
18+
public int Inhabitants;
19+
20+
public void Deserialize(DeserializeEvent e)
21+
{
22+
Width = e.Reader.ReadSingle();
23+
Height = e.Reader.ReadSingle();
24+
Inhabitants = e.Reader.ReadInt32();
25+
}
26+
27+
public void DeserializeOptional(DarkRiftReader reader, int tag)
28+
{
29+
if (tag == 1)
30+
{
31+
Width = reader.ReadSingle();
32+
Height = reader.ReadSingle();
33+
}
34+
}
35+
36+
public void Serialize(SerializeEvent e)
37+
{
38+
e.Writer.Write(Width);
39+
e.Writer.Write(Height);
40+
e.Writer.Write(Inhabitants);
41+
}
42+
43+
public void SerializeOptional(DarkRiftWriter writer, int tag)
44+
{
45+
if (tag == 1)
46+
{
47+
writer.Write(Width);
48+
writer.Write(Height);
49+
}
50+
}
51+
}
52+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading;
6+
using DarkRift;
7+
using DarkRift.Client;
8+
using Penca53.DarkRift.MLAPI;
9+
10+
namespace DarkRiftLibary_MLAPI_Test_Client
11+
{
12+
class Program
13+
{
14+
public static DarkRiftClient DarkRiftClient = new DarkRiftClient();
15+
public static House House = new House() { Width = 50, Height = 30, Inhabitants = 25 };
16+
17+
static void Main(string[] args)
18+
{
19+
MLAPI.SyncTypes.Add(1, typeof(House));
20+
21+
DarkRiftClient.MessageReceived += MessageReceived;
22+
DarkRiftClient.Connect(System.Net.IPAddress.Loopback, 4296, IPVersion.IPv4);
23+
24+
Console.ReadLine();
25+
}
26+
27+
static void MessageReceived(object sender, MessageReceivedEventArgs e)
28+
{
29+
Console.WriteLine("Received a message with tag: " + e.Tag);
30+
31+
using (DarkRiftReader reader = e.GetMessage().GetReader())
32+
{
33+
if (e.Tag == Tags.HouseNormal)
34+
{
35+
House _houseNormal = reader.ReadSerializable<House>();
36+
37+
Console.WriteLine("HouseNormal Width is: " + _houseNormal.Width);
38+
Console.WriteLine("HouseNormal Height is: " + _houseNormal.Height);
39+
Console.WriteLine("HouseNormal Inhabitants is: " + _houseNormal.Inhabitants);
40+
}
41+
else if (e.Tag == Tags.HouseNothing)
42+
{
43+
ISync _houseNothing = reader.ReadSerializableSmart();
44+
45+
if (_houseNothing.TypeID == 1)
46+
{
47+
House _house = (House)_houseNothing;
48+
49+
Console.WriteLine("HouseNothing Width is: " + _house.Width);
50+
Console.WriteLine("HouseNothing Height is: " + _house.Height);
51+
Console.WriteLine("HouseNothing Inhabitants is: " + _house.Inhabitants);
52+
}
53+
}
54+
else if (e.Tag == Tags.HouseType)
55+
{
56+
House _houseType = reader.ReadSerializableSmart<House>();
57+
58+
Console.WriteLine("HouseType Width is: " + _houseType.Width);
59+
Console.WriteLine("HouseType Height is: " + _houseType.Height);
60+
Console.WriteLine("HouseType Inhabitants is: " + _houseType.Inhabitants);
61+
}
62+
else if (e.Tag == Tags.HouseTag)
63+
{
64+
ISync _houseTag = reader.ReadSerializableSmart(1);
65+
66+
if (_houseTag.TypeID == 1)
67+
{
68+
House _house = (House)_houseTag;
69+
70+
Console.WriteLine("HouseTag Width is: " + _house.Width);
71+
Console.WriteLine("HouseTag Height is: " + _house.Height);
72+
Console.WriteLine("HouseTag Inhabitants is: " + _house.Inhabitants);
73+
}
74+
}
75+
else if (e.Tag == Tags.HouseTypeANDTag)
76+
{
77+
House _houseTypeANDTag = reader.ReadSerializableSmart<House>(1);
78+
79+
Console.WriteLine("HouseTypeANDTag Width is: " + _houseTypeANDTag.Width);
80+
Console.WriteLine("HouseTypeANDTag Height is: " + _houseTypeANDTag.Height);
81+
Console.WriteLine("HouseTypeANDTag Inhabitants is: " + _houseTypeANDTag.Inhabitants);
82+
}
83+
else if (e.Tag == Tags.HouseUpdateNothing)
84+
{
85+
Console.WriteLine("HouseUpdateTag Width was: " + House.Width);
86+
Console.WriteLine("HouseUpdateTag Height was: " + House.Height);
87+
Console.WriteLine("HouseUpdateTag Inhabitants was: " + House.Inhabitants);
88+
89+
House.ReadSerializableSmart(reader);
90+
91+
Console.WriteLine("HouseUpdateNothing Width is: " + House.Width);
92+
Console.WriteLine("HouseUpdateNothing Height is: " + House.Height);
93+
Console.WriteLine("HouseUpdateNothing Inhabitants is: " + House.Inhabitants);
94+
}
95+
else if (e.Tag == Tags.HouseUpdateTag)
96+
{
97+
Console.WriteLine("HouseUpdateTag Width was: " + House.Width);
98+
Console.WriteLine("HouseUpdateTag Height was: " + House.Height);
99+
Console.WriteLine("HouseUpdateTag Inhabitants was: " + House.Inhabitants);
100+
101+
House.ReadSerializableSmart(reader, 1);
102+
103+
Console.WriteLine("HouseUpdateTag Width is: " + House.Width);
104+
Console.WriteLine("HouseUpdateTag Height is: " + House.Height);
105+
Console.WriteLine("HouseUpdateTag Inhabitants is: " + House.Inhabitants);
106+
}
107+
}
108+
}
109+
}
110+
111+
static class Tags
112+
{
113+
public static readonly ushort HouseNormal = 0;
114+
public static readonly ushort HouseNothing = 1;
115+
public static readonly ushort HouseType = 2;
116+
public static readonly ushort HouseTag = 3;
117+
public static readonly ushort HouseTypeANDTag = 4;
118+
public static readonly ushort HouseUpdateNothing = 5;
119+
public static readonly ushort HouseUpdateTag = 6;
120+
}
121+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// Le informazioni generali relative a un assembly sono controllate dal seguente
6+
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
7+
// associate a un assembly.
8+
[assembly: AssemblyTitle("DarkRiftLibary-MLAPI-Test-Client")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("DarkRiftLibary-MLAPI-Test-Client")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
18+
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
19+
// COM, impostare su true l'attributo ComVisible per tale tipo.
20+
[assembly: ComVisible(false)]
21+
22+
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
23+
[assembly: Guid("7cc57df7-56b7-4dec-9e09-8fc9b76d6d2f")]
24+
25+
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
26+
//
27+
// Versione principale
28+
// Versione secondaria
29+
// Numero di build
30+
// Revisione
31+
//
32+
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
33+
// usando l'asterisco '*' come illustrato di seguito:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)