Commit 9b50b9b3 authored by SherryChaos's avatar SherryChaos

fix bugs

parent 2c21cc43
......@@ -1132,10 +1132,10 @@ namespace MDPro3
moveTime = 0.1f;
break;
case GameMessage.ShuffleSetCard:
case GameMessage.Swap:
moveTime = 0.2f;
break;
}
TokenPass:
var cardPlane = manager.GetElement<Transform>("CardPlane");
var pivot = manager.GetElement<Transform>("Pivot");
var offset = manager.GetElement<Transform>("Offset");
......
......@@ -2008,12 +2008,26 @@ namespace MDPro3
from = r.ReadGPS();
code = r.ReadInt32();
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);
var card_2 = GCS_Get(to);
if (card != null)
Sleep((int)(card.Move(to) * 100));
card = GCS_Get(to);
if (card != null)
Sleep((int)(card.Move(from) * 100));
Sleep((int)(card.Move(to2) * 100));
if (card_2 != null)
Sleep((int)(card_2.Move(from2) * 100));
break;
case GameMessage.Summoning:
cardsInSelection.Clear();
......@@ -4713,35 +4727,25 @@ namespace MDPro3
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)
return false;
bool returnValue = false;
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)
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)
if(!unselectables.Contains(c))
if (!newSelectedCards.Contains(c))
{
returnValue = CheckSelectable(cards, c, newSelectedCards, max, unselectables);
returnValue = CheckSelectableInSum(cards, c, newSelectedCards, max);
if (returnValue)
return true;
}
}
return returnValue;
}
......@@ -5319,6 +5323,16 @@ namespace MDPro3
if (currentMessage == GameMessage.SelectCard
|| currentMessage == GameMessage.SelectCounter)
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
hintText.text = fieldHint;
}
......@@ -5351,7 +5365,7 @@ namespace MDPro3
foreach (var place in places)
if (place.cardSelecting)
if (!place.cardSelected)
if (CheckSelectable(cardsInSelection, place.cookieCard, selected, ES_max))
if (CheckSelectableInSum(cardsInSelection, place.cookieCard, selected, ES_max))
place.CardInThisZoneSelectable();
else
place.CardInThisZoneUnselectable();
......
......@@ -203,6 +203,8 @@ namespace MDPro3.UI
}
else if (!cardSelected && !cardUnselectable && !cardPreselected)
selectButton.Show();
else if (cardSelected && !cardUnselectable && !cardPreselected)
UnselectCardInThisZone();
var card = FindCardInThisPlace();
if (card != null)
card.OnClick();
......@@ -421,6 +423,15 @@ namespace MDPro3.UI
selectCardPush.SetActive(true);
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()
{
cardUnselectable = false;
......@@ -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()
{
......
......@@ -92,6 +92,12 @@ namespace MDPro3.UI
mono.PreSelectThis();
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;
}
else if (core.currentMessage == GameMessage.SortCard
......@@ -135,7 +141,7 @@ namespace MDPro3.UI
foreach (var mono in monos)
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();
else
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