Card's different usage in different List.

pull/6/head
SherlockShiYL 2022-03-22 15:05:34 -07:00
parent deea0a218e
commit 11335ec7c1
3 changed files with 190 additions and 49 deletions

View File

@ -33,7 +33,7 @@ RectTransform:
m_Children:
- {fileID: 1332304437}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 1
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -167,7 +167,7 @@ RectTransform:
m_Children:
- {fileID: 2046541689}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 5
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -301,7 +301,7 @@ RectTransform:
m_Children:
- {fileID: 1395513335}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 0
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@ -435,7 +435,7 @@ RectTransform:
m_Children:
- {fileID: 1416698943}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 2
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
@ -938,9 +938,9 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1973886306}
- component: {fileID: 4941518367652551659}
- component: {fileID: 5533491040094273193}
m_Layer: 5
m_Name: HandListContent
m_Name: HandList
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -957,16 +957,17 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Children:
- {fileID: 4609289629788984896}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 4
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -300, y: 150}
m_Pivot: {x: 0.5, y: 0}
--- !u!114 &4941518367652551659
--- !u!114 &5533491040094273193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -975,23 +976,27 @@ MonoBehaviour:
m_GameObject: {fileID: 1973886305}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 4
m_Spacing: 0
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 1
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
m_Content: {fileID: 3465344247853958630}
m_Horizontal: 1
m_Vertical: 0
m_MovementType: 1
m_Elasticity: 0.1
m_Inertia: 1
m_DecelerationRate: 0.135
m_ScrollSensitivity: 1
m_Viewport: {fileID: 0}
m_HorizontalScrollbar: {fileID: 0}
m_VerticalScrollbar: {fileID: 0}
m_HorizontalScrollbarVisibility: 0
m_VerticalScrollbarVisibility: 0
m_HorizontalScrollbarSpacing: 0
m_VerticalScrollbarSpacing: 0
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
--- !u!1 &2046541688
GameObject:
m_ObjectHideFlags: 0
@ -1312,6 +1317,43 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &449798028753245721
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4609289629788984896}
m_Layer: 5
m_Name: Viewport
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &4609289629788984896
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 449798028753245721}
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: 3465344247853958630}
m_Father: {fileID: 1973886306}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &624918691686486625
GameObject:
m_ObjectHideFlags: 0
@ -1326,7 +1368,7 @@ GameObject:
- component: {fileID: 197290887366058445}
- component: {fileID: 282726085305090731}
m_Layer: 0
m_Name: DrawListContent
m_Name: DrawList
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1703,15 +1745,15 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 798687730}
- {fileID: 40377006}
- {fileID: 1076265206}
- {fileID: 8411292500737609253}
- {fileID: 1973886306}
- {fileID: 263713420}
- {fileID: 5334463587201139456}
- {fileID: 6880760287070379452}
- {fileID: 5782647815976031890}
- {fileID: 798687730}
- {fileID: 40377006}
- {fileID: 1076265206}
- {fileID: 8411292500737609253}
m_Father: {fileID: 3351518597856635956}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1917,7 +1959,7 @@ GameObject:
m_Component:
- component: {fileID: 8411292500737609253}
m_Layer: 0
m_Name: DiscardHoldingListContent
m_Name: DiscardHoldingList
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -1937,7 +1979,7 @@ RectTransform:
m_Children:
- {fileID: 733329886733235994}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 3
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@ -1958,7 +2000,7 @@ GameObject:
- component: {fileID: 6380889451377588091}
- component: {fileID: 6285318974774029726}
m_Layer: 0
m_Name: DiscardListContent
m_Name: DiscardList
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -2142,7 +2184,7 @@ RectTransform:
m_Children:
- {fileID: 3729732707831903442}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 8
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -2976,7 +3018,7 @@ RectTransform:
m_Children:
- {fileID: 1190278128854001673}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 7
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
@ -3016,7 +3058,7 @@ RectTransform:
m_Children:
- {fileID: 2059345702030202642}
m_Father: {fileID: 6342785598281792429}
m_RootOrder: 6
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0}
@ -3154,6 +3196,84 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 200}
m_SizeDelta: {x: 100, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &8434197004107661611
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3465344247853958630}
- component: {fileID: 2769256388689244092}
- component: {fileID: 3882490491709594971}
m_Layer: 5
m_Name: Content
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3465344247853958630
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8434197004107661611}
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: 4609289629788984896}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2769256388689244092
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8434197004107661611}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 4
m_Spacing: 0
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 1
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!114 &3882490491709594971
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8434197004107661611}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalFit: 2
m_VerticalFit: 0
--- !u!1 &8554190406370288895
GameObject:
m_ObjectHideFlags: 0

View File

@ -519,6 +519,14 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 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

View File

@ -30,24 +30,24 @@ public class Deck : MonoBehaviour
// Start is called before the first frame update
void Start()
{
drawListContent = transform.Find("DrawListContent/Viewport/Content").gameObject;
drawListContent = transform.Find("DrawList/Viewport/Content").gameObject;
drawListContent.transform.parent.parent.gameObject.SetActive(false);
discardListContent = transform.Find("DiscardListContent/Viewport/Content").gameObject;
discardListContent = transform.Find("DiscardList/Viewport/Content").gameObject;
discardListContent.transform.parent.parent.gameObject.SetActive(false);
handListContent = transform.Find("Content/HandListContent").gameObject;
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/DiscardHoldingListContent/Viewport/HoldingListContent").gameObject;
discardHoldingListContent = transform.Find("Content/DiscardHoldingList/Viewport/HoldingListContent").gameObject;
discardHoldingListContent.transform.parent.parent.gameObject.SetActive(false);
discardWarningDisplayText = transform.Find("Content/DiscardHoldingListContent/Viewport/DiscardWarning/Text").gameObject.GetComponent<TextMeshProUGUI>();
discardWarningDisplayText = transform.Find("Content/DiscardHoldingList/Viewport/DiscardWarning/Text").gameObject.GetComponent<TextMeshProUGUI>();
randomSeed = 200;
Random.InitState(randomSeed);
for (int i = 0; i < cardDataList.Count; i++)
{
GameObject tempDrawDisplay = Instantiate(cardTemplate.gameObject, transform.Find("DrawListContent/Viewport/Content"));
GameObject tempDrawDisplay = Instantiate(cardTemplate.gameObject, transform.Find("DrawList/Viewport/Content"));
tempDrawDisplay.transform.Find("Card").gameObject.GetComponent<CardDisplay>().SetCardData(cardDataList[i]);
tempDrawDisplay.transform.Find("Button").gameObject.GetComponent<Image>().sprite = cardDataList[i].artwork;
tempDrawDisplay.SetActive(true);
@ -110,20 +110,33 @@ public class Deck : MonoBehaviour
public void UseThisCard(GameObject card)
{
if (!discardHoldingListContent.transform.parent.parent.gameObject.activeSelf)
if(card.transform.parent == handListContent.transform)
{
card.transform.SetParent(discardListContent.transform);
}
else
{
if (card.transform.parent == discardHoldingListContent.transform)
if (!discardHoldingListContent.transform.parent.parent.gameObject.activeSelf)
{
card.transform.SetParent(handListContent.transform);
// Use card in hand
card.transform.SetParent(discardListContent.transform);
}
else if (handListContent.transform.childCount > maxCardRemainLimit)
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");
}
}