浏览代码

Invoke方法加个重载,type为0的时候可以不填

tanghai 3 年之前
父节点
当前提交
816e703ec8

+ 2 - 1
.gitignore

@@ -87,4 +87,5 @@ Publish/
 
 /Unity/Assets/Bundles/AotDlls
 /Unity/Assets/Bundles/AotDlls.meta
-/Unity/HybridCLRData
+/Unity/HybridCLRData
+/Unity/Assembly-CSharp-firstpass.csproj

+ 0 - 82
Unity/Assembly-CSharp-firstpass.csproj

@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <LangVersion>9.0</LangVersion>
-    <_TargetFrameworkDirectories>non_empty_path_generated_by_unity.rider.package</_TargetFrameworkDirectories>
-    <_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_unity.rider.package</_FullFrameworkReferenceAssemblyPaths>
-    <DisableHandlePackageFileConflicts>true</DisableHandlePackageFileConflicts>
-  </PropertyGroup>
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.20506</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <RootNamespace></RootNamespace>
-    <ProjectGuid>{09b46226-3263-561e-d797-c9025c53bdd6}</ProjectGuid>
-    <ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <AssemblyName>Assembly-CSharp-firstpass</AssemblyName>
-    <TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <BaseDirectory>.</BaseDirectory>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>Temp\Bin\Debug\Unity.Rider.Editor\</OutputPath>
-    <DefineConstants>UNITY_EDITOR</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <NoWarn>0169,0649</NoWarn>
-    <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
-    <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
-  </PropertyGroup>
-  <PropertyGroup>
-    <NoConfig>true</NoConfig>
-    <NoStdLib>true</NoStdLib>
-    <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
-    <ImplicitlyExpandNETStandardFacades>false</ImplicitlyExpandNETStandardFacades>
-    <ImplicitlyExpandDesignTimeFacades>false</ImplicitlyExpandDesignTimeFacades>
-  </PropertyGroup>
-  <ItemGroup>
-     <Folder Include="Assets/Plugins/Android" />
-     <Folder Include="Assets/Plugins/MongoDB/runtimes/win/native" />
-     <Folder Include="Assets/Plugins/MongoDB/runtimes/linux" />
-     <Folder Include="Assets/Plugins/MacOS" />
-     <Folder Include="Assets/Plugins" />
-     <Folder Include="Assets/Plugins/MongoDB/runtimes" />
-     <Folder Include="Assets/Plugins/Android/libs/x86" />
-     <Folder Include="Assets/Plugins/MacOS/x86_64" />
-     <Folder Include="Assets/Plugins/MongoDB/runtimes/win" />
-     <Folder Include="Assets/Plugins/MongoDB" />
-     <Folder Include="Assets/Plugins/Android/libs/arm64-v8a" />
-     <Folder Include="Assets/Plugins/MacOS/arm64" />
-     <Folder Include="Assets/Plugins/Android/libs/armeabi-v7a" />
-     <Folder Include="Assets/Plugins/iOS" />
-     <Folder Include="Assets/Plugins/MongoDB/runtimes/osx" />
-     <Folder Include="Assets/Plugins/x86" />
-     <Folder Include="Assets/Plugins/MongoDB/runtimes/linux/native" />
-     <Folder Include="Assets/Plugins/Android/libs" />
-     <Folder Include="Assets/Plugins/x86_64" />
-     <Folder Include="Assets/Plugins/MongoDB/runtimes/osx/native" />
-     <Reference Include="UnityEngine">
-     <HintPath>/Applications/Unity/Hub/Editor/2021.3.16f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.dll</HintPath>
-     </Reference>
-     <Reference Include="UnityEngine.CoreModule">
-     <HintPath>/Applications/Unity/Hub/Editor/2021.3.16f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.CoreModule.dll</HintPath>
-     </Reference>
-     <Reference Include="UnityEditor">
-     <HintPath>/Applications/Unity/Hub/Editor/2021.3.16f1/Unity.app/Contents/Managed/UnityEngine/UnityEditor.dll</HintPath>
-     </Reference>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- 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.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>

+ 1 - 1
Unity/Assets/Scripts/Codes/Hotfix/Share/Module/Recast/NavmeshComponentSystem.cs

@@ -21,7 +21,7 @@ namespace ET
                 return ptr;
             }
 
-            byte[] buffer = EventSystem.Instance.Invoke<NavmeshComponent.RecastFileLoader, byte[]>(0, new NavmeshComponent.RecastFileLoader() {Name = name});
+            byte[] buffer = EventSystem.Instance.Invoke<NavmeshComponent.RecastFileLoader, byte[]>(new NavmeshComponent.RecastFileLoader() {Name = name});
             if (buffer.Length == 0)
             {
                 throw new Exception($"no nav data: {name}");

+ 3 - 3
Unity/Assets/Scripts/Core/Module/Config/ConfigComponent.cs

@@ -36,7 +36,7 @@ namespace ET
 				oneConfig.Destroy();
 			}
 			
-			byte[] oneConfigBytes = EventSystem.Instance.Invoke<GetOneConfigBytes, byte[]>(0, new GetOneConfigBytes() {ConfigName = configType.FullName});
+			byte[] oneConfigBytes = EventSystem.Instance.Invoke<GetOneConfigBytes, byte[]>(new GetOneConfigBytes() {ConfigName = configType.FullName});
 
 			object category = SerializeHelper.Deserialize(configType, oneConfigBytes, 0, oneConfigBytes.Length);
 			ISingleton singleton = category as ISingleton;
@@ -49,7 +49,7 @@ namespace ET
 		public void Load()
 		{
 			this.allConfig.Clear();
-			Dictionary<Type, byte[]> configBytes = EventSystem.Instance.Invoke<GetAllConfigBytes, Dictionary<Type, byte[]>>(0, new GetAllConfigBytes());
+			Dictionary<Type, byte[]> configBytes = EventSystem.Instance.Invoke<GetAllConfigBytes, Dictionary<Type, byte[]>>(new GetAllConfigBytes());
 
 			foreach (Type type in configBytes.Keys)
 			{
@@ -61,7 +61,7 @@ namespace ET
 		public async ETTask LoadAsync()
 		{
 			this.allConfig.Clear();
-			Dictionary<Type, byte[]> configBytes = EventSystem.Instance.Invoke<GetAllConfigBytes, Dictionary<Type, byte[]>>(0, new GetAllConfigBytes());
+			Dictionary<Type, byte[]> configBytes = EventSystem.Instance.Invoke<GetAllConfigBytes, Dictionary<Type, byte[]>>(new GetAllConfigBytes());
 
 			using ListComponent<Task> listTasks = ListComponent<Task>.Create();
 			

+ 10 - 0
Unity/Assets/Scripts/Core/Module/EventSystem/EventSystem.cs

@@ -692,5 +692,15 @@ namespace ET
             
             return aInvokeHandler.Handle(args);
         }
+        
+        public void Invoke<A>(A args) where A: struct
+        {
+            Invoke(0, args);
+        }
+        
+        public T Invoke<A, T>(A args) where A: struct
+        {
+            return Invoke<A, T>(0, args);
+        }
     }
 }