Commit e7ed55c3 authored by ElderLich's avatar ElderLich

Bug Fix: Info Panel Bug

Makes the i duel info panel refresh summon counters from live duel state and reset cleanly between duels instead of showing stale 1 normal / 1 special values.
parent 070f80b2
...@@ -84,6 +84,7 @@ namespace MDPro3.Duel ...@@ -84,6 +84,7 @@ namespace MDPro3.Duel
opActivated.Clear(); opActivated.Clear();
Program.instance.ocgcore.GetUI<OcgCoreUI>().CardDescription.Hide(); Program.instance.ocgcore.GetUI<OcgCoreUI>().CardDescription.Hide();
Program.instance.ocgcore.GetUI<OcgCoreUI>().CardList.Hide(); Program.instance.ocgcore.GetUI<OcgCoreUI>().CardList.Hide();
Program.instance.ocgcore.GetUI<OcgCoreUI>().ResetBgDetailState();
surrendered = false; surrendered = false;
tagSurrendered = false; tagSurrendered = false;
deckReserved = false; deckReserved = false;
...@@ -818,6 +819,7 @@ namespace MDPro3.Duel ...@@ -818,6 +819,7 @@ namespace MDPro3.Duel
mySummonCount++; mySummonCount++;
else else
opSummonCount++; opSummonCount++;
Core.GetUI<OcgCoreUI>().RefreshBgDetail();
var se = "SE_LAND_NORMAL"; var se = "SE_LAND_NORMAL";
...@@ -910,6 +912,7 @@ namespace MDPro3.Duel ...@@ -910,6 +912,7 @@ namespace MDPro3.Duel
mySpSummonCount++; mySpSummonCount++;
else else
opSpSummonCount++; opSpSummonCount++;
Core.GetUI<OcgCoreUI>().RefreshBgDetail();
if (card.GetData().HasType(CardType.Token)) if (card.GetData().HasType(CardType.Token))
goto TokenPass; goto TokenPass;
...@@ -1968,6 +1971,7 @@ namespace MDPro3.Duel ...@@ -1968,6 +1971,7 @@ namespace MDPro3.Duel
mySpSummonCount = 0; mySpSummonCount = 0;
opSummonCount = 0; opSummonCount = 0;
opSpSummonCount = 0; opSpSummonCount = 0;
Core.GetUI<OcgCoreUI>().RefreshBgDetail();
turns++; turns++;
myTurn = isFirst ? (turns % 2 != 0) : (turns % 2 == 0); myTurn = isFirst ? (turns % 2 != 0) : (turns % 2 == 0);
duelBGManager.OnNewTurn(myTurn, turns); duelBGManager.OnNewTurn(myTurn, turns);
......
...@@ -621,6 +621,55 @@ namespace MDPro3.UI.ServantUI ...@@ -621,6 +621,55 @@ namespace MDPro3.UI.ServantUI
} }
private bool bgDetailShowing; private bool bgDetailShowing;
public void RefreshBgDetail()
{
var core = Program.instance.ocgcore;
var info = core?.messageDispatcher?.duel?.duelBGManager?.fieldSummonRightInfo;
if (info == null)
return;
var summonInfoManager = info.GetComponent<ElementObjectManager>();
if (summonInfoManager == null)
return;
var nearManager = summonInfoManager.GetElement<ElementObjectManager>("RootNear");
var farManager = summonInfoManager.GetElement<ElementObjectManager>("RootFar");
nearManager.GetElement<TextMeshPro>("TextSummon").text = mySummonCount.ToString();
nearManager.GetElement<TextMeshPro>("TextSpSummon").text = mySpSummonCount.ToString();
farManager.GetElement<TextMeshPro>("TextSummon").text = opSummonCount.ToString();
farManager.GetElement<TextMeshPro>("TextSpSummon").text = opSpSummonCount.ToString();
nearManager.GetElement<TextMeshPro>("TextTotalAtk").text = core.GetAllAtk(true).ToString();
farManager.GetElement<TextMeshPro>("TextTotalAtk").text = core.GetAllAtk(false).ToString();
summonInfoManager.GetElement<TextMeshPro>("GraveNear").text = core.GetLocationCardCount(CardLocation.Grave, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("GraveFar").text = core.GetLocationCardCount(CardLocation.Grave, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExcludeNear").text = core.GetLocationCardCount(CardLocation.Removed, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExcludeFar").text = core.GetLocationCardCount(CardLocation.Removed, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("DeckNear").text = core.GetLocationCardCount(CardLocation.Deck, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("DeckFar").text = core.GetLocationCardCount(CardLocation.Deck, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExtraNear").text = core.GetLocationCardCount(CardLocation.Extra, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExtraFar").text = core.GetLocationCardCount(CardLocation.Extra, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("HandNear").text = core.GetLocationCardCount(CardLocation.Hand, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("HandFar").text = core.GetLocationCardCount(CardLocation.Hand, 1).ToString();
}
public void ResetBgDetailState()
{
var wasShowing = bgDetailShowing;
bgDetailShowing = false;
foreach (var card in cards)
card.HideHiddenLabel();
var info = Program.instance.ocgcore?.messageDispatcher?.duel?.duelBGManager?.fieldSummonRightInfo;
if (info != null)
{
if (wasShowing || info.activeSelf)
CameraManager.DuelOverlay3DMinus();
info.SetActive(false);
}
}
public void SwitchBgDetail(bool show) public void SwitchBgDetail(bool show)
{ {
if (show) if (show)
...@@ -631,7 +680,6 @@ namespace MDPro3.UI.ServantUI ...@@ -631,7 +680,6 @@ namespace MDPro3.UI.ServantUI
private void ShowBgDetail() private void ShowBgDetail()
{ {
var core = Program.instance.ocgcore;
var info = Program.instance.ocgcore.messageDispatcher.duel.duelBGManager.fieldSummonRightInfo; var info = Program.instance.ocgcore.messageDispatcher.duel.duelBGManager.fieldSummonRightInfo;
if (bgDetailShowing) if (bgDetailShowing)
...@@ -644,29 +692,7 @@ namespace MDPro3.UI.ServantUI ...@@ -644,29 +692,7 @@ namespace MDPro3.UI.ServantUI
{ {
CameraManager.DuelOverlay3DPlus(); CameraManager.DuelOverlay3DPlus();
info.SetActive(true); info.SetActive(true);
RefreshBgDetail();
var summonInfoManager = info.GetComponent<ElementObjectManager>();
var nearManager = summonInfoManager.GetElement<ElementObjectManager>("RootNear");
var farManager = summonInfoManager.GetElement<ElementObjectManager>("RootFar");
nearManager.GetElement<TextMeshPro>("TextSummon").text = mySummonCount.ToString();
nearManager.GetElement<TextMeshPro>("TextSpSummon").text = mySpSummonCount.ToString();
farManager.GetElement<TextMeshPro>("TextSummon").text = opSummonCount.ToString();
farManager.GetElement<TextMeshPro>("TextSpSummon").text = opSpSummonCount.ToString();
nearManager.GetElement<TextMeshPro>("TextTotalAtk").text = core.GetAllAtk(true).ToString();
farManager.GetElement<TextMeshPro>("TextTotalAtk").text = core.GetAllAtk(false).ToString();
summonInfoManager.GetElement<TextMeshPro>("GraveNear").text = core.GetLocationCardCount(CardLocation.Grave, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("GraveFar").text = core.GetLocationCardCount(CardLocation.Grave, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExcludeNear").text = core.GetLocationCardCount(CardLocation.Removed, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExcludeFar").text = core.GetLocationCardCount(CardLocation.Removed, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("DeckNear").text = core.GetLocationCardCount(CardLocation.Deck, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("DeckFar").text = core.GetLocationCardCount(CardLocation.Deck, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExtraNear").text = core.GetLocationCardCount(CardLocation.Extra, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("ExtraFar").text = core.GetLocationCardCount(CardLocation.Extra, 1).ToString();
summonInfoManager.GetElement<TextMeshPro>("HandNear").text = core.GetLocationCardCount(CardLocation.Hand, 0).ToString();
summonInfoManager.GetElement<TextMeshPro>("HandFar").text = core.GetLocationCardCount(CardLocation.Hand, 1).ToString();
} }
} }
......
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