Merge pull request 'Hand_system' (#5) from Hand_system into master

Reviewed-on: #5
master
aquostics 2022-03-17 18:20:21 -07:00
commit fb93ab693f
10 changed files with 3344 additions and 6 deletions

View File

@ -0,0 +1,52 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5470971240814093006
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 497306795194634562}
- component: {fileID: 1940333407340412725}
m_Layer: 0
m_Name: Card
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &497306795194634562
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5470971240814093006}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 664.5282, y: 189.92244, z: -3.0574389}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1940333407340412725
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5470971240814093006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eeaffccf69df3fc439ce26cfeccb72cd, type: 3}
m_Name:
m_EditorClassIdentifier:
cardData: {fileID: 0}
nameText: {fileID: 0}
costText: {fileID: 0}
attackText: {fileID: 0}
defenseText: {fileID: 0}
healthText: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1abb286fb916b7e438ee6a04c1e0e21b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -14,11 +14,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
name: ZhaoYun
description:
artwork: {fileID: 0}
artwork: {fileID: 21300000, guid: 0c5ad4d47b284844ca0fce58c9b22564, type: 3}
cost: 0
attack: 0
defense: 0
movement: 1
cardTags:
- {fileID: 11400000, guid: cf728e5d8a62fa3418d2f3daa01f93df, type: 2}
- {fileID: 11400000, guid: 53185ea05ebfbd843b009cb14101377a, type: 2}

2618
Assets/Prefabs/UIDeck.prefab Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0890cb6eff04b7c46be2a388688fe4d6
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,479 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!224 &344141829 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
m_PrefabInstance: {fileID: 4683416251218580692}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1455724351
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1455724355}
- component: {fileID: 1455724354}
- component: {fileID: 1455724353}
- component: {fileID: 1455724352}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1455724352
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1455724351}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1455724353
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1455724351}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &1455724354
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1455724351}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &1455724355
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1455724351}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 344141829}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &1695983359
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1695983362}
- component: {fileID: 1695983361}
- component: {fileID: 1695983360}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1695983360
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1695983359}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1695983361
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1695983359}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1695983362
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1695983359}
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: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2076520015
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2076520018}
- component: {fileID: 2076520017}
- component: {fileID: 2076520016}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &2076520016
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076520015}
m_Enabled: 1
--- !u!20 &2076520017
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076520015}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &2076520018
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2076520015}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &4683416251218580692
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1455724355}
m_Modifications:
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3351518597856635956, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4683416251428496599, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}
propertyPath: m_Name
value: UIDeck
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0890cb6eff04b7c46be2a388688fe4d6, type: 3}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1e2693069a456914b87e0c746e48d3c7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
@ -9,8 +9,6 @@ public class CardDisplay : MonoBehaviour
public Text nameText;
public Image artworkImage;
public Text costText;
public Text attackText;
public Text defenseText;
@ -19,6 +17,10 @@ public class CardDisplay : MonoBehaviour
// Start is called before the first frame update
void Start()
{
}
public void SetCardData(CardData data)
{
cardData = data;
}
}

156
Assets/Scripts/Deck.cs Normal file
View File

@ -0,0 +1,156 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Deck : MonoBehaviour
{
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 GameObject handCardTemplate;
public GameObject cardDisplayTemplate;
public GameObject drawListContent;
public GameObject discardListContent;
// Start is called before the first frame update
void Start()
{
randomSeed = 200;
Random.InitState(randomSeed);
for (int i = 0; i < cardDataList.Count; i++)
{
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("Button").gameObject.GetComponent<Image>().sprite = cardDataList[i].artwork;
tempDrawDisplay.SetActive(true);
drawDisplayList.Add(tempDrawDisplay);
}
drawListContent.SetActive(false);
discardListContent.SetActive(false);
}
// Update is called once per frame
void Update()
{
}
public void DrawCards(int amount)
{
for (int i = 0; i < amount; i++)
{
if (drawList.Count == 0)
{
Shuffle();
}
if(drawList.Count==0)
{
return;
}
int randomIndex = Random.Range(0, drawList.Count);
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);
}
}
public void UseACard(int index)
{
// TODO: Add card type into card data
// Chech if the card is waste card;
//if (handList[index].cardTags == wastCard)
//{
// wasteList.Add(handList[index]);
//}
//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<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;
discardDisplayList.Add(tempDiscardDisplay);
discardList.Add(card.transform.Find("Card").gameObject.gameObject.GetComponent<CardDisplay>().cardData);
Destroy(card);
}
// 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++)
{
discardList.Add(drawList[i]);
Destroy(drawDisplayList[i]);
}
drawDisplayList.Clear();
drawList.Clear();
while (discardList.Count != 0)
{
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<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()
{
drawListContent.SetActive(true);
}
public void DeactivateDisplayDrawList()
{
drawListContent.SetActive(false);
}
public void ActivateDisplayDiscardList()
{
discardListContent.SetActive(true);
}
public void DeactivateDisplayDiscardList()
{
discardListContent.SetActive(false);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e2b93d08c3a9bb4c84596f4a7ff0c8b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: