程序集:LitJson UniRx UnityEngine
NuGet: MQTTnet MySql.Data
如果是Net.Standard Dll还需要加入
<PackageReference Include="MySql.Data" Version="8.0.16" />
<PackageReference Include="MQTTnet" Version="2.8.5" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
配置中添加:ZP_SERVER;ZP_UNIRX;
Demo工程代码如下:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG;NETCOREAPP;NETCOREAPP2_2;ZP_SERVER;ZP_UNIRX;</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="MySql.Data" Version="8.0.15" />
<PackageReference Include="MQTTnet" Version="2.8.5" />
</ItemGroup>
<ItemGroup>
<Reference Include="UniRx">
<HintPath>ServerLibrary\UniRx.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>ServerLibrary\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SharedInternalsModule">
<HintPath>ServerLibrary\UnityEngine.SharedInternalsModule.dll</HintPath>
</Reference>
<Reference Include="LitJson">
<HintPath>Assets\Plugins\LitJson.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Remove="Assets\ZProperties\*\*.meta" />
<None Remove="Assets\ZProperties\*\*\*.meta" />
<None Remove="Assets\ZProperties\*\*\*\*.meta" />
<None Remove="Assets\ZProperties\*\*\*\*\*.meta" />
<None Remove="Assets\ZProperties\*.meta" />
</ItemGroup>
</Project>
可以与Console工程合并在一起,融合代码如下:
public class Program
{
public static void Main(string[] args)
{
//Task.Run(async () => { await ProgramForMQTT.MainTest(); });
if (args.Length > 0 && string.CompareOrdinal( args[0], "exe") == 0) {
ServerTest.TestScene();
Console.WriteLine("Hello World!");
Console.ReadKey();
}
else
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
}
HelloWorld
person = ZPropertyMesh.CreateObject<Person> ();
person.blood.Value = 100;
person.rank.Value = 2;
Weapon sword = person.weapon.Value;
sword.power.Value = 991.0f;
person.testList.Add(900);
person.testList.Add(100);
var testObj = ZPropertyMesh.CreateObject<TestObj> ();
testObj.testData.Value = 201;
person.testInterface.Value = testObj;
var pp = ZPropertyMesh.GetPropertyEx(person, ".weapon.power");