Skip to content

Commit

Permalink
231105
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynab committed Nov 4, 2023
1 parent 27986d3 commit 67dad75
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Assets/Scenes/MainScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -3264,13 +3264,13 @@ MonoBehaviour:
- {fileID: 1226310186}
- {fileID: 600562791}
- {fileID: 34188331}
EmptyPos: {fileID: 21300000, guid: dad99cc115f7ec143b4dec916337800f, type: 3}
CardSleeve: {fileID: 21300000, guid: 4e91445daa38b914b8cafafc0c273166, type: 3}
CardPrefab: {fileID: 8949091621847208831, guid: e47e610d005bb014f978fe27600fb47f, type: 3}
DeckButton: {fileID: 2065622092}
TripsOnDisplay: []
DeckCard: []
DisCardPile: []
_emptyPos: {fileID: 21300000, guid: dad99cc115f7ec143b4dec916337800f, type: 3}
_cardSleeve: {fileID: 21300000, guid: 4e91445daa38b914b8cafafc0c273166, type: 3}
--- !u!4 &1618202105
Transform:
m_ObjectHideFlags: 0
Expand Down
18 changes: 10 additions & 8 deletions Assets/Script/ManagerCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Assertions;
using static System.Linq.Enumerable;
using static UnityEngine.Quaternion;
using static UnityEngine.GameObject;
using static UnityEngine.Quaternion;

public sealed class ManagerCard : MonoBehaviour
{
public Sprite[] FaceCard;
public GameObject[] PosTops;
public GameObject[] PosBots;
public Sprite EmptyPos;
public Sprite CardSleeve;
public GameObject CardPrefab;
public GameObject DeckButton;

Expand All @@ -36,9 +37,6 @@ public sealed class ManagerCard : MonoBehaviour
private int _trips;
private int _tripsRemainder;

[SerializeField] private Sprite _emptyPos;
[SerializeField] private Sprite _cardSleeve;

private void Start() => Bots = new List<string>[] { _bot0, _bot1, _bot2, _bot3, _bot4, _bot5, _bot6 };

public void DealCard()
Expand Down Expand Up @@ -112,7 +110,7 @@ public IEnumerator DealFromDeck()

if (_deckLocation >= _trips)
{
Find("DeckCard").GetComponent<SpriteRenderer>().sprite = _emptyPos;
Find("DeckCard").GetComponent<SpriteRenderer>().sprite = EmptyPos;
}
}
else
Expand Down Expand Up @@ -179,7 +177,7 @@ private void SortDeckIntoTrips()
{
_trips = DeckCard.Count / 3;
_tripsRemainder = DeckCard.Count % 3;
//DeckTrips.Clear();
DeckTrips.Clear();

var index = 0;

Expand All @@ -200,10 +198,14 @@ private void SortDeckIntoTrips()

private void RestackTopDeck()
{
Find("DeckCard").GetComponent<SpriteRenderer>().sprite = _cardSleeve;
DeckCard.Clear();
DeckCard.AddRange(DisCardPile);
DisCardPile.Clear();
SortDeckIntoTrips();

if (DeckCard.Any())
{
Find("DeckCard").GetComponent<SpriteRenderer>().sprite = CardSleeve;
}
}
}
1 change: 1 addition & 0 deletions Assets/Script/ManagerGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public void BtnNewGame()
}

FindObjectOfType<ManagerCard>().DealCard();
Find("DeckCard").GetComponent<SpriteRenderer>().sprite = FindObjectOfType<ManagerCard>().CardSleeve;
_isTime = true;
_countTime = default;
IsPlay = default;
Expand Down

0 comments on commit 67dad75

Please sign in to comment.