Skip to content

Commit

Permalink
V6.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hardcpp committed Aug 16, 2024
1 parent eab1ab0 commit ff9c238
Show file tree
Hide file tree
Showing 70 changed files with 704 additions and 442 deletions.
2 changes: 1 addition & 1 deletion ChatPlexSDK-BS
11 changes: 6 additions & 5 deletions Modules/BeatSaberPlus_Chat/BeatSaberPlus_Chat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;BEATSABER;BEATSABER_1_29_4_OR_NEWER</DefineConstants>
<DefineConstants>TRACE;DEBUG;BEATSABER;BEATSABER_1_35_0_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>BEATSABER;BEATSABER_1_29_4_OR_NEWER</DefineConstants>
<DefineConstants>BEATSABER;BEATSABER_1_35_0_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Expand All @@ -52,10 +52,13 @@
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="DataModels">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\DataModels.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(BeatSaberDir)\Libs\Newtonsoft.Json.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="Main">
Expand Down Expand Up @@ -88,12 +91,10 @@
<Reference Include="UnityEngine.TextCoreModule">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.TextCoreModule.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>$(BeatSaberDir)\Beat Saber_Data\Managed\UnityEngine.UI.dll</HintPath>
Expand Down
Binary file modified Modules/BeatSaberPlus_Chat/BeatSaberPlus_Chat.csproj.user
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal class ChatMessageText : TextMeshProUGUI
/// <summary>
/// Images to add
/// </summary>
private List<(Vector3, CP_SDK.Unity.EnhancedImage)> m_ImagesToAdd;
private List<(Vector3, CP_SDK.Unity.EnhancedImage, float)> m_ImagesToAdd;

////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -99,7 +99,7 @@ internal class ChatMessageText : TextMeshProUGUI
defaultCapacity: 10
);

m_ImagesToAdd = new List<(Vector3, CP_SDK.Unity.EnhancedImage)>(20);
m_ImagesToAdd = new List<(Vector3, CP_SDK.Unity.EnhancedImage, float)>(20);
}

////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -166,7 +166,7 @@ public override void Rebuild(CanvasUpdate p_UpdateType)
if (FontInfo == null || !FontInfo.TryGetImageInfo(l_Character, out var l_ImageInfo))
continue;

m_ImagesToAdd.Add((l_CharacterInfo.topLeft, l_ImageInfo));
m_ImagesToAdd.Add((l_CharacterInfo.topLeft, l_ImageInfo, l_CharacterInfo.scale));
}

CP_SDK.Unity.MTMainThreadInvoker.Enqueue(() => RebuildImagesInternal());
Expand Down Expand Up @@ -195,8 +195,6 @@ private void RebuildImagesInternal()
if (!this)
return;

var l_ScaleFactor = (float)((double)m_currentFontSize / (double)m_currentFontAsset.faceInfo.pointSize * (double)m_currentFontAsset.faceInfo.scale * (m_isOrthographic ? 1.0 : 0.1f));
var l_LocalScale = new Vector3(l_ScaleFactor * 1.08f, l_ScaleFactor * 1.08f, l_ScaleFactor * 1.08f);
var l_ImagesToAddCount = m_ImagesToAdd.Count;
var l_AlreadyAllocated = m_CurrentImages.Count;
var l_Iterator = 0;
Expand Down Expand Up @@ -228,9 +226,9 @@ private void RebuildImagesInternal()
}

var l_RectTransform = l_Image.rectTransform;
l_RectTransform.localScale = l_LocalScale;
l_RectTransform.localScale = Vector3.one * l_Infos.Item3;
l_RectTransform.sizeDelta = new Vector2(l_Infos.Item2.Width, l_Infos.Item2.Height);
l_RectTransform.localPosition = l_Infos.Item1 - new Vector3(0, l_Infos.Item2.Height * l_ScaleFactor * 0.558f / 2);
l_RectTransform.localPosition = l_Infos.Item1 - new Vector3(0, l_Infos.Item2.Height * l_Infos.Item3 * 0.558f / 2);
}

/// Allocate
Expand All @@ -251,9 +249,9 @@ private void RebuildImagesInternal()
}

var l_RectTransform = l_Image.rectTransform;
l_RectTransform.localScale = l_LocalScale;
l_RectTransform.localScale = Vector3.one * l_Infos.Item3;
l_RectTransform.sizeDelta = new Vector2(l_Infos.Item2.Width, l_Infos.Item2.Height);
l_RectTransform.localPosition = l_Infos.Item1 - new Vector3(0, l_Infos.Item2.Height * l_ScaleFactor * 0.558f / 2);
l_RectTransform.localPosition = l_Infos.Item1 - new Vector3(0, l_Infos.Item2.Height * l_Infos.Item3 * 0.558f / 2);

m_CurrentImages.Add(l_Image);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ internal bool TryRegisterImageInfo(CP_SDK.Unity.EnhancedImage p_ImageInfo, out u

var l_Glypth = new Glyph(l_ReplaceCharacter, new GlyphMetrics(0, 0, 0, 0, p_ImageInfo.Width), new GlyphRect(0, 0, 0, 0));

#if BEATSABER && !BEATSABER_1_29_4_OR_NEWER
#if BEATSABER && !BEATSABER_1_35_0_OR_NEWER
Font.characterLookupTable.Add(l_ReplaceCharacter, new TMP_Character(l_ReplaceCharacter, l_Glypth));
#elif BEATSABER_1_29_4_OR_NEWER || UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX || DANCEDASH
#elif BEATSABER_1_35_0_OR_NEWER || UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX || DANCEDASH
Font.characterLookupTable.Add(l_ReplaceCharacter, new TMP_Character(l_ReplaceCharacter, Font, l_Glypth));
#else
#error Missing game implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ private IXUIElement BuildOption(Sprite p_WhiteSprite, int p_Index)
private void Update()
{
if (m_LastPoll != null
&& m_LastPoll.status != CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.ARCHIVED
&& m_LastPoll.status != CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.INVALID)
&& m_LastPoll.status != CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.ARCHIVED
&& m_LastPoll.status != CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.INVALID)
{
if (m_CurrentPollStart < 0)
{
Expand Down Expand Up @@ -203,8 +203,8 @@ private void HelixAPI_OnActivePollChanged(CP_SDK.Chat.Models.Twitch.Helix_Poll p
if ((p_Poll?.id ?? null) != (m_LastPoll?.id ?? null))
{
if (p_Poll != null
&& p_Poll.status != CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.ARCHIVED
&& p_Poll.status != CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.INVALID)
&& p_Poll.status != CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.ARCHIVED
&& p_Poll.status != CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.INVALID)
{
CurrentScreen?.gameObject?.SetActive(true);

Expand All @@ -217,8 +217,8 @@ private void HelixAPI_OnActivePollChanged(CP_SDK.Chat.Models.Twitch.Helix_Poll p
for (int l_I = 0; l_I < p_Poll.choices.Count && l_I < m_ProgressBars.Length; ++l_I)
l_TotalVotes += p_Poll.choices[l_I].votes;

if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.COMPLETED)
if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.COMPLETED)
{
var l_Sorted = p_Poll.choices.OrderByDescending(x => x.votes).ToArray();

Expand Down Expand Up @@ -247,8 +247,8 @@ private void HelixAPI_OnActivePollChanged(CP_SDK.Chat.Models.Twitch.Helix_Poll p
m_CurrentPollStart = Time.realtimeSinceStartup - Mathf.Abs((float)(l_UTCNow - l_UTCStart).TotalSeconds);
m_CurrentPollEnd = m_CurrentPollStart + p_Poll.duration;

if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.COMPLETED)
if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.COMPLETED)
m_CurrentPollEnd = Time.realtimeSinceStartup;
}
else
Expand All @@ -262,8 +262,8 @@ private void HelixAPI_OnActivePollChanged(CP_SDK.Chat.Models.Twitch.Helix_Poll p
for (var l_I = 0; l_I < p_Poll.choices.Count && l_I < m_ProgressBars.Length; ++l_I)
l_TotalVotes += p_Poll.choices[l_I].votes;

if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.COMPLETED)
if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.COMPLETED)
{
var l_Sorted = p_Poll.choices.OrderByDescending(x => x.votes).ToArray();

Expand All @@ -277,13 +277,13 @@ private void HelixAPI_OnActivePollChanged(CP_SDK.Chat.Models.Twitch.Helix_Poll p
}
}

if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.COMPLETED)
if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.TERMINATED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.COMPLETED)
m_CurrentPollEnd = Time.realtimeSinceStartup;

if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.ARCHIVED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.INVALID
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.Helix_Poll.Status.MODERATED)
if ( p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.ARCHIVED
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.INVALID
|| p_Poll.status == CP_SDK.Chat.Models.Twitch.EHelix_PollStatus.MODERATED)
CurrentScreen?.gameObject?.SetActive(false);
}

Expand Down
Loading

0 comments on commit ff9c238

Please sign in to comment.