From 27986d3aec767a6248bf9610e585d808a4be6318 Mon Sep 17 00:00:00 2001 From: Yami An Date: Fri, 3 Nov 2023 00:21:50 +0700 Subject: [PATCH] 231103 --- Assets/Scenes/MainScene.unity | 39 ++++++++++++++--------------------- Assets/Script/ManagerCard.cs | 23 +++++++++++++++------ 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index f3a6a37..5325de6 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -375,7 +375,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -567,7 +566,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -745,7 +743,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -1003,7 +1000,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -1575,7 +1571,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -1802,7 +1797,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -2193,7 +2187,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -2385,7 +2378,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -2564,7 +2556,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -2890,7 +2881,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 @@ -3208,19 +3198,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 5ad4bb91b1709e9498cd0eb2d5bf75a6, type: 3} m_Name: m_EditorClassIdentifier: - PosTops: - - {fileID: 230371216} - - {fileID: 1212278198} - - {fileID: 1035028800} - - {fileID: 454662471} - PosBots: - - {fileID: 1324752376} - - {fileID: 1198939758} - - {fileID: 975406505} - - {fileID: 1963198422} - - {fileID: 1226310186} - - {fileID: 600562791} - - {fileID: 34188331} FaceCard: - {fileID: 21300000, guid: 134a6822c050bd04cba592c934a6f6ed, type: 3} - {fileID: 21300000, guid: a80d2f70c6c99b3409009708bf638888, type: 3} @@ -3274,11 +3251,26 @@ MonoBehaviour: - {fileID: 21300000, guid: a196b3727a318cd40a33fdffdcab4684, type: 3} - {fileID: 21300000, guid: dec6ce0b4d3e4534c966419cf09c8bd8, type: 3} - {fileID: 21300000, guid: c3c730b1616a25f4db823c33bc7481ff, type: 3} + PosTops: + - {fileID: 230371216} + - {fileID: 1212278198} + - {fileID: 1035028800} + - {fileID: 454662471} + PosBots: + - {fileID: 1324752376} + - {fileID: 1198939758} + - {fileID: 975406505} + - {fileID: 1963198422} + - {fileID: 1226310186} + - {fileID: 600562791} + - {fileID: 34188331} 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 @@ -3634,7 +3626,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: FaceUp: 0 - Top: 0 IsDeckPile: 0 Values: 0 Row: 0 diff --git a/Assets/Script/ManagerCard.cs b/Assets/Script/ManagerCard.cs index 6eed437..ac636f7 100644 --- a/Assets/Script/ManagerCard.cs +++ b/Assets/Script/ManagerCard.cs @@ -2,8 +2,10 @@ 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; public sealed class ManagerCard : MonoBehaviour { @@ -34,6 +36,9 @@ 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[] { _bot0, _bot1, _bot2, _bot3, _bot4, _bot5, _bot6 }; public void DealCard() @@ -82,8 +87,8 @@ public IEnumerator DealFromDeck() { TripsOnDisplay.Clear(); - var xPos = 6f; - var zPos = 0f; + var xSet = 6f; + var zSet = 0f; foreach (var item in DeckTrips[_deckLocation]) { @@ -91,7 +96,7 @@ public IEnumerator DealFromDeck() TripsOnDisplay.Add(item); - var newTopCard = Instantiate(CardPrefab, new Vector3(DeckButton.transform.position.x + xPos, DeckButton.transform.position.y, DeckButton.transform.position.z + zPos), identity, DeckButton.transform); + var newTopCard = Instantiate(CardPrefab, new Vector3(DeckButton.transform.position.x + xSet, DeckButton.transform.position.y, DeckButton.transform.position.z + zSet), identity, DeckButton.transform); newTopCard.name = item; @@ -99,11 +104,16 @@ public IEnumerator DealFromDeck() s.FaceUp = true; s.IsDeckPile = true; - xPos += 1f; - zPos -= 0.1f; + xSet += 1f; + zSet -= 0.1f; } _deckLocation++; + + if (_deckLocation >= _trips) + { + Find("DeckCard").GetComponent().sprite = _emptyPos; + } } else { @@ -169,7 +179,7 @@ private void SortDeckIntoTrips() { _trips = DeckCard.Count / 3; _tripsRemainder = DeckCard.Count % 3; - DeckTrips.Clear(); + //DeckTrips.Clear(); var index = 0; @@ -190,6 +200,7 @@ private void SortDeckIntoTrips() private void RestackTopDeck() { + Find("DeckCard").GetComponent().sprite = _cardSleeve; DeckCard.Clear(); DeckCard.AddRange(DisCardPile); DisCardPile.Clear();