Skip to content

Commit

Permalink
Merge pull request #11 from denpadokei/10-sync-position
Browse files Browse the repository at this point in the history
sync position
  • Loading branch information
denpadokei authored Jun 13, 2022
2 parents 961d981 + 3297c1d commit 0e66f7d
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 105 deletions.
32 changes: 22 additions & 10 deletions Chat/ChatDisplay.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,31 @@ private void OnPropertyChanged(PropertyChangedEventArgs e)
this._chatConfig.ChatWidth = this.ChatWidth;
}
else if (e.PropertyName == nameof(this.ChatPosition)) {
if (this._isInGame) {
if (this._chatConfig.SyncOrientation) {
this._chatConfig.Menu_ChatPosition = this.ChatPosition;
this._chatConfig.Song_ChatPosition = this.ChatPosition;
}
else {
this._chatConfig.Menu_ChatPosition = this.ChatPosition;
if (this._isInGame) {
this._chatConfig.Song_ChatPosition = this.ChatPosition;
}
else {
this._chatConfig.Menu_ChatPosition = this.ChatPosition;
}
}
}
else if (e.PropertyName == nameof(this.ChatRotation)) {
if (this._isInGame) {
if (this._chatConfig.SyncOrientation) {
this._chatConfig.Menu_ChatRotation = this.ChatRotation;
this._chatConfig.Song_ChatRotation = this.ChatRotation;
}
else {
this._chatConfig.Menu_ChatRotation = this.ChatRotation;
if (this._isInGame) {
this._chatConfig.Song_ChatRotation = this.ChatRotation;
}
else {
this._chatConfig.Menu_ChatRotation = this.ChatRotation;
}
}
}
else if (e.PropertyName == nameof(this.FontSize)) {
Expand All @@ -77,7 +89,7 @@ private void OnPropertyChanged(PropertyChangedEventArgs e)
}
else if (e.PropertyName == nameof(this.SyncOrientation)) {
this._chatConfig.SyncOrientation = this.SyncOrientation;
if (this.SyncOrientation) {
if (this._chatConfig.SyncOrientation) {
if (this._isInGame) {
this._chatConfig.Menu_ChatPosition = this._chatConfig.Song_ChatPosition;
this._chatConfig.Menu_ChatRotation = this._chatConfig.Song_ChatRotation;
Expand Down Expand Up @@ -409,6 +421,11 @@ private void Load()
this.AllowMovement = this._chatConfig.AllowMovement;
this.ChatHeight = this._chatConfig.ChatHeight;
this.ChatWidth = this._chatConfig.ChatWidth;
this.FontSize = this._chatConfig.FontSize;
this.HighlightColor = this._chatConfig.HighlightColor;
this.PingColor = this._chatConfig.PingColor;
this.ReverseChatOrder = this._chatConfig.ReverseChatOrder;
this.SyncOrientation = this._chatConfig.SyncOrientation;
if (this._isInGame) {
this.ChatPosition = this._chatConfig.Song_ChatPosition;
this.ChatRotation = this._chatConfig.Song_ChatRotation;
Expand All @@ -417,11 +434,6 @@ private void Load()
this.ChatPosition = this._chatConfig.Menu_ChatPosition;
this.ChatRotation = this._chatConfig.Menu_ChatRotation;
}
this.FontSize = this._chatConfig.FontSize;
this.HighlightColor = this._chatConfig.HighlightColor;
this.PingColor = this._chatConfig.PingColor;
this.ReverseChatOrder = this._chatConfig.ReverseChatOrder;
this.SyncOrientation = this._chatConfig.SyncOrientation;
}
}
}
23 changes: 1 addition & 22 deletions Chat/ChatDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using BeatSaberMarkupLanguage.ViewControllers;
using EnhancedStreamChat.Configuration;
using EnhancedStreamChat.Graphics;
using EnhancedStreamChat.HarmonyPatches;
using EnhancedStreamChat.Interfaces;
using EnhancedStreamChat.Models;
using EnhancedStreamChat.Utilities;
Expand All @@ -29,7 +28,7 @@
namespace EnhancedStreamChat.Chat
{
[HotReload]
public partial class ChatDisplay : BSMLAutomaticViewController, IAsyncInitializable, IChatDisplay, IDisposable, IAffinity, ILatePreRenderRebuildReciver, IIrcServiceDisconnectReceiver, IPubSubServiceDisconnectReceiver
public partial class ChatDisplay : BSMLAutomaticViewController, IAsyncInitializable, IChatDisplay, IDisposable, IAffinity, ILatePreRenderRebuildReciver
{
//゚+。*゚+。。+゚*。+゚ ゚+。*゚+。。+゚*。+゚ ゚+。*゚+。*゚+。。+゚*。+゚ ゚+。*゚+。。+゚*。+゚ ゚+。*゚+。*゚+。。+゚*。+゚ ゚+。*゚+。。+゚*。+゚ ゚+。*
#region // プロパティ
Expand Down Expand Up @@ -58,8 +57,6 @@ public async Task InitializeAsync(CancellationToken token)
while (s_backupMessageQueue.TryDequeue(out var msg)) {
await this.OnTextMessageReceived(msg.Value, msg.Key);
}
TwitchIrcServicePatch.RegistIrcReceiver(this);
TwitchIrcServicePatch.RegistPubSubReceiver(this);
this._chatConfig.OnConfigChanged += this.Instance_OnConfigChanged;
SceneManager.activeSceneChanged += this.SceneManager_activeSceneChanged;
this._catCoreManager.OnChatConnected += this.CatCoreManager_OnChatConnected;
Expand Down Expand Up @@ -111,22 +108,6 @@ public void VRPointerOnEnable(VRPointer __instance)
this.PointerOnEnabled(__instance);
}

public void OnIrcDisconnect(object ircService)
{
if (!this._chatConfig.ForceAutoReconnect || !this.ReconnectEnable) {
return;
}
this.ReIrcConnect();
}

public void OnPubsubDisconnect(object pubSubService)
{
if (!this._chatConfig.ForceAutoReconnect || !this.ReconnectEnable) {
return;
}
this.PubSubReconnect(pubSubService);
}

public void LatePreRenderRebuildHandler(object sender, EventArgs e)
{
this._updateMessagePositions = true;
Expand Down Expand Up @@ -520,8 +501,6 @@ protected virtual void Dispose(bool disposing)
this._catCoreManager.OnChatCleared -= this.OnCatCoreManager_OnChatCleared;
this._catCoreManager.OnFollow -= this.OnCatCoreManager_OnFollow;
this._catCoreManager.OnRewardRedeemed -= this.OnCatCoreManager_OnRewardRedeemed;
TwitchIrcServicePatch.UnRegistIrcReceiver(this);
TwitchIrcServicePatch.UnRegistPubSubReceiver(this);
this.StopAllCoroutines();
while (this._messages.TryDequeue(out var msg)) {
if (msg != null) {
Expand Down
4 changes: 2 additions & 2 deletions Chat/ChatImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public IEnumerator OnSingleImageCached(byte[] bytes, string id, ESCAnimationType
break;

case ESCAnimationType.MAYBE_GIF:
if (6 <= bytes.Length && (ContainBytePattern(bytes, s_animattedGIF89aPattern) || ContainBytePattern(bytes, s_animattedGIF87aPattern))) {
if (6 <= bytes.Length && (this.ContainBytePattern(bytes, s_animattedGIF89aPattern) || this.ContainBytePattern(bytes, s_animattedGIF87aPattern))) {
AnimationLoader.Process(AnimationType.GIF, bytes, (tex, atlas, delays, width, height) =>
{
animControllerData = AnimationController.instance.Register(id, tex, atlas, delays);
Expand Down Expand Up @@ -232,7 +232,7 @@ internal void ClearCache()
/// <param name="array">Input array</param>
/// <param name="pattern">Lookup pattern</param>
/// <returns></returns>
private static bool ContainBytePattern(byte[] array, byte[] pattern)
private bool ContainBytePattern(byte[] array, byte[] pattern)
{
var patternPosition = 0;
for (var i = 0; i < array.Length; ++i) {
Expand Down
1 change: 0 additions & 1 deletion Configuration/PluginConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class PluginConfig
public virtual Vector3 Song_ChatPosition { get; set; } = new Vector3(0, 3.75f, 2.5f);
[UseConverter(typeof(Vector3Conveter))]
public virtual Vector3 Song_ChatRotation { get; set; } = new Vector3(325, 0, 0);
public virtual bool ForceAutoReconnect { get; set; } = true;

public event Action OnConfigChanged;

Expand Down
2 changes: 1 addition & 1 deletion EnhancedStreamChat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<NoWarn>1591</NoWarn>
<AssemblyName>EnhancedStreamChat</AssemblyName>
<RootNamespace>EnhancedStreamChat</RootNamespace>
<Version>5.0.3</Version>
<Version>5.0.4</Version>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<DebugType>embedded</DebugType>
<AssemblySearchPath>$(ReferencePath)</AssemblySearchPath>
Expand Down
54 changes: 0 additions & 54 deletions HarmonyPatches/TwitchIrcServicePatch.cs

This file was deleted.

7 changes: 0 additions & 7 deletions Interfaces/IIrcServiceDisconnectReceiver.cs

This file was deleted.

7 changes: 0 additions & 7 deletions Interfaces/IPubSubServiceDisconnectReceiver.cs

This file was deleted.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "EnhancedStreamChat",
"name": "Enhanced Stream Chat",
"author": "denpadokei",
"version": "5.0.3",
"version": "5.0.4",
"description": "Enhanced Stream Chat is a rich text chat integration mod, with full unicode, emote, and emoji support.",
"gameVersion": "1.22.0",
"dependsOn": {
Expand Down

0 comments on commit 0e66f7d

Please sign in to comment.