Skip to content

Commit

Permalink
Fix load, hovering and remove hooking into various decoration labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Osmodium committed Jan 18, 2024
1 parent ea325e6 commit dfe13b1
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
By [Osmodium](https://github.com/Osmodium)

## This mod is made for Warhammer 40K: Rogue Trader and introduces TTS (TextToSpeech) in most places.
Version: 0.9.0
Version: 0.9.2

**Disclaimer: UNDER DEVELOPMENT**

Expand Down Expand Up @@ -119,7 +119,7 @@ In the main menu view, a welcome message is shown, this can be played back by ho

### Settings

New keybind setting in the game menu under "Sound"
New keybind setting in the game menu under "Sound" to stop playback.
![Assign keybind(s) to stopping of playback](https://dashvoid.com/speechmod/w40krt/4_Keybinding.png)

If enabled in the mod-settings, a notification will be shown when stopping the playback through use of the keybind.
Expand Down
1 change: 1 addition & 0 deletions SpeechMod.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "Test\Test.csproj",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solutionfiles", "Solutionfiles", "{504859E5-17AA-4CD4-BD1C-40BCAFCF4E5F}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
Todo.txt = Todo.txt
EndProjectSection
EndProject
Expand Down
2 changes: 1 addition & 1 deletion SpeechMod/Info.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"AssemblyName": "W40KRTSpeechMod.dll",
"EntryMethod": "SpeechMod.Main.Load",
"HomePage": "https://www.nexusmods.com/warhammer40kroguetrader/mods/75",
"Version": "0.9.1"
"Version": "0.9.2"
}
7 changes: 6 additions & 1 deletion SpeechMod/Patches/TooltipEngine_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Collections.Generic;
using System.Linq;
using Kingmaker.Code.UI.MVVM.View.Tooltip.Bricks;
using Kingmaker.Utility;
using Owlcat.Runtime.UI.Controls.Button;
using TMPro;
using UnityEngine;
Expand Down Expand Up @@ -79,9 +80,13 @@ private static bool ApplyFilter(Transform transform)
if (string.IsNullOrWhiteSpace(transform.name))
return false;

return !(transform.name.Trim().Equals("bracket", StringComparison.InvariantCultureIgnoreCase)
return !(transform.GetGameObjectPath().Contains("ComparativeTooltipPCView")
|| transform.name.Trim().Equals("bracket", StringComparison.InvariantCultureIgnoreCase)
|| transform.name.Trim().Equals("Acronim", StringComparison.InvariantCultureIgnoreCase)
|| transform.name.Trim().Equals("decortext", StringComparison.InvariantCultureIgnoreCase)
|| transform.name.Trim().Equals("Text (TMP) (1)", StringComparison.InvariantCultureIgnoreCase)
|| transform.name.Trim().Equals("Text (TMP) (2)", StringComparison.InvariantCultureIgnoreCase)
|| transform.GetGameObjectPath()!.Contains("/LeftBlock (1)/Empty/Text (TMP)")
|| transform.parent?.GetComponent<OwlcatButton>() != null);
}
}
3 changes: 2 additions & 1 deletion SpeechMod/PhoneticDictionary.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
"technomat": "techno-mat",
"mechanised": "mechanized",
"heretech": "herree-tech",
"xenotech": "xeenotech"
"xenotech": "xeenotech",
"sceptical": "skeptical"
}
4 changes: 0 additions & 4 deletions SpeechMod/SpeechMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
<HintPath>$(RogueTraderInstallDir)\WH40KRT_Data\Managed\Owlcat.Runtime.UniRx.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RogueTrader.GameCore">
<HintPath>$(RogueTraderInstallDir)\WH40KRT_Data\Managed\RogueTrader.GameCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UniRx">
<HintPath>$(RogueTraderInstallDir)\WH40KRT_Data\Managed\UniRx.dll</HintPath>
<Private>False</Private>
Expand Down
19 changes: 7 additions & 12 deletions SpeechMod/Unity/Extensions/Hooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,14 @@ public static void HookupTextToSpeech(this TextMeshProUGUI textMeshPro, bool for
return;
}

var skipEventAssignment = false;

var defaultValues = textMeshProTransform.GetComponent<TextMeshProValues>();
if (defaultValues == null)
{
defaultValues = textMeshProTransform.gameObject?.AddComponent<TextMeshProValues>();
defaultValues!.FontStyles = textMeshPro.fontStyle;
defaultValues.Color = textMeshPro.color;
defaultValues.ExtraPadding = textMeshPro.extraPadding;
}
else
skipEventAssignment = true;

if (skipEventAssignment)
{
#if DEBUG
//Debug.Log("Skipping event assignment!");
#endif
// Skip event assignment since it should already be hooked up
return;
}

Expand All @@ -115,13 +105,18 @@ public static void HookupTextToSpeech(this TextMeshProUGUI textMeshPro, bool for
textMeshPro.OnPointerEnterAsObservable().Subscribe(
_ =>
{
defaultValues = textMeshProTransform.gameObject?.AddComponent<TextMeshProValues>();
defaultValues!.FontStyles = textMeshPro.fontStyle;
defaultValues.Color = textMeshPro.color;
defaultValues.ExtraPadding = textMeshPro.extraPadding;

if (Main.Settings!.FontStyleOnHover)
{
for (int i = 0; i < Main.Settings.FontStyles!.Length; i++)
{
if (Main.Settings.FontStyles[i])
{
textMeshPro.fontStyle |= (FontStyles)Enum.Parse(typeof(FontStyles), Main.FontStyleNames![i]!, true);
textMeshPro.fontStyle ^= (FontStyles)Enum.Parse(typeof(FontStyles), Main.FontStyleNames![i]!, true);
}
}
textMeshPro.extraPadding = false;
Expand Down

0 comments on commit dfe13b1

Please sign in to comment.