diff --git a/Assets/Prefabs/UIDeck.prefab b/Assets/Prefabs/UIDeck.prefab index 8db2f50..e22b53c 100644 --- a/Assets/Prefabs/UIDeck.prefab +++ b/Assets/Prefabs/UIDeck.prefab @@ -1512,6 +1512,7 @@ RectTransform: - {fileID: 1973886306} - {fileID: 263713420} - {fileID: 5334463587201139456} + - {fileID: 6880760287070379452} m_Father: {fileID: 3351518597856635956} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1520,6 +1521,141 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &2283412729387017120 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1190278128854001673} + - component: {fileID: 4832866463948114768} + - component: {fileID: 5443227565047484921} + m_Layer: 0 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1190278128854001673 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2283412729387017120} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6880760287070379452} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4832866463948114768 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2283412729387017120} + m_CullTransparentMesh: 1 +--- !u!114 &5443227565047484921 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2283412729387017120} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Cannot get more cards + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 18 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} --- !u!1 &2339368777483364026 GameObject: m_ObjectHideFlags: 0 @@ -1897,10 +2033,7 @@ MonoBehaviour: - {fileID: 11400000, guid: 9eb62481994b51e4897a57499081c3db, type: 2} - {fileID: 11400000, guid: 9eb62481994b51e4897a57499081c3db, type: 2} - {fileID: 11400000, guid: 9eb62481994b51e4897a57499081c3db, type: 2} - drawList: [] drawDisplayList: [] - handList: [] - discardList: [] discardDisplayList: [] wasteList: [] randomSeed: 0 @@ -1908,6 +2041,8 @@ MonoBehaviour: cardDisplayTemplate: {fileID: 7657681008272561115} drawListContent: {fileID: 624918691686486625} discardListContent: {fileID: 3370262408006457270} + maxCardinHandLimit: 10 + maxCardRemainLimit: 5 --- !u!1 &4772833656592657312 GameObject: m_ObjectHideFlags: 0 @@ -2299,6 +2434,43 @@ MonoBehaviour: m_OnClick: m_PersistentCalls: m_Calls: [] +--- !u!1 &5654186365262363981 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6880760287070379452} + m_Layer: 0 + m_Name: LimitWarning + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6880760287070379452 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5654186365262363981} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1190278128854001673} + m_Father: {fileID: 6342785598281792429} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 198.8} + m_SizeDelta: {x: 100, y: 20} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &6593117350918236961 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/HandSimulator.unity b/Assets/Scenes/HandSimulator.unity index 237a314..fa58876 100644 --- a/Assets/Scenes/HandSimulator.unity +++ b/Assets/Scenes/HandSimulator.unity @@ -387,6 +387,54 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 1455724355} m_Modifications: + - target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1368154424702687206, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2224386513268639486, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} propertyPath: m_Pivot.x value: 0.5 @@ -471,9 +519,129 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3949232578393738854, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4683416251428496599, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} propertyPath: m_Name value: UIDeck objectReference: {fileID: 0} + - target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4951491574161479434, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6691872718163008490, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6915207597938486102, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8299245348046405515, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3} diff --git a/Assets/Scripts/Deck.cs b/Assets/Scripts/Deck.cs index ed03956..a08a7ad 100644 --- a/Assets/Scripts/Deck.cs +++ b/Assets/Scripts/Deck.cs @@ -7,14 +7,13 @@ public class Deck : MonoBehaviour { public List cardDataList; - public List drawList; - // Control Card Display + //public List drawList; public List drawDisplayList; - public List handList; + //public List handList; + //public List handDisplayList; - public List discardList; - // Control Card Display + //public List discardList; public List discardDisplayList; public List wasteList; @@ -26,14 +25,26 @@ public class Deck : MonoBehaviour public GameObject drawListContent; public GameObject discardListContent; + private int cardInHandAmount = 0; + // Card Limit + public int maxCardinHandLimit = 10; + public int maxCardRemainLimit = 5; + + private GameObject reachCardinHandLimitWarningDisplay; + private float warningDisplayCountDown; + private float warningDisplayTime = 1.0f; + // Start is called before the first frame update void Start() { + reachCardinHandLimitWarningDisplay = transform.Find("Content/LimitWarning").gameObject; + reachCardinHandLimitWarningDisplay.SetActive(false); + randomSeed = 200; Random.InitState(randomSeed); for (int i = 0; i < cardDataList.Count; i++) { - drawList.Add(cardDataList[i]); + //drawList.Add(cardDataList[i]); GameObject tempDrawDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content")); tempDrawDisplay.transform.Find("Card").gameObject.GetComponent().SetCardData(cardDataList[i]); tempDrawDisplay.transform.Find("Button").gameObject.GetComponent().sprite = cardDataList[i].artwork; @@ -50,24 +61,44 @@ public class Deck : MonoBehaviour } + private void FixedUpdate() + { + if (warningDisplayCountDown >= 0.0f) + { + warningDisplayCountDown -= Time.deltaTime; + if (warningDisplayCountDown <= 0.0f) + { + DeactivateCardInHandLimitWarning(); + } + } + } + public void DrawCards(int amount) { for (int i = 0; i < amount; i++) { - if (drawList.Count == 0) + if (cardInHandAmount > maxCardinHandLimit - 1) + { + ActivateCardInHandLimitWarning(); + return; + } + if (drawDisplayList.Count == 0) { Shuffle(); } - if(drawList.Count==0) + if (drawDisplayList.Count == 0) { return; } - int randomIndex = Random.Range(0, drawList.Count); + int randomIndex = Random.Range(0, drawDisplayList.Count); GameObject cardObj = Instantiate(handCardTemplate.gameObject, transform.Find("Content/HandList")); + var tempCardData = drawDisplayList[randomIndex].transform.Find("Card").gameObject.GetComponent().cardData; + cardObj.transform.Find("Card").gameObject.GetComponent().SetCardData(tempCardData); + cardObj.transform.Find("Button").gameObject.GetComponent().sprite = tempCardData.artwork; cardObj.SetActive(true); - cardObj.transform.Find("Card").gameObject.GetComponent().SetCardData(drawList[randomIndex]); - cardObj.transform.Find("Button").gameObject.GetComponent().sprite = drawList[randomIndex].artwork; - drawList.RemoveAt(randomIndex); + cardInHandAmount++; + //handDisplayList.Add(cardObj); + //handList.Add(drawList[randomIndex]); Destroy(drawDisplayList[randomIndex]); drawDisplayList.RemoveAt(randomIndex); } @@ -83,55 +114,65 @@ public class Deck : MonoBehaviour //} //else //{ - discardList.Add(handList[index]); + //} - handList.RemoveAt(index); } public void UseThisCard(GameObject card) { GameObject tempDiscardDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DiscardListContent/Viewport/Content")); tempDiscardDisplay.SetActive(true); - tempDiscardDisplay.transform.Find("Card").gameObject.GetComponent().SetCardData(card.transform.Find("Card").gameObject.gameObject.GetComponent().cardData); - tempDiscardDisplay.transform.Find("Button").gameObject.GetComponent().sprite = card.transform.Find("Card").gameObject.gameObject.GetComponent().cardData.artwork; + tempDiscardDisplay.transform.Find("Card").gameObject.GetComponent().SetCardData(card.transform.Find("Card").GetComponent().cardData); + tempDiscardDisplay.transform.Find("Button").gameObject.GetComponent().sprite = card.transform.Find("Card").GetComponent().cardData.artwork; discardDisplayList.Add(tempDiscardDisplay); - discardList.Add(card.transform.Find("Card").gameObject.gameObject.GetComponent().cardData); + //discardList.Add(card.transform.Find("Card").gameObject.gameObject.GetComponent().cardData); + //handDisplayList.Find(card); Destroy(card); + cardInHandAmount--; } // When unit dead public void AddACardIntoDiscardList(CardData card) { - discardList.Add(card); + } public void Shuffle() { // Put all cards in drawList into discardList - for (int i = 0; i < drawList.Count; i++) + List tempCardDataList = new List(); + for (int i = 0; i < drawDisplayList.Count; i++) { - discardList.Add(drawList[i]); + tempCardDataList.Add(drawDisplayList[i].transform.Find("Card").GetComponent().cardData); Destroy(drawDisplayList[i]); } drawDisplayList.Clear(); - drawList.Clear(); + //drawList.Clear(); - while (discardList.Count != 0) + for (int i = 0; i < tempCardDataList.Count; i++) { - int index = Random.Range(0, discardList.Count); - drawList.Add(discardList[index]); - GameObject tempCardDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content")); - tempCardDisplay.transform.Find("Card").gameObject.GetComponent().SetCardData(discardList[index]); - tempCardDisplay.transform.Find("Button").gameObject.GetComponent().sprite = discardList[index].artwork; + GameObject tempCardDisplay = Instantiate(cardDisplayTemplate.gameObject,transform.Find("DrawListContent/Viewport/Content")); + tempCardDisplay.transform.Find("Card").gameObject.GetComponent().SetCardData(tempCardDataList[i]); + tempCardDisplay.transform.Find("Button").gameObject.GetComponent().sprite = tempCardDataList[i].artwork; tempCardDisplay.SetActive(true); drawDisplayList.Add(tempCardDisplay); - discardList[index] = discardList[discardList.Count - 1]; - discardList.RemoveAt(discardList.Count - 1); - }; - for (int i = 0; i < discardDisplayList.Count; i++) - { - Destroy(discardDisplayList[i]); } + tempCardDataList.Clear(); + + while (discardDisplayList.Count != 0) + { + int index = Random.Range(0, discardDisplayList.Count); + GameObject tempCardDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content")); + CardData tempCardData = discardDisplayList[index].transform.Find("Card").GetComponent().cardData; + tempCardDisplay.transform.Find("Card").gameObject.GetComponent().SetCardData(tempCardData); + tempCardDisplay.transform.Find("Button").gameObject.GetComponent().sprite = tempCardData.artwork; + tempCardDisplay.SetActive(true); + drawDisplayList.Add(tempCardDisplay); + Destroy(discardDisplayList[index]); + discardDisplayList.RemoveAt(index); + }; + Debug.LogError(discardDisplayList.Count); + discardDisplayList.Clear(); } public void ActivateDisplayDrawList() @@ -153,4 +194,23 @@ public class Deck : MonoBehaviour { discardListContent.SetActive(false); } + + private void ActivateCardInHandLimitWarning() + { + reachCardinHandLimitWarningDisplay.SetActive(true); + warningDisplayCountDown = warningDisplayTime; + } + + private void DeactivateCardInHandLimitWarning() + { + reachCardinHandLimitWarningDisplay.SetActive(false); + } + + public void EndRound() + { + if (cardInHandAmount > maxCardRemainLimit) + { + + } + } }