Kaynağa Gözat

增加错误回调

wuyu 1 yıl önce
ebeveyn
işleme
9c62e97f8c

+ 6 - 1
Assets/PaperFold/Test/TestLevel.cs

@@ -26,7 +26,7 @@ public class TestLevel : MonoBehaviour
         Paper levelPrefab = await LoadPaperLevel(0);
         currentPaper = Instantiate(levelPrefab, transform);
         onPaperInstantiated?.Invoke(currentPaper);
-        currentPaper.setPaperCallBack(this.levelComplete);
+        currentPaper.setPaperCallBack(this.levelComplete,wrongPaperFolded);
     }
 
     private async UniTask<Paper> LoadPaperLevel(int level)
@@ -47,4 +47,9 @@ public class TestLevel : MonoBehaviour
     {
         Debug.Log("Level Complete");
     }
+    
+    private void wrongPaperFolded()
+    {
+        Debug.Log("Level wrongPaperFolded");
+    }
 }

+ 4 - 2
Assets/_Packages/PaperFoldAsset/Paper Fold/Scripts/Paper.cs

@@ -59,6 +59,7 @@ public class Paper : MonoBehaviour
 
     public IEnumerable<Folding> Folding => foldingsParent.Cast<Transform>().Select(x => x.GetComponent<Folding>());
     private Action levelCompleteCallBack;
+    public  Action wrongPaperFolded;
     private void Awake()
     {
         backFilter = paperBackRenderer.GetComponent<MeshFilter>();
@@ -75,9 +76,10 @@ public class Paper : MonoBehaviour
                  .setOnComplete(() => LoadingState.IsLoading = false);
     }
 
-    public void setPaperCallBack(Action levelCompleteCallBackTemp)
+    public void setPaperCallBack(Action levelCompleteCallBackTemp, Action wrongPaperFoldedTemp)
     {
         levelCompleteCallBack = levelCompleteCallBackTemp;
+        wrongPaperFolded = wrongPaperFoldedTemp;
     }
 
     // Start is called before the first frame update
@@ -419,7 +421,7 @@ public class Paper : MonoBehaviour
             YandexSDK.instance.ShowInterstitial();
 
         UIManager.wrongPaperFolded?.Invoke();
-
+        wrongPaperFolded?.Invoke();
         yield break;
     }