Quellcode durchsuchen

Added Player Selection Queue For DNA

BennAbbot vor 4 Monaten
Ursprung
Commit
704b150b79
1 geänderte Dateien mit 19 neuen und 15 gelöschten Zeilen
  1. 19 15
      Assets/Scripts/Script/CardEffectCommons/DNADigivolveEffects.cs

+ 19 - 15
Assets/Scripts/Script/CardEffectCommons/DNADigivolveEffects.cs

@@ -1,10 +1,11 @@
+using Photon;
+using Photon.Pun;
+using Photon.Realtime;
+using System;
 using System.Collections;
 using System.Collections.Generic;
-using UnityEngine;
 using System.Linq;
-using Photon;
-using System;
-using Photon.Pun;
+using UnityEngine;
 
 public partial class CardEffectCommons
 {
@@ -580,20 +581,20 @@ public partial class CardEffectCommons
                     yield return null;
                 }
 
-                controller.photonView.RPC("SetJogressEvoRootsFrameIDs", RpcTarget.All, _jogressEvoRootsFrameIDs);
+                controller.photonView.RPC("SetJogressEvoRootsFrameIDs", RpcTarget.All, owner.PlayerID, _jogressEvoRootsFrameIDs);
             }
             else
             {
                 GManager.instance.commandText.OpenCommandText("The opponent is choosing a card to DNA digivolve.");
             }
 
-            yield return new WaitWhile(() => !controller.EndSelect);
-            controller.EndSelect = false;
+            yield return new WaitUntil(() => owner.HasPlayerSelection());
+            PermanentSelection permanentSelection = owner.DequeuePlayerSelection<PermanentSelection>();
 
             GManager.instance.commandText.CloseCommandText();
             yield return new WaitWhile(() => GManager.instance.commandText.gameObject.activeSelf);
 
-            if (controller.JogressEvoRootsFrameIDs.Length == DnaPermanentCount)
+            if (permanentSelection.PermanentIDList.Length == DnaPermanentCount)
             {
                 yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { dnaTarget }, "Played Card", true, true));
 
@@ -606,7 +607,7 @@ public partial class CardEffectCommons
                     root: isHand ? SelectCardEffect.Root.Hand : SelectCardEffect.Root.Trash,
                     activateETB: true);
 
-                playCard.SetJogress(controller.JogressEvoRootsFrameIDs);
+                playCard.SetJogress(permanentSelection.PermanentIDList);
 
                 yield return ContinuousController.instance.StartCoroutine(playCard.PlayCard());
 
@@ -657,14 +658,17 @@ public partial class CardEffectCommons
     //Private class used to register the callback so this doesn't need to be defined in every card that uses DNA by effect
     private class SetJogressEvoRootsController : MonoBehaviourPunCallbacks
     {
-        public bool EndSelect = false;
-        public int[] JogressEvoRootsFrameIDs = new int[0];
-
         [PunRPC]
-        public void SetJogressEvoRootsFrameIDs(int[] JogressEvoRootsFrameIDs)
+        public void SetJogressEvoRootsFrameIDs(int playerID, int[] jogressEvoRootsFrameIDs)
         {
-            this.JogressEvoRootsFrameIDs = JogressEvoRootsFrameIDs;
-            EndSelect = true;
+            Player selectionPlayer = GManager.instance.GetPlayerFromID(playerID);
+
+            if (selectionPlayer == null)
+            {
+                return;
+            }
+
+            selectionPlayer.QueuePlayerSelection(new PermanentSelection(null, jogressEvoRootsFrameIDs));
         }
     }