Преглед изворни кода

mono层的配置生成一个AvoidAOT的方法,防止aot问题

tanghai пре 7 година
родитељ
комит
ba0be5bdc9

+ 0 - 24
Server/Model/Entity/Config/BuffConfig.cs

@@ -1,24 +0,0 @@
-using MongoDB.Bson.Serialization.Attributes;
-
-namespace Model
-{
-	[BsonIgnoreExtraElements]
-	public class BuffConfig: AConfig
-	{
-		public string Name { get; set; }
-		public int Duration { get; set; }
-
-		public BuffConfig()
-		{
-		}
-
-		public BuffConfig(long id): base(id)
-		{
-		}
-	}
-
-	[Config(AppType.Client | AppType.Gate)]
-	public class BuffCategory: ACategory<BuffConfig>
-	{
-	}
-}

+ 12 - 1
Unity/Assets/Editor/ExcelExporterEditor/ExcelExporterEditor.cs

@@ -125,7 +125,18 @@ public class ExcelExporterEditor : EditorWindow
 
 			sb.Append("\t[Config(AppType.Client)]\n");
 			sb.Append($"\tpublic partial class {protoName}Category : ACategory<{protoName}>\n");
-			sb.Append("\t{}\n\n");
+			sb.Append("\t{\n");
+			sb.Append($"\t\tpublic static void AvoidAOT(ConfigComponent configComponent, {protoName}Category category)\n");
+			sb.Append("\t\t{\n");
+			sb.Append($"\t\t\tconfigComponent.Get<{protoName}>(1);\n");
+			sb.Append($"\t\t\tconfigComponent.GetCategory<{protoName}Category>();\n");
+			sb.Append($"\t\t\tconfigComponent.GetAll<{protoName}>();\n");
+			sb.Append($"\t\t\tcategory.GetAll();\n");
+			sb.Append($"\t\t\t{protoName} config = category[1];\n");
+			sb.Append($"\t\t\tconfig = category.TryGet(1);\n");
+			sb.Append($"\t\t\tconfig = category.GetOne();\n");
+			sb.Append("\t\t}\n");
+			sb.Append("\t}\n\n");
 
 			sb.Append($"\tpublic class {protoName}: AConfig\n");
 			sb.Append("\t{\n");

+ 0 - 21
Unity/Assets/Scripts/Entity/Config/BuffConfig.cs

@@ -1,21 +0,0 @@
-namespace Model
-{
-	public class BuffConfig: AConfig
-	{
-		public string Name { get; set; }
-		public int Duration { get; set; }
-
-		public BuffConfig()
-		{
-		}
-
-		public BuffConfig(long id): base(id)
-		{
-		}
-	}
-
-	[Config(AppType.Client)]
-	public class BuffCategory: ACategory<BuffConfig>
-	{
-	}
-}

+ 0 - 12
Unity/Assets/Scripts/Entity/Config/BuffConfig.cs.meta

@@ -1,12 +0,0 @@
-fileFormatVersion: 2
-guid: 8433bdafcbe56e140b3fe0c93722e0cf
-timeCreated: 1498118076
-licenseType: Free
-MonoImporter:
-  serializedVersion: 2
-  defaultReferences: []
-  executionOrder: 0
-  icon: {instanceID: 0}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 12 - 1
Unity/Assets/Scripts/Entity/Config/UnitConfig.cs

@@ -2,7 +2,18 @@ namespace Model
 {
 	[Config(AppType.Client)]
 	public partial class UnitConfigCategory : ACategory<UnitConfig>
-	{}
+	{
+		public static void AvoidAOT(ConfigComponent configComponent, UnitConfigCategory category)
+		{
+			configComponent.Get<UnitConfig>(1);
+			configComponent.GetCategory<UnitConfigCategory>();
+			configComponent.GetAll<UnitConfig>();
+			category.GetAll();
+			UnitConfig config = category[1];
+			config = category.TryGet(1);
+			config = category.GetOne();
+		}
+	}
 
 	public class UnitConfig: AConfig
 	{

+ 0 - 23
Unity/Hotfix/Entity/Config/BuffConfig.cs

@@ -1,23 +0,0 @@
-using Model;
-
-namespace Hotfix
-{
-	public class BuffConfig: AConfig
-	{
-		public string Name { get; set; }
-		public int Duration { get; set; }
-
-		public BuffConfig()
-		{
-		}
-
-		public BuffConfig(long id): base(id)
-		{
-		}
-	}
-
-	[Config(AppType.Client)]
-	public class BuffCategory: ACategory<BuffConfig>
-	{
-	}
-}

+ 0 - 1
Unity/Hotfix/Unity.Hotfix.csproj

@@ -57,7 +57,6 @@
     <Compile Include="Base\Helper\JsonHelper.cs" />
     <Compile Include="Base\Object\IStart.cs" />
     <Compile Include="Component\OperaComponent.cs" />
-    <Compile Include="Entity\Config\BuffConfig.cs" />
     <Compile Include="Entity\Config\UnitConfig.cs" />
     <Compile Include="Event\TestHotfixSubscribMonoEvent_LogString.cs" />
     <Compile Include="Handler\Actor_CreateUnitsHandler.cs" />

+ 2 - 2
Unity/Unity.Editor.Plugins.csproj

@@ -52,7 +52,7 @@
     <Reference Include="System">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.dll</HintPath>
     </Reference>
-    <Reference Include="System.Xml">
+    <Reference Include="System.XML">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.XML.dll</HintPath>
     </Reference>
     <Reference Include="System.Core">
@@ -181,4 +181,4 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>

+ 2 - 2
Unity/Unity.Editor.csproj

@@ -52,7 +52,7 @@
     <Reference Include="System">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.dll</HintPath>
     </Reference>
-    <Reference Include="System.Xml">
+    <Reference Include="System.XML">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.XML.dll</HintPath>
     </Reference>
     <Reference Include="System.Core">
@@ -248,4 +248,4 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>

+ 5 - 8
Unity/Unity.Plugins.csproj

@@ -12,15 +12,12 @@
     <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
     <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
-    <TargetFrameworkProfile>
-    </TargetFrameworkProfile>
-    <CompilerResponseFile>
-    </CompilerResponseFile>
+    <TargetFrameworkProfile></TargetFrameworkProfile>
+    <CompilerResponseFile></CompilerResponseFile>
     <UnityProjectType>GamePlugins:3</UnityProjectType>
     <UnityBuildTarget>StandaloneWindows:5</UnityBuildTarget>
     <UnityVersion>2017.1.1p4</UnityVersion>
-    <RootNamespace>
-    </RootNamespace>
+    <RootNamespace></RootNamespace>
     <LangVersion>6</LangVersion>
   </PropertyGroup>
   <PropertyGroup>
@@ -55,7 +52,7 @@
     <Reference Include="System">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.dll</HintPath>
     </Reference>
-    <Reference Include="System.Xml">
+    <Reference Include="System.XML">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.XML.dll</HintPath>
     </Reference>
     <Reference Include="System.Core">
@@ -445,4 +442,4 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>

+ 7 - 5
Unity/Unity.csproj

@@ -12,12 +12,15 @@
     <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
     <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
-    <TargetFrameworkProfile></TargetFrameworkProfile>
-    <CompilerResponseFile></CompilerResponseFile>
+    <TargetFrameworkProfile>
+    </TargetFrameworkProfile>
+    <CompilerResponseFile>
+    </CompilerResponseFile>
     <UnityProjectType>Game:1</UnityProjectType>
     <UnityBuildTarget>StandaloneWindows:5</UnityBuildTarget>
     <UnityVersion>2017.1.1p4</UnityVersion>
-    <RootNamespace></RootNamespace>
+    <RootNamespace>
+    </RootNamespace>
     <LangVersion>6</LangVersion>
   </PropertyGroup>
   <PropertyGroup>
@@ -52,7 +55,7 @@
     <Reference Include="System">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.dll</HintPath>
     </Reference>
-    <Reference Include="System.Xml">
+    <Reference Include="System.XML">
       <HintPath>C:\Apps\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5\System.XML.dll</HintPath>
     </Reference>
     <Reference Include="System.Core">
@@ -206,7 +209,6 @@
     <Compile Include="Assets\Scripts\Component\UnitComponent.cs" />
     <Compile Include="Assets\Scripts\Entity\AssetsBundleLoaderAsync.cs" />
     <Compile Include="Assets\Scripts\Entity\AssetsLoaderAsync.cs" />
-    <Compile Include="Assets\Scripts\Entity\Config\BuffConfig.cs" />
     <Compile Include="Assets\Scripts\Entity\Config\UnitConfig.cs" />
     <Compile Include="Assets\Scripts\Entity\Game.cs" />
     <Compile Include="Assets\Scripts\Entity\Hotfix.cs" />

+ 22 - 25
Unity/Unity.sln

@@ -1,13 +1,13 @@
 
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Assembly-CSharp-firstpass.csproj", "{2662B409-6332-1E56-D797-C9025C53BDD6}"
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2017
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Assembly-CSharp.csproj", "{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Assembly-CSharp-Editor.csproj", "{6311E6C6-0A20-383B-320B-694068DE37A5}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Assembly-CSharp-Editor-firstpass.csproj", "{F534D6C4-3368-032B-289C-A943CC171719}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor.Plugins", "Unity.Editor.Plugins.csproj", "{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,27 +15,24 @@ Global
 		Release|Any CPU = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{2662B409-6332-1E56-D797-C9025C53BDD6}.Release|Any CPU.Build.0 = Release|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{CD8C9303-404B-FB8D-6B9B-21988D5CAC0A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{6311E6C6-0A20-383B-320B-694068DE37A5}.Release|Any CPU.Build.0 = Release|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{F534D6C4-3368-032B-289C-A943CC171719}.Release|Any CPU.Build.0 = Release|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D1FDB199-0FB7-099D-3771-C6A942E4E326}.Release|Any CPU.Build.0 = Release|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{CF118143-7E37-744F-BE45-3F55345FEC40}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C17F48D3-964E-E97C-3D2E-966F7A6C6D93}.Release|Any CPU.Build.0 = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{81A6E58E-BFF2-F1C8-1C4E-6316985F642C}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
-	GlobalSection(MonoDevelopProperties) = preSolution
-		StartupItem = Assembly-CSharp.csproj
-	EndGlobalSection
 EndGlobal