Исправление бага с активацией представления витрины в PVP режиме. Исправлено показ Забрать или продолжить при пустой витрине.
This commit is contained in:
parent
a29ce63ce4
commit
7a5f9ec7ce
@ -64,12 +64,6 @@ public class MenuState : IState
|
||||
subState = MenuSubStates.Choosing;//субстейт и так ставится в энтере
|
||||
}
|
||||
|
||||
//если пришли из игры, то нужно начать с открытия меню
|
||||
public MenuState(bool fromGameplay) : this()
|
||||
{
|
||||
subState = MenuSubStates.OpeningMenu;//субстейт и так ставится в энтере
|
||||
}
|
||||
|
||||
public void enter()
|
||||
{
|
||||
PullRefs();
|
||||
@ -114,6 +108,8 @@ public class MenuState : IState
|
||||
gm.player2score = 0;
|
||||
gm.vsBotScore = 0;
|
||||
|
||||
VitrinaView.Instance.Deactivate();
|
||||
|
||||
gm.moveMade = false;
|
||||
}
|
||||
|
||||
|
||||
@ -30,6 +30,8 @@ public class StartRoundState : IState
|
||||
DualAvatarController.Instance.ShowCharacters();
|
||||
}
|
||||
|
||||
VitrinaView.Instance.ActivateIfNeed();
|
||||
|
||||
gm.stateMachine.ChangeState(new StartTurnState());
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@ -57,6 +57,16 @@ public static class StateRouter
|
||||
|
||||
var currentPrize = CharacterController.CurrentCharacter.prize;
|
||||
bool currentBotHasNonEmptyPrize = CharacterController.CurrentCharacter.HasPrize && currentPrize is not EmptyPrize;
|
||||
|
||||
if(currentPrize is VitrinaPrize vitrinaPrize)
|
||||
{
|
||||
int[] readyBoxes = PrizeStandController.GetReadyBoxes();
|
||||
if (VitrinaPanel.FindIntersection(readyBoxes, vitrinaPrize.Boxes).Length == 0)
|
||||
{
|
||||
currentBotHasNonEmptyPrize = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!currentBotHasNonEmptyPrize) return NextBot();
|
||||
|
||||
|
||||
|
||||
@ -8,7 +8,20 @@ using UnityEngine.UI;
|
||||
//Это как шкала че есть в витрине чего нет.
|
||||
public class VitrinaView : MonoBehaviour
|
||||
{
|
||||
public static VitrinaView instance;
|
||||
private static VitrinaView instance;
|
||||
public static VitrinaView Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = GameObject.FindObjectOfType<VitrinaView>();
|
||||
CharacterEventBus.Instance.OnCharacterAppeared.AddListener(instance.ActivateIfNeed);
|
||||
instance.Deactivate();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField] private List<Image> Cells;
|
||||
|
||||
@ -20,16 +33,21 @@ public class VitrinaView : MonoBehaviour
|
||||
[SerializeField] private Color AvailableEmptyColor;
|
||||
[SerializeField] private Color NotAvailableColor;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
instance = this;
|
||||
CharacterEventBus.Instance.OnCharacterAppeared.AddListener(ActivateIfNeed);
|
||||
Deactivate();
|
||||
|
||||
}
|
||||
//private void Start()
|
||||
//{
|
||||
// instance = this;
|
||||
// CharacterEventBus.Instance.OnCharacterAppeared.AddListener(ActivateIfNeed);
|
||||
|
||||
//}
|
||||
|
||||
public void ActivateIfNeed()
|
||||
{
|
||||
if (GameManager.instance.gameMode == GameMode.pvp)
|
||||
{
|
||||
Deactivate();
|
||||
return;
|
||||
}
|
||||
|
||||
bool hasPrize = CharacterController.CurrentCharacter.HasPrize;
|
||||
if (hasPrize && CharacterController.CurrentCharacter.prize is VitrinaPrize vitrinaPrize)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user