Commit 1612c01b authored by ElderLich's avatar ElderLich

Bug Fix: Fix player/system message toggle enforcement

Make duel, spectate, and replay player/system message settings apply consistently by routing duel log and hint messages through the same runtime filters instead of bypassing the config toggles.
parent 67444bff
...@@ -509,7 +509,8 @@ namespace MDPro3.Duel ...@@ -509,7 +509,8 @@ namespace MDPro3.Duel
/*var lenth = */reader.ReadInt16(); /*var lenth = */reader.ReadInt16();
var buffer = reader.ReadToEnd(); var buffer = reader.ReadToEnd();
var text = Encoding.UTF8.GetString(buffer, 0, buffer.Length); var text = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
MessageManager.Cast(text); if (OcgCore.ShouldShowSystemMessages())
MessageManager.Cast(text);
return UniTask.CompletedTask; return UniTask.CompletedTask;
} }
......
...@@ -763,24 +763,38 @@ namespace MDPro3.Servant ...@@ -763,24 +763,38 @@ namespace MDPro3.Servant
GetUI<OcgCoreUI>().DuelErrorLog.Show(error); GetUI<OcgCoreUI>().DuelErrorLog.Show(error);
} }
public static bool ShouldShowPlayerMessages()
{
if (condition == Condition.Duel && !Config.GetBool("DuelPlayerMessage", true))
return false;
if (condition == Condition.Watch && !Config.GetBool("WatchPlayerMessage", true))
return false;
if (condition == Condition.Replay && !Config.GetBool("ReplayPlayerMessage", true))
return false;
return true;
}
public static bool ShouldShowSystemMessages()
{
if (condition == Condition.Duel && !Config.GetBool("DuelSystemMessage", true))
return false;
if (condition == Condition.Watch && !Config.GetBool("WatchSystemMessage", true))
return false;
if (condition == Condition.Replay && !Config.GetBool("ReplaySystemMessage", true))
return false;
return true;
}
public bool GetMessageConfig(int player) public bool GetMessageConfig(int player)
{ {
if (player < 4 || player == 7) if (player < 4 || player == 7)
{ {
if (condition == Condition.Duel && !Config.GetBool("DuelPlayerMessage", true)) if (!ShouldShowPlayerMessages())
return false;
if (condition == Condition.Watch && !Config.GetBool("WatchPlayerMessage", true))
return false;
if (condition == Condition.Replay && !Config.GetBool("ReplayPlayerMessage", true))
return false; return false;
} }
else else
{ {
if (condition == Condition.Duel && !Config.GetBool("DuelSystemMessage", true)) if (!ShouldShowSystemMessages())
return false;
if (condition == Condition.Watch && !Config.GetBool("WatchSystemMessage", true))
return false;
if (condition == Condition.Replay && !Config.GetBool("ReplaySystemMessage", true))
return false; return false;
} }
return true; return true;
...@@ -1464,6 +1478,8 @@ namespace MDPro3.Servant ...@@ -1464,6 +1478,8 @@ namespace MDPro3.Servant
public static void PrintDuelLog(string content) public static void PrintDuelLog(string content)
{ {
lastDuelLog = content; lastDuelLog = content;
if (!ShouldShowSystemMessages())
return;
MessageManager.Cast(content); MessageManager.Cast(content);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment