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

Assembly.Load还是需要mdb

tanghai пре 8 година
родитељ
комит
2b3b655b2e

BIN
Unity/Assets/Res/Code/Hotfix.mdb.bytes


+ 8 - 0
Unity/Assets/Res/Code/Hotfix.mdb.bytes.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 23845562ede90da4c8bc06908a4c6667
+timeCreated: 1504515298
+licenseType: Free
+TextScriptImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 2 - 0
Unity/Assets/Resources/Code.prefab

@@ -56,3 +56,5 @@ MonoBehaviour:
     gameObject: {fileID: 4900000, guid: ae44b218243cfc347af99a6875e9e11c, type: 3}
   - key: Hotfix.pdb
     gameObject: {fileID: 4900000, guid: dd08ff64f788e7a4ba0f918632ff8d0f, type: 3}
+  - key: Hotfix.mdb
+    gameObject: {fileID: 4900000, guid: 23845562ede90da4c8bc06908a4c6667, type: 3}

+ 3 - 13
Unity/Assets/Scripts/Helper/DllHelper.cs

@@ -29,15 +29,12 @@ namespace Model
 		{
 			GameObject code = (GameObject)Resources.Load("Code");
 			byte[] assBytes = code.Get<TextAsset>("Hotfix.dll").bytes;
-			byte[] mdbBytes = code.Get<TextAsset>("Hotfix.pdb").bytes;
+			byte[] mdbBytes = code.Get<TextAsset>("Hotfix.mdb").bytes;
 			Assembly assembly = Assembly.Load(assBytes, mdbBytes);
 			return assembly;
 		}
 #endif
 
-		private static List<Type> _typeBuffer = new List<Type>();
-
-
 		public static Type[] GetHotfixTypes()
 		{
 #if ILRuntime
@@ -46,15 +43,8 @@ namespace Model
 			{
 				return new Type[0];
 			}
-            
-			foreach (IType type in appDomain.LoadedTypes.Values.ToArray())
-			{
-                if (!_typeBuffer.Contains(type.ReflectionType))
-                {
-                    _typeBuffer.Add(type.ReflectionType);
-                }
-			}
-			return _typeBuffer.ToArray();
+
+			return appDomain.LoadedTypes.Values.Select(x => x.ReflectionType).ToArray();
 #else
 			return ObjectEvents.Instance.Get("Hotfix").GetTypes();
 #endif

+ 3 - 3
Unity/Hotfix/Init.cs

@@ -14,7 +14,7 @@ namespace Hotfix
 				Hotfix.Scene.ModelScene.AddComponent<Model.MessageDispatherComponent>();
 				Hotfix.Scene.ModelScene.AddComponent<NetOuterComponent>();
 				Hotfix.Scene.ModelScene.AddComponent<ResourcesComponent>();
-				Hotfix.Scene.ModelScene.AddComponent<BehaviorTreeComponent>();  
+				Hotfix.Scene.ModelScene.AddComponent<BehaviorTreeComponent>();
 				Hotfix.Scene.AddComponent<UIComponent>();
 				Hotfix.Scene.GetComponent<EventComponent>().Run(EventIdType.InitSceneStart);
 			}
@@ -32,7 +32,7 @@ namespace Hotfix
 			}
 			catch (Exception e)
 			{
-				Log.Error(e.ToString());
+				Log.Error(e.ToStr());
 			}
 		}
 
@@ -44,7 +44,7 @@ namespace Hotfix
 			}
 			catch (Exception e)
 			{
-				Log.Error(e.ToString());
+				Log.Error(e.ToStr());
 			}
 		}
 

+ 10 - 2
Unity/Hotfix/Unity.Hotfix.csproj

@@ -104,8 +104,16 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>echo FA | xcopy $(TargetName).dll $(SolutionDir)Assets\Res\Code\$(TargetName).dll.bytes
-echo FA | xcopy $(TargetName).pdb $(SolutionDir)Assets\Res\Code\$(TargetName).pdb.bytes</PostBuildEvent>
+    <PostBuildEvent>"$(SolutionDir)\Tools\pdb2mdb.exe" $(TargetFileName)
+
+
+echo FA | xcopy $(TargetName).dll $(SolutionDir)Assets\Res\Code\$(TargetName).dll.bytes
+
+
+echo FA | xcopy $(TargetName).pdb $(SolutionDir)Assets\Res\Code\$(TargetName).pdb.bytes
+
+
+echo FA | xcopy $(TargetName).dll.mdb $(SolutionDir)Assets\Res\Code\$(TargetName).mdb.bytes</PostBuildEvent>
   </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

+ 3 - 0
Unity/ProjectSettings/ProjectSettings.asset

@@ -437,6 +437,9 @@ PlayerSettings:
   switchUdpSendBufferSize: 9
   switchUdpReceiveBufferSize: 42
   switchSocketBufferEfficiency: 4
+  switchSocketInitializeEnabled: 1
+  switchNetworkInterfaceManagerInitializeEnabled: 1
+  switchPlayerConnectionEnabled: 1
   ps4NPAgeRating: 12
   ps4NPTitleSecret: 
   ps4NPTrophyPackPath: 

+ 1 - 1
Unity/ProjectSettings/ProjectVersion.txt

@@ -1 +1 @@
-m_EditorVersion: 2017.1.0f3
+m_EditorVersion: 2017.1.0p5

+ 6 - 1
Unity/Unity.sln

@@ -1,6 +1,8 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2017
+# Visual Studio 15
+VisualStudioVersion = 15.0.26730.10
+MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Plugins", "Unity.Plugins.csproj", "{D1FDB199-0FB7-099D-3771-C6A942E4E326}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity", "Unity.csproj", "{CF118143-7E37-744F-BE45-3F55345FEC40}"
@@ -35,4 +37,7 @@ Global
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {F4CA14D3-C715-499C-A877-DF4AB6A05C1E}
+	EndGlobalSection
 EndGlobal