Skip to content

Commit 624085d

Browse files
Merge pull request #1 from EmberSL/main
pull
2 parents 31aa5f5 + 20aa367 commit 624085d

File tree

5 files changed

+80
-8
lines changed

5 files changed

+80
-8
lines changed

AdvancedHints.sln

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedHints", "AdvancedHints\AdvancedHints.csproj", "{410CB435-091A-4141-92C9-8EEC16CD1DDA}"
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.11.35431.28
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AdvancedHints", "AdvancedHints\AdvancedHints.csproj", "{410CB435-091A-4141-92C9-8EEC16CD1DDA}"
47
EndProject
58
Global
69
GlobalSection(SolutionConfigurationPlatforms) = preSolution
710
Debug|Any CPU = Debug|Any CPU
11+
Debug|x64 = Debug|x64
812
Release|Any CPU = Release|Any CPU
13+
Release|x64 = Release|x64
914
EndGlobalSection
1015
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1116
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1217
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Debug|x64.ActiveCfg = Debug|x64
19+
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Debug|x64.Build.0 = Debug|x64
1320
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Release|Any CPU.ActiveCfg = Release|Any CPU
1421
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Release|x64.ActiveCfg = Release|x64
23+
{410CB435-091A-4141-92C9-8EEC16CD1DDA}.Release|x64.Build.0 = Release|x64
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
1527
EndGlobalSection
1628
EndGlobal

AdvancedHints/AdvancedHints.csproj

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,34 @@
1010
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
1111
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1212
<LangVersion>9</LangVersion>
13+
<Platforms>AnyCPU;x64</Platforms>
1314
</PropertyGroup>
1415

1516
<ItemGroup>
16-
<PackageReference Include="EXILED" Version="8.0.0" />
17+
<PackageReference Include="ExMod.Exiled" Version="9.2.2" />
1718
<PackageReference Include="Lib.Harmony" Version="2.2.2" />
1819
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
1920
</ItemGroup>
2021

2122
<ItemGroup>
22-
<Reference Include="Assembly-CSharp" HintPath="$(EXILED_References)\Assembly-CSharp-Publicized.dll" Private="false" />
23-
<Reference Include="Assembly-CSharp-firstpass" HintPath="$(EXILED_References)\Assembly-CSharp-firstpass.dll" Private="false" />
23+
<Reference Include="Assembly-CSharp">
24+
<HintPath>$(EXILED_REFERENCES)\Assembly-CSharp-Publicized.dll</HintPath>
25+
</Reference>
26+
<Reference Include="Assembly-CSharp-firstpass">
27+
<HintPath>$(EXILED_REFERENCES)\Assembly-CSharp-firstpass.dll</HintPath>
28+
</Reference>
2429
<Reference Include="CommandSystem.Core" HintPath="$(EXILED_References)\CommandSystem.Core.dll" Private="false" />
2530
<Reference Include="Mirror" HintPath="$(EXILED_References)\Mirror.dll" Private="false" />
2631
<Reference Include="NorthwoodLib" HintPath="$(EXILED_References)\NorthwoodLib.dll" Private="false" />
32+
<Reference Include="UnityEngine">
33+
<HintPath>$(EXILED_REFERENCES)\UnityEngine.dll</HintPath>
34+
</Reference>
35+
<Reference Include="UnityEngine.AnimationModule">
36+
<HintPath>$(EXILED_REFERENCES)\UnityEngine.AnimationModule.dll</HintPath>
37+
</Reference>
38+
<Reference Include="UnityEngine.AssetBundleModule">
39+
<HintPath>$(EXILED_REFERENCES)\UnityEngine.AssetBundleModule.dll</HintPath>
40+
</Reference>
2741
<Reference Include="UnityEngine.CoreModule" HintPath="$(EXILED_References)\UnityEngine.CoreModule.dll" Private="false" />
2842
<Reference Include="UnityEngine.AudioModule" HintPath="$(EXILED_References)\UnityEngine.AudioModule.dll" Private="false" />
2943
<Reference Include="UnityEngine.PhysicsModule" HintPath="$(EXILED_References)\UnityEngine.PhysicsModule.dll" Private="false" />

AdvancedHints/Components/HudManager.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ namespace AdvancedHints.Components
99
{
1010
using System;
1111
using System.Collections.Generic;
12-
using System.IO;
1312
using System.Linq;
1413
using AdvancedHints.Enums;
1514
using AdvancedHints.Models;
1615
using Exiled.API.Features;
17-
using Hints;
1816
using UnityEngine;
1917

2018
/// <summary>
@@ -67,6 +65,11 @@ public HudManager()
6765
[DisplayLocation.Bottom] = new HudDisplay(),
6866
};
6967

68+
/// <summary>
69+
/// Gets or sets a value indicating whether debug mode is enabled.
70+
/// </summary>
71+
public bool Debug { get; set; } = false;
72+
7073
/// <summary>
7174
/// Displays a hint to a player.
7275
/// </summary>
@@ -122,7 +125,11 @@ private void UpdateHints()
122125
toFormat = Displays.Values.Select(display => FormatStringForHud(
123126
display.Content ?? display.DefaultText, Plugin.Singleton.Config.LinesPerPosition))
124127
.ToArray<object>();
125-
hint = string.Format(Plugin.Singleton.Config.HudTemplate, toFormat);
128+
129+
string newHint = string.Format(Plugin.Singleton.Config.HudTemplate, toFormat);
130+
if (Debug && newHint != hint)
131+
player.SendConsoleMessage(newHint, "white");
132+
hint = newHint;
126133

127134
player.ShowHint(Plugin.HintPrefix + hint, Plugin.Singleton.Config.HintDuration);
128135
}

AdvancedHints/DebugCommand.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
2+
#pragma warning disable SA1600 // Elements should be documented
3+
#pragma warning disable SA1516 // Elements should be separated by blank line
4+
5+
namespace AdvancedHints
6+
{
7+
using System;
8+
using AdvancedHints.Components;
9+
using CommandSystem;
10+
using Exiled.API.Features;
11+
using RemoteAdmin;
12+
13+
[CommandHandler(typeof(ClientCommandHandler))]
14+
public class DebugCommand : ICommand
15+
{
16+
public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out string response)
17+
{
18+
if (Player.TryGet(sender, out Player ply))
19+
{
20+
if (!HudManager.Instances.TryGetValue(ply, out HudManager hudManager))
21+
{
22+
response = "You do not have a HudManager instance.";
23+
return false;
24+
}
25+
26+
hudManager.Debug = !hudManager.Debug;
27+
response = $"Debug mode {(hudManager.Debug ? "enabled" : "disabled")} (check client console).";
28+
return true;
29+
}
30+
31+
response = "You must be a player to use this command.";
32+
return false;
33+
}
34+
35+
public string Command { get; } = "toggleadvhdebug";
36+
public string[] Aliases { get; } = { "tahd" };
37+
public string Description { get; } = "Toggles debug mode for AdvancedHints.";
38+
}
39+
}

AdvancedHints/Models/HudDisplay.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace AdvancedHints.Models
2020
public class HudDisplay
2121
{
2222
/// <summary>
23-
/// Gets or sets a <see cref="Func"/> that returns the default text to be displayed.
23+
/// Gets or sets a Func that returns the default text to be displayed.
2424
/// May or may not override the one from the Config.
2525
/// </summary>
2626
[CanBeNull]

0 commit comments

Comments
 (0)