Skip to content

Commit

Permalink
Merge pull request #4 from Theadd/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Theadd authored Jan 13, 2022
2 parents 26e1e02 + 6079ffb commit c8802ca
Show file tree
Hide file tree
Showing 66 changed files with 2,387 additions and 261 deletions.
53 changes: 50 additions & 3 deletions DevTools.cs
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
using System;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Modding.Humankind.DevTools.Core;
using Modding.Humankind.DevTools.DeveloperTools;
using Modding.Humankind.DevTools.DeveloperTools.UI;
using UnityEngine;

namespace Modding.Humankind.DevTools
{

[BepInPlugin(PLUGIN_GUID, "DevTools", "1.4.0.0")]
[BepInPlugin(PLUGIN_GUID, "DevTools", "1.6.0.0")]
[BepInIncompatibility("AOM.Humankind.Teams")]
internal class DevTools : BaseUnityPlugin
public class DevTools : BaseUnityPlugin
{
const string PLUGIN_GUID = "Modding.Humankind.DevTools";

internal static ManualLogSource Log;

public static bool IncludeExternalModules = true;

public static bool QuietMode { get; set; } = true;

public static DevTools Instance { get; private set; }

private Harmony _harmony;

private static AssetLoader _assets;

private static bool _uiReady = false;

public static AssetLoader Assets =>
_assets ?? (_assets = new AssetLoader()
{
Assembly = typeof(DevTools).Assembly,
ManifestResourceName = PLUGIN_GUID + ".Resources.devtools-resources"
});

private void Awake()
{
Log = Logger;
Instance = this;

_harmony = new Harmony(PLUGIN_GUID);

Expand All @@ -30,14 +50,41 @@ private void Awake()
private void FixedUpdate()
{
ActionManager.Run();
if (!_uiReady) TryToInitializeUI();
}

private void Start()
{
if (!QuietMode)
Loggr.Log("STARTING HUMANKIND DEVTOOLS...", ConsoleColor.Green);
}

void OnGUI () {
// -
}

private void TryToInitializeUI()
{
if (GameObject.Find("/WindowsRoot/SystemOverlays") != null)
{
_uiReady = true;
UIManager.Initialize();
if (!QuietMode)
Loggr.Log("HUMANKIND DEVTOOLS UI LOADED SUCCESSFULLY.", ConsoleColor.Green);
}
}

public static GameObject GetGameObject() => Instance?.gameObject;

private void OnDestroy()
{
_harmony?.UnpatchSelf();
GameController.Unload();
ActionManager.Unload();
Loggr.Debug("Unloaded DevTools Framework.");
Assets.Unload(true);
Destroy(gameObject);
if (!QuietMode)
Loggr.Debug("Unloaded DevTools Framework.");
}
}
}
10 changes: 8 additions & 2 deletions Modding.Humankind.DevTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
</PropertyGroup>
<ItemGroup>
<TargetBinFiles Include="$(TargetBinPath)\*.*" />
<GeneratedDocsFiles Include="./gen-docs/generated-allpages/GameSpeedLevel.md;./gen-docs/generated/InGameKeyboardShortcutAttribute.md;./gen-docs/generated/DevToolsModuleAttribute.md;./gen-docs/generated/OnGameHasLoadedAttribute.md;./gen-docs/generated/OnGameHasUnloadedAttribute.md;./gen-docs/generated-allpages/HumankindEmpire.md;./gen-docs/generated-allpages/HumankindSettlement.md;./gen-docs/generated-allpages/HumankindDevTools.md;./gen-docs/generated-allpages/HumankindGame.md" />
<DevToolsBinary Include="$(TargetBinPath)Modding.Humankind.DevTools.dll" />
<GeneratedDocsFiles Include="./gen-docs/generated-allpages/GameSpeedLevel.md;./gen-docs/generated/InGameKeyboardShortcutAttribute.md;./gen-docs/generated/DevToolsModuleAttribute.md;./gen-docs/generated/OnGameHasLoadedAttribute.md;./gen-docs/generated/OnGameHasUnloadedAttribute.md;./gen-docs/generated/HumankindEmpire.md;./gen-docs/generated/HumankindSettlement.md;./gen-docs/generated/HumankindDevTools.md;./gen-docs/generated/HumankindGame.md;./gen-docs/generated/HumankindEmpireExtensions.md;./gen-docs/generated/HumankindSettlementExtensions.md" />
<DevToolsBinary Include="$(TargetBinPath)Modding.Humankind.DevTools.dll;$(TargetBinPath)Modding.Humankind.DevTools.pdb;$(TargetBinPath)Modding.Humankind.DevTools.xml" />
<!--<DevToolsBinary Include="$(TargetBinPath)Modding.Humankind.DevTools.dll" />-->
</ItemGroup>
<MakeDir Directories="$(GenDocsDir)" />
<MakeDir Directories="$(GenDocsResourcesDir)" />
Expand Down Expand Up @@ -59,6 +60,8 @@
<PreserveCompilationContext>false</PreserveCompilationContext>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(OUTPUT_PATH)</OutputPath>
<!--<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>-->
<DebugType>portable</DebugType>
<DebugSymbols>false</DebugSymbols>
<DebugSymbols Condition=" '$(Configuration)' == 'Debug' ">true</DebugSymbols>
Expand Down Expand Up @@ -452,4 +455,7 @@
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\*" />
</ItemGroup>
</Project>
Binary file added Resources/devtools-resources
Binary file not shown.
32 changes: 32 additions & 0 deletions Resources/devtools-resources.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ManifestFileVersion: 0
CRC: 1881966896
Hashes:
AssetFileHash:
serializedVersion: 2
Hash: eef4acfe5dab5a67a0345b323d19b8d5
TypeTreeHash:
serializedVersion: 2
Hash: 931e2f8058cfc418f2e1a18239c7b7c5
HashAppended: 0
ClassTypes:
- Class: 21
Script: {instanceID: 0}
- Class: 28
Script: {instanceID: 0}
- Class: 48
Script: {instanceID: 0}
- Class: 114
Script: {fileID: 12001, guid: 0000000000000000e000000000000000, type: 0}
- Class: 115
Script: {instanceID: 0}
- Class: 128
Script: {instanceID: 0}
- Class: 213
Script: {instanceID: 0}
SerializeReferenceClassIdentifiers: []
Assets:
- Assets/DevToolsAssets/GUISkins/GenericUISkin.guiskin
- Assets/DevToolsAssets/Skin/SourceCodePro-Light.otf
- Assets/DevToolsAssets/UITextures/GameplayOrientation_Warmonger.png
- Assets/DevToolsAssets/Skin/SourceCodePro-Regular.otf
Dependencies: []
Binary file added Resources/resources
Binary file not shown.
7 changes: 7 additions & 0 deletions Resources/resources.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ManifestFileVersion: 0
CRC: 3332730710
AssetBundleManifest:
AssetBundleInfos:
Info_0:
Name: devtools-resources
Dependencies: {}
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Api.dll
Binary file not shown.
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Api.pdb
Binary file not shown.
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Common.dll
Binary file not shown.
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Common.pdb
Binary file not shown.
22 changes: 11 additions & 11 deletions bin/GenerateDocsTool/DefaultDocumentation.Console.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v5.0": {
"DefaultDocumentation.Console/0-local20211115053905": {
"DefaultDocumentation.Console/0-local20211211062743": {
"dependencies": {
"CommandLineParser": "2.8.0",
"DefaultDocumentation.Common": "0.0.0-local20211115053904",
"DefaultDocumentation.Common": "0.0.0-local20211211062742",
"Microsoft.CodeAnalysis.NetAnalyzers": "5.0.3",
"Roslynator.Analyzers": "3.2.2",
"Roslynator.CodeAnalysis.Analyzers": "1.1.1"
Expand Down Expand Up @@ -59,7 +59,7 @@
"Roslynator.CodeAnalysis.Analyzers/1.1.1": {},
"System.Collections.Immutable/5.0.0": {},
"System.Reflection.Metadata/5.0.0": {},
"DefaultDocumentation.Api/0.0.0-local20211115053904": {
"DefaultDocumentation.Api/0.0.0-local20211211062742": {
"dependencies": {
"ICSharpCode.Decompiler": "7.1.0.6543",
"NLog": "4.7.12",
Expand All @@ -69,17 +69,17 @@
"DefaultDocumentation.Api.dll": {}
}
},
"DefaultDocumentation.Common/0.0.0-local20211115053904": {
"DefaultDocumentation.Common/0.0.0-local20211211062742": {
"dependencies": {
"DefaultDocumentation.Markdown": "0.0.0-local20211115053904"
"DefaultDocumentation.Markdown": "0.0.0-local20211211062742"
},
"runtime": {
"DefaultDocumentation.Common.dll": {}
}
},
"DefaultDocumentation.Markdown/0.0.0-local20211115053904": {
"DefaultDocumentation.Markdown/0.0.0-local20211211062742": {
"dependencies": {
"DefaultDocumentation.Api": "0.0.0-local20211115053904"
"DefaultDocumentation.Api": "0.0.0-local20211211062742"
},
"runtime": {
"DefaultDocumentation.Markdown.dll": {}
Expand All @@ -88,7 +88,7 @@
}
},
"libraries": {
"DefaultDocumentation.Console/0-local20211115053905": {
"DefaultDocumentation.Console/0-local20211211062743": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down Expand Up @@ -156,17 +156,17 @@
"path": "system.reflection.metadata/5.0.0",
"hashPath": "system.reflection.metadata.5.0.0.nupkg.sha512"
},
"DefaultDocumentation.Api/0.0.0-local20211115053904": {
"DefaultDocumentation.Api/0.0.0-local20211211062742": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"DefaultDocumentation.Common/0.0.0-local20211115053904": {
"DefaultDocumentation.Common/0.0.0-local20211211062742": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"DefaultDocumentation.Markdown/0.0.0-local20211115053904": {
"DefaultDocumentation.Markdown/0.0.0-local20211211062742": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Console.dll
Binary file not shown.
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Console.exe
Binary file not shown.
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Console.pdb
Binary file not shown.
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Markdown.dll
Binary file not shown.
Binary file modified bin/GenerateDocsTool/DefaultDocumentation.Markdown.pdb
Binary file not shown.
Loading

0 comments on commit c8802ca

Please sign in to comment.