Commit 54035a8e authored by SherryChaos's avatar SherryChaos

fix duplicate buttons bug

parent ffb717d5
...@@ -14,24 +14,28 @@ namespace MDPro3.UI ...@@ -14,24 +14,28 @@ namespace MDPro3.UI
public List<DuelButtonInfo> buttons = new List<DuelButtonInfo>(); public List<DuelButtonInfo> buttons = new List<DuelButtonInfo>();
public List<DuelButton> buttonObjs = new List<DuelButton>(); public List<DuelButton> buttonObjs = new List<DuelButton>();
DuelButton selectButton; private DuelButton selectButton;
GameObject highlight; private GameObject highlight;
GameObject select; private GameObject select;
GameObject selectPush; private GameObject selectPush;
GameObject selectCard; private GameObject selectCard;
GameObject selectCardPush; private GameObject selectCardPush;
GameObject disable; private GameObject disable;
public GameCard cookieCard; public GameCard cookieCard;
bool hover; private bool hover;
bool selecting; private bool selecting;
bool selected; private bool selected;
public bool cardSelecting; public bool cardSelecting;
public bool cardSelected; public bool cardSelected;
bool cardPreselected; private bool cardPreselected;
bool cardUnselectable; private bool cardUnselectable;
private bool countShowing;
private bool buttonsCreated = false;
private GameObject hintObj;
private void Start() private void Start()
{ {
...@@ -119,8 +123,6 @@ namespace MDPro3.UI ...@@ -119,8 +123,6 @@ namespace MDPro3.UI
} }
} }
bool countShowing;
private void Update() private void Update()
{ {
hover = false; hover = false;
...@@ -157,7 +159,7 @@ namespace MDPro3.UI ...@@ -157,7 +159,7 @@ namespace MDPro3.UI
highlight.SetActive(false); highlight.SetActive(false);
} }
void OnClick() private void OnClick()
{ {
if (selecting) if (selecting)
{ {
...@@ -228,7 +230,7 @@ namespace MDPro3.UI ...@@ -228,7 +230,7 @@ namespace MDPro3.UI
else else
{ {
AudioManager.PlaySE("SE_DUEL_SELECT"); AudioManager.PlaySE("SE_DUEL_SELECT");
List<GameCard> cards = new List<GameCard>(); List<GameCard> cards = new();
foreach (var card in Program.instance.ocgcore.cards) foreach (var card in Program.instance.ocgcore.cards)
if ((card.p.location & p.location) > 0) if ((card.p.location & p.location) > 0)
if (card.p.controller == p.controller) if (card.p.controller == p.controller)
...@@ -270,11 +272,13 @@ namespace MDPro3.UI ...@@ -270,11 +272,13 @@ namespace MDPro3.UI
} }
} }
bool buttonsCreated = false; private void CreateButtons()
void CreateButtons()
{ {
if (buttonsCreated || Program.instance.ocgcore.returnAction != null || buttons.Count == 0) if (buttonsCreated || Program.instance.ocgcore.returnAction != null || buttons.Count == 0)
{
buttons.Clear();
return; return;
}
for (int i = 0; i < buttons.Count; i++) for (int i = 0; i < buttons.Count; i++)
{ {
...@@ -294,7 +298,7 @@ namespace MDPro3.UI ...@@ -294,7 +298,7 @@ namespace MDPro3.UI
buttonsCreated = true; buttonsCreated = true;
} }
void CreateSelectButton() private void CreateSelectButton()
{ {
var obj = Instantiate(Program.instance.ocgcore.container.duelButton); var obj = Instantiate(Program.instance.ocgcore.container.duelButton);
selectButton = obj.GetComponent<DuelButton>(); selectButton = obj.GetComponent<DuelButton>();
...@@ -310,7 +314,6 @@ namespace MDPro3.UI ...@@ -310,7 +314,6 @@ namespace MDPro3.UI
selectButton.Hide(); selectButton.Hide();
} }
public void ShowButtons() public void ShowButtons()
{ {
foreach (var button in buttonObjs) foreach (var button in buttonObjs)
...@@ -334,7 +337,6 @@ namespace MDPro3.UI ...@@ -334,7 +337,6 @@ namespace MDPro3.UI
buttonsCreated = false; buttonsCreated = false;
} }
public void StopResponse() public void StopResponse()
{ {
if (selecting) if (selecting)
...@@ -540,7 +542,6 @@ namespace MDPro3.UI ...@@ -540,7 +542,6 @@ namespace MDPro3.UI
return null; return null;
} }
GameObject hintObj;
public void ShowHint(uint location, uint controller) public void ShowHint(uint location, uint controller)
{ {
if ((location & p.location) > 0 && controller == p.controller) if ((location & p.location) > 0 && controller == p.controller)
......
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