From 535b2a557c9e6fbf5a566b714612004a67bfa07c Mon Sep 17 00:00:00 2001 From: Reherc Date: Sun, 14 Mar 2021 03:29:17 +0100 Subject: [PATCH] Made R&D mod to test GSL features --- Centrifuge.Mods.Distance.sln | 22 +++ Distance.AdventureMaker/Entry.cs | 3 +- ...e.ResearchAndDevelopment.Content.projitems | 14 ++ ...ance.ResearchAndDevelopment.Content.shproj | 13 ++ .../Mod/mod.json | 13 ++ .../Distance.ResearchAndDevelopment.csproj | 141 ++++++++++++++++++ Distance.ResearchAndDevelopment/Entry.cs | 62 ++++++++ .../Properties/AssemblyInfo.cs | 36 +++++ .../packages.config | 9 ++ 9 files changed, 311 insertions(+), 2 deletions(-) create mode 100644 Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.projitems create mode 100644 Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.shproj create mode 100644 Distance.ResearchAndDevelopment.Content/Mod/mod.json create mode 100644 Distance.ResearchAndDevelopment/Distance.ResearchAndDevelopment.csproj create mode 100644 Distance.ResearchAndDevelopment/Entry.cs create mode 100644 Distance.ResearchAndDevelopment/Properties/AssemblyInfo.cs create mode 100644 Distance.ResearchAndDevelopment/packages.config diff --git a/Centrifuge.Mods.Distance.sln b/Centrifuge.Mods.Distance.sln index 61a7d49..48027ba 100644 --- a/Centrifuge.Mods.Distance.sln +++ b/Centrifuge.Mods.Distance.sln @@ -84,6 +84,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Solution.Task.PostBuild", " {5AA5A388-EB90-4280-BB32-4496138DD00E} = {5AA5A388-EB90-4280-BB32-4496138DD00E} {5C9E788B-C9B8-462D-A561-431EBA706C0F} = {5C9E788B-C9B8-462D-A561-431EBA706C0F} {83C8F38B-07E9-4A9B-8E5C-37981A28136E} = {83C8F38B-07E9-4A9B-8E5C-37981A28136E} + {004F8E95-36D7-400D-873F-60288E533802} = {004F8E95-36D7-400D-873F-60288E533802} {06A78A9A-7A66-431F-8023-36EAA5D0FBAF} = {06A78A9A-7A66-431F-8023-36EAA5D0FBAF} {AEE4B99D-C164-4495-AEE2-94CE4DBAAFDD} = {AEE4B99D-C164-4495-AEE2-94CE4DBAAFDD} {0AD5BDA8-85AB-4163-BA40-CF49F769BADF} = {0AD5BDA8-85AB-4163-BA40-CF49F769BADF} @@ -276,6 +277,15 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Centrifuge.Distance.Shared" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Wiki", "Wiki", "{B278157B-15FE-472F-A7DC-79C8217A0F3B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ResearchAndDevelopment", "ResearchAndDevelopment", "{2474388E-8D7C-4287-8A9E-7878D89E989A}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Distance.ResearchAndDevelopment.Content", "Distance.ResearchAndDevelopment.Content\Distance.ResearchAndDevelopment.Content.shproj", "{F6C2C5DD-2F7C-4423-A3BD-D54F3FA8E6C9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Distance.ResearchAndDevelopment", "Distance.ResearchAndDevelopment\Distance.ResearchAndDevelopment.csproj", "{004F8E95-36D7-400D-873F-60288E533802}" + ProjectSection(ProjectDependencies) = postProject + {F9FB724F-6555-4B6B-8D51-3140CA47D2FE} = {F9FB724F-6555-4B6B-8D51-3140CA47D2FE} + EndProjectSection +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Distance.NoServerLimit.Content\Distance.NoServerLimit.Content.projitems*{02cd7385-b155-4974-843d-9d0dd6bbfbe5}*SharedItemsImports = 13 @@ -313,6 +323,7 @@ Global Distance.EditorAdditions.Content\Distance.EditorAdditions.Content.projitems*{e2e4ac75-d500-4d5d-a706-613a3df688e3}*SharedItemsImports = 13 Centrifuge.Distance\Centrifuge.GameSupport.Distance.Shared\Centrifuge.Distance.Shared.projitems*{e4ac586e-ad6d-43a8-a0cb-aa4d2d6fe578}*SharedItemsImports = 13 Distance.SceneDumper.Content\Distance.SceneDumper.Content.projitems*{e84718c2-200c-415f-ad1d-0cc133c38e70}*SharedItemsImports = 13 + Distance.ResearchAndDevelopment.Content\Distance.ResearchAndDevelopment.Content.projitems*{f6c2c5dd-2f7c-4423-a3bd-d54f3fa8e6c9}*SharedItemsImports = 13 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -537,6 +548,14 @@ Global {C0573B40-FE3F-4E65-BB05-CC143A10A700}.Release|Any CPU.Build.0 = Release|Any CPU {C0573B40-FE3F-4E65-BB05-CC143A10A700}.Release|x86.ActiveCfg = Release|Any CPU {C0573B40-FE3F-4E65-BB05-CC143A10A700}.Release|x86.Build.0 = Release|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Debug|Any CPU.Build.0 = Debug|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Debug|x86.ActiveCfg = Debug|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Debug|x86.Build.0 = Debug|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Release|Any CPU.ActiveCfg = Release|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Release|Any CPU.Build.0 = Release|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Release|x86.ActiveCfg = Release|Any CPU + {004F8E95-36D7-400D-873F-60288E533802}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -614,6 +633,9 @@ Global {0F2C2BE7-27A2-408A-841F-643B3549A55E} = {23D64D48-DA47-4121-9E52-978C85687AC5} {27ADDC41-184A-417C-ABD0-13264475C380} = {C6C7A7A2-BAE8-4C15-9BC6-61BAB6A42006} {E4AC586E-AD6D-43A8-A0CB-AA4D2D6FE578} = {4DA6AF01-8F55-48AF-8044-9C0C10E8F797} + {2474388E-8D7C-4287-8A9E-7878D89E989A} = {0FC121F4-6F94-4C7D-A2B5-D92AC9CC91A6} + {F6C2C5DD-2F7C-4423-A3BD-D54F3FA8E6C9} = {2474388E-8D7C-4287-8A9E-7878D89E989A} + {004F8E95-36D7-400D-873F-60288E533802} = {2474388E-8D7C-4287-8A9E-7878D89E989A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C475AB02-6F97-4575-9527-2F31F5AF847C} diff --git a/Distance.AdventureMaker/Entry.cs b/Distance.AdventureMaker/Entry.cs index a5948d5..3645afa 100644 --- a/Distance.AdventureMaker/Entry.cs +++ b/Distance.AdventureMaker/Entry.cs @@ -1,5 +1,4 @@ -using Centrifuge.Distance.Game; -using Events.MainMenu; +using Events.MainMenu; using Reactor.API.Attributes; using Reactor.API.Interfaces.Systems; using Reactor.API.Logging; diff --git a/Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.projitems b/Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.projitems new file mode 100644 index 0000000..f3c691c --- /dev/null +++ b/Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.projitems @@ -0,0 +1,14 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + f6c2c5dd-2f7c-4423-a3bd-d54f3fa8e6c9 + + + Distance.ResearchAndDevelopment.Content + + + + + \ No newline at end of file diff --git a/Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.shproj b/Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.shproj new file mode 100644 index 0000000..b4958f6 --- /dev/null +++ b/Distance.ResearchAndDevelopment.Content/Distance.ResearchAndDevelopment.Content.shproj @@ -0,0 +1,13 @@ + + + + f6c2c5dd-2f7c-4423-a3bd-d54f3fa8e6c9 + 14.0 + + + + + + + + diff --git a/Distance.ResearchAndDevelopment.Content/Mod/mod.json b/Distance.ResearchAndDevelopment.Content/Mod/mod.json new file mode 100644 index 0000000..c0fbd6d --- /dev/null +++ b/Distance.ResearchAndDevelopment.Content/Mod/mod.json @@ -0,0 +1,13 @@ +{ + "FriendlyName": "Research and Development", + "Description": "Testing grounds for potential GSL features.", + "Author": "Reherc", + "Contact": "Github: @REHERC", + "ModuleFileName": "Distance.ResearchAndDevelopment.dll", + "Priority": 10, + "SkipLoad": false, + "Dependencies": [], + "RequiredGSLs": [ + "com.github.reherc/Centrifuge.Distance" + ] +} \ No newline at end of file diff --git a/Distance.ResearchAndDevelopment/Distance.ResearchAndDevelopment.csproj b/Distance.ResearchAndDevelopment/Distance.ResearchAndDevelopment.csproj new file mode 100644 index 0000000..b452bd0 --- /dev/null +++ b/Distance.ResearchAndDevelopment/Distance.ResearchAndDevelopment.csproj @@ -0,0 +1,141 @@ + + + + + Debug + AnyCPU + {004F8E95-36D7-400D-873F-60288E533802} + Library + Properties + Distance.ResearchAndDevelopment + Distance.ResearchAndDevelopment + v3.5 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + + + + ..\packages\HarmonyX.2.4.0\lib\net35\0Harmony.dll + + + False + ..\Centrifuge.Distance\Centrifuge.GameSupport.Distance.Shared\Binaries\Distance\Assembly-CSharp.dll + + + ..\packages\Mono.Cecil.0.10.4\lib\net35\Mono.Cecil.dll + + + ..\packages\Mono.Cecil.0.10.4\lib\net35\Mono.Cecil.Mdb.dll + + + ..\packages\Mono.Cecil.0.10.4\lib\net35\Mono.Cecil.Pdb.dll + + + ..\packages\Mono.Cecil.0.10.4\lib\net35\Mono.Cecil.Rocks.dll + + + ..\packages\MonoMod.RuntimeDetour.21.3.1.1\lib\net35\MonoMod.RuntimeDetour.dll + + + ..\packages\MonoMod.Utils.21.3.1.1\lib\net35\MonoMod.Utils.dll + + + ..\packages\Json.Net.Unity3D.9.0.1\lib\net35\Newtonsoft.Json.dll + + + ..\packages\Centrifuge.Mod.SDK.3.2.0\lib\net35\Reactor.API.dll + + + + + + + + + False + ..\Centrifuge.Distance\Centrifuge.GameSupport.Distance.Shared\Binaries\UnityEngine\UnityEngine.dll + + + + + + + + + + + + {c0573b40-fe3f-4e65-bb05-cc143a10a700} + Centrifuge.Distance + + + + + SET MODNAME=Distance Research And Development +SET INCLUDE=$(SolutionDir)Distance.ResearchAndDevelopment.Content + +SET BUILD=$(ProjectDir)$(OutDir) +SET PACKAGES=$(SolutionDir)Build\%25MODNAME%25\Centrifuge + +SET MOD=%25PACKAGES%25\Mods\%25MODNAME%25 + +REM ===== COPY MOD FILES ===== + +CALL :MAKEDIR "%25MOD%25" + +CALL :COPYDIR "%25INCLUDE%25\Mod" "%25MOD%25" +CALL :COPY "%25BUILD%25Distance.ResearchAndDevelopment.dll" "%25MOD%25" + +CALL :INCLUDEGSL Centrifuge.Distance + +EXIT 0 + +REM ===== BUILD SUBROUTINES ===== + +:MAKEDIR +IF NOT EXIST %251 MKDIR %251 +GOTO :EOF + +:COPY +XCOPY /s /Y /v %251 %252 +GOTO :EOF + +:COPYDIR +XCOPY /i /s /Y /v %251 %252 +GOTO :EOF + +:INCLUDEGSL +CALL :MAKEDIR "%25PACKAGES%25\GameSupport" +CALL :COPY "%25BUILD%25%251.dll" "%25PACKAGES%25\GameSupport" +GOTO :EOF + +:INCLUDEDEPENDENCY +CALL :MAKEDIR "%25MOD%25\Dependencies" +CALL :COPY "%25BUILD%25%251.dll" "%25MOD%25\Dependencies" +GOTO :EOF + +:INCLUDEDEPENDENCYRENAME +CALL :MAKEDIR "%25MOD%25\Dependencies" +CALL :COPY "%25BUILD%25%251.dll" "%25MOD%25\Dependencies\%252.dll" +GOTO :EOF + + \ No newline at end of file diff --git a/Distance.ResearchAndDevelopment/Entry.cs b/Distance.ResearchAndDevelopment/Entry.cs new file mode 100644 index 0000000..629e1bd --- /dev/null +++ b/Distance.ResearchAndDevelopment/Entry.cs @@ -0,0 +1,62 @@ +using Centrifuge.Distance.Game; +using Events.MainMenu; +using Reactor.API.Attributes; +using Reactor.API.Interfaces.Systems; +using Reactor.API.Logging; +using Reactor.API.Runtime.Patching; +using System.Collections; +using UnityEngine; + +namespace Distance.ResearchAndDevelopment +{ + [ModEntryPoint("com.github.reherc/Distance.ResearchAndDevelopment")] + public class Mod : MonoBehaviour + { + public static Mod Instance; + + public IManager Manager { get; set; } + + public Log Logger { get; set; } + + public void Initialize(IManager manager) + { + DontDestroyOnLoad(this); + + Instance = this; + Manager = manager; + Logger = LogManager.GetForCurrentAssembly(); + + RuntimePatcher.AutoPatch(); + + Initialized.Subscribe(OnMainMenuInitialized); + } + + private void OnMainMenuInitialized(Initialized.Data data) + { + Task.Run(MyTask); + } + + private IEnumerator MyTask(Task.Status status) + { + const int max = 500; + + status.SetText("Setting up..."); + status.SetProgress(0, 1); + + yield return Task.Wait(1.5f); + + for (uint i = 1; i <= max; ++i) + { + status.SetText($"Running task {i} of {max}..."); + status.SetProgress(i, max); + + yield return Task.Wait(0.05f); + } + + status.SetText("Finishing..."); + status.SetProgress(1, 1); + + yield return Task.Wait(2.0f); + } + } +} \ No newline at end of file diff --git a/Distance.ResearchAndDevelopment/Properties/AssemblyInfo.cs b/Distance.ResearchAndDevelopment/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..4c17c34 --- /dev/null +++ b/Distance.ResearchAndDevelopment/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Distance.ResearchAndDevelopment")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Distance.ResearchAndDevelopment")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("004f8e95-36d7-400d-873f-60288e533802")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Distance.ResearchAndDevelopment/packages.config b/Distance.ResearchAndDevelopment/packages.config new file mode 100644 index 0000000..c4af825 --- /dev/null +++ b/Distance.ResearchAndDevelopment/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file