Working flipping cards
This commit is contained in:
@@ -14,7 +14,37 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
m_EditorClassIdentifier: Unity.Addressables.Editor::UnityEditor.AddressableAssets.Settings.AddressableAssetGroup
|
||||||
m_GroupName: BlokkemonCards
|
m_GroupName: BlokkemonCards
|
||||||
m_GUID: 0d5d36d6da388314b92b9c6967d23f39
|
m_GUID: 0d5d36d6da388314b92b9c6967d23f39
|
||||||
m_SerializeEntries: []
|
m_SerializeEntries:
|
||||||
|
- m_GUID: 0046d7c3ed6b85245af4ce4144b60dfb
|
||||||
|
m_Address: Assets/Data/Cards/Card_New Card 1.asset
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels:
|
||||||
|
- BlokkemonCard
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 1114248d35c978848be75d204ba67c84
|
||||||
|
m_Address: Assets/Data/Cards/Card_New Card.asset
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels:
|
||||||
|
- BlokkemonCard
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: 91031de62f795884e8e2ccbaebeebf9b
|
||||||
|
m_Address: Assets/Data/Cards/Card_Marmormormor.asset
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels:
|
||||||
|
- BlokkemonCard
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: ac75dd9d27a925f4c90bbc3b255820e2
|
||||||
|
m_Address: Assets/Data/Cards/Card_Brosten.asset
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels:
|
||||||
|
- BlokkemonCard
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
|
- m_GUID: e2d5a81487e00e2489357c877fa484db
|
||||||
|
m_Address: Assets/Data/Cards/Card_New Card.asset
|
||||||
|
m_ReadOnly: 0
|
||||||
|
m_SerializedLabels:
|
||||||
|
- BlokkemonCard
|
||||||
|
FlaggedDuringContentUpdateRestriction: 0
|
||||||
m_ReadOnly: 0
|
m_ReadOnly: 0
|
||||||
m_Settings: {fileID: 11400000, guid: 11da9bb90d9dd5848b4f7629415a6937, type: 2}
|
m_Settings: {fileID: 11400000, guid: 11da9bb90d9dd5848b4f7629415a6937, type: 2}
|
||||||
m_SchemaSet:
|
m_SchemaSet:
|
||||||
|
|||||||
23
Assets/Data/Cards/Card_AnnaLise.asset
Normal file
23
Assets/Data/Cards/Card_AnnaLise.asset
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 2a80cc88c9884512b8b633110d838780, type: 3}
|
||||||
|
m_Name: Card_AnnaLise
|
||||||
|
m_EditorClassIdentifier: AppleHillsScripts::AppleHills.Data.CardSystem.CardDefinition
|
||||||
|
Id: aac7e84e-43ff-4c51-bee2-5cfd6fdc526b
|
||||||
|
Name: AnnaLise
|
||||||
|
UseCustomFileName: 0
|
||||||
|
CustomFileName:
|
||||||
|
Description: Card description
|
||||||
|
Rarity: 1
|
||||||
|
Zone: 0
|
||||||
|
CardImage: {fileID: 2133529702, guid: 99d4c3083e9c24142bc20deaeaf95720, type: 3}
|
||||||
|
CollectionIndex: 2
|
||||||
8
Assets/Data/Cards/Card_AnnaLise.asset.meta
Normal file
8
Assets/Data/Cards/Card_AnnaLise.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1114248d35c978848be75d204ba67c84
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
23
Assets/Data/Cards/Card_NewCard.asset
Normal file
23
Assets/Data/Cards/Card_NewCard.asset
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 2a80cc88c9884512b8b633110d838780, type: 3}
|
||||||
|
m_Name: Card_NewCard
|
||||||
|
m_EditorClassIdentifier: AppleHillsScripts::AppleHills.Data.CardSystem.CardDefinition
|
||||||
|
Id: 3d07b51f-5b22-44d8-bc34-688b3e6c1516
|
||||||
|
Name: New Card
|
||||||
|
UseCustomFileName: 0
|
||||||
|
CustomFileName:
|
||||||
|
Description: Card description
|
||||||
|
Rarity: 0
|
||||||
|
Zone: 0
|
||||||
|
CardImage: {fileID: 0}
|
||||||
|
CollectionIndex: 3
|
||||||
8
Assets/Data/Cards/Card_NewCard.asset.meta
Normal file
8
Assets/Data/Cards/Card_NewCard.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e2d5a81487e00e2489357c877fa484db
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
23
Assets/Data/Cards/Card_Pulver.asset
Normal file
23
Assets/Data/Cards/Card_Pulver.asset
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 2a80cc88c9884512b8b633110d838780, type: 3}
|
||||||
|
m_Name: Card_Pulver
|
||||||
|
m_EditorClassIdentifier: AppleHillsScripts::AppleHills.Data.CardSystem.CardDefinition
|
||||||
|
Id: 96ac041f-3632-41a6-89b4-de1a9c80bed4
|
||||||
|
Name: Pulver
|
||||||
|
UseCustomFileName: 0
|
||||||
|
CustomFileName:
|
||||||
|
Description: Card description
|
||||||
|
Rarity: 2
|
||||||
|
Zone: 0
|
||||||
|
CardImage: {fileID: -46950309, guid: 8af0253099943e84e960c630bafbbdb4, type: 3}
|
||||||
|
CollectionIndex: 4
|
||||||
8
Assets/Data/Cards/Card_Pulver.asset.meta
Normal file
8
Assets/Data/Cards/Card_Pulver.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0046d7c3ed6b85245af4ce4144b60dfb
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AppleHills.Data.CardSystem;
|
using AppleHills.Data.CardSystem;
|
||||||
|
using AppleHills.Editor.Utilities;
|
||||||
using UI.CardSystem;
|
using UI.CardSystem;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -17,7 +18,7 @@ namespace Editor.CardSystem
|
|||||||
// Paths
|
// Paths
|
||||||
private const string CardDefinitionsPath = "Assets/Data/Cards";
|
private const string CardDefinitionsPath = "Assets/Data/Cards";
|
||||||
private const string MenuPath = "AppleHills/Card Editor";
|
private const string MenuPath = "AppleHills/Card Editor";
|
||||||
private const string CardUIPrefabPath = "Assets/Prefabs/UI/Cards/Card.prefab";
|
private const string CardUIPrefabPath = "Assets/Prefabs/UI/CardsSystem/Cards/Card.prefab";
|
||||||
private const string CardVisualConfigPath = CardDefinitionsPath + "/CardVisualConfig.asset";
|
private const string CardVisualConfigPath = CardDefinitionsPath + "/CardVisualConfig.asset";
|
||||||
|
|
||||||
// Preview settings
|
// Preview settings
|
||||||
@@ -501,6 +502,17 @@ namespace Editor.CardSystem
|
|||||||
AssetDatabase.CreateAsset(newCard, path);
|
AssetDatabase.CreateAsset(newCard, path);
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
|
// Add to Addressables group "BlokkemonCards" and apply "BlokkemonCard" label
|
||||||
|
if (AddressablesUtility.EnsureAssetInGroupWithLabel(path, "BlokkemonCards", "BlokkemonCard"))
|
||||||
|
{
|
||||||
|
AddressablesUtility.SaveAddressableAssets();
|
||||||
|
Debug.Log($"[CardEditorWindow] Added new card to Addressables with 'BlokkemonCard' label");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning("[CardEditorWindow] Failed to add new card to Addressables. Please ensure Addressables are set up in this project.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LoadCardDefinitions();
|
LoadCardDefinitions();
|
||||||
SelectCard(newCard);
|
SelectCard(newCard);
|
||||||
@@ -524,6 +536,7 @@ namespace Editor.CardSystem
|
|||||||
string desiredFileName = _selectedCard.UseCustomFileName && !string.IsNullOrEmpty(_selectedCard.CustomFileName)
|
string desiredFileName = _selectedCard.UseCustomFileName && !string.IsNullOrEmpty(_selectedCard.CustomFileName)
|
||||||
? _selectedCard.CustomFileName
|
? _selectedCard.CustomFileName
|
||||||
: _selectedCard.Name;
|
: _selectedCard.Name;
|
||||||
|
string finalPath = oldPath;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(desiredFileName))
|
if (!string.IsNullOrEmpty(desiredFileName))
|
||||||
{
|
{
|
||||||
@@ -547,12 +560,26 @@ namespace Editor.CardSystem
|
|||||||
Debug.LogError($"[CardEditorWindow] Failed to rename asset: {error}");
|
Debug.LogError($"[CardEditorWindow] Failed to rename asset: {error}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
finalPath = uniquePath;
|
||||||
{
|
{
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Add to Addressables group "BlokkemonCards" and apply "BlokkemonCard" label
|
||||||
|
if (!string.IsNullOrEmpty(finalPath))
|
||||||
|
{
|
||||||
|
if (AddressablesUtility.EnsureAssetInGroupWithLabel(finalPath, "BlokkemonCards", "BlokkemonCard"))
|
||||||
|
{
|
||||||
|
AddressablesUtility.SaveAddressableAssets();
|
||||||
|
Debug.Log($"[CardEditorWindow] Added {_selectedCard.Name} to Addressables with 'BlokkemonCard' label");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("[CardEditorWindow] Failed to add card to Addressables. Please ensure Addressables are set up in this project.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_isDirty = false;
|
_isDirty = false;
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ Material:
|
|||||||
- _WeightNormal: 0
|
- _WeightNormal: 0
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
||||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
- _FaceColor: {r: 0.0038706942, g: 0.4528302, b: 0, a: 1}
|
||||||
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
|
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
|
||||||
m_BuildTextureStacks: []
|
m_BuildTextureStacks: []
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ RectTransform:
|
|||||||
- {fileID: 2081116343754364062}
|
- {fileID: 2081116343754364062}
|
||||||
- {fileID: 4830022034953347571}
|
- {fileID: 4830022034953347571}
|
||||||
- {fileID: 7968396929263690413}
|
- {fileID: 7968396929263690413}
|
||||||
- {fileID: 6421996619962684991}
|
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
@@ -77,10 +76,11 @@ MonoBehaviour:
|
|||||||
centerOpeningSlot: {fileID: 3371630871680769077}
|
centerOpeningSlot: {fileID: 3371630871680769077}
|
||||||
cardDisplayContainer: {fileID: 4830022034953347571}
|
cardDisplayContainer: {fileID: 4830022034953347571}
|
||||||
flippableCardPrefab: {fileID: 9060030918047515996, guid: e16716863eca4704fbfabef5a699b5aa, type: 3}
|
flippableCardPrefab: {fileID: 9060030918047515996, guid: e16716863eca4704fbfabef5a699b5aa, type: 3}
|
||||||
cardSpacing: 50
|
cardSpacing: 500
|
||||||
cardRevealDelay: 0.5
|
cardRevealDelay: 0.5
|
||||||
boosterDisappearDuration: 0.5
|
boosterDisappearDuration: 0.5
|
||||||
impulseSource: {fileID: 4448843358972162772}
|
impulseSource: {fileID: 4448843358972162772}
|
||||||
|
openingParticleSystem: {fileID: 0}
|
||||||
--- !u!114 &4448843358972162772
|
--- !u!114 &4448843358972162772
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -245,10 +245,10 @@ RectTransform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 5228380266581535650}
|
m_Father: {fileID: 5228380266581535650}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 1, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 1200, y: 1000}
|
m_SizeDelta: {x: 0, y: 100}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &5906478951385585403
|
--- !u!1 &5906478951385585403
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -874,116 +874,6 @@ RectTransform:
|
|||||||
m_CorrespondingSourceObject: {fileID: 4310919426181576387, guid: 561f7c561a416e54e9bf1c2af2f3f4ef, type: 3}
|
m_CorrespondingSourceObject: {fileID: 4310919426181576387, guid: 561f7c561a416e54e9bf1c2af2f3f4ef, type: 3}
|
||||||
m_PrefabInstance: {fileID: 3020147864556123455}
|
m_PrefabInstance: {fileID: 3020147864556123455}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
--- !u!1001 &5916465061944119399
|
|
||||||
PrefabInstance:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
serializedVersion: 2
|
|
||||||
m_Modification:
|
|
||||||
serializedVersion: 3
|
|
||||||
m_TransformParent: {fileID: 5228380266581535650}
|
|
||||||
m_Modifications:
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
|
||||||
value: 0.7071068
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
|
||||||
value: -0.7071068
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
|
||||||
value: -0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: -0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
|
||||||
value: -90
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 2325046327999825244, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_Name
|
|
||||||
value: VFX_ConfettiBurst_WIP
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: looping
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.size3D
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSize.scalar
|
|
||||||
value: 10
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSizeY.scalar
|
|
||||||
value: 10
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSizeZ.scalar
|
|
||||||
value: 10
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSpeed.scalar
|
|
||||||
value: 300
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSize.minScalar
|
|
||||||
value: 20
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSizeY.minScalar
|
|
||||||
value: 20
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSizeZ.minScalar
|
|
||||||
value: 20
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.startSpeed.minScalar
|
|
||||||
value: 200
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 4983040125055815969, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: InitialModule.gravityModifier.scalar
|
|
||||||
value: 10
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 5980722886308389101, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
propertyPath: m_SortingLayer
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_RemovedGameObjects: []
|
|
||||||
m_AddedGameObjects: []
|
|
||||||
m_AddedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
--- !u!224 &6421996619962684991 stripped
|
|
||||||
RectTransform:
|
|
||||||
m_CorrespondingSourceObject: {fileID: 793761934373733976, guid: a04075d06f231594292595e90a69cbb1, type: 3}
|
|
||||||
m_PrefabInstance: {fileID: 5916465061944119399}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
--- !u!1001 &8252956905557640428
|
--- !u!1001 &8252956905557640428
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -38,6 +38,7 @@ namespace UI.CardSystem
|
|||||||
[SerializeField] private float cardRevealDelay = 0.5f;
|
[SerializeField] private float cardRevealDelay = 0.5f;
|
||||||
[SerializeField] private float boosterDisappearDuration = 0.5f;
|
[SerializeField] private float boosterDisappearDuration = 0.5f;
|
||||||
[SerializeField] private CinemachineImpulseSource impulseSource;
|
[SerializeField] private CinemachineImpulseSource impulseSource;
|
||||||
|
[SerializeField] private ParticleSystem openingParticleSystem;
|
||||||
|
|
||||||
private int _availableBoosterCount;
|
private int _availableBoosterCount;
|
||||||
private BoosterPackDraggable _currentBoosterInCenter;
|
private BoosterPackDraggable _currentBoosterInCenter;
|
||||||
@@ -314,6 +315,7 @@ namespace UI.CardSystem
|
|||||||
// Subscribe to tap events for visual feedback
|
// Subscribe to tap events for visual feedback
|
||||||
booster.OnTapped += OnBoosterTapped;
|
booster.OnTapped += OnBoosterTapped;
|
||||||
booster.OnReadyToOpen += OnBoosterReadyToOpen;
|
booster.OnReadyToOpen += OnBoosterReadyToOpen;
|
||||||
|
booster.OnBoosterOpened += OnBoosterOpened;
|
||||||
|
|
||||||
// Try to spawn a new booster to maintain 3 visible
|
// Try to spawn a new booster to maintain 3 visible
|
||||||
// Use decrementCount=true because this booster will be consumed
|
// Use decrementCount=true because this booster will be consumed
|
||||||
@@ -363,6 +365,30 @@ namespace UI.CardSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle when booster is opened - play particle effects
|
||||||
|
/// </summary>
|
||||||
|
private void OnBoosterOpened(BoosterPackDraggable booster)
|
||||||
|
{
|
||||||
|
Debug.Log($"[BoosterOpeningPage] Booster opened, playing particle effect");
|
||||||
|
|
||||||
|
// Reset and play particle system
|
||||||
|
if (openingParticleSystem != null)
|
||||||
|
{
|
||||||
|
// Stop any existing playback
|
||||||
|
if (openingParticleSystem.isPlaying)
|
||||||
|
{
|
||||||
|
openingParticleSystem.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear existing particles
|
||||||
|
openingParticleSystem.Clear();
|
||||||
|
|
||||||
|
// Play the particle system
|
||||||
|
openingParticleSystem.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle tap-to-place: When player taps a booster in bottom slots, move it to center
|
/// Handle tap-to-place: When player taps a booster in bottom slots, move it to center
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -488,15 +514,21 @@ namespace UI.CardSystem
|
|||||||
cardRect.anchoredPosition = new Vector2(startX + (i * cardSpacing), 0);
|
cardRect.anchoredPosition = new Vector2(startX + (i * cardSpacing), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add button to handle reveal on click
|
// Get FlippableCard component and setup the card data
|
||||||
Button cardButton = cardObj.GetComponent<Button>();
|
FlippableCard flippableCard = cardObj.GetComponent<FlippableCard>();
|
||||||
if (cardButton == null)
|
if (flippableCard != null)
|
||||||
{
|
{
|
||||||
cardButton = cardObj.AddComponent<Button>();
|
// Setup the card data (stored but not revealed yet)
|
||||||
}
|
flippableCard.SetupCard(_currentCardData[i]);
|
||||||
|
|
||||||
|
// Subscribe to reveal event to track when flipped
|
||||||
int cardIndex = i; // Capture for closure
|
int cardIndex = i; // Capture for closure
|
||||||
cardButton.onClick.AddListener(() => OnCardClicked(cardIndex, cardObj));
|
flippableCard.OnCardRevealed += (card, data) => OnCardRevealed(cardIndex);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning($"[BoosterOpeningPage] FlippableCard component not found on card {i}!");
|
||||||
|
}
|
||||||
|
|
||||||
_currentRevealedCards.Add(cardObj);
|
_currentRevealedCards.Add(cardObj);
|
||||||
|
|
||||||
@@ -507,32 +539,11 @@ namespace UI.CardSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle card click to reveal
|
/// Handle card reveal (when flipped)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnCardClicked(int cardIndex, GameObject cardObj)
|
private void OnCardRevealed(int cardIndex)
|
||||||
{
|
{
|
||||||
if (cardIndex >= _currentCardData.Length) return;
|
Debug.Log($"[BoosterOpeningPage] Card {cardIndex} revealed!");
|
||||||
|
|
||||||
// Flip/reveal animation (placeholder - just show card data for now)
|
|
||||||
CardDisplay cardDisplay = cardObj.GetComponent<CardDisplay>();
|
|
||||||
if (cardDisplay != null)
|
|
||||||
{
|
|
||||||
cardDisplay.SetupCard(_currentCardData[cardIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable button so it can't be clicked again
|
|
||||||
Button cardButton = cardObj.GetComponent<Button>();
|
|
||||||
if (cardButton != null)
|
|
||||||
{
|
|
||||||
cardButton.interactable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scale punch animation
|
|
||||||
Tween.LocalScale(cardObj.transform, Vector3.one * 1.2f, 0.15f, 0f, Tween.EaseOutBack,
|
|
||||||
completeCallback: () => {
|
|
||||||
Tween.LocalScale(cardObj.transform, Vector3.one, 0.15f, 0f, Tween.EaseInBack);
|
|
||||||
});
|
|
||||||
|
|
||||||
_revealedCardCount++;
|
_revealedCardCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,6 +615,7 @@ namespace UI.CardSystem
|
|||||||
{
|
{
|
||||||
booster.OnReadyToOpen -= OnBoosterReadyToOpen;
|
booster.OnReadyToOpen -= OnBoosterReadyToOpen;
|
||||||
booster.OnTapped -= OnBoosterTapped;
|
booster.OnTapped -= OnBoosterTapped;
|
||||||
|
booster.OnBoosterOpened -= OnBoosterOpened;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -612,6 +624,7 @@ namespace UI.CardSystem
|
|||||||
{
|
{
|
||||||
_currentBoosterInCenter.OnReadyToOpen -= OnBoosterReadyToOpen;
|
_currentBoosterInCenter.OnReadyToOpen -= OnBoosterReadyToOpen;
|
||||||
_currentBoosterInCenter.OnTapped -= OnBoosterTapped;
|
_currentBoosterInCenter.OnTapped -= OnBoosterTapped;
|
||||||
|
_currentBoosterInCenter.OnBoosterOpened -= OnBoosterOpened;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace UI.CardSystem.DragDrop
|
|||||||
[SerializeField] private int maxTapsToOpen = 3;
|
[SerializeField] private int maxTapsToOpen = 3;
|
||||||
[SerializeField] private float tapPulseScale = 1.15f;
|
[SerializeField] private float tapPulseScale = 1.15f;
|
||||||
[SerializeField] private float tapPulseDuration = 0.2f;
|
[SerializeField] private float tapPulseDuration = 0.2f;
|
||||||
[SerializeField] private ParticleSystem openingParticleSystem;
|
|
||||||
|
|
||||||
// ...existing code...
|
// ...existing code...
|
||||||
public event System.Action<BoosterPackDraggable> OnBoosterOpened;
|
public event System.Action<BoosterPackDraggable> OnBoosterOpened;
|
||||||
@@ -106,12 +105,6 @@ namespace UI.CardSystem.DragDrop
|
|||||||
|
|
||||||
_isOpening = true;
|
_isOpening = true;
|
||||||
|
|
||||||
// Play particle effect
|
|
||||||
if (openingParticleSystem != null)
|
|
||||||
{
|
|
||||||
openingParticleSystem.Play();
|
|
||||||
}
|
|
||||||
|
|
||||||
OnBoosterOpened?.Invoke(this);
|
OnBoosterOpened?.Invoke(this);
|
||||||
|
|
||||||
// The actual opening logic (calling CardSystemManager) should be handled
|
// The actual opening logic (calling CardSystemManager) should be handled
|
||||||
|
|||||||
225
Assets/Scripts/UI/CardSystem/FlippableCard.cs
Normal file
225
Assets/Scripts/UI/CardSystem/FlippableCard.cs
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
using System;
|
||||||
|
using AppleHills.Data.CardSystem;
|
||||||
|
using Pixelplacement;
|
||||||
|
using Pixelplacement.TweenSystem;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace UI.CardSystem
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Flippable card wrapper that shows a card back, then flips to reveal the CardDisplay front.
|
||||||
|
/// This component nests an existing CardDisplay prefab to reuse card visuals everywhere.
|
||||||
|
/// </summary>
|
||||||
|
public class FlippableCard : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
|
||||||
|
{
|
||||||
|
[Header("Card References")]
|
||||||
|
[SerializeField] private GameObject cardBackObject; // The card back visual
|
||||||
|
[SerializeField] private GameObject cardFrontObject; // Your CardDisplay prefab instance
|
||||||
|
[SerializeField] private CardDisplay cardDisplay; // Reference to CardDisplay component
|
||||||
|
|
||||||
|
[Header("Idle Hover Animation")]
|
||||||
|
[SerializeField] private bool enableIdleHover = true;
|
||||||
|
[SerializeField] private float idleHoverHeight = 10f;
|
||||||
|
[SerializeField] private float idleHoverDuration = 1.5f;
|
||||||
|
[SerializeField] private float hoverScaleMultiplier = 1.05f;
|
||||||
|
|
||||||
|
[Header("Flip Animation")]
|
||||||
|
[SerializeField] private float flipDuration = 0.6f;
|
||||||
|
[SerializeField] private float flipScalePunch = 1.1f;
|
||||||
|
|
||||||
|
// State
|
||||||
|
private bool _isFlipped = false;
|
||||||
|
private bool _isFlipping = false;
|
||||||
|
private bool _isHovering = false;
|
||||||
|
private TweenBase _idleHoverTween;
|
||||||
|
private CardData _cardData;
|
||||||
|
private Vector2 _originalPosition; // Track original spawn position
|
||||||
|
|
||||||
|
// Events
|
||||||
|
public event Action<FlippableCard, CardData> OnCardRevealed;
|
||||||
|
|
||||||
|
public bool IsFlipped => _isFlipped;
|
||||||
|
public CardData CardData => _cardData;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
// Auto-find CardDisplay if not assigned
|
||||||
|
if (cardDisplay == null && cardFrontObject != null)
|
||||||
|
{
|
||||||
|
cardDisplay = cardFrontObject.GetComponent<CardDisplay>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start with back showing, front hidden
|
||||||
|
if (cardBackObject != null)
|
||||||
|
cardBackObject.SetActive(true);
|
||||||
|
if (cardFrontObject != null)
|
||||||
|
cardFrontObject.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
// Save the original position so we can return to it after hover
|
||||||
|
RectTransform rectTransform = GetComponent<RectTransform>();
|
||||||
|
if (rectTransform != null)
|
||||||
|
{
|
||||||
|
_originalPosition = rectTransform.anchoredPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start idle hover animation
|
||||||
|
if (enableIdleHover && !_isFlipped)
|
||||||
|
{
|
||||||
|
StartIdleHover();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Setup the card data (stores it but doesn't reveal until flipped)
|
||||||
|
/// </summary>
|
||||||
|
public void SetupCard(CardData data)
|
||||||
|
{
|
||||||
|
_cardData = data;
|
||||||
|
|
||||||
|
// Setup the CardDisplay but keep it hidden
|
||||||
|
if (cardDisplay != null)
|
||||||
|
{
|
||||||
|
cardDisplay.SetupCard(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Flip the card to reveal the front
|
||||||
|
/// </summary>
|
||||||
|
public void FlipToReveal()
|
||||||
|
{
|
||||||
|
if (_isFlipped || _isFlipping)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isFlipping = true;
|
||||||
|
|
||||||
|
// Stop idle hover
|
||||||
|
StopIdleHover();
|
||||||
|
|
||||||
|
// Flip animation: rotate Y 0 -> 90 (hide back) -> 180 (show front)
|
||||||
|
Transform cardTransform = transform;
|
||||||
|
|
||||||
|
// Phase 1: Flip to 90 degrees (edge view, hide back)
|
||||||
|
Tween.LocalRotation(cardTransform, Quaternion.Euler(0, 90, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut,
|
||||||
|
completeCallback: () =>
|
||||||
|
{
|
||||||
|
// Switch visuals at the edge
|
||||||
|
if (cardBackObject != null)
|
||||||
|
cardBackObject.SetActive(false);
|
||||||
|
if (cardFrontObject != null)
|
||||||
|
cardFrontObject.SetActive(true);
|
||||||
|
|
||||||
|
// Phase 2: Flip from 90 to 180 (show front)
|
||||||
|
Tween.LocalRotation(cardTransform, Quaternion.Euler(0, 180, 0), flipDuration * 0.5f, 0f, Tween.EaseInOut,
|
||||||
|
completeCallback: () =>
|
||||||
|
{
|
||||||
|
_isFlipped = true;
|
||||||
|
_isFlipping = false;
|
||||||
|
|
||||||
|
// Fire revealed event
|
||||||
|
OnCardRevealed?.Invoke(this, _cardData);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Scale punch during flip for extra juice
|
||||||
|
Vector3 originalScale = cardTransform.localScale;
|
||||||
|
Tween.LocalScale(cardTransform, originalScale * flipScalePunch, flipDuration * 0.5f, 0f, Tween.EaseOutBack,
|
||||||
|
completeCallback: () =>
|
||||||
|
{
|
||||||
|
Tween.LocalScale(cardTransform, originalScale, flipDuration * 0.5f, 0f, Tween.EaseInBack);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Start idle hover animation (gentle bobbing)
|
||||||
|
/// </summary>
|
||||||
|
private void StartIdleHover()
|
||||||
|
{
|
||||||
|
if (_idleHoverTween != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RectTransform rectTransform = GetComponent<RectTransform>();
|
||||||
|
if (rectTransform == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector2 originalPos = rectTransform.anchoredPosition;
|
||||||
|
Vector2 targetPos = originalPos + Vector2.up * idleHoverHeight;
|
||||||
|
|
||||||
|
_idleHoverTween = Tween.Value(0f, 1f,
|
||||||
|
(val) =>
|
||||||
|
{
|
||||||
|
if (rectTransform != null)
|
||||||
|
{
|
||||||
|
float t = Mathf.Sin(val * Mathf.PI * 2f) * 0.5f + 0.5f; // Smooth sine wave
|
||||||
|
rectTransform.anchoredPosition = Vector2.Lerp(originalPos, targetPos, t);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
idleHoverDuration, 0f, Tween.EaseInOut, Tween.LoopType.Loop);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop idle hover animation
|
||||||
|
/// </summary>
|
||||||
|
private void StopIdleHover()
|
||||||
|
{
|
||||||
|
if (_idleHoverTween != null)
|
||||||
|
{
|
||||||
|
_idleHoverTween.Stop();
|
||||||
|
_idleHoverTween = null;
|
||||||
|
|
||||||
|
// Reset to ORIGINAL position (not Vector2.zero!)
|
||||||
|
RectTransform rectTransform = GetComponent<RectTransform>();
|
||||||
|
if (rectTransform != null)
|
||||||
|
{
|
||||||
|
Tween.AnchoredPosition(rectTransform, _originalPosition, 0.3f, 0f, Tween.EaseOutBack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Pointer Event Handlers
|
||||||
|
|
||||||
|
public void OnPointerEnter(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
if (_isFlipped || _isFlipping)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isHovering = true;
|
||||||
|
|
||||||
|
// Scale up slightly on hover
|
||||||
|
Tween.LocalScale(transform, Vector3.one * hoverScaleMultiplier, 0.2f, 0f, Tween.EaseOutBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPointerExit(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
if (_isFlipped || _isFlipping)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_isHovering = false;
|
||||||
|
|
||||||
|
// Scale back to normal
|
||||||
|
Tween.LocalScale(transform, Vector3.one, 0.2f, 0f, Tween.EaseOutBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPointerClick(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
if (_isFlipped || _isFlipping)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Flip on click
|
||||||
|
FlipToReveal();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
StopIdleHover();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
3
Assets/Scripts/UI/CardSystem/FlippableCard.cs.meta
Normal file
3
Assets/Scripts/UI/CardSystem/FlippableCard.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ffa05ec4ecbd4cc485e2127683c29f09
|
||||||
|
timeCreated: 1762454507
|
||||||
Reference in New Issue
Block a user