Compare commits
No commits in common. "f3dcde486e7068669e7bf6274e678dd393bc4efe" and "fb93ab693f0403bdf0a72aa8c0b92207c95cc9f1" have entirely different histories.
f3dcde486e
...
fb93ab693f
File diff suppressed because it is too large
Load Diff
|
@ -387,54 +387,6 @@ PrefabInstance:
|
||||||
m_Modification:
|
m_Modification:
|
||||||
m_TransformParent: {fileID: 1455724355}
|
m_TransformParent: {fileID: 1455724355}
|
||||||
m_Modifications:
|
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}
|
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
propertyPath: m_Pivot.x
|
propertyPath: m_Pivot.x
|
||||||
value: 0.5
|
value: 0.5
|
||||||
|
@ -519,137 +471,9 @@ PrefabInstance:
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
value: 0
|
value: 0
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3465344247853958630, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
|
||||||
propertyPath: m_SizeDelta.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 3465344247853958630, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
|
||||||
propertyPath: m_AnchoredPosition.x
|
|
||||||
value: 0.0002593994
|
|
||||||
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}
|
- target: {fileID: 4683416251428496599, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
propertyPath: m_Name
|
propertyPath: m_Name
|
||||||
value: UIDeck
|
value: UIDeck
|
||||||
objectReference: {fileID: 0}
|
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_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
|
||||||
|
|
|
@ -2,56 +2,46 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TMPro;
|
|
||||||
|
|
||||||
public class Deck : MonoBehaviour
|
public class Deck : MonoBehaviour
|
||||||
{
|
{
|
||||||
public List<CardData> cardDataList;
|
public List<CardData> cardDataList;
|
||||||
|
|
||||||
|
public List<CardData> drawList;
|
||||||
|
// Control Card Display
|
||||||
|
public List<GameObject> drawDisplayList;
|
||||||
|
|
||||||
|
public List<CardData> handList;
|
||||||
|
|
||||||
|
public List<CardData> discardList;
|
||||||
|
// Control Card Display
|
||||||
|
public List<GameObject> discardDisplayList;
|
||||||
|
|
||||||
|
public List<CardData> wasteList;
|
||||||
public int randomSeed;
|
public int randomSeed;
|
||||||
|
|
||||||
private GameObject cardTemplate;
|
public GameObject handCardTemplate;
|
||||||
|
public GameObject cardDisplayTemplate;
|
||||||
private GameObject handListContent;
|
|
||||||
private GameObject drawListContent;
|
|
||||||
private GameObject discardListContent;
|
|
||||||
|
|
||||||
// Card Limit
|
|
||||||
public int maxCardinHandLimit = 10;
|
|
||||||
public int maxCardRemainLimit = 5;
|
|
||||||
|
|
||||||
private GameObject reachCardinHandLimitWarningDisplay;
|
|
||||||
private float warningDisplayCountDown;
|
|
||||||
private float warningDisplayTime = 1.0f;
|
|
||||||
|
|
||||||
private GameObject discardHoldingListContent;
|
|
||||||
private TextMeshProUGUI discardWarningDisplayText;
|
|
||||||
|
|
||||||
|
public GameObject drawListContent;
|
||||||
|
public GameObject discardListContent;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
drawListContent = transform.Find("DrawList/Viewport/Content").gameObject;
|
|
||||||
drawListContent.transform.parent.parent.gameObject.SetActive(false);
|
|
||||||
discardListContent = transform.Find("DiscardList/Viewport/Content").gameObject;
|
|
||||||
discardListContent.transform.parent.parent.gameObject.SetActive(false);
|
|
||||||
handListContent = transform.Find("Content/HandList/Viewport/Content").gameObject;
|
|
||||||
|
|
||||||
cardTemplate = transform.Find("CardTemplate").gameObject;
|
|
||||||
reachCardinHandLimitWarningDisplay = transform.Find("Content/LimitWarning").gameObject;
|
|
||||||
reachCardinHandLimitWarningDisplay.SetActive(false);
|
|
||||||
discardHoldingListContent = transform.Find("Content/DiscardHoldingList/Viewport/HoldingListContent").gameObject;
|
|
||||||
discardHoldingListContent.transform.parent.parent.gameObject.SetActive(false);
|
|
||||||
discardWarningDisplayText = transform.Find("Content/DiscardHoldingList/Viewport/DiscardWarning/Text").gameObject.GetComponent<TextMeshProUGUI>();
|
|
||||||
|
|
||||||
randomSeed = 200;
|
randomSeed = 200;
|
||||||
Random.InitState(randomSeed);
|
Random.InitState(randomSeed);
|
||||||
for (int i = 0; i < cardDataList.Count; i++)
|
for (int i = 0; i < cardDataList.Count; i++)
|
||||||
{
|
{
|
||||||
GameObject tempDrawDisplay = Instantiate(cardTemplate.gameObject, transform.Find("DrawList/Viewport/Content"));
|
drawList.Add(cardDataList[i]);
|
||||||
|
GameObject tempDrawDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content"));
|
||||||
tempDrawDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(cardDataList[i]);
|
tempDrawDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(cardDataList[i]);
|
||||||
tempDrawDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = cardDataList[i].artwork;
|
tempDrawDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = cardDataList[i].artwork;
|
||||||
tempDrawDisplay.SetActive(true);
|
tempDrawDisplay.SetActive(true);
|
||||||
|
drawDisplayList.Add(tempDrawDisplay);
|
||||||
}
|
}
|
||||||
|
drawListContent.SetActive(false);
|
||||||
|
discardListContent.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
@ -60,37 +50,26 @@ public class Deck : MonoBehaviour
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FixedUpdate()
|
|
||||||
{
|
|
||||||
if (warningDisplayCountDown >= 0.0f)
|
|
||||||
{
|
|
||||||
warningDisplayCountDown -= Time.deltaTime;
|
|
||||||
if (warningDisplayCountDown <= 0.0f)
|
|
||||||
{
|
|
||||||
DeactivateCardInHandLimitWarning();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DrawCards(int amount)
|
public void DrawCards(int amount)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < amount; i++)
|
for (int i = 0; i < amount; i++)
|
||||||
{
|
{
|
||||||
if (handListContent.transform.childCount > maxCardinHandLimit - 1)
|
if (drawList.Count == 0)
|
||||||
{
|
|
||||||
ActivateCardInHandLimitWarning();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (drawListContent.transform.childCount == 0)
|
|
||||||
{
|
{
|
||||||
Shuffle();
|
Shuffle();
|
||||||
}
|
}
|
||||||
if (drawListContent.transform.childCount == 0)
|
if(drawList.Count==0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int randomIndex = Random.Range(0, drawListContent.transform.childCount);
|
int randomIndex = Random.Range(0, drawList.Count);
|
||||||
drawListContent.transform.GetChild(randomIndex).transform.SetParent(handListContent.transform);
|
GameObject cardObj = Instantiate(handCardTemplate.gameObject, transform.Find("Content/HandList"));
|
||||||
|
cardObj.SetActive(true);
|
||||||
|
cardObj.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(drawList[randomIndex]);
|
||||||
|
cardObj.transform.Find("Button").gameObject.GetComponent<Image>().sprite = drawList[randomIndex].artwork;
|
||||||
|
drawList.RemoveAt(randomIndex);
|
||||||
|
Destroy(drawDisplayList[randomIndex]);
|
||||||
|
drawDisplayList.RemoveAt(randomIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,116 +83,74 @@ public class Deck : MonoBehaviour
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
|
discardList.Add(handList[index]);
|
||||||
//}
|
//}
|
||||||
|
handList.RemoveAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UseThisCard(GameObject card)
|
public void UseThisCard(GameObject card)
|
||||||
{
|
{
|
||||||
if(card.transform.parent == handListContent.transform)
|
GameObject tempDiscardDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DiscardListContent/Viewport/Content"));
|
||||||
{
|
tempDiscardDisplay.SetActive(true);
|
||||||
if (!discardHoldingListContent.transform.parent.parent.gameObject.activeSelf)
|
tempDiscardDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(card.transform.Find("Card").gameObject.gameObject.GetComponent<CardDisplay>().cardData);
|
||||||
{
|
tempDiscardDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = card.transform.Find("Card").gameObject.gameObject.GetComponent<CardDisplay>().cardData.artwork;
|
||||||
// Use card in hand
|
discardDisplayList.Add(tempDiscardDisplay);
|
||||||
card.transform.SetParent(discardListContent.transform);
|
discardList.Add(card.transform.Find("Card").gameObject.gameObject.GetComponent<CardDisplay>().cardData);
|
||||||
}
|
Destroy(card);
|
||||||
else if (handListContent.transform.childCount > maxCardRemainLimit)
|
|
||||||
{
|
|
||||||
// Put card in discard holding list
|
|
||||||
card.transform.SetParent(discardHoldingListContent.transform);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (card.transform.parent == discardHoldingListContent.transform)
|
|
||||||
{
|
|
||||||
card.transform.SetParent(handListContent.transform);
|
|
||||||
}
|
|
||||||
else if (card.transform.parent == drawListContent.transform)
|
|
||||||
{
|
|
||||||
// card in draw list
|
|
||||||
Debug.Log("Card in Draw list");
|
|
||||||
}
|
|
||||||
else if (card.transform.parent == discardListContent.transform)
|
|
||||||
{
|
|
||||||
// card in discard list
|
|
||||||
Debug.Log("Card in Discard list");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// When unit dead
|
// When unit dead
|
||||||
public void AddACardIntoDiscardList(CardData card)
|
public void AddACardIntoDiscardList(CardData card)
|
||||||
{
|
{
|
||||||
|
discardList.Add(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Shuffle()
|
public void Shuffle()
|
||||||
{
|
{
|
||||||
while (drawListContent.transform.childCount != 0)
|
// Put all cards in drawList into discardList
|
||||||
|
for (int i = 0; i < drawList.Count; i++)
|
||||||
{
|
{
|
||||||
drawListContent.transform.GetChild(drawListContent.transform.childCount - 1).SetParent(discardListContent.transform);
|
discardList.Add(drawList[i]);
|
||||||
|
Destroy(drawDisplayList[i]);
|
||||||
}
|
}
|
||||||
|
drawDisplayList.Clear();
|
||||||
|
drawList.Clear();
|
||||||
|
|
||||||
while (discardListContent.transform.childCount != 0)
|
while (discardList.Count != 0)
|
||||||
{
|
{
|
||||||
int index = Random.Range(0, discardListContent.transform.childCount);
|
int index = Random.Range(0, discardList.Count);
|
||||||
discardListContent.transform.GetChild(index).transform.SetParent(drawListContent.transform);
|
drawList.Add(discardList[index]);
|
||||||
|
GameObject tempCardDisplay = Instantiate(cardDisplayTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content"));
|
||||||
|
tempCardDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(discardList[index]);
|
||||||
|
tempCardDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = discardList[index].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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateDisplayDrawList()
|
public void ActivateDisplayDrawList()
|
||||||
{
|
{
|
||||||
drawListContent.transform.parent.parent.gameObject.SetActive(true);
|
drawListContent.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeactivateDisplayDrawList()
|
public void DeactivateDisplayDrawList()
|
||||||
{
|
{
|
||||||
drawListContent.transform.parent.parent.gameObject.SetActive(false);
|
drawListContent.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ActivateDisplayDiscardList()
|
public void ActivateDisplayDiscardList()
|
||||||
{
|
{
|
||||||
discardListContent.transform.parent.parent.gameObject.SetActive(true);
|
discardListContent.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeactivateDisplayDiscardList()
|
public void DeactivateDisplayDiscardList()
|
||||||
{
|
{
|
||||||
discardListContent.transform.parent.parent.gameObject.SetActive(false);
|
discardListContent.SetActive(false);
|
||||||
}
|
|
||||||
|
|
||||||
private void ActivateCardInHandLimitWarning()
|
|
||||||
{
|
|
||||||
reachCardinHandLimitWarningDisplay.SetActive(true);
|
|
||||||
warningDisplayCountDown = warningDisplayTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeactivateCardInHandLimitWarning()
|
|
||||||
{
|
|
||||||
reachCardinHandLimitWarningDisplay.SetActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EndRound()
|
|
||||||
{
|
|
||||||
if (handListContent.transform.childCount > maxCardRemainLimit)
|
|
||||||
{
|
|
||||||
ActivateDiscardWarning();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ActivateDiscardWarning()
|
|
||||||
{
|
|
||||||
discardHoldingListContent.transform.parent.parent.gameObject.SetActive(true);
|
|
||||||
discardWarningDisplayText.text = string.Format("Choose {0} Card(s) to Discard", handListContent.transform.childCount - maxCardRemainLimit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DiscardHoldingListCards()
|
|
||||||
{
|
|
||||||
while (discardHoldingListContent.transform.childCount != 0)
|
|
||||||
{
|
|
||||||
discardHoldingListContent.transform.GetChild(discardHoldingListContent.transform.childCount - 1).SetParent(discardListContent.transform);
|
|
||||||
}
|
|
||||||
if (handListContent.transform.childCount <= maxCardRemainLimit)
|
|
||||||
{
|
|
||||||
discardHoldingListContent.transform.parent.parent.gameObject.SetActive(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue