day1基本走通,接下来优化clueboard
This commit is contained in:
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using RainbowArt.CleanFlatUI;
|
||||
using Yarn.Unity;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
|
||||
public class WindowManager : MonoBehaviour
|
||||
{
|
||||
@@ -36,7 +37,7 @@ public class WindowManager : MonoBehaviour
|
||||
singleButtonWindowPrefab.DescriptionValue = description;
|
||||
singleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
|
||||
singleButtonWindowPrefab.gameObject.SetActive(true);
|
||||
singleButtonWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 等待用户确认
|
||||
yield return new WaitUntil(() => isConfirmed);
|
||||
@@ -44,18 +45,27 @@ public class WindowManager : MonoBehaviour
|
||||
singleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
[YarnCommand("OpenProgressWindow")]
|
||||
public IEnumerator OpenProgressWindow(string title, string description)
|
||||
public IEnumerator OpenProgressWindow(string title, string description,float duration)
|
||||
{
|
||||
bool isConfirmed = false;
|
||||
|
||||
progressWindowPrefab.TitleValue = title;
|
||||
progressWindowPrefab.DescriptionValue = description;
|
||||
progressWindowPrefab.OnFinish.AddListener(() => isConfirmed = true);
|
||||
progressWindowPrefab.gameObject.SetActive(true);
|
||||
float currentProgress=0;
|
||||
DOTween.To(
|
||||
() => currentProgress,
|
||||
value =>
|
||||
{
|
||||
currentProgress = value;
|
||||
progressWindowPrefab.SetProgress(currentProgress); // 更新进度
|
||||
},
|
||||
100,
|
||||
duration
|
||||
);
|
||||
progressWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 等待用户确认
|
||||
yield return new WaitUntil(() => isConfirmed);
|
||||
progressWindowPrefab.OnFinish.RemoveAllListeners();
|
||||
yield return new WaitUntil(() => currentProgress>=100);
|
||||
progressWindowPrefab.HideModalWindow();
|
||||
}
|
||||
[YarnCommand("OpenImageWindow_UFImage")]
|
||||
public void OpenImageSingleButtonWindowPrefab(string title, string imageName)
|
||||
@@ -66,15 +76,16 @@ public class WindowManager : MonoBehaviour
|
||||
ImageSingleButtonWindowPrefab.ImageValue=Resources.Load<Sprite>("Art/Photos/" + imageName);
|
||||
ImageSingleButtonWindowPrefab.DescriptionValue="";
|
||||
//progressWindowPrefab.OnFinish.AddListener(() => isConfirmed = true);
|
||||
progressWindowPrefab.gameObject.SetActive(true);
|
||||
ImageSingleButtonWindowPrefab.ShowModalWindow();
|
||||
}
|
||||
[YarnCommand("EnableAndWaitForClosingUFImage")]
|
||||
public IEnumerator EnableAndWaitForClosingUFImage()
|
||||
{
|
||||
bool isConfirmed = false;
|
||||
ImageSingleButtonWindowPrefab.IsConfirmButtonActive=true;
|
||||
ImageSingleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
yield return new WaitUntil(() => isConfirmed);
|
||||
progressWindowPrefab.OnFinish.RemoveAllListeners();
|
||||
ImageSingleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user