Skip to content

Commit bd9cf95

Browse files
committed
Fix build with SDK change
1 parent f82eee6 commit bd9cf95

File tree

86 files changed

+489
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+489
-570
lines changed

Modules/BeatSaberPlus_Chat/BeatSaberPlus_Chat.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@
137137
<None Include="BuildTargets.targets" />
138138
</ItemGroup>
139139
<ItemGroup>
140-
<ProjectReference Include="..\..\BeatSaberPlus\BeatSaberPlus.csproj">
141-
<Project>{84972bac-4faf-4da8-92ed-e3a735af0e92}</Project>
142-
<Name>BeatSaberPlus</Name>
143-
</ProjectReference>
140+
<EmbeddedResource Include="ChatPlexMod_Chat\Resources\ViewerIcon.png" />
144141
</ItemGroup>
145142
<ItemGroup>
146-
<EmbeddedResource Include="ChatPlexMod_Chat\Resources\ViewerIcon.png" />
143+
<ProjectReference Include="..\..\ChatPlexSDK_BS\ChatPlexSDK_BS.csproj">
144+
<Project>{84972bac-4faf-4da8-92ed-e3a735af0e92}</Project>
145+
<Name>ChatPlexSDK_BS</Name>
146+
</ProjectReference>
147147
</ItemGroup>
148148
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
149149
<Import Project="BuildTargets.targets" />

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/CConfig.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ internal class CConfig : CP_SDK.Config.JsonConfig<CConfig>
3333

3434
private static Vector3 DefaultChatPlayingPosition = new Vector3(2.33f, 2.145f, 3.669f);
3535
private static Vector3 DefaultChatPlayingRotation = new Vector3(0.00f, 49.4501f, 0.000f);
36+
#elif DANCEDASH
37+
private static Vector3 DefaultChatMenuPosition = new Vector3(0.00f, 4.10f, 3.50f);
38+
private static Vector3 DefaultChatMenuRotation = new Vector3(325.00f, 0.00f, 0.00f);
39+
40+
private static Vector3 DefaultChatPlayingPosition = new Vector3(0.00f, 4.20f, 5.80f);
41+
private static Vector3 DefaultChatPlayingRotation = new Vector3(325.00f, 0.00f, 0.00f);
3642
#else
3743
#error Missing game implementation
3844
#endif
@@ -84,7 +90,7 @@ internal class CConfig : CP_SDK.Config.JsonConfig<CConfig>
8490
/// </summary>
8591
/// <returns></returns>
8692
public override string GetRelativePath()
87-
=> $"{CP_SDK.ChatPlexSDK.ProductName}/Chat/Config";
93+
=> $"{CP_SDK.ChatPlexSDK.ProductName}Plus/Chat/Config";
8894

8995
////////////////////////////////////////////////////////////////////////////
9096
////////////////////////////////////////////////////////////////////////////
@@ -105,8 +111,6 @@ protected override void OnInit(bool p_OnCreation)
105111
"!bsr"
106112
};
107113
}
108-
109-
Save();
110114
}
111115

112116
////////////////////////////////////////////////////////////////////////////

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/Chat.cs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected override void OnEnable()
7878
CP_SDK.ChatPlexSDK.OnGenericSceneChange += ChatPlexSDK_OnGenericSceneChange;
7979

8080
/// If we are already in menu scene, activate
81-
if (CP_SDK.ChatPlexSDK.ActiveGenericScene == CP_SDK.ChatPlexSDK.EGenericScene.Menu)
81+
if (CP_SDK.ChatPlexSDK.ActiveGenericScene == CP_SDK.EGenericScene.Menu)
8282
ChatPlexSDK_OnGenericSceneChange(CP_SDK.ChatPlexSDK.ActiveGenericScene);
8383

8484
if (!m_ChatCoreAcquired)
@@ -227,16 +227,22 @@ private void ChatPlexSDK_OnGenericMenuSceneLoaded()
227227
/// When the active scene is changed
228228
/// </summary>
229229
/// <param name="p_SceneType"></param>
230-
private void ChatPlexSDK_OnGenericSceneChange(CP_SDK.ChatPlexSDK.EGenericScene p_SceneType)
230+
private void ChatPlexSDK_OnGenericSceneChange(CP_SDK.EGenericScene p_SceneType)
231231
{
232232
if (m_RootTransform)
233233
m_RootTransform.transform.localScale = Vector3.one;
234234

235-
if (p_SceneType == CP_SDK.ChatPlexSDK.EGenericScene.Menu)
235+
if (p_SceneType == CP_SDK.EGenericScene.Menu)
236236
UpdateButton();
237237

238238
if (m_ChatFloatingPanel == null) CreateFloatingPanels();
239239
else UpdateFloatingPanels();
240+
241+
#if DANCEDASH
242+
var l_Player = Component.FindObjectsOfType<GameObject>().FirstOrDefault(x => x.activeSelf && x.transform.parent == null && x.name == "Player");
243+
if (l_Player)
244+
m_RootTransform.position = l_Player.transform.position;
245+
#endif
240246
}
241247
/// <summary>
242248
/// When the floating window is moved
@@ -291,7 +297,7 @@ private IEnumerator CreateButtonCoroutine()
291297
yield return l_Waiter;
292298
}
293299

294-
m_ModerationButton = BeatSaberPlus.SDK.UI.Button.Create(l_LevelSelectionNavigationController.transform, "Chat\nModeration", () => UI.ModerationViewFlowCoordinator.Instance().Present(), null);
300+
m_ModerationButton = CP_SDK_BS.UI.Button.Create(l_LevelSelectionNavigationController.transform, "Chat\nModeration", () => UI.ModerationViewFlowCoordinator.Instance().Present(), null);
295301
m_ModerationButton.transform.localPosition = new Vector3(72.50f, 27.00f, 2.60f);
296302
m_ModerationButton.transform.localScale = new Vector3( 0.65f, 0.50f, 0.65f);
297303
m_ModerationButton.transform.SetAsFirstSibling();
@@ -309,7 +315,7 @@ private IEnumerator CreateButtonCoroutine()
309315
UpdateButton();
310316

311317
m_CreateButtonCoroutine = null;
312-
#elif UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX
318+
#elif UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX || DANCEDASH
313319
yield return null;
314320
#else
315321
#error Missing game implementation
@@ -326,7 +332,7 @@ internal void UpdateButton()
326332
#if BEATSABER
327333
m_ModerationButton.transform.localPosition = new Vector3(72.50f, 27.00f, 2.60f);
328334
m_ModerationButton.transform.localScale = new Vector3( 0.65f, 0.50f, 0.65f);
329-
#elif UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX
335+
#elif UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX || DANCEDASH
330336
#else
331337
#error Missing game implementation
332338
#endif
@@ -362,15 +368,15 @@ private void CreateFloatingPanels()
362368
m_ChatFloatingPanel.SetRadius(0);
363369
m_ChatFloatingPanel.SetViewController(m_ChatFloatingPanelView);
364370
m_ChatFloatingPanel.OnRelease(OnFloatingWindowMoved);
365-
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.ChatPlexSDK.EGenericScene.Menu, CConfig.Instance.MenuChatPosition, CConfig.Instance.MenuChatRotation);
366-
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.ChatPlexSDK.EGenericScene.Menu, CConfig.Instance.PlayingChatPosition, CConfig.Instance.PlayingChatRotation);
367-
m_ChatFloatingPanel.OnSceneRelease(CP_SDK.ChatPlexSDK.EGenericScene.Menu, (p_LocalPosition, p_LocalRotation) =>
371+
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.EGenericScene.Menu, CConfig.Instance.MenuChatPosition, CConfig.Instance.MenuChatRotation);
372+
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.EGenericScene.Menu, CConfig.Instance.PlayingChatPosition, CConfig.Instance.PlayingChatRotation);
373+
m_ChatFloatingPanel.OnSceneRelease(CP_SDK.EGenericScene.Menu, (p_LocalPosition, p_LocalRotation) =>
368374
{
369375
CConfig.Instance.MenuChatPosition = p_LocalPosition;
370376
CConfig.Instance.MenuChatRotation = p_LocalRotation;
371377
CConfig.Instance.Save();
372378
});
373-
m_ChatFloatingPanel.OnSceneRelease(CP_SDK.ChatPlexSDK.EGenericScene.Playing, (p_LocalPosition, p_LocalRotation) =>
379+
m_ChatFloatingPanel.OnSceneRelease(CP_SDK.EGenericScene.Playing, (p_LocalPosition, p_LocalRotation) =>
374380
{
375381
CConfig.Instance.PlayingChatPosition = p_LocalPosition;
376382
CConfig.Instance.PlayingChatRotation = p_LocalRotation;
@@ -480,10 +486,10 @@ internal void UpdateFloatingPanels()
480486
m_ChatFloatingPanel.SetSize(CConfig.Instance.ChatSize);
481487
m_ChatFloatingPanel.SetAlignWithFloor(CConfig.Instance.AlignWithFloor);
482488
m_ChatFloatingPanel.SetBackgroundColor(CConfig.Instance.BackgroundColor);
483-
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.ChatPlexSDK.EGenericScene.Menu, CConfig.Instance.MenuChatPosition, CConfig.Instance.MenuChatRotation);
484-
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.ChatPlexSDK.EGenericScene.Playing, CConfig.Instance.PlayingChatPosition, CConfig.Instance.PlayingChatRotation);
489+
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.EGenericScene.Menu, CConfig.Instance.MenuChatPosition, CConfig.Instance.MenuChatRotation);
490+
m_ChatFloatingPanel.SetSceneTransform(CP_SDK.EGenericScene.Playing, CConfig.Instance.PlayingChatPosition, CConfig.Instance.PlayingChatRotation);
485491

486-
if (CP_SDK.ChatPlexSDK.ActiveGenericScene == CP_SDK.ChatPlexSDK.EGenericScene.Menu)
492+
if (CP_SDK.ChatPlexSDK.ActiveGenericScene == CP_SDK.EGenericScene.Menu)
487493
m_ChatFloatingPanel.SetGearIcon(CConfig.Instance.ReverseChatOrder ? CP_SDK.UI.Components.CFloatingPanel.ECorner.BottomLeft : CP_SDK.UI.Components.CFloatingPanel.ECorner.TopLeft);
488494
else
489495
m_ChatFloatingPanel.SetGearIcon(CP_SDK.UI.Components.CFloatingPanel.ECorner.None);
@@ -495,11 +501,11 @@ internal void UpdateFloatingPanels()
495501

496502
/// Prepare data for level with rotations
497503
#if BEATSABER
498-
var l_Is360Level = BeatSaberPlus.SDK.Game.Logic.LevelData?.Data?.transformedBeatmapData?.spawnRotationEventsCount > 0;
504+
var l_Is360Level = CP_SDK_BS.Game.Logic.LevelData?.Data?.transformedBeatmapData?.spawnRotationEventsCount > 0;
499505
var l_RotationRef = l_Is360Level ? Resources.FindObjectsOfTypeAll<FlyingGameHUDRotation>().FirstOrDefault()?.gameObject : null as GameObject;
500506
#elif SYNTHRIDERS
501507
var l_RotationRef = Resources.FindObjectsOfTypeAll<GameObject>().FirstOrDefault(x => x.name == "[Score & Misc]");
502-
#elif UNITY_TESTING || AUDIOTRIP || BOOMBOX
508+
#elif UNITY_TESTING || AUDIOTRIP || BOOMBOX || DANCEDASH
503509
var l_RotationRef = null as GameObject;
504510
#else
505511
#error Missing game implementation

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/Components/ChatMessageWidget.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ private void Awake()
109109
Text.margin = new Vector4(s_LeftRightMargins, s_TopDownMargins, s_LeftRightMargins, s_TopDownMargins);
110110
Text.raycastTarget = false;
111111
Text.enableWordWrapping = true;
112-
Text.fontStyle = FontStyles.Normal;
113-
Text.overflowMode = TextOverflowModes.Overflow;
114-
Text.alignment = TextAlignmentOptions.TopLeft;
112+
TMProProxy.TMP_Text_SetFontStyle(Text, FontStyles.Normal);
113+
TMProProxy.TMP_Text_SetTextOverflowMode(Text, TextOverflowModes.Overflow);
114+
TMProProxy.TMP_Text_SetAlignment(Text, TextAlignmentOptions.TopLeft);
115115
Text.OnLatePreRenderRebuildComplete += Text_OnLatePreRenderRebuildComplete;
116116

117117
/// Prepare sub text
@@ -123,9 +123,9 @@ private void Awake()
123123
SubText.margin = new Vector4(s_LeftRightMargins, s_TopDownMargins, s_LeftRightMargins, s_TopDownMargins);
124124
SubText.raycastTarget = false;
125125
SubText.enableWordWrapping = true;
126-
SubText.fontStyle = FontStyles.Normal;
127-
SubText.overflowMode = TextOverflowModes.Overflow;
128-
SubText.alignment = TextAlignmentOptions.TopLeft;
126+
TMProProxy.TMP_Text_SetFontStyle(SubText, FontStyles.Normal);
127+
TMProProxy.TMP_Text_SetTextOverflowMode(SubText, TextOverflowModes.Overflow);
128+
TMProProxy.TMP_Text_SetAlignment(SubText, TextAlignmentOptions.TopLeft);
129129
SubText.OnLatePreRenderRebuildComplete += Text_OnLatePreRenderRebuildComplete;
130130

131131
/// Accent image
@@ -205,8 +205,8 @@ private void Text_OnLatePreRenderRebuildComplete()
205205
/// </summary>
206206
private void OnTextChanged()
207207
{
208-
float l_TextHeight = Mathf.Max(0, Text.GetRenderedValues().y + (2 * s_TopDownMargins));
209-
float l_SubTextHeight = SubTextEnabled ? Mathf.Max(0, SubText.GetRenderedValues().y + (2 * s_TopDownMargins)) : 0;
208+
float l_TextHeight = Mathf.Max(0, TMProProxy.TMP_Text_GetRendererValues(Text).y + (2 * s_TopDownMargins));
209+
float l_SubTextHeight = SubTextEnabled ? Mathf.Max(0, TMProProxy.TMP_Text_GetRendererValues(SubText).y + (2 * s_TopDownMargins)) : 0;
210210

211211
//if (l_TextHeight == 0)
212212
// l_TextHeight = Text.GetPreferredValues(" ").y;

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/Extensions/EnhancedFontInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ internal bool TryRegisterImageInfo(CP_SDK.Unity.EnhancedImage p_ImageInfo, out u
143143

144144
#if BEATSABER && !BEATSABER_1_29_4_OR_NEWER
145145
Font.characterLookupTable.Add(l_ReplaceCharacter, new TMP_Character(l_ReplaceCharacter, l_Glypth));
146-
#elif BEATSABER_1_29_4_OR_NEWER || UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX
146+
#elif BEATSABER_1_29_4_OR_NEWER || UNITY_TESTING || SYNTHRIDERS || AUDIOTRIP || BOOMBOX || DANCEDASH
147147
Font.characterLookupTable.Add(l_ReplaceCharacter, new TMP_Character(l_ReplaceCharacter, Font, l_Glypth));
148148
#else
149149
#error Missing game implementation

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/UI/ChatFloatingPanelView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private void InitLogic()
165165
l_Message.SetWidth(m_ChatSize.x);
166166

167167
l_Message.transform.localScale = Vector3.zero;
168-
l_Message.gameObject.ChangerLayerRecursive(CP_SDK.UI.UISystem.UILayer);
168+
GameObjectU.ChangerLayerRecursive(l_Message.gameObject, CP_SDK.UI.UISystem.UILayer);
169169

170170
UpdateMessageStyle(l_Message);
171171

@@ -541,7 +541,7 @@ internal void OnChannelSubsciption(IChatService p_Service, IChatChannel p_Channe
541541
return;
542542

543543
var l_Prefix = !string.IsNullOrEmpty(p_Channel.Prefix) ? $"<b><color=yellow>[{p_Channel.Prefix}]</color></b> " : string.Empty;
544-
var l_MessageStr = $"{l_Prefix}<#FFFFFFBB>[<b>{p_Service.DisplayName}</b>] <color={p_User.Color}><b>@{p_User.PaintedName}</b>";
544+
var l_MessageStr = $"{l_Prefix}<#FFFFFFBB>[<b>{p_Service.DisplayName}</b>] <color={p_User.Color}><b>@{p_User.PaintedName}</b> ";
545545
if (p_Event.IsGift)
546546
l_MessageStr += $"gifted <color={p_User.Color}><b>{p_Event.PurchasedMonthCount}</b></color> month of <color={p_User.Color}><b>{p_Event.SubPlan}</b></color> to <color={p_User.Color}><b>@{p_Event.RecipientDisplayName}</b></color>!";
547547
else

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/UI/HypeTrainFloatingPanelView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ internal sealed class HypeTrainFloatingPanelView : CP_SDK.UI.ViewController<Hype
3939
/// </summary>
4040
protected override void OnViewCreation()
4141
{
42-
var l_WhiteSprite = CP_SDK.Unity.SpriteU.CreateFromTextureWithBorders(Texture2D.whiteTexture);
42+
var l_WhiteSprite = CP_SDK.Unity.SpriteU.CreateFromTexture(Texture2D.whiteTexture);
4343

4444
XUIHLayout.Make(
4545
XUIHLayout.Make(

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/UI/PollFloatingPanelView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal sealed class PollFloatingPanelView : CP_SDK.UI.ViewController<PollFloat
4848
/// </summary>
4949
protected override sealed void OnViewCreation()
5050
{
51-
var l_WhiteSprite = CP_SDK.Unity.SpriteU.CreateFromTextureWithBorders(Texture2D.whiteTexture);
51+
var l_WhiteSprite = CP_SDK.Unity.SpriteU.CreateFromTexture(Texture2D.whiteTexture);
5252

5353
Templates.FullRectLayout(
5454
Templates.TitleBar("Poll"),

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/UI/PredictionFloatingPanelView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ internal sealed class PredictionFloatingPanelView : CP_SDK.UI.ViewController<Pre
6363
/// </summary>
6464
protected override sealed void OnViewCreation()
6565
{
66-
var l_WhiteSprite = CP_SDK.Unity.SpriteU.CreateFromTextureWithBorders(Texture2D.whiteTexture);
66+
var l_WhiteSprite = CP_SDK.Unity.SpriteU.CreateFromTexture(Texture2D.whiteTexture);
6767

6868
Templates.FullRectLayout(
6969
Templates.TitleBar("Prediction"),

Modules/BeatSaberPlus_Chat/ChatPlexMod_Chat/UI/StatusFloatingPanelView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal sealed class StatusFloatingPanelView : CP_SDK.UI.ViewController<StatusF
2929
protected override void OnViewCreation()
3030
{
3131
var l_Assembly = Assembly.GetExecutingAssembly();
32-
var l_ViewerIconSprite = CP_SDK.Unity.SpriteU.CreateFromRawWithBorders(CP_SDK.Misc.Resources.FromRelPath(l_Assembly, "ChatPlexMod_Chat.Resources.ViewerIcon.png"));
32+
var l_ViewerIconSprite = CP_SDK.Unity.SpriteU.CreateFromRaw(CP_SDK.Misc.Resources.FromRelPath(l_Assembly, "ChatPlexMod_Chat.Resources.ViewerIcon.png"));
3333

3434
XUIHLayout.Make(
3535
XUIImage.Make(l_ViewerIconSprite)

0 commit comments

Comments
 (0)