Commit 9b50b9b3 authored by SherryChaos's avatar SherryChaos

fix bugs

parent 2c21cc43
...@@ -1132,10 +1132,10 @@ namespace MDPro3 ...@@ -1132,10 +1132,10 @@ namespace MDPro3
moveTime = 0.1f; moveTime = 0.1f;
break; break;
case GameMessage.ShuffleSetCard: case GameMessage.ShuffleSetCard:
case GameMessage.Swap:
moveTime = 0.2f; moveTime = 0.2f;
break; break;
} }
TokenPass:
var cardPlane = manager.GetElement<Transform>("CardPlane"); var cardPlane = manager.GetElement<Transform>("CardPlane");
var pivot = manager.GetElement<Transform>("Pivot"); var pivot = manager.GetElement<Transform>("Pivot");
var offset = manager.GetElement<Transform>("Offset"); var offset = manager.GetElement<Transform>("Offset");
......
...@@ -2008,12 +2008,26 @@ namespace MDPro3 ...@@ -2008,12 +2008,26 @@ namespace MDPro3
from = r.ReadGPS(); from = r.ReadGPS();
code = r.ReadInt32(); code = r.ReadInt32();
to = r.ReadGPS(); to = r.ReadGPS();
var from2 = new GPS
{
controller = from.controller,
location = from.location,
sequence = from.sequence,
position = to.position
};
var to2 = new GPS
{
controller = to.controller,
location = to.location,
sequence = to.sequence,
position = from.position
};
card = GCS_Get(from); card = GCS_Get(from);
var card_2 = GCS_Get(to);
if (card != null) if (card != null)
Sleep((int)(card.Move(to) * 100)); Sleep((int)(card.Move(to2) * 100));
card = GCS_Get(to); if (card_2 != null)
if (card != null) Sleep((int)(card_2.Move(from2) * 100));
Sleep((int)(card.Move(from) * 100));
break; break;
case GameMessage.Summoning: case GameMessage.Summoning:
cardsInSelection.Clear(); cardsInSelection.Clear();
...@@ -4713,35 +4727,25 @@ namespace MDPro3 ...@@ -4713,35 +4727,25 @@ namespace MDPro3
return new int[] { sum1, sum2 }; return new int[] { sum1, sum2 };
} }
public static bool CheckSelectable(List<GameCard> cards, GameCard card, List<GameCard> selectedCards, int max, List<GameCard> unselectables = null) public static bool CheckSelectableInSum(List<GameCard> cards, GameCard card, List<GameCard> selectedCards, int max)
{ {
if(selectedCards.Count >= max) if(selectedCards.Count >= max)
return false; return false;
bool returnValue = false; bool returnValue = false;
var sum = GetSelectLevelSum(selectedCards); var sum = GetSelectLevelSum(selectedCards);
if(unselectables == null)
unselectables = new List<GameCard>();
foreach(var c in cards)
if(!selectedCards.Contains(c))
if (!unselectables.Contains(c))
if(c != card)
if (sum[0] + c.levelForSelect_1 > Program.I().ocgcore.ES_level || sum[1] + c.levelForSelect_2 > Program.I().ocgcore.ES_level)
unselectables.Add(c);
if (sum[0] + card.levelForSelect_1 == Program.I().ocgcore.ES_level || sum[1] + card.levelForSelect_2 == Program.I().ocgcore.ES_level) if (sum[0] + card.levelForSelect_1 == Program.I().ocgcore.ES_level || sum[1] + card.levelForSelect_2 == Program.I().ocgcore.ES_level)
return true; return true;
else if (sum[0] + card.levelForSelect_1 > Program.I().ocgcore.ES_level || sum[1] + card.levelForSelect_2 > Program.I().ocgcore.ES_level)
{ return false;
var newSelectedCards = new List<GameCard>(selectedCards) { card };
foreach (var c in cards) var newSelectedCards = new List<GameCard>(selectedCards) { card };
if(!unselectables.Contains(c)) foreach (var c in cards)
if (!newSelectedCards.Contains(c)) if (!newSelectedCards.Contains(c))
{ {
returnValue = CheckSelectable(cards, c, newSelectedCards, max, unselectables); returnValue = CheckSelectableInSum(cards, c, newSelectedCards, max);
if (returnValue) if (returnValue)
return true; return true;
} }
}
return returnValue; return returnValue;
} }
...@@ -5319,6 +5323,16 @@ namespace MDPro3 ...@@ -5319,6 +5323,16 @@ namespace MDPro3
if (currentMessage == GameMessage.SelectCard if (currentMessage == GameMessage.SelectCard
|| currentMessage == GameMessage.SelectCounter) || currentMessage == GameMessage.SelectCounter)
hintText.text = fieldHint + ": " + 0 + "/" + fieldMax; hintText.text = fieldHint + ": " + 0 + "/" + fieldMax;
else if(currentMessage == GameMessage.SelectSum && !ES_overFlow)
{
foreach (var place in places)
if (place.cardSelecting)
if (!place.cardSelected)
if (CheckSelectableInSum(cardsInSelection, place.cookieCard, cardsMustBeSelected, ES_max))
place.CardInThisZoneSelectable();
else
place.CardInThisZoneUnselectable();
}
else else
hintText.text = fieldHint; hintText.text = fieldHint;
} }
...@@ -5351,7 +5365,7 @@ namespace MDPro3 ...@@ -5351,7 +5365,7 @@ namespace MDPro3
foreach (var place in places) foreach (var place in places)
if (place.cardSelecting) if (place.cardSelecting)
if (!place.cardSelected) if (!place.cardSelected)
if (CheckSelectable(cardsInSelection, place.cookieCard, selected, ES_max)) if (CheckSelectableInSum(cardsInSelection, place.cookieCard, selected, ES_max))
place.CardInThisZoneSelectable(); place.CardInThisZoneSelectable();
else else
place.CardInThisZoneUnselectable(); place.CardInThisZoneUnselectable();
......
...@@ -203,6 +203,8 @@ namespace MDPro3.UI ...@@ -203,6 +203,8 @@ namespace MDPro3.UI
} }
else if (!cardSelected && !cardUnselectable && !cardPreselected) else if (!cardSelected && !cardUnselectable && !cardPreselected)
selectButton.Show(); selectButton.Show();
else if (cardSelected && !cardUnselectable && !cardPreselected)
UnselectCardInThisZone();
var card = FindCardInThisPlace(); var card = FindCardInThisPlace();
if (card != null) if (card != null)
card.OnClick(); card.OnClick();
...@@ -421,6 +423,15 @@ namespace MDPro3.UI ...@@ -421,6 +423,15 @@ namespace MDPro3.UI
selectCardPush.SetActive(true); selectCardPush.SetActive(true);
Program.I().ocgcore.FieldSelectRefresh(cookieCard); Program.I().ocgcore.FieldSelectRefresh(cookieCard);
} }
public void UnselectCardInThisZone()
{
if (Program.I().ocgcore.currentMessage == GameMessage.SelectCounter)
return;
cardSelected = false;
Program.I().ocgcore.FieldSelectRefresh(cookieCard);
}
public void CardInThisZoneSelectable() public void CardInThisZoneSelectable()
{ {
cardUnselectable = false; cardUnselectable = false;
...@@ -489,16 +500,6 @@ namespace MDPro3.UI ...@@ -489,16 +500,6 @@ namespace MDPro3.UI
} }
} }
public void StopShowingZoneHighlight()
{
select.SetActive(false);
}
public void StopShowingCardHighlight()
{
selectCard.SetActive(false);
selectCardPush.SetActive(false);
selectCardPush.SetActive(true);
}
public GameCard FindCardInThisPlace() public GameCard FindCardInThisPlace()
{ {
......
...@@ -92,6 +92,12 @@ namespace MDPro3.UI ...@@ -92,6 +92,12 @@ namespace MDPro3.UI
mono.PreSelectThis(); mono.PreSelectThis();
break; break;
} }
foreach (var mono in monos)
if (!mono.selected)
if (OcgCore.CheckSelectableInSum(Program.I().ocgcore.cardsInSelection, mono.card, core.cardsMustBeSelected, max + core.cardsMustBeSelected.Count))
mono.SelectableThis();
else
mono.UnselectableThis();
title.text = hint + "-" + OcgCore.GetSelectLevelSum(GetSelected())[0].ToString() + "/" + core.ES_level; title.text = hint + "-" + OcgCore.GetSelectLevelSum(GetSelected())[0].ToString() + "/" + core.ES_level;
} }
else if (core.currentMessage == GameMessage.SortCard else if (core.currentMessage == GameMessage.SortCard
...@@ -135,7 +141,7 @@ namespace MDPro3.UI ...@@ -135,7 +141,7 @@ namespace MDPro3.UI
foreach (var mono in monos) foreach (var mono in monos)
if (!mono.selected) if (!mono.selected)
if (OcgCore.CheckSelectable(Program.I().ocgcore.cardsInSelection, mono.card, selected, max + core.cardsMustBeSelected.Count)) if (OcgCore.CheckSelectableInSum(Program.I().ocgcore.cardsInSelection, mono.card, selected, max + core.cardsMustBeSelected.Count))
mono.SelectableThis(); mono.SelectableThis();
else else
mono.UnselectableThis(); mono.UnselectableThis();
......
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