From c0078c7970fbd1be66ffdd073051f797fd263c91 Mon Sep 17 00:00:00 2001 From: David Finol Date: Sun, 29 Sep 2024 17:13:35 -0500 Subject: [PATCH 01/16] Card Zone fixes --- .../Scripts/Cgs/CardGameView/CardDropArea.cs | 6 +- .../Cgs/CardGameView/Multiplayer/CardModel.cs | 22 +++---- .../Cgs/CardGameView/Multiplayer/CardZone.cs | 63 ++++++++++--------- .../Multiplayer/CgsNetPlayable.cs | 2 +- .../CardGameView/Viewer/CardActionPanel.cs | 2 - Assets/Scripts/Cgs/Decks/DeckEditor.cs | 2 +- .../Cgs/Play/Multiplayer/CgsNetPlayer.cs | 7 ++- Assets/Scripts/Cgs/Play/PlayController.cs | 61 +++--------------- .../Cgs/UI/ScrollRects/CardScrollArea.cs | 2 +- docs/pages/roadmap.md | 5 +- 10 files changed, 65 insertions(+), 107 deletions(-) diff --git a/Assets/Scripts/Cgs/CardGameView/CardDropArea.cs b/Assets/Scripts/Cgs/CardGameView/CardDropArea.cs index c0cbd3b0e..ad8581ecd 100644 --- a/Assets/Scripts/Cgs/CardGameView/CardDropArea.cs +++ b/Assets/Scripts/Cgs/CardGameView/CardDropArea.cs @@ -26,7 +26,7 @@ private void OnTriggerEnter2D(Collider2D other) { var cardModel = other.GetComponent(); if (cardModel == null || cardModel.ParentCardZone == null || - cardModel.ParentCardZone.type != CardZoneType.Area) + cardModel.ParentCardZone.Type != CardZoneType.Area) return; cardModel.DropTarget = this; @@ -53,8 +53,8 @@ public void OnDrop(PointerEventData eventData) { var cardModel = CardModel.GetPointerDrag(eventData); if (cardModel == null - || cardModel.ParentCardZone != null && cardModel.ParentCardZone.type != CardZoneType.Area - || cardModel.PlaceHolderCardZone != null && cardModel.PlaceHolderCardZone.type != CardZoneType.Area) + || cardModel.ParentCardZone != null && cardModel.ParentCardZone.Type != CardZoneType.Area + || cardModel.PlaceHolderCardZone != null && cardModel.PlaceHolderCardZone.Type != CardZoneType.Area) return; var drawerViewer = DropHandler as DrawerViewer; diff --git a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs index 261a96b0c..fc1394934 100644 --- a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs +++ b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs @@ -191,7 +191,7 @@ protected override void OnStartPlayable() if (PlayController.Instance != null && PlayController.Instance.playAreaCardZone.transform == transform.parent) { - PlayController.SetPlayActions(this); + PlayController.SetPlayAreaActions(this); var cardDropArea = gameObject.GetOrAddComponent(); cardDropArea.isBlocker = true; cardDropArea.DropHandler = this; @@ -424,10 +424,10 @@ protected override void PostDragPlayable(PointerEventData eventData) var dropTargetCardModel = DropTarget.GetComponent(); var shouldDiscard = false; - if (Visibility.blocksRaycasts && ParentCardZone != null && ParentCardZone.type == CardZoneType.Area - || PlaceHolderCardZone != null && PlaceHolderCardZone.type == CardZoneType.Area + if (Visibility.blocksRaycasts && ParentCardZone != null && ParentCardZone.Type == CardZoneType.Area + || PlaceHolderCardZone != null && PlaceHolderCardZone.Type == CardZoneType.Area || dropTargetCardModel != null && dropTargetCardModel.ParentCardZone != null && - dropTargetCardModel.ParentCardZone.type == CardZoneType.Area) + dropTargetCardModel.ParentCardZone.Type == CardZoneType.Area) { var hits = new List(); EventSystem.current.RaycastAll(eventData, hits); @@ -446,7 +446,7 @@ protected override void PostDragPlayable(PointerEventData eventData) } if (dropTargetCardModel != null && dropTargetCardModel.ParentCardZone != null && - dropTargetCardModel.ParentCardZone.type == CardZoneType.Area) + dropTargetCardModel.ParentCardZone.Type == CardZoneType.Area) { PlaceHolderCardZone = dropTargetCardModel.ParentCardZone; PlaceHolderCardZone.UpdateLayout(PlaceHolder, transform.position); @@ -466,7 +466,7 @@ protected override void PostDragPlayable(PointerEventData eventData) IsMovingToPlaceHolder = true; else if (ParentCardZone == null) Discard(); - else if (ParentCardZone.type == CardZoneType.Area) + else if (ParentCardZone.Type == CardZoneType.Area) SnapToGrid(); } @@ -580,7 +580,7 @@ private void UpdateCardZonePosition(Vector2 targetPosition) if (cardZone == null || LacksOwnership) return; - if (!cardZone.DoesImmediatelyRelease && cardZone.type is CardZoneType.Vertical or CardZoneType.Horizontal) + if (!cardZone.DoesImmediatelyRelease && cardZone.Type is CardZoneType.Vertical or CardZoneType.Horizontal) cardZone.UpdateScrollRect(CurrentDragPhase, CurrentPointerEventData); else if (!IsStatic) cardZone.UpdateLayout(transform as RectTransform, targetPosition); @@ -588,7 +588,7 @@ private void UpdateCardZonePosition(Vector2 targetPosition) if (IsStatic) return; - if (cardZone.type == CardZoneType.Area) + if (cardZone.Type == CardZoneType.Area) transform.SetAsLastSibling(); var zoneCorners = new Vector3[4]; @@ -596,9 +596,9 @@ private void UpdateCardZonePosition(Vector2 targetPosition) var isOutYBounds = targetPosition.y < zoneCorners[0].y || targetPosition.y > zoneCorners[1].y; var isOutXBounds = targetPosition.x < zoneCorners[0].x || targetPosition.y > zoneCorners[2].x; if ((cardZone.DoesImmediatelyRelease && !IsProcessingSecondaryDragAction) - || (cardZone.type == CardZoneType.Vertical && isOutXBounds) - || (cardZone.type == CardZoneType.Horizontal && isOutYBounds) - || (cardZone.type == CardZoneType.Area && PlaceHolder != null && + || (cardZone.Type == CardZoneType.Vertical && isOutXBounds) + || (cardZone.Type == CardZoneType.Horizontal && isOutYBounds) + || (cardZone.Type == CardZoneType.Area && PlaceHolder != null && PlaceHolder.parent != transform.parent)) ParentToCanvas(targetPosition); } diff --git a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardZone.cs b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardZone.cs index 91cded647..b90706065 100644 --- a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardZone.cs +++ b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardZone.cs @@ -110,7 +110,20 @@ protected override void OnAwakePlayable() protected override void OnNetworkSpawnPlayable() { - if (CardZoneType.Area.Equals(Type)) + if (CardZoneType.Area.Equals(type)) + type = (CardZoneType) _typeNetworkVariable.Value; + if (Vector2.zero.Equals(_size)) + _size = _sizeNetworkVariable.Value; + if (FacePreference.Any.Equals(_facePreference)) + _facePreference = (FacePreference) _faceNetworkVariable.Value; + if (CardAction.Move.Equals(_cardAction)) + _cardAction = (CardAction) _actionNetworkVariable.Value; + } + + protected override void OnStartPlayable() + { + if (PlayController.Instance == null || + PlayController.Instance.playAreaCardZone.transform != transform.parent) return; var rectTransform = (RectTransform) transform; @@ -141,7 +154,6 @@ protected override void OnNetworkSpawnPlayable() if (layoutGroup != null) layoutGroup.spacing = -225f; - type = Type; allowsFlip = true; allowsRotation = true; scrollRectContainer = PlayController.Instance.playArea; @@ -150,27 +162,20 @@ protected override void OnNetworkSpawnPlayable() if (_faceNetworkVariable.Value != (int) _facePreference && (int) _facePreference != 0) _faceNetworkVariable.Value = (int) _facePreference; - switch (DefaultFace) - { - case FacePreference.Any: - OnAddCardActions.Add(PlayController.OnAddCardModel); - break; - case FacePreference.Down: - OnAddCardActions.Add(PlayController.OnAddCardModelFaceDown); - break; - case FacePreference.Up: - OnAddCardActions.Add(PlayController.OnAddCardModelFaceUp); - break; - default: - OnAddCardActions.Add(PlayController.OnAddCardModel); - break; - } - if (_actionNetworkVariable.Value != (int) _cardAction && (int) _cardAction != 0) _actionNetworkVariable.Value = (int) _cardAction; - var defaultAction = CardActionPanel.CardActionDictionary[DefaultAction]; - OnAddCardActions.Add((_, cardModel) => cardModel.DefaultAction = defaultAction); + OnAddCardActions.Add((cardZone, cardModel) => + { + cardModel.IsFacedown = cardZone.DefaultFace switch + { + FacePreference.Down => true, + FacePreference.Up => false, + _ => cardModel.IsFacedown + }; + cardModel.DefaultAction = CardActionPanel.CardActionDictionary[cardZone.DefaultAction]; + cardModel.SecondaryDragAction = cardModel.UpdateParentCardZoneScrollRect; + }); StartCoroutine(WaitToAddMoveCardToServer()); } @@ -185,11 +190,11 @@ private IEnumerator WaitToAddMoveCardToServer() protected override void OnPointerEnterPlayable(PointerEventData eventData) { var cardModel = CardModel.GetPointerDrag(eventData); - if (cardModel != null && (type != CardZoneType.Area || cardModel.transform.parent != transform) && + if (cardModel != null && (Type != CardZoneType.Area || cardModel.transform.parent != transform) && !cardModel.IsStatic) cardModel.PlaceHolderCardZone = this; - if (type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) + if (Type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) scrollRect.OnPointerEnter(eventData); } @@ -201,7 +206,7 @@ protected override void OnPointerExitPlayable(PointerEventData eventData) OnLayout?.Invoke(); - if (type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) + if (Type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) scrollRect.OnPointerExit(eventData); } @@ -227,7 +232,7 @@ protected override void OnDeselectPlayable(BaseEventData eventData) protected override void OnBeginDragPlayable(PointerEventData eventData) { - if (type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) + if (Type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) scrollRect.OnBeginDrag(eventData); else if (scrollRectContainer != null) scrollRectContainer.OnBeginDrag(eventData); @@ -235,7 +240,7 @@ protected override void OnBeginDragPlayable(PointerEventData eventData) protected override void OnDragPlayable(PointerEventData eventData) { - if (type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) + if (Type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) scrollRect.OnDrag(eventData); else if (scrollRectContainer != null) scrollRectContainer.OnDrag(eventData); @@ -243,7 +248,7 @@ protected override void OnDragPlayable(PointerEventData eventData) protected override void OnEndDragPlayable(PointerEventData eventData) { - if (type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) + if (Type == CardZoneType.Area && scrollRectContainer is RotateZoomableScrollRect scrollRect) scrollRect.OnEndDrag(eventData); else if (scrollRectContainer != null) scrollRectContainer.OnEndDrag(eventData); @@ -264,7 +269,7 @@ public void OnAdd(CardModel cardModel) if (cardModel == null) return; - if (type == CardZoneType.Area) + if (Type == CardZoneType.Area) cardModel.SnapToGrid(); if (cardModel.ToDiscard) @@ -288,14 +293,14 @@ public void UpdateLayout(RectTransform child, Vector2 targetPosition) if (child == null) return; - switch (type) + switch (Type) { case CardZoneType.Vertical: case CardZoneType.Horizontal: var newSiblingIndex = transform.childCount; for (var i = 0; i < transform.childCount; i++) { - if (type == CardZoneType.Vertical + if (Type == CardZoneType.Vertical ? targetPosition.y < transform.GetChild(i).position.y : targetPosition.x > transform.GetChild(i).position.x) continue; diff --git a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs index 32e2e0417..e9dfa53b7 100644 --- a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs +++ b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs @@ -406,7 +406,7 @@ protected virtual void OnEndDragPlayable(PointerEventData eventData) protected virtual void PostDragPlayable(PointerEventData eventData) { - if (ParentCardZone != null && ParentCardZone.type == CardZoneType.Area) + if (ParentCardZone != null && ParentCardZone.Type == CardZoneType.Area) SnapToGrid(); } diff --git a/Assets/Scripts/Cgs/CardGameView/Viewer/CardActionPanel.cs b/Assets/Scripts/Cgs/CardGameView/Viewer/CardActionPanel.cs index 58029ad95..decac81ff 100644 --- a/Assets/Scripts/Cgs/CardGameView/Viewer/CardActionPanel.cs +++ b/Assets/Scripts/Cgs/CardGameView/Viewer/CardActionPanel.cs @@ -16,8 +16,6 @@ namespace Cgs.CardGameView.Viewer public class CardActionPanel : MonoBehaviour { - public const float PositionOffsetAmount = 250f; - public static IReadOnlyDictionary CardActionDictionary => _cardActionDictionary ??= new Dictionary { diff --git a/Assets/Scripts/Cgs/Decks/DeckEditor.cs b/Assets/Scripts/Cgs/Decks/DeckEditor.cs index 94a982689..4499a4a34 100644 --- a/Assets/Scripts/Cgs/Decks/DeckEditor.cs +++ b/Assets/Scripts/Cgs/Decks/DeckEditor.cs @@ -211,7 +211,7 @@ private void Consolidate() private void AddCardZone() { var cardZone = Instantiate(cardZonePrefab, layoutContent).GetOrAddComponent(); - cardZone.type = CardZoneType.Vertical; + cardZone.Type = CardZoneType.Vertical; cardZone.scrollRectContainer = scrollRect; cardZone.DoesImmediatelyRelease = true; cardZone.OnLayout = Consolidate; diff --git a/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs b/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs index 1ad7dc4b0..cfeeaa194 100644 --- a/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs +++ b/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs @@ -526,7 +526,8 @@ public void MoveCardToServer(CardZone cardZone, CardModel cardModel) var isFacedown = cardModel.IsFacedown && !cardModel.Value.IsBackFaceCard; if (cardZone.IsSpawned) - SpawnCardInZoneServerRpc(cardZone.gameObject, cardModel.Id, position, rotation, isFacedown); + SpawnCardInZoneServerRpc(cardZone.gameObject, cardModel.Id, position, rotation, isFacedown, + cardZone.DefaultAction.ToString()); else SpawnCardInPlayAreaServerRpc(cardModel.Id, position, rotation, isFacedown); @@ -539,9 +540,9 @@ public void MoveCardToServer(CardZone cardZone, CardModel cardModel) [ServerRpc] // ReSharper disable once MemberCanBeMadeStatic.Local private void SpawnCardInZoneServerRpc(NetworkObjectReference container, string cardId, Vector3 position, - Quaternion rotation, bool isFacedown) + Quaternion rotation, bool isFacedown, string defaultAction) { - PlayController.Instance.CreateCardModel(container, cardId, position, rotation, isFacedown); + PlayController.Instance.CreateCardModel(container, cardId, position, rotation, isFacedown, defaultAction); } [ServerRpc] diff --git a/Assets/Scripts/Cgs/Play/PlayController.cs b/Assets/Scripts/Cgs/Play/PlayController.cs index 0173e0922..c8ccf6733 100644 --- a/Assets/Scripts/Cgs/Play/PlayController.cs +++ b/Assets/Scripts/Cgs/Play/PlayController.cs @@ -154,7 +154,7 @@ private void Start() { CardGameManager.Instance.CardCanvases.Add(GetComponent()); - playAreaCardZone.OnAddCardActions.Add(AddCardToPlay); + playAreaCardZone.OnAddCardActions.Add(AddCardToPlayArea); playDropZones.ForEach(dropZone => dropZone.DropHandler = this); if (CardGameManager.Instance.IsSearchingForServer) @@ -408,7 +408,7 @@ private IEnumerable PopSoloDeckCards(int count) return cards; } - private static void AddCardToPlay(CardZone cardZone, CardModel cardModel) + private static void AddCardToPlayArea(CardZone cardZone, CardModel cardModel) { if (cardModel.IsFacedown && cardModel.Value.IsBackFaceCard) cardModel.IsFacedown = false; @@ -416,10 +416,10 @@ private static void AddCardToPlay(CardZone cardZone, CardModel cardModel) if (CgsNetManager.Instance.IsOnline) CgsNetManager.Instance.LocalPlayer.MoveCardToServer(cardZone, cardModel); else - SetPlayActions(cardModel); + SetPlayAreaActions(cardModel); } - public static void SetPlayActions(CardModel cardModel) + public static void SetPlayAreaActions(CardModel cardModel) { cardModel.DefaultAction = CardActionPanel.CardActionDictionary[CardGameManager.Current.GameDefaultCardAction]; @@ -437,7 +437,7 @@ private void DisplayResults(string filters, List cards) } public void CreateCardModel(GameObject container, string cardId, Vector3 position, Quaternion rotation, - bool isFacedown) + bool isFacedown, string defaultAction = "") { if (container == null) container = playAreaCardZone.gameObject; @@ -450,8 +450,9 @@ public void CreateCardModel(GameObject container, string cardId, Vector3 positio cardModel.Position = position; cardModel.Rotation = rotation; cardModel.IsFacedown = isFacedown; + if (Enum.TryParse(defaultAction, out var cardAction)) + cardModel.DefaultAction = CardActionPanel.CardActionDictionary[cardAction]; - SetPlayActions(cardModel); cardModel.HideHighlightClientRpc(); } @@ -551,8 +552,6 @@ public CardZone CreateZone(string type, Vector2 position, Quaternion rotation, V cardZone.Size = size; cardZone.DefaultFace = facePreference; cardZone.DefaultAction = cardAction; - var defaultAction = CardActionPanel.CardActionDictionary[cardZone.DefaultAction]; - cardZone.OnAddCardActions.Add((_, cardModel) => cardModel.DefaultAction = defaultAction); return cardZone; } @@ -574,13 +573,7 @@ private CardZone CreateHorizontalZone(Vector2 position, Quaternion rotation) .GetOrAddComponent(); if (CgsNetManager.Instance.IsOnline) cardZone.MyNetworkObject.Spawn(); - cardZone.Type = CardZoneType.Horizontal; - cardZone.Position = position; - cardZone.Rotation = rotation; - cardZone.allowsRotation = true; - cardZone.allowsFlip = true; - return cardZone; } @@ -590,51 +583,13 @@ private CardZone CreateVerticalZone(Vector2 position, Quaternion rotation) .GetComponent(); if (CgsNetManager.Instance.IsOnline) cardZone.MyNetworkObject.Spawn(); - cardZone.Type = CardZoneType.Vertical; - cardZone.Position = position; - cardZone.Rotation = rotation; - cardZone.allowsRotation = true; - cardZone.allowsFlip = true; - return cardZone; } - public static void OnAddCardModel(CardZone cardZone, CardModel cardModel) - { - if (cardZone == null || cardModel == null) - return; - - cardModel.SecondaryDragAction = cardModel.UpdateParentCardZoneScrollRect; - cardModel.DefaultAction = - CardActionPanel.CardActionDictionary[CardGameManager.Current.GameDefaultCardAction]; - } - - public static void OnAddCardModelFaceDown(CardZone cardZone, CardModel cardModel) - { - if (cardZone == null || cardModel == null) - return; - - cardModel.SecondaryDragAction = cardModel.UpdateParentCardZoneScrollRect; - cardModel.DefaultAction = - CardActionPanel.CardActionDictionary[CardGameManager.Current.GameDefaultCardAction]; - cardModel.IsFacedown = true; - } - - public static void OnAddCardModelFaceUp(CardZone cardZone, CardModel cardModel) - { - if (cardZone == null || cardModel == null) - return; - - cardModel.SecondaryDragAction = cardModel.UpdateParentCardZoneScrollRect; - cardModel.DefaultAction = - CardActionPanel.CardActionDictionary[CardGameManager.Current.GameDefaultCardAction]; - cardModel.IsFacedown = false; - } - public void OnDrop(CardModel cardModel) { - AddCardToPlay(playAreaCardZone, cardModel); + AddCardToPlayArea(playAreaCardZone, cardModel); } [UsedImplicitly] diff --git a/Assets/Scripts/Cgs/UI/ScrollRects/CardScrollArea.cs b/Assets/Scripts/Cgs/UI/ScrollRects/CardScrollArea.cs index 41d1b82a3..c3135c918 100644 --- a/Assets/Scripts/Cgs/UI/ScrollRects/CardScrollArea.cs +++ b/Assets/Scripts/Cgs/UI/ScrollRects/CardScrollArea.cs @@ -100,7 +100,7 @@ public void OnPointerEnter(PointerEventData eventData) var playable = eventData.pointerDrag.GetComponent(); if (playable != null && - (playable.ParentCardZone == null || playable.ParentCardZone.type == CardZoneType.Area)) + (playable.ParentCardZone == null || playable.ParentCardZone.Type == CardZoneType.Area)) _isScrolling = true; } diff --git a/docs/pages/roadmap.md b/docs/pages/roadmap.md index adb9b8ef3..d8b7f0ddb 100644 --- a/docs/pages/roadmap.md +++ b/docs/pages/roadmap.md @@ -4,11 +4,10 @@ permalink: roadmap.html # Roadmap -## What's New - v1.120 -- Add Grand Archive Gabrary Spoilers +## What's New - v1.121 +- Bug-Fix: Card Zone faces ## Sprint - Priority 1 -- Bug-Fix: GA memory facedown - Bug-Fix: Merging Stacks on client - Bug-Fix: When adding a card to hand, it duplicates the card at the edge of the board - Bug-Fix: macOS Mission Control freezes From af8b41c3cc6eee1ef19b783c4c531c42feab6e38 Mon Sep 17 00:00:00 2001 From: David Finol Date: Wed, 2 Oct 2024 14:37:48 -0500 Subject: [PATCH 02/16] Update roadmap --- docs/pages/roadmap.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/pages/roadmap.md b/docs/pages/roadmap.md index d8b7f0ddb..c068eb7ef 100644 --- a/docs/pages/roadmap.md +++ b/docs/pages/roadmap.md @@ -6,17 +6,17 @@ permalink: roadmap.html ## What's New - v1.121 - Bug-Fix: Card Zone faces +- Bug-Fix: Merging Stacks on client +- Game-Play: Support for card back faces + - Select backs folder in Game Editor Menu + - Select back from dropdown in Card Creator Menu + - Search backs in Card Search/Filter Menu ## Sprint - Priority 1 -- Bug-Fix: Merging Stacks on client - Bug-Fix: When adding a card to hand, it duplicates the card at the edge of the board - Bug-Fix: macOS Mission Control freezes - Bug-Fix: Importing more than 200 cards fails - Bug-Fix: Deck Editor slows when loading too many cards -- Game-Play: Support for card back faces - - Select backs folder in Game Editor Menu - - Select back from dropdown in Card Creator Menu - - Search backs in Card Search/Filter Menu - Game-Play: gamePlayDefaultDecks and gamePlayDefaultCards - Cards: Support mix of different card sizes in the same game - Game-Play: Move card to zone, stack, or drawer (E) From 75af79fcc24e7565f4832af471746c1195ad7add Mon Sep 17 00:00:00 2001 From: David Finol Date: Fri, 4 Oct 2024 11:29:23 -0500 Subject: [PATCH 03/16] Update GA --- .../grand_archive_gabrary_spoilers.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json b/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json index 29013fee8..e6f958844 100644 --- a/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json +++ b/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json @@ -3,7 +3,7 @@ "allCardsUrl": "https://cgs.games/api/proxy/api.gatcg.com/cards/search", "allCardsUrlPageCountIdentifier": "total_pages", "allSetsUrl": "https://www.cardgamesimulator.com/games/grand_archive_gabrary_spoilers/AllSets.json", - "autoUpdate": 1, + "autoUpdate": 30, "autoUpdateUrl": "https://www.cardgamesimulator.com/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json", "bannerImageUrl": "https://www.cardgamesimulator.com/games/grand_archive/Banner.png", "cardBackImageUrl": "https://www.cardgamesimulator.com/games/grand_archive/CardBack.png", From 02d5710c57c20be1c1d84962ac7525b14be8559c Mon Sep 17 00:00:00 2001 From: David Finol Date: Sat, 5 Oct 2024 00:50:24 -0500 Subject: [PATCH 04/16] Fix Stacks on Client --- .../Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs | 10 +++++----- .../Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs | 9 +-------- docs/pages/roadmap.md | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs index febd70fe4..57890f29f 100644 --- a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs +++ b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs @@ -42,7 +42,6 @@ public static void Shuffle(this IList list) } } - [RequireComponent(typeof(CardDropArea))] public class CardStack : CgsNetPlayable, ICardDisplay, ICardDropHandler, IStackDropHandler { private const float DragHoldTime = 0.5f; @@ -190,8 +189,8 @@ protected override void OnNetworkSpawnPlayable() protected override void OnStartPlayable() { - GetComponent().DropHandler = this; - GetComponent().DropHandler = this; + gameObject.GetOrAddComponent().DropHandler = this; + gameObject.GetOrAddComponent().DropHandler = this; var rectTransform = (RectTransform) transform; var cardSize = new Vector2(CardGameManager.Current.CardSize.X, CardGameManager.Current.CardSize.Y); @@ -375,8 +374,9 @@ public void OnDrop(CardModel cardModel) public void OnDrop(CardStack cardStack) { - for (var i = _cards.Count - 1; i >= 0; i--) - cardStack.RequestInsert(0, _cards[i].Id); + var cards = Cards; + for (var i = cards.Count - 1; i >= 0; i--) + cardStack.RequestInsert(0, cards[i].Id); RequestDelete(); } diff --git a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs index e9dfa53b7..4b2796d33 100644 --- a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs +++ b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CgsNetPlayable.cs @@ -7,7 +7,6 @@ using Cgs.CardGameView.Viewer; using Cgs.Menu; using Cgs.Play; -using Cgs.Play.Multiplayer; using JetBrains.Annotations; using Unity.Netcode; using UnityEngine; @@ -572,7 +571,7 @@ public void PromptDelete() protected void RequestDelete() { - if (CgsNetManager.Instance.IsOnline) + if (IsSpawned) DeleteServerRpc(); else Destroy(gameObject); @@ -581,12 +580,6 @@ protected void RequestDelete() [ServerRpc(RequireOwnership = false)] private void DeleteServerRpc() { - if (!IsOwnedByServer) - { - Debug.LogWarning("Ignoring request to delete, since it is currently owned by a client!"); - return; - } - MyNetworkObject.Despawn(); Destroy(gameObject); } diff --git a/docs/pages/roadmap.md b/docs/pages/roadmap.md index c068eb7ef..4e78710f6 100644 --- a/docs/pages/roadmap.md +++ b/docs/pages/roadmap.md @@ -11,13 +11,13 @@ permalink: roadmap.html - Select backs folder in Game Editor Menu - Select back from dropdown in Card Creator Menu - Search backs in Card Search/Filter Menu +- Game-Play: gamePlayDefaultDecks and gamePlayDefaultCards ## Sprint - Priority 1 - Bug-Fix: When adding a card to hand, it duplicates the card at the edge of the board - Bug-Fix: macOS Mission Control freezes - Bug-Fix: Importing more than 200 cards fails - Bug-Fix: Deck Editor slows when loading too many cards -- Game-Play: gamePlayDefaultDecks and gamePlayDefaultCards - Cards: Support mix of different card sizes in the same game - Game-Play: Move card to zone, stack, or drawer (E) - Game-Play: Animation for card and stack actions From 29448b50d0a877eb66a908c3a0350f6f96c9ade1 Mon Sep 17 00:00:00 2001 From: davidmfinol <1088474+davidmfinol@users.noreply.github.com> Date: Tue, 8 Oct 2024 18:46:03 +0000 Subject: [PATCH 05/16] [create-pull-request] automated change --- .../Plugins/FinolDigital.Cgs.CardGameDef.dll | 4 +- docs/schema/CardGameDef.json | 45 ++++++++++++++++++- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Assets/Plugins/FinolDigital.Cgs.CardGameDef.dll b/Assets/Plugins/FinolDigital.Cgs.CardGameDef.dll index 258f3a7e9..e84228524 100644 --- a/Assets/Plugins/FinolDigital.Cgs.CardGameDef.dll +++ b/Assets/Plugins/FinolDigital.Cgs.CardGameDef.dll @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:06f83fb25247aba874a453da9700ce664f3019c17359f91fcc9e10dfda160c0c -size 75776 +oid sha256:b21c86f16daf56bb9aaa4f5c9aeeb0560a51940955b52f6920ec0475a816ccd7 +size 77312 diff --git a/docs/schema/CardGameDef.json b/docs/schema/CardGameDef.json index 51393927b..23924163f 100644 --- a/docs/schema/CardGameDef.json +++ b/docs/schema/CardGameDef.json @@ -285,6 +285,13 @@ } ] }, + "deckPlayCards": { + "type": "array", + "description": "deckPlayCards indicates cards that should automatically be played when a player loads a deck in Play Mode.", + "items": { + "$ref": "#/definitions/DeckPlayCard" + } + }, "deckSharePreference": { "description": "For networked games, CGS will use deckSharePreference to: ask players if they want to share the same deck, force all players to share the same deck, or force an individual deck for each player.", "default": "share", @@ -366,14 +373,21 @@ "$ref": "#/definitions/GamePlayZone" } }, + "gameStartDecks": { + "type": "array", + "description": "gameStartDecks indicates decks that should automatically be loaded when a player starts playing in Play Mode.", + "items": { + "$ref": "#/definitions/DeckUrl" + } + }, "gameStartHandCount": { "type": "integer", - "description": "gameStartHandCount indicates how many cards are automatically dealt from the deck to the hand, when a user loads a deck in Play Mode.", + "description": "gameStartHandCount indicates how many cards are automatically dealt from a loaded deck to a player's hand.", "format": "int32" }, "gameStartPointsCount": { "type": "integer", - "description": "gameStartPointsCount indicates how many points are assigned to each player, when that player loads a deck in Play Mode.", + "description": "gameStartPointsCount indicates how many points are automatically assigned to each player.", "format": "int32" }, "playMatImageFileType": { @@ -593,6 +607,33 @@ "ydk" ] }, + "DeckPlayCard": { + "type": "object", + "additionalProperties": false, + "properties": { + "cardQuery": { + "type": "string", + "description": "CGS will automatically play the Card that matches cardQuery, when the player loads a Deck in Play Mode matching deckQuery" + }, + "deckQuery": { + "type": "string", + "description": "CGS will automatically play the Card that matches cardQuery, when the player loads a Deck in Play Mode matching deckQuery" + }, + "position": { + "description": "Indicates the played Card's position in inches", + "oneOf": [ + { + "$ref": "#/definitions/Float2" + } + ] + }, + "rotation": { + "type": "integer", + "description": "Indicates the played Card's rotation in degrees", + "format": "int32" + } + } + }, "SharePreference": { "type": "string", "description": "", From d1e4379ede5045d4d922bedc64a634f620198dd3 Mon Sep 17 00:00:00 2001 From: David Finol Date: Tue, 8 Oct 2024 13:51:44 -0500 Subject: [PATCH 06/16] Update roadmap --- docs/pages/roadmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/roadmap.md b/docs/pages/roadmap.md index 4e78710f6..c1cc3b84a 100644 --- a/docs/pages/roadmap.md +++ b/docs/pages/roadmap.md @@ -7,11 +7,11 @@ permalink: roadmap.html ## What's New - v1.121 - Bug-Fix: Card Zone faces - Bug-Fix: Merging Stacks on client +- Game-Play: deckPlayCards and gameStartDecks - Game-Play: Support for card back faces - Select backs folder in Game Editor Menu - Select back from dropdown in Card Creator Menu - Search backs in Card Search/Filter Menu -- Game-Play: gamePlayDefaultDecks and gamePlayDefaultCards ## Sprint - Priority 1 - Bug-Fix: When adding a card to hand, it duplicates the card at the edge of the board From cede5bf3c8a01591fbcade9fe7fa31865d2a747e Mon Sep 17 00:00:00 2001 From: David Finol Date: Tue, 8 Oct 2024 14:48:31 -0500 Subject: [PATCH 07/16] Add deckPlayCards and gameStartDecks --- Assets/Scripts/Cgs/AotTypeEnforcer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/Cgs/AotTypeEnforcer.cs b/Assets/Scripts/Cgs/AotTypeEnforcer.cs index 559af5345..f6c20bf74 100644 --- a/Assets/Scripts/Cgs/AotTypeEnforcer.cs +++ b/Assets/Scripts/Cgs/AotTypeEnforcer.cs @@ -80,13 +80,15 @@ public void Awake() cardGame.DeckFileAltId = string.Empty; cardGame.DeckFileTxtId = DeckFileTxtId.Id; cardGame.DeckFileType = DeckFileType.Dec; + var float2 = new Float2(0f, 0f); + var deckPlayCard = new DeckPlayCard(string.Empty, string.Empty, float2, 0); + cardGame.DeckPlayCards = new List() {deckPlayCard}; var deckUrl = new DeckUrl(string.Empty, string.Empty, new Uri(UnityFileMethods.FilePrefix)); cardGame.DeckUrls = new List {deckUrl}; var enumDef = new EnumDef(string.Empty, new Dictionary()); cardGame.Enums = new List {enumDef}; var extraDef = new ExtraDef(string.Empty, string.Empty, string.Empty); cardGame.Extras = new List {extraDef}; - var float2 = new Float2(0f, 0f); var gameBoard = new GameBoard(string.Empty, float2, float2); var gameBoardCard = new GameBoardCard(string.Empty, new List {gameBoard}); cardGame.GameBoardCards = new List {gameBoardCard}; @@ -103,6 +105,7 @@ public void Awake() var gamePlayZone3 = new GamePlayZone(FacePreference.Down, CardAction.Rotate, float2, 0, float2, GamePlayZoneType.Area); cardGame.GamePlayZones = new List {gamePlayZone, gamePlayZone2, gamePlayZone3}; + cardGame.GameStartDecks = new List() {deckUrl}; cardGame.GameStartHandCount = 1; cardGame.GameStartPointsCount = 1; cardGame.Name = string.Empty; From 5f3ba4bb5ccd07c3c31fa5ed45d7955bd85e3bab Mon Sep 17 00:00:00 2001 From: David Finol Date: Tue, 8 Oct 2024 14:49:29 -0500 Subject: [PATCH 08/16] Update firebase --- firebase/firebase.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firebase/firebase.json b/firebase/firebase.json index 746c4171e..c7fa680bc 100644 --- a/firebase/firebase.json +++ b/firebase/firebase.json @@ -5,7 +5,7 @@ "redirects": [ { "source": "/gatcg", - "destination": "https://cgs.games/link/grand_archive_gabrary_spoilers", + "destination": "https://cgs.games/link/grand_archive", "type": 301 } ], From c44a2f225f18684cf42920d2886f1740f93fe5af Mon Sep 17 00:00:00 2001 From: David Finol Date: Thu, 10 Oct 2024 18:55:49 -0500 Subject: [PATCH 09/16] Add gameStartDecks --- .../Viewer/Card Action Panel.prefab | 14 ++- .../Cgs/CardGameView/Multiplayer/CardModel.cs | 2 +- .../Cgs/Play/Multiplayer/CgsNetPlayer.cs | 1 - Assets/Scripts/Cgs/Play/PlayController.cs | 87 ++++++++++++++++++- .../Scripts/Cgs/Play/PlayController.cs.meta | 3 +- .../Dominoes.json | 6 ++ .../Mahjong.json | 6 ++ .../Standard Playing Cards.json | 6 ++ docs/games/Dominoes/Dominoes.json | 6 ++ docs/games/Mahjong/Mahjong.json | 6 ++ docs/games/Standard/Standard.json | 6 ++ 11 files changed, 128 insertions(+), 15 deletions(-) diff --git a/Assets/Prefabs/CardGameView/Viewer/Card Action Panel.prefab b/Assets/Prefabs/CardGameView/Viewer/Card Action Panel.prefab index 4db23c17e..47b685730 100644 --- a/Assets/Prefabs/CardGameView/Viewer/Card Action Panel.prefab +++ b/Assets/Prefabs/CardGameView/Viewer/Card Action Panel.prefab @@ -300,7 +300,7 @@ PrefabInstance: - target: {fileID: 8387297474274779720, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} propertyPath: tooltip - value: Tap + value: Toggle rotation objectReference: {fileID: 0} - target: {fileID: 8688795498816596447, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} @@ -735,7 +735,7 @@ PrefabInstance: - target: {fileID: 8387297474274779720, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} propertyPath: tooltip - value: Flip + value: Flip face objectReference: {fileID: 0} - target: {fileID: 8688795498816596447, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} @@ -952,7 +952,7 @@ PrefabInstance: - target: {fileID: 8387297474274779720, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} propertyPath: tooltip - value: Rotate + value: Rotate clockwise objectReference: {fileID: 0} - target: {fileID: 8688795498816596447, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} @@ -1051,7 +1051,7 @@ PrefabInstance: - target: {fileID: 633149931556260070, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} propertyPath: m_Name - value: Discard Button + value: Delete Button objectReference: {fileID: 0} - target: {fileID: 633149931556260071, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} @@ -1177,14 +1177,12 @@ PrefabInstance: - target: {fileID: 8387297474274779720, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} propertyPath: tooltip - value: Discard + value: Destroy permanently objectReference: {fileID: 0} - target: {fileID: 8688795498816596447, guid: 050b35c711bf97548b7054e54e7b44b4, type: 3} propertyPath: m_Text - value: 'Discard - -' + value: Delete objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] diff --git a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs index fc1394934..e5b77e4bb 100644 --- a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs +++ b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardModel.cs @@ -22,7 +22,7 @@ namespace Cgs.CardGameView.Multiplayer public class CardModel : CgsNetPlayable, ICardDisplay, ICardDropHandler, IStackDropHandler { public const string DropErrorMessage = "Error: Card dropped on Card outside of play area!"; - public string DiscardPrompt => $"Discard {gameObject.name}?"; + public string DiscardPrompt => $"Delete cannot be undone. Delete {gameObject.name}?"; private const float ZoomHoldTime = 1.5f; private const float MovementSpeed = 600f; diff --git a/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs b/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs index cfeeaa194..cadea13b4 100644 --- a/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs +++ b/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs @@ -126,7 +126,6 @@ public override void OnNetworkSpawn() RequestNameUpdate(PlayerPrefs.GetString(Scoreboard.PlayerNamePlayerPrefs, Scoreboard.DefaultPlayerName)); RequestNewHand(CardDrawer.DefaultHandName); - PlayController.Instance.ShowDeckMenu(); ApplyPlayerTranslationServerRpc(); } else diff --git a/Assets/Scripts/Cgs/Play/PlayController.cs b/Assets/Scripts/Cgs/Play/PlayController.cs index c8ccf6733..e9364b503 100644 --- a/Assets/Scripts/Cgs/Play/PlayController.cs +++ b/Assets/Scripts/Cgs/Play/PlayController.cs @@ -3,7 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ using System; +using System.Collections; using System.Collections.Generic; +using System.IO; using System.Linq; using Cgs.CardGameView; using Cgs.CardGameView.Multiplayer; @@ -36,6 +38,20 @@ public class PlayController : MonoBehaviour, ICardDropHandler private const float PlayAreaBuffer = 8; private const float DeckPositionBuffer = 50; + public static string LoadStartDecksAsk + { + get + { + var text = "Load "; + var deckUrls = CardGameManager.Current.GameStartDecks; + text += $"'{deckUrls[0].Name}'"; + for (var i = 1; i < deckUrls.Count; i++) + text += $", '{deckUrls[i].Name}'"; + text += "?"; + return text; + } + } + public static PlayController Instance { get; private set; } public GameObject cardViewerPrefab; @@ -165,7 +181,7 @@ private void Start() #if !UNITY_WEBGL Lobby.Host(); #endif - DeckLoader.Show(LoadDeck); + StartDecks(); } } @@ -190,8 +206,7 @@ private void Restart() { ResetPlayArea(); drawer.Clear(); - _soloDeckStack = null; - DeckLoader.Show(LoadDeck); + StartDecks(); } } @@ -233,6 +248,62 @@ public void ResetPlayArea() scoreboard.ChangePoints(CardGameManager.Current.GameStartPointsCount.ToString()); } + private void StartDecks() + { + if (CardGameManager.Current.GameStartDecks.Count > 0) + CardGameManager.Instance.Messenger.Ask(LoadStartDecksAsk, ShowDeckMenu, StartLoadStartDecks); + else + ShowDeckMenu(); + } + + private void StartLoadStartDecks() + { + StartCoroutine(LoadStartDecks()); + } + + private IEnumerator LoadStartDecks() + { + foreach (var deckUrl in CardGameManager.Current.GameStartDecks) + { + if (string.IsNullOrEmpty(deckUrl.Name) || !deckUrl.IsAvailable) + { + Debug.Log($"Ignoring deckUrl {deckUrl}"); + continue; + } + + var deckFilePath = Path.Combine(CardGameManager.Current.DecksDirectoryPath, + deckUrl.Name + "." + CardGameManager.Current.DeckFileType.ToString().ToLower()); + + if (!File.Exists(deckFilePath)) + { + if (!string.IsNullOrEmpty(CardGameManager.Current.AllDecksUrlTxtRoot) && + !string.IsNullOrEmpty(deckUrl.Txt)) + yield return UnityFileMethods.SaveUrlToFile( + CardGameManager.Current.AllDecksUrlTxtRoot + deckUrl.Txt, deckFilePath); + else if (deckUrl.Url.IsAbsoluteUri) + yield return UnityFileMethods.SaveUrlToFile(deckUrl.Url.AbsoluteUri, deckFilePath); + else + { + Debug.Log($"Empty url for deckUrl {deckUrl}"); + continue; + } + } + + try + { + var deckText = File.ReadAllText(deckFilePath); + var newDeck = UnityDeck.Parse(CardGameManager.Current, deckUrl.Name, + CardGameManager.Current.DeckFileType, deckText); + LoadDeck(newDeck); + } + catch (Exception e) + { + Debug.LogError(DeckLoadMenu.DeckLoadErrorMessage + e); + CardGameManager.Instance.Messenger.Show(DeckLoadMenu.DeckLoadErrorMessage + e.Message); + } + } + } + public void ShowPlaySettingsMenu() { Settings.Show(); @@ -312,7 +383,15 @@ private void LoadDeck(UnityDeck deck) } } - PromptForHand(); + if (CardGameManager.Current.DeckPlayCards.Count > 0) + DeckPlayCards(); + else + PromptForHand(); + } + + private void DeckPlayCards() + { + // TODO } private void CreateGameBoards(IEnumerable gameBoards) diff --git a/Assets/Scripts/Cgs/Play/PlayController.cs.meta b/Assets/Scripts/Cgs/Play/PlayController.cs.meta index d5ae410b3..096b7a9bd 100644 --- a/Assets/Scripts/Cgs/Play/PlayController.cs.meta +++ b/Assets/Scripts/Cgs/Play/PlayController.cs.meta @@ -32,7 +32,8 @@ MonoImporter: type: 3} - verticalCardZonePrefab: {fileID: 1907640108394560, guid: a98e6f63635e6f046938f07c822f0370, type: 3} - - playMatPrefab: {instanceID: 0} + - playMatPrefab: {fileID: 1562332272364026163, guid: 3d79cafa6de4bec4bb2067fc2c04bf5f, + type: 3} - stackViewers: {instanceID: 0} - playArea: {instanceID: 0} - playAreaCardZone: {instanceID: 0} diff --git a/Assets/StreamingAssets/Dominoes@www.cardgamesimulator.com/Dominoes.json b/Assets/StreamingAssets/Dominoes@www.cardgamesimulator.com/Dominoes.json index 0a2fc127e..feb36fa50 100644 --- a/Assets/StreamingAssets/Dominoes@www.cardgamesimulator.com/Dominoes.json +++ b/Assets/StreamingAssets/Dominoes@www.cardgamesimulator.com/Dominoes.json @@ -64,6 +64,12 @@ ], "gameDefaultCardAction": "rotate", "gamePlayDeckName": "Stock", + "gameStartDecks": [ + { + "name": "Double Six Dominoes", + "url": "https://www.cardgamesimulator.com/games/Dominoes/decks/Double%20Six%20Dominoes.txt" + } + ], "gameStartHandCount": 7, "name": "Dominoes", "rulesUrl": "http://www.dominorules.com/introduction" diff --git a/Assets/StreamingAssets/Mahjong@www.cardgamesimulator.com/Mahjong.json b/Assets/StreamingAssets/Mahjong@www.cardgamesimulator.com/Mahjong.json index d6839953e..07a77d03d 100644 --- a/Assets/StreamingAssets/Mahjong@www.cardgamesimulator.com/Mahjong.json +++ b/Assets/StreamingAssets/Mahjong@www.cardgamesimulator.com/Mahjong.json @@ -53,6 +53,12 @@ } ], "gamePlayDeckName": "Square Wall", + "gameStartDecks": [ + { + "name": "Traditional Mahjong Deck", + "url": "https://www.cardgamesimulator.com/games/Mahjong/decks/Traditional%20Mahjong%20Deck.txt" + } + ], "gameStartHandCount": 13, "name": "Mahjong", "rulesUrl": "http://mahjong.wikidot.com/basic-rules" diff --git a/Assets/StreamingAssets/Standard Playing Cards@www.cardgamesimulator.com/Standard Playing Cards.json b/Assets/StreamingAssets/Standard Playing Cards@www.cardgamesimulator.com/Standard Playing Cards.json index 6469665cb..ea5c8b9b7 100644 --- a/Assets/StreamingAssets/Standard Playing Cards@www.cardgamesimulator.com/Standard Playing Cards.json +++ b/Assets/StreamingAssets/Standard Playing Cards@www.cardgamesimulator.com/Standard Playing Cards.json @@ -85,6 +85,12 @@ } ], "gamePlayDeckName": "Deck", + "gameStartDecks": [ + { + "name": "Standard 52-card Deck", + "url": "https://www.cardgamesimulator.com/games/Standard/decks/Standard%2052-card%20Deck.txt" + } + ], "gameStartHandCount": 2, "name": "Standard Playing Cards", "rulesUrl": "https://www.bicyclecards.com/rules/" diff --git a/docs/games/Dominoes/Dominoes.json b/docs/games/Dominoes/Dominoes.json index 0a2fc127e..feb36fa50 100644 --- a/docs/games/Dominoes/Dominoes.json +++ b/docs/games/Dominoes/Dominoes.json @@ -64,6 +64,12 @@ ], "gameDefaultCardAction": "rotate", "gamePlayDeckName": "Stock", + "gameStartDecks": [ + { + "name": "Double Six Dominoes", + "url": "https://www.cardgamesimulator.com/games/Dominoes/decks/Double%20Six%20Dominoes.txt" + } + ], "gameStartHandCount": 7, "name": "Dominoes", "rulesUrl": "http://www.dominorules.com/introduction" diff --git a/docs/games/Mahjong/Mahjong.json b/docs/games/Mahjong/Mahjong.json index d6839953e..07a77d03d 100644 --- a/docs/games/Mahjong/Mahjong.json +++ b/docs/games/Mahjong/Mahjong.json @@ -53,6 +53,12 @@ } ], "gamePlayDeckName": "Square Wall", + "gameStartDecks": [ + { + "name": "Traditional Mahjong Deck", + "url": "https://www.cardgamesimulator.com/games/Mahjong/decks/Traditional%20Mahjong%20Deck.txt" + } + ], "gameStartHandCount": 13, "name": "Mahjong", "rulesUrl": "http://mahjong.wikidot.com/basic-rules" diff --git a/docs/games/Standard/Standard.json b/docs/games/Standard/Standard.json index 6469665cb..ea5c8b9b7 100644 --- a/docs/games/Standard/Standard.json +++ b/docs/games/Standard/Standard.json @@ -85,6 +85,12 @@ } ], "gamePlayDeckName": "Deck", + "gameStartDecks": [ + { + "name": "Standard 52-card Deck", + "url": "https://www.cardgamesimulator.com/games/Standard/decks/Standard%2052-card%20Deck.txt" + } + ], "gameStartHandCount": 2, "name": "Standard Playing Cards", "rulesUrl": "https://www.bicyclecards.com/rules/" From 2b4fca15bf8ecaa4c5ffc03606a337f1d0e1f5b2 Mon Sep 17 00:00:00 2001 From: David Finol Date: Sat, 19 Oct 2024 14:53:10 -0500 Subject: [PATCH 10/16] Add deckPlayCards --- .../Cgs/CardGameView/Multiplayer/CardStack.cs | 16 ++- .../Cgs/CardGameView/Viewer/StackViewer.cs | 9 +- .../Cgs/Play/Multiplayer/CgsNetPlayer.cs | 58 +++++++- Assets/Scripts/Cgs/Play/PlayController.cs | 132 +++++++++++++++--- docs/games/grand_archive/grand_archive.json | 20 +++ .../grand_archive_gabrary_spoilers.json | 20 +++ 6 files changed, 221 insertions(+), 34 deletions(-) diff --git a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs index 57890f29f..d731ea440 100644 --- a/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs +++ b/Assets/Scripts/Cgs/CardGameView/Multiplayer/CardStack.cs @@ -303,7 +303,7 @@ private void DragCard(PointerEventData eventData) if (CgsNetManager.Instance.IsOnline && cards.Count > 1) CgsNetManager.Instance.LocalPlayer.RequestRemoveAt(gameObject, cards.Count - 1); else if (!CgsNetManager.Instance.IsOnline) - PopCard(); + OwnerPopCard(); if (PlaySettings.AutoStackCards && cards.Count == 1) RequestDelete(); @@ -398,7 +398,15 @@ public void OwnerInsert(int index, string cardId) SyncView(); } - public string RemoveAt(int index) + public void RequestRemoveAt(int index) + { + if (LacksOwnership) + CgsNetManager.Instance.LocalPlayer.RequestRemoveAt(gameObject, index); + else + OwnerRemoveAt(index); + } + + public string OwnerRemoveAt(int index) { if (index < 0 || index >= Cards.Count) return UnityCard.Blank.Id; @@ -411,9 +419,9 @@ public string RemoveAt(int index) return cardId; } - public string PopCard() + public string OwnerPopCard() { - return RemoveAt(Cards.Count - 1); + return OwnerRemoveAt(Cards.Count - 1); } [ServerRpc(RequireOwnership = false)] diff --git a/Assets/Scripts/Cgs/CardGameView/Viewer/StackViewer.cs b/Assets/Scripts/Cgs/CardGameView/Viewer/StackViewer.cs index 100d52466..c5652a092 100644 --- a/Assets/Scripts/Cgs/CardGameView/Viewer/StackViewer.cs +++ b/Assets/Scripts/Cgs/CardGameView/Viewer/StackViewer.cs @@ -170,13 +170,8 @@ private void OnRemoveCardModel(CardZone cardZone, CardModel cardModel) CgsNetManager.Instance.LocalPlayer.RequestSyncHand((int) _handIndex, cardModels.Select(card => (CgsNetString) card.Id).ToArray()); - if (_cardStack == null) - return; - - if (CgsNetManager.Instance.IsOnline) - CgsNetManager.Instance.LocalPlayer.RequestRemoveAt(_cardStack.gameObject, cardModel.Index); - else - _cardStack.RemoveAt(cardModel.Index); + if (_cardStack != null) + _cardStack.RequestRemoveAt(cardModel.Index); } [UsedImplicitly] diff --git a/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs b/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs index cadea13b4..16b84a629 100644 --- a/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs +++ b/Assets/Scripts/Cgs/Play/Multiplayer/CgsNetPlayer.cs @@ -60,6 +60,19 @@ public bool IsDeckShared private NetworkVariable _isDeckShared; + private IReadOnlyList CardStacks + { + get + { + var cardStacks = new List(); + foreach (var cardStack in _cardStacks) + cardStacks.Add(((NetworkObject) cardStack).GetComponent()); + return cardStacks; + } + } + + private NetworkList _cardStacks; + public int CurrentHand { get => _currentHand.Value; @@ -107,6 +120,7 @@ private void Awake() _points = new NetworkVariable(); _currentDeck = new NetworkVariable(); _isDeckShared = new NetworkVariable(); + _cardStacks = new NetworkList(); _currentHand = new NetworkVariable(); _handCards = new NetworkList(); _handNames = new NetworkList(); @@ -317,6 +331,7 @@ private void CreateCardStackServerRpc(string stackName, CgsNetString[] cardIds, cardIds.Select(cardId => CardGameManager.Current.Cards[cardId]).ToList(), position, rotation, isFaceup); if (isDeck) CurrentDeck = cardStack.GetComponent(); + _cardStacks.Add(cardStack.gameObject); Debug.Log($"[CgsNet Player] Created new card stack {stackName}!"); } @@ -332,16 +347,47 @@ private void ShareDeckServerRpc() Debug.Log("[CgsNet Player] Sending shared deck..."); CurrentDeck = CgsNetManager.Instance.LocalPlayer.CurrentDeck; IsDeckShared = true; - ShareDeckOwnerClientRpc(OwnerClientRpcParams); + _cardStacks.Add(CurrentDeck); + ShareDeckOwnerClientRpc(NetworkManager.Singleton.ConnectedClients.Count, OwnerClientRpcParams); + } + + [ClientRpc] + // ReSharper disable once UnusedParameter.Local + // ReSharper disable once MemberCanBeMadeStatic.Local + private void ShareDeckOwnerClientRpc(int playerCount, ClientRpcParams clientRpcParams = default) + { + Debug.Log($"[CgsNet Player] Received share deck callback for {playerCount}!"); + PlayController.Instance.DecksCallback(CardStacks, playerCount); + } + + public void RequestDecks(int deckCount) + { + Debug.Log($"[CgsNet Player] Requesting decks {deckCount}..."); + StartDecksServerRpc(deckCount); + } + + [ServerRpc] + // ReSharper disable once MemberCanBeMadeStatic.Local + private void StartDecksServerRpc(int deckCount) + { + Debug.Log($"[CgsNet Player] Waiting for decks {deckCount}..."); + StartCoroutine(WaitForDecks(deckCount)); + } + + private IEnumerator WaitForDecks(int deckCount) + { + while (CardStacks.Count < deckCount) + yield return null; + DecksCallbackOwnerClientRpc(NetworkManager.Singleton.ConnectedClients.Count, OwnerClientRpcParams); } [ClientRpc] // ReSharper disable once UnusedParameter.Local // ReSharper disable once MemberCanBeMadeStatic.Local - private void ShareDeckOwnerClientRpc(ClientRpcParams clientRpcParams = default) + private void DecksCallbackOwnerClientRpc(int playerCount, ClientRpcParams clientRpcParams = default) { - Debug.Log("[CgsNet Player] Received shared deck!"); - PlayController.Instance.PromptForHand(); + Debug.Log($"[CgsNet Player] Received decks callback for {playerCount}!"); + PlayController.Instance.DecksCallback(CardStacks, playerCount); } public void RequestShuffle(GameObject toShuffle) @@ -386,7 +432,7 @@ private void RemoveAtServerRpc(NetworkObjectReference stack, int index) { Debug.Log($"[CgsNet Player] Remove at {index}!"); var cardStack = ((NetworkObject) stack).GetComponent(); - cardStack.RemoveAt(index); + cardStack.OwnerRemoveAt(index); } public void RequestDeal(NetworkObject stack, int count) @@ -403,7 +449,7 @@ private void DealServerRpc(NetworkObjectReference stack, int count) var cardStack = ((NetworkObject) stack).GetComponent(); var cardIds = new CgsNetString[count]; for (var i = 0; i < count && cardStack.Cards.Count > 0; i++) - cardIds[i] = cardStack.PopCard(); + cardIds[i] = cardStack.OwnerPopCard(); DealClientRpc(cardIds, OwnerClientRpcParams); } diff --git a/Assets/Scripts/Cgs/Play/PlayController.cs b/Assets/Scripts/Cgs/Play/PlayController.cs index e9364b503..9480d7499 100644 --- a/Assets/Scripts/Cgs/Play/PlayController.cs +++ b/Assets/Scripts/Cgs/Play/PlayController.cs @@ -360,10 +360,14 @@ private void LoadDeck(UnityDeck deck) position, CgsNetManager.Instance.LocalPlayer.DefaultRotation, false); i++; } + + CgsNetManager.Instance.LocalPlayer.RequestDecks(i); } else { + List cardStacks = new(); _soloDeckStack = CreateCardStack(deckName, deckCards, newDeckPosition, Quaternion.identity, false); + cardStacks.Add(_soloDeckStack); var i = 1; foreach (var (groupName, cards) in extraGroups) { @@ -377,21 +381,14 @@ private void LoadDeck(UnityDeck deck) position = CardGameManager.PixelsPerInch * new Vector2(targetPosition.X, targetPosition.Y); } - CreateCardStack(groupName, cards.Cast().Reverse().ToList(), position, + var cardStack = CreateCardStack(groupName, cards.Cast().Reverse().ToList(), position, Quaternion.identity, false); + cardStacks.Add(cardStack); i++; } - } - if (CardGameManager.Current.DeckPlayCards.Count > 0) - DeckPlayCards(); - else - PromptForHand(); - } - - private void DeckPlayCards() - { - // TODO + DecksCallback(cardStacks, 1); + } } private void CreateGameBoards(IEnumerable gameBoards) @@ -399,7 +396,8 @@ private void CreateGameBoards(IEnumerable gameBoards) foreach (var gameBoard in gameBoards) { var size = new Vector2(gameBoard.Size.X, gameBoard.Size.Y); - var position = new Vector2(gameBoard.OffsetMin.X, gameBoard.OffsetMin.Y); + var position = new Vector2(gameBoard.OffsetMin.X, gameBoard.OffsetMin.Y) * + CardGameManager.PixelsPerInch; if (CgsNetManager.Instance.IsOnline && CgsNetManager.Instance.LocalPlayer != null) CgsNetManager.Instance.LocalPlayer.RequestNewBoard(gameBoard.Id, size, position); else @@ -442,7 +440,104 @@ public CardStack CreateCardStack(string stackName, IReadOnlyList card return cardStack; } - public void PromptForHand() + public void DecksCallback(IReadOnlyList cardStacks, int playerCount) + { + var decksToCardsToPlay = FindDeckToCardsToPlay(cardStacks, playerCount); + + var deckPlayCardsAsk = GenerateAskForDeckPlayCards(decksToCardsToPlay); + if (!string.IsNullOrEmpty(deckPlayCardsAsk)) + CardGameManager.Instance.Messenger.Ask(deckPlayCardsAsk, PromptForHand, + () => MoveToPlay(decksToCardsToPlay)); + else + PromptForHand(); + } + + private static Dictionary>> FindDeckToCardsToPlay( + IReadOnlyList cardStacks, int playerCount) + { + var deckToCardsToPlay = new Dictionary>>(); + + var deckQuery = "playerCount=" + playerCount; + foreach (var deckPlayCard in CardGameManager.Current.DeckPlayCards.Where(deckPlayCard => + string.IsNullOrEmpty(deckPlayCard.DeckQuery) || deckPlayCard.DeckQuery.Equals(deckQuery))) + deckToCardsToPlay[deckPlayCard] = FindCardsToPlay(deckPlayCard, cardStacks); + + return deckToCardsToPlay; + } + + private static Dictionary> FindCardsToPlay(DeckPlayCard deckPlayCard, + IEnumerable cardStacks) + { + var cardsToPlay = new Dictionary>(); + + var cardSearchFilters = new CardSearchFilters(); + cardSearchFilters.Parse(deckPlayCard.CardQuery); + var matchingCards = CardGameManager.Current.FilterCards(cardSearchFilters).ToList(); + + foreach (var cardStack in cardStacks) + { + var cardIndexes = new List(); + var cards = cardStack.Cards; + for (var i = 0; i < cards.Count; i++) + if (matchingCards.Contains(cards[i]) && cardIndexes.Count == 0) // Only play the first match + cardIndexes.Add(i); + if (cardIndexes.Any()) + cardsToPlay[cardStack] = cardIndexes; + } + + return cardsToPlay; + } + + private static string GenerateAskForDeckPlayCards( + Dictionary>> deckToCardsToPlay) + { + var text = string.Empty; + + foreach (var deckPlayCard in deckToCardsToPlay) + { + foreach (var cardStackToPlay in deckPlayCard.Value) + { + var cards = cardStackToPlay.Key.Cards; + foreach (var cardToPlay in cardStackToPlay.Value) + { + if (string.IsNullOrEmpty(text)) + text = "Play '" + cards[cardToPlay].Name + "'"; + else + text += " and '" + cards[cardToPlay].Name + "'"; + } + } + } + + if (!string.IsNullOrEmpty(text)) + text += "?"; + return text; + } + + private void MoveToPlay(Dictionary>> deckToCardsToPlay) + { + foreach (var deckPlayCard in deckToCardsToPlay) + { + foreach (var cardStackToPlay in deckPlayCard.Value) + { + var cards = cardStackToPlay.Key.Cards; + cardStackToPlay.Value.Reverse(); + foreach (var cardToPlay in cardStackToPlay.Value) + { + var position = new Vector2(deckPlayCard.Key.Position.X, deckPlayCard.Key.Position.Y) * + CardGameManager.PixelsPerInch; + var rotation = Quaternion.Euler(0, 0, deckPlayCard.Key.Rotation); + var cardModel = CreateCardModel(playAreaCardZone.gameObject, cards[cardToPlay].Id, position, + rotation, false); + cardStackToPlay.Key.RequestRemoveAt(cardToPlay); + AddCardToPlayArea(playAreaCardZone, cardModel); + } + } + } + + PromptForHand(); + } + + private void PromptForHand() { if (CardGameManager.Current.GameStartHandCount > 0) ShowDealer(); @@ -483,7 +578,7 @@ private IEnumerable PopSoloDeckCards(int count) return cards; for (var i = 0; i < count && _soloDeckStack.Cards.Count > 0; i++) - cards.Add(CardGameManager.Current.Cards[_soloDeckStack.PopCard()]); + cards.Add(CardGameManager.Current.Cards[_soloDeckStack.OwnerPopCard()]); return cards; } @@ -492,7 +587,7 @@ private static void AddCardToPlayArea(CardZone cardZone, CardModel cardModel) if (cardModel.IsFacedown && cardModel.Value.IsBackFaceCard) cardModel.IsFacedown = false; - if (CgsNetManager.Instance.IsOnline) + if (CgsNetManager.Instance.IsOnline && !cardModel.IsSpawned) CgsNetManager.Instance.LocalPlayer.MoveCardToServer(cardZone, cardModel); else SetPlayAreaActions(cardModel); @@ -515,12 +610,13 @@ private void DisplayResults(string filters, List cards) CreateCardStack(filters, cards, position, Quaternion.identity, false); } - public void CreateCardModel(GameObject container, string cardId, Vector3 position, Quaternion rotation, + public CardModel CreateCardModel(GameObject container, string cardId, Vector3 position, Quaternion rotation, bool isFacedown, string defaultAction = "") { if (container == null) container = playAreaCardZone.gameObject; - var cardModel = Instantiate(cardModelPrefab, container.transform).GetComponent(); + var cardModel = Instantiate(cardModelPrefab, position, rotation, container.transform) + .GetComponent(); if (CgsNetManager.Instance.IsOnline) cardModel.MyNetworkObject.Spawn(); @@ -533,6 +629,8 @@ public void CreateCardModel(GameObject container, string cardId, Vector3 positio cardModel.DefaultAction = CardActionPanel.CardActionDictionary[cardAction]; cardModel.HideHighlightClientRpc(); + + return cardModel; } public void CreateDefaultDie() diff --git a/docs/games/grand_archive/grand_archive.json b/docs/games/grand_archive/grand_archive.json index 815d6eb5e..8ec6dc580 100644 --- a/docs/games/grand_archive/grand_archive.json +++ b/docs/games/grand_archive/grand_archive.json @@ -118,6 +118,26 @@ "cardSetIdentifier": "editions", "cgsGamesLink": "https://cgs.games/link/grand_archive", "copyright": "Weebs of the Shore LLC", + "deckPlayCards": [ + { + "cardQuery": "classes:spirit", + "deckQuery": "playerCount=1", + "position": { + "x": -20, + "y": -5.5 + }, + "rotation": 0 + }, + { + "cardQuery": "classes:spirit", + "deckQuery": "playerCount=2", + "position": { + "x": 20, + "y": 5.5 + }, + "rotation": 180 + } + ], "deckSharePreference": "individual", "deckUrls": [ { diff --git a/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json b/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json index e6f958844..7256bad0a 100644 --- a/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json +++ b/docs/games/grand_archive_gabrary_spoilers/grand_archive_gabrary_spoilers.json @@ -121,6 +121,26 @@ "cardSetIdentifier": "editions", "cgsGamesLink": "https://cgs.games/link/grand_archive_gabrary_spoilers", "copyright": "Weebs of the Shore LLC", + "deckPlayCards": [ + { + "cardQuery": "classes:spirit", + "deckQuery": "playerCount=1", + "position": { + "x": -20, + "y": -5.5 + }, + "rotation": 0 + }, + { + "cardQuery": "classes:spirit", + "deckQuery": "playerCount=2", + "position": { + "x": 20, + "y": 5.5 + }, + "rotation": 180 + } + ], "deckSharePreference": "individual", "deckUrls": [ { From 6aed1948874bcb48f508f97286b0a8771c290477 Mon Sep 17 00:00:00 2001 From: David Finol Date: Sun, 20 Oct 2024 08:45:13 -0500 Subject: [PATCH 11/16] Remove scrape --- .github/workflows/scrape.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/scrape.yml b/.github/workflows/scrape.yml index e4f8e2de8..4224fcecb 100644 --- a/.github/workflows/scrape.yml +++ b/.github/workflows/scrape.yml @@ -1,8 +1,8 @@ name: scrape on: workflow_dispatch: - schedule: - - cron: '0 21 * * *' +# schedule: +# - cron: '0 21 * * *' jobs: scrape: runs-on: ubuntu-latest From 04e3ce33a35463f3449d6b79552433489a404e68 Mon Sep 17 00:00:00 2001 From: David Finol Date: Sun, 20 Oct 2024 09:48:21 -0500 Subject: [PATCH 12/16] Use StringBuilder --- Assets/Scripts/Cgs/Play/PlayController.cs | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Assets/Scripts/Cgs/Play/PlayController.cs b/Assets/Scripts/Cgs/Play/PlayController.cs index 9480d7499..a54afd439 100644 --- a/Assets/Scripts/Cgs/Play/PlayController.cs +++ b/Assets/Scripts/Cgs/Play/PlayController.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using Cgs.CardGameView; using Cgs.CardGameView.Multiplayer; using Cgs.CardGameView.Viewer; @@ -42,13 +43,13 @@ public static string LoadStartDecksAsk { get { - var text = "Load "; + var text = new StringBuilder("Load "); var deckUrls = CardGameManager.Current.GameStartDecks; - text += $"'{deckUrls[0].Name}'"; + text.Append($"'{deckUrls[0].Name}'"); for (var i = 1; i < deckUrls.Count; i++) - text += $", '{deckUrls[i].Name}'"; - text += "?"; - return text; + text.Append($", '{deckUrls[i].Name}'"); + text.Append("?"); + return text.ToString(); } } @@ -444,7 +445,7 @@ public void DecksCallback(IReadOnlyList cardStacks, int playerCount) { var decksToCardsToPlay = FindDeckToCardsToPlay(cardStacks, playerCount); - var deckPlayCardsAsk = GenerateAskForDeckPlayCards(decksToCardsToPlay); + var deckPlayCardsAsk = BuildAskForDeckPlayCards(decksToCardsToPlay); if (!string.IsNullOrEmpty(deckPlayCardsAsk)) CardGameManager.Instance.Messenger.Ask(deckPlayCardsAsk, PromptForHand, () => MoveToPlay(decksToCardsToPlay)); @@ -488,10 +489,10 @@ private static Dictionary> FindCardsToPlay(DeckPlayCard dec return cardsToPlay; } - private static string GenerateAskForDeckPlayCards( + private static string BuildAskForDeckPlayCards( Dictionary>> deckToCardsToPlay) { - var text = string.Empty; + StringBuilder text = null; foreach (var deckPlayCard in deckToCardsToPlay) { @@ -500,17 +501,16 @@ private static string GenerateAskForDeckPlayCards( var cards = cardStackToPlay.Key.Cards; foreach (var cardToPlay in cardStackToPlay.Value) { - if (string.IsNullOrEmpty(text)) - text = "Play '" + cards[cardToPlay].Name + "'"; + if (text == null) + text = new StringBuilder("Play '" + cards[cardToPlay].Name + "'"); else - text += " and '" + cards[cardToPlay].Name + "'"; + text.Append(" and '" + cards[cardToPlay].Name + "'"); } } } - if (!string.IsNullOrEmpty(text)) - text += "?"; - return text; + text?.Append("?"); + return text?.ToString(); } private void MoveToPlay(Dictionary>> deckToCardsToPlay) From da3cb1773c0d68dcf2d93fa95a5fb9bdd3f23de4 Mon Sep 17 00:00:00 2001 From: David Finol Date: Sun, 20 Oct 2024 13:55:24 -0500 Subject: [PATCH 13/16] Sonar edit --- .github/workflows/main.yml | 7 ++++--- Assets/Scripts/Cgs/Play/PlayController.cs | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c21edddee..6c14b00ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -129,11 +129,12 @@ jobs: ./dotnet-sonarscanner begin \ /o:"finol-digital" \ /k:"finol-digital_Card-Game-Simulator" \ - /d:sonar.login="$SONAR_TOKEN" \ + /d:sonar.token="$SONAR_TOKEN" \ /d:sonar.host.url=https://sonarcloud.io \ - /d:sonar.exclusions=Assets/Plugins/** + /d:sonar.scm.provider=git \ + /d:sonar.exclusions=**/Plugins/** dotnet build Card-Game-Simulator.sln - ./dotnet-sonarscanner end /d:sonar.login="$SONAR_TOKEN" + ./dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" cd Card-Game-Simulator - name: SonarQube Quality Gate Check uses: SonarSource/sonarqube-quality-gate-action@v1.1.0 diff --git a/Assets/Scripts/Cgs/Play/PlayController.cs b/Assets/Scripts/Cgs/Play/PlayController.cs index a54afd439..19dc72ae4 100644 --- a/Assets/Scripts/Cgs/Play/PlayController.cs +++ b/Assets/Scripts/Cgs/Play/PlayController.cs @@ -39,7 +39,7 @@ public class PlayController : MonoBehaviour, ICardDropHandler private const float PlayAreaBuffer = 8; private const float DeckPositionBuffer = 50; - public static string LoadStartDecksAsk + private static string LoadStartDecksAsk { get { From 5f2eaa4b7648f199a7d474f0a3b855d132350648 Mon Sep 17 00:00:00 2001 From: David Finol Date: Sun, 20 Oct 2024 14:47:27 -0500 Subject: [PATCH 14/16] Sonar edit --- .github/workflows/main.yml | 1 - Assets/Scripts/Cgs/Play/PlayController.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6c14b00ea..95a4bed47 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,7 +131,6 @@ jobs: /k:"finol-digital_Card-Game-Simulator" \ /d:sonar.token="$SONAR_TOKEN" \ /d:sonar.host.url=https://sonarcloud.io \ - /d:sonar.scm.provider=git \ /d:sonar.exclusions=**/Plugins/** dotnet build Card-Game-Simulator.sln ./dotnet-sonarscanner end /d:sonar.token="$SONAR_TOKEN" diff --git a/Assets/Scripts/Cgs/Play/PlayController.cs b/Assets/Scripts/Cgs/Play/PlayController.cs index 19dc72ae4..a54afd439 100644 --- a/Assets/Scripts/Cgs/Play/PlayController.cs +++ b/Assets/Scripts/Cgs/Play/PlayController.cs @@ -39,7 +39,7 @@ public class PlayController : MonoBehaviour, ICardDropHandler private const float PlayAreaBuffer = 8; private const float DeckPositionBuffer = 50; - private static string LoadStartDecksAsk + public static string LoadStartDecksAsk { get { From 0c71904bb52e968bf3a5a4c2596050edf425cb4b Mon Sep 17 00:00:00 2001 From: David Finol Date: Mon, 21 Oct 2024 15:13:29 -0500 Subject: [PATCH 15/16] Update roadmap --- docs/pages/roadmap.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/roadmap.md b/docs/pages/roadmap.md index c1cc3b84a..0d5b6d0fa 100644 --- a/docs/pages/roadmap.md +++ b/docs/pages/roadmap.md @@ -10,8 +10,7 @@ permalink: roadmap.html - Game-Play: deckPlayCards and gameStartDecks - Game-Play: Support for card back faces - Select backs folder in Game Editor Menu - - Select back from dropdown in Card Creator Menu - - Search backs in Card Search/Filter Menu + - Select back from dropdown in Card Creator Menu and Set Import Menu ## Sprint - Priority 1 - Bug-Fix: When adding a card to hand, it duplicates the card at the edge of the board @@ -37,6 +36,7 @@ permalink: roadmap.html - Game-Play: Flip Random for tokens - Game-Play: Rename Stacks - Game-Play: Add restart button in Play Settings Menu +- Cards: Search backs in Card Search/Filter Menu - Decks: Support organizing decks into folders - Decouple games and decks, so you can use any deck from any game and deleting a game won't delete your decks - Decks: Add extra tags (\*CMDR\* for .txt; sideboards for .dec and .ydk) From 9ff10f8ac9e93813775435f04b364fdcbc62bc8c Mon Sep 17 00:00:00 2001 From: David Finol Date: Mon, 21 Oct 2024 17:09:12 -0500 Subject: [PATCH 16/16] Add card backs --- Assets/Prefabs/Menus/Card Editor Menu.prefab | 304 +++++++++++- .../Menus/Card Game Editor Menu.prefab | 448 +++++++++++++++++- Assets/Prefabs/Menus/Set Import Menu.prefab | 309 +++++++++++- Assets/Scripts/Cgs/Cards/CardEditorMenu.cs | 21 +- Assets/Scripts/Cgs/Cards/SetImportMenu.cs | 32 +- Assets/Scripts/Cgs/Menu/CardGameEditorMenu.cs | 69 +++ 6 files changed, 1169 insertions(+), 14 deletions(-) diff --git a/Assets/Prefabs/Menus/Card Editor Menu.prefab b/Assets/Prefabs/Menus/Card Editor Menu.prefab index 652f29ea9..c579de23a 100644 --- a/Assets/Prefabs/Menus/Card Editor Menu.prefab +++ b/Assets/Prefabs/Menus/Card Editor Menu.prefab @@ -116,12 +116,14 @@ RectTransform: - {fileID: 3751717276885688301} - {fileID: 7557410562394956533} - {fileID: 5059895988602915785} + - {fileID: 4930459830660871687} + - {fileID: 9052368778950765492} m_Father: {fileID: 1869253921984234116} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 325, y: -25} - m_SizeDelta: {x: 600, y: 200} + m_SizeDelta: {x: 600, y: 300} m_Pivot: {x: 0.5, y: 1} --- !u!222 &8937589716176591439 CanvasRenderer: @@ -175,9 +177,9 @@ MonoBehaviour: m_EditorClassIdentifier: m_IgnoreLayout: 0 m_MinWidth: 600 - m_MinHeight: 200 + m_MinHeight: 300 m_PreferredWidth: 600 - m_PreferredHeight: 200 + m_PreferredHeight: 300 m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 @@ -661,6 +663,7 @@ MonoBehaviour: - {fileID: 4949916991088919623} cardIdInputField: {fileID: 3934238613493567587} setCodeInputField: {fileID: 4949916991088919623} + backSelector: {fileID: 9162998249089658734} cardImage: {fileID: 7650270232468140256} saveButton: {fileID: 3288109361705386331} --- !u!1001 &476697711553669634 @@ -1951,6 +1954,140 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 5537974771124472253} m_PrefabAsset: {fileID: 0} +--- !u!1001 &5969615885701383376 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1749039355795317158} + m_Modifications: + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_SizeDelta.x + value: 225 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchoredPosition.y + value: -200 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6960506880217691888, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Text + value: Back + objectReference: {fileID: 0} + - target: {fileID: 7755028453825778640, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Name + value: Back Label + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: eb9a84c1b0b6d25479b907acb118cde9, type: 3} +--- !u!224 &4930459830660871687 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + m_PrefabInstance: {fileID: 5969615885701383376} + m_PrefabAsset: {fileID: 0} --- !u!1001 &6062883361368327702 PrefabInstance: m_ObjectHideFlags: 0 @@ -3033,6 +3170,167 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 8291462134345967558} m_PrefabAsset: {fileID: 0} +--- !u!1001 &8328177537136676862 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1749039355795317158} + m_Modifications: + - target: {fileID: 916273688120697700, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Text + value: + objectReference: {fileID: 0} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Options.m_Options.Array.data[0].m_Text + value: + objectReference: {fileID: 0} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 4118894267374975462} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: set_Back + objectReference: {fileID: 0} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: Cgs.Cards.CardEditorMenu, Cgs + objectReference: {fileID: 0} + - target: {fileID: 948743394630853548, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Name + value: Back Dropdown + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_SizeDelta.x + value: -225 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 112.5 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchoredPosition.y + value: -200 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 8d611347712873941990408a695ae759, type: 3} +--- !u!224 &9052368778950765492 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + m_PrefabInstance: {fileID: 8328177537136676862} + m_PrefabAsset: {fileID: 0} +--- !u!114 &9162998249089658734 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + m_PrefabInstance: {fileID: 8328177537136676862} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d0b652f32a2cc243917e4028fa0f046, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &8409637090698706470 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Menus/Card Game Editor Menu.prefab b/Assets/Prefabs/Menus/Card Game Editor Menu.prefab index b452292e7..7c36e85ee 100644 --- a/Assets/Prefabs/Menus/Card Game Editor Menu.prefab +++ b/Assets/Prefabs/Menus/Card Game Editor Menu.prefab @@ -1569,7 +1569,121 @@ MonoBehaviour: bannerImage: {fileID: 5808374412478590082} cardBackImage: {fileID: 2900055768572430823} playMatImage: {fileID: 5426961772105621355} + backsFolderText: {fileID: 1743191941766219692} saveButton: {fileID: 3288109361705386331} +--- !u!1 &8687566175535138263 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5220137667917461443} + - component: {fileID: 6182305803495966476} + - component: {fileID: 4268861079459481347} + - component: {fileID: 5070817642476718311} + - component: {fileID: 5132689289330571789} + m_Layer: 5 + m_Name: Backs Folder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5220137667917461443 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8687566175535138263} + 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: 3417297275256032698} + - {fileID: 3100810486699501352} + m_Father: {fileID: 3250183333955770306} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 575, y: -900} + m_SizeDelta: {x: 350, y: 200} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6182305803495966476 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8687566175535138263} + m_CullTransparentMesh: 1 +--- !u!114 &4268861079459481347 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8687566175535138263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: 062b85b23e1058941a28497c2519e749, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &5070817642476718311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8687566175535138263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: 350 + m_MinHeight: 200 + m_PreferredWidth: 350 + m_PreferredHeight: 200 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &5132689289330571789 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8687566175535138263} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 2 --- !u!1001 &388257654275461665 PrefabInstance: m_ObjectHideFlags: 0 @@ -2147,6 +2261,198 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 640954355663113986} m_PrefabAsset: {fileID: 0} +--- !u!1001 &904961963566295415 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 5220137667917461443} + m_Modifications: + - target: {fileID: 1494664878241574619, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_Text + value: + objectReference: {fileID: 0} + - target: {fileID: 1751753110650578252, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: isBelow + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1751753110650578252, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: tooltip + value: Select Backs Folder + objectReference: {fileID: 0} + - target: {fileID: 2442268098906025027, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 364b003a1bd067f4fb41ea1adfe03b56, + type: 3} + - target: {fileID: 2848342772243254878, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_Name + value: Framed Labeled Button + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_SizeDelta.x + value: -50 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_SizeDelta.y + value: 75 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_AnchoredPosition.y + value: -85 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7269854554250268640, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7269854554250268640, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7269854554250268640, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 2509290508521618914} + - target: {fileID: 7269854554250268640, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 7269854554250268640, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: SelectBacksFolder + objectReference: {fileID: 0} + - target: {fileID: 7269854554250268640, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: Cgs.Menu.CardGameEditorMenu, Cgs + objectReference: {fileID: 0} + - target: {fileID: 7269854554250268640, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 30c175fe170c9e0459ee166821450a03, type: 3} +--- !u!114 &1743191941766219692 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 1494664878241574619, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + m_PrefabInstance: {fileID: 904961963566295415} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!224 &3100810486699501352 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 2848342772243254879, guid: 30c175fe170c9e0459ee166821450a03, + type: 3} + m_PrefabInstance: {fileID: 904961963566295415} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1378245701644965237 PrefabInstance: m_ObjectHideFlags: 0 @@ -3208,7 +3514,7 @@ PrefabInstance: - target: {fileID: 8441293159771624762, guid: bcd6c8c8d8b4b004ab05978ff2d32058, type: 3} propertyPath: m_Size - value: 0.242 + value: 0.2326923 objectReference: {fileID: 0} - target: {fileID: 8441293161199918481, guid: bcd6c8c8d8b4b004ab05978ff2d32058, type: 3} @@ -3223,7 +3529,7 @@ PrefabInstance: - target: {fileID: 8441293161199918481, guid: bcd6c8c8d8b4b004ab05978ff2d32058, type: 3} propertyPath: m_AnchorMin.y - value: 0.758 + value: 0.7673077 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -3260,6 +3566,10 @@ PrefabInstance: type: 3} insertIndex: -1 addedObject: {fileID: 1758297209062295551} + - targetCorrespondingSourceObject: {fileID: 707491489704095531, guid: bcd6c8c8d8b4b004ab05978ff2d32058, + type: 3} + insertIndex: -1 + addedObject: {fileID: 5220137667917461443} m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: bcd6c8c8d8b4b004ab05978ff2d32058, type: 3} --- !u!224 &3250183333955770306 stripped @@ -4127,6 +4437,140 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 4118925510133051666} m_PrefabAsset: {fileID: 0} +--- !u!1001 &4168214319115730797 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 5220137667917461443} + m_Modifications: + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_SizeDelta.x + value: 250 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_SizeDelta.y + value: 80 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6960506880217691888, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Text + value: Backs Folder + objectReference: {fileID: 0} + - target: {fileID: 7755028453825778640, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Name + value: BacksFolder Label + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: eb9a84c1b0b6d25479b907acb118cde9, type: 3} +--- !u!224 &3417297275256032698 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + m_PrefabInstance: {fileID: 4168214319115730797} + m_PrefabAsset: {fileID: 0} --- !u!1001 &4527197461938940384 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Menus/Set Import Menu.prefab b/Assets/Prefabs/Menus/Set Import Menu.prefab index 5026357f3..54c8647d1 100644 --- a/Assets/Prefabs/Menus/Set Import Menu.prefab +++ b/Assets/Prefabs/Menus/Set Import Menu.prefab @@ -59,7 +59,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_VertexColorAlwaysGammaSpace: 0 - m_AdditionalShaderChannelsFlag: 0 + m_AdditionalShaderChannelsFlag: 25 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 m_SortingOrder: 85 @@ -118,6 +118,7 @@ MonoBehaviour: m_EditorClassIdentifier: setNameText: {fileID: 8048555959403378878} cardNamesText: {fileID: 2308992911830701843} + backSelector: {fileID: 3673002717146128287} importButton: {fileID: 6945829736936368772} --- !u!1 &6063335200564067541 GameObject: @@ -154,6 +155,8 @@ RectTransform: - {fileID: 6439626329420470727} - {fileID: 1846003278379482265} - {fileID: 2308992910928662122} + - {fileID: 8687253988483646318} + - {fileID: 3490531258046061381} - {fileID: 1704927231478980121} m_Father: {fileID: 2474638859470940481} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -828,6 +831,172 @@ RectTransform: type: 3} m_PrefabInstance: {fileID: 2540107421395262872} m_PrefabAsset: {fileID: 0} +--- !u!1001 &4486433530190151439 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 3162819817568487429} + m_Modifications: + - target: {fileID: 916273688120697700, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Text + value: + objectReference: {fileID: 0} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Navigation.m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Options.m_Options.Array.data[0].m_Text + value: + objectReference: {fileID: 0} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 186088718753695776} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: set_Back + objectReference: {fileID: 0} + - target: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_OnValueChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: Cgs.Cards.SetImportMenu, Cgs + objectReference: {fileID: 0} + - target: {fileID: 948743394630853548, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Name + value: Back Dropdown + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_SizeDelta.x + value: 500 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 182.5 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 8d611347712873941990408a695ae759, type: 3} +--- !u!224 &3490531258046061381 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1023399211122107466, guid: 8d611347712873941990408a695ae759, + type: 3} + m_PrefabInstance: {fileID: 4486433530190151439} + m_PrefabAsset: {fileID: 0} +--- !u!114 &3673002717146128287 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 917083975517249680, guid: 8d611347712873941990408a695ae759, + type: 3} + m_PrefabInstance: {fileID: 4486433530190151439} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0d0b652f32a2cc243917e4028fa0f046, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1001 &4527258587213515801 PrefabInstance: m_ObjectHideFlags: 0 @@ -1352,7 +1521,7 @@ PrefabInstance: - target: {fileID: 8614848688831283421, guid: 72c2cddda8f96c04593a8ff521560e3f, type: 3} propertyPath: m_SizeDelta.y - value: -600 + value: -700 objectReference: {fileID: 0} - target: {fileID: 8614848688831283421, guid: 72c2cddda8f96c04593a8ff521560e3f, type: 3} @@ -1496,3 +1665,139 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &7943090163263271353 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 3162819817568487429} + m_Modifications: + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_SizeDelta.x + value: 150 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_SizeDelta.y + value: 100 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchoredPosition.x + value: -250 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 182.5 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6960506880217691888, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Text + value: 'Back + +' + objectReference: {fileID: 0} + - target: {fileID: 7755028453825778640, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + propertyPath: m_Name + value: Back Label + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: eb9a84c1b0b6d25479b907acb118cde9, type: 3} +--- !u!224 &8687253988483646318 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1636166841839465175, guid: eb9a84c1b0b6d25479b907acb118cde9, + type: 3} + m_PrefabInstance: {fileID: 7943090163263271353} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Scripts/Cgs/Cards/CardEditorMenu.cs b/Assets/Scripts/Cgs/Cards/CardEditorMenu.cs index 79efb60fd..1dc23cfa0 100644 --- a/Assets/Scripts/Cgs/Cards/CardEditorMenu.cs +++ b/Assets/Scripts/Cgs/Cards/CardEditorMenu.cs @@ -38,6 +38,7 @@ public class CardEditorMenu : Modal public List inputFields; public InputField cardIdInputField; public InputField setCodeInputField; + public Dropdown backSelector; public Image cardImage; public Button saveButton; @@ -75,6 +76,16 @@ public string SetCode private string _setCode = string.Empty; + [UsedImplicitly] public int Back { get; set; } + + private string BackFace => Back < BackFaceOptions.Count ? BackFaceOptions[Back].text : string.Empty; + + private List BackFaceOptions { get; } = new(); + + private string BackFaceId => CardGameManager.Current.CardBackFaceImageSprites.ContainsKey(BackFace) + ? BackFace + : string.Empty; + private Uri CardImageUri { get => _cardImageUri; @@ -129,6 +140,14 @@ public void Show(UnityAction onCreationCallback) { Show(); SetCode = string.Concat(CardGameManager.Current.Name.Where(char.IsLetterOrDigit)); + + BackFaceOptions.Clear(); + BackFaceOptions.Add(new Dropdown.OptionData() {text = string.Empty}); + foreach (var backFaceKey in CardGameManager.Current.CardBackFaceImageSprites.Keys) + BackFaceOptions.Add(new Dropdown.OptionData() {text = backFaceKey}); + backSelector.options = BackFaceOptions; + backSelector.value = 0; + cardImage.sprite = CardImageSprite != null ? CardImageSprite : CardGameManager.Current.CardBackImageSprite; _onCreationCallback = onCreationCallback; @@ -256,7 +275,7 @@ private IEnumerator SaveCard() ? Guid.NewGuid().ToString().ToUpper() : CardId, CardName, string.IsNullOrEmpty(SetCode) ? Set.DefaultCode : SetCode, propertyDefValuePairs, - false) + false, false, BackFaceId) {ImageWebUrl = CardImageUri.AbsoluteUri}; yield return UnityFileMethods.SaveUrlToFile(CardImageUri.AbsoluteUri, card.ImageFilePath); diff --git a/Assets/Scripts/Cgs/Cards/SetImportMenu.cs b/Assets/Scripts/Cgs/Cards/SetImportMenu.cs index f5f2ff444..18a8590aa 100644 --- a/Assets/Scripts/Cgs/Cards/SetImportMenu.cs +++ b/Assets/Scripts/Cgs/Cards/SetImportMenu.cs @@ -4,6 +4,7 @@ using System; using System.Collections; +using System.Collections.Generic; using System.IO; using System.Linq; using Cgs.Menu; @@ -36,6 +37,7 @@ public class SetImportMenu : Modal, IProgressible public Text setNameText; public TMP_Text cardNamesText; + public Dropdown backSelector; public Button importButton; public float ProgressPercentage { get; private set; } @@ -68,9 +70,8 @@ private string SetFolderPath { var fileName = file.Name; if (fileName.EndsWith(CardGameManager.Current.CardImageFileType)) - fileName = fileName.Substring(0, - fileName.LastIndexOf(CardGameManager.Current.CardImageFileType, - StringComparison.Ordinal) - 1); + fileName = fileName[..(fileName.LastIndexOf(CardGameManager.Current.CardImageFileType, + StringComparison.Ordinal) - 1)]; return current + fileName + "\n"; }); cardNamesText.text = !string.IsNullOrWhiteSpace(cardNames) ? cardNames : SetImportMissingWarningMessage; @@ -80,11 +81,29 @@ private string SetFolderPath private string _setFolderPath; + [UsedImplicitly] public int Back { get; set; } + + private string BackFace => Back < BackFaceOptions.Count ? BackFaceOptions[Back].text : string.Empty; + + private List BackFaceOptions { get; } = new(); + + private string BackFaceId => CardGameManager.Current.CardBackFaceImageSprites.ContainsKey(BackFace) + ? BackFace + : string.Empty; + private UnityAction _onCreationCallback; public void Show(UnityAction onCreationCallback) { Show(); + + BackFaceOptions.Clear(); + BackFaceOptions.Add(new Dropdown.OptionData() {text = string.Empty}); + foreach (var backFaceKey in CardGameManager.Current.CardBackFaceImageSprites.Keys) + BackFaceOptions.Add(new Dropdown.OptionData() {text = backFaceKey}); + backSelector.options = BackFaceOptions; + backSelector.value = 0; + _onCreationCallback = onCreationCallback; } @@ -159,9 +178,10 @@ private IEnumerator ImportSet() var fileName = cardPathsToImport[i].Name; var end = fileName.LastIndexOf(CardGameManager.Current.CardImageFileType, StringComparison.Ordinal); - var cardName = fileName.Substring(0, end - 1); - var cardId = UnityFileMethods.GetSafeFileName(cardName).Replace(" ","_"); - var card = new UnityCard(CardGameManager.Current, cardId, cardName, SetName, null, false); + var cardName = fileName[..(end - 1)]; + var cardId = UnityFileMethods.GetSafeFileName(cardName).Replace(" ", "_"); + var card = new UnityCard(CardGameManager.Current, cardId, cardName, SetName, null, false, false, + BackFaceId); FileBrowserHelpers.CopyFile(cardPathsToImport[i].Path, card.ImageFilePath); if (!File.Exists(card.ImageFilePath)) diff --git a/Assets/Scripts/Cgs/Menu/CardGameEditorMenu.cs b/Assets/Scripts/Cgs/Menu/CardGameEditorMenu.cs index ba90e754f..8672dcfc2 100644 --- a/Assets/Scripts/Cgs/Menu/CardGameEditorMenu.cs +++ b/Assets/Scripts/Cgs/Menu/CardGameEditorMenu.cs @@ -14,6 +14,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using SFB; +using SimpleFileBrowser; using UnityEngine; using UnityEngine.UI; using UnityExtensionMethods; @@ -22,6 +23,10 @@ namespace Cgs.Menu { public class CardGameEditorMenu : Modal { +#if ENABLE_WINMD_SUPPORT + public const string PlatformWarningMessage = "Sorry, Backs Folder is not supported from Windows Store!"; +#endif + public const string DownloadBannerImage = "Download Banner Image"; public const string DownloadBannerImagePrompt = "Enter banner image url..."; public const string DownloadCardBackImage = "Download Card Back Image"; @@ -36,6 +41,9 @@ public class CardGameEditorMenu : Modal public const string SelectPlayMatImageFilePrompt = "Select PlayMat Image File"; #endif public const string ImportImageWarningMessage = "No image file selected for import!"; + public const string SelectFolderPrompt = "Select Folder"; + public const string ImportFolderWarningMessage = "No folder found for import! "; + public const string ImportBackFailedWarningMessage = "Failed to find back: "; public const string CreationWarningMessage = "Failed to create the custom card game! "; public const string CreationCleanupErrorMessage = "Failed to both create and cleanup during creation! "; @@ -44,6 +52,7 @@ public class CardGameEditorMenu : Modal public Image bannerImage; public Image cardBackImage; public Image playMatImage; + public Text backsFolderText; public Button saveButton; private DownloadMenu Downloader => @@ -112,6 +121,26 @@ public string Height [UsedImplicitly] public string CardProperty { get; set; } = "description"; + [UsedImplicitly] + public string BacksFolderPath + { + get => _backsFolderPath; + set + { + if (!FileBrowserHelpers.DirectoryExists(value)) + { + Debug.LogWarning(ImportFolderWarningMessage + value); + CardGameManager.Instance.Messenger.Show(ImportFolderWarningMessage + value); + return; + } + + _backsFolderPath = value; + backsFolderText.text = _backsFolderPath; + } + } + + private string _backsFolderPath = string.Empty; + private bool _isEdit; public void ShowNew() @@ -475,6 +504,9 @@ private IEnumerator CreateGame() File.WriteAllText(unityCardGame.GameFilePath, JsonConvert.SerializeObject(unityCardGame, jsonSerializerSettings)); + if (!string.IsNullOrEmpty(BacksFolderPath) && FileBrowserHelpers.DirectoryExists(BacksFolderPath)) + CopyBacksFolder(); + yield return CardGameManager.Instance.UpdateCardGame(unityCardGame); if (!string.IsNullOrEmpty(unityCardGame.Error)) @@ -496,5 +528,42 @@ private IEnumerator CreateGame() Hide(); } } + + [UsedImplicitly] + public void SelectBacksFolder() + { +#if ENABLE_WINMD_SUPPORT + CardGameManager.Instance.Messenger.Show(PlatformWarningMessage); + Hide(); +#else + FileBrowser.ShowLoadDialog((paths) => { BacksFolderPath = paths[0]; }, () => { }, + FileBrowser.PickMode.Folders, false, null, null, SelectFolderPrompt); +#endif + } + + private void CopyBacksFolder() + { + var backsToImport = FileBrowserHelpers.GetEntriesInDirectory(BacksFolderPath, true) + .Where(fileSystemEntry => !fileSystemEntry.IsDirectory && + !string.IsNullOrEmpty(fileSystemEntry.Extension) && + fileSystemEntry.Extension.EndsWith(CardGameManager.Current + .CardBackImageFileType)) + .ToList(); + for (var i = 0; i < backsToImport.Count; i++) + { + try + { + if (!Directory.Exists(CardGameManager.Current.BacksDirectoryPath)) + Directory.CreateDirectory(CardGameManager.Current.BacksDirectoryPath); + FileBrowserHelpers.CopyFile(backsToImport[i].Path, + Path.Join(CardGameManager.Current.BacksDirectoryPath, backsToImport[i].Name)); + } + catch + { + Debug.LogWarning(ImportBackFailedWarningMessage + backsToImport[i].Name); + CardGameManager.Instance.Messenger.Show(ImportBackFailedWarningMessage + backsToImport[i].Name); + } + } + } } }