新冷却液
This commit is contained in:
@@ -8,8 +8,7 @@ public class WindowManager : MonoBehaviour
|
||||
{
|
||||
public static WindowManager Instance { get; private set; }
|
||||
|
||||
[Header("Window Prefabs")]
|
||||
public ModalWindow singleButtonWindowPrefab;
|
||||
[Header("Window Prefabs")] public ModalWindow singleButtonWindowPrefab;
|
||||
|
||||
public ModalWindow ImageSingleButtonWindowPrefab;
|
||||
public ModalWindowProgressBar progressWindowPrefab;
|
||||
@@ -28,8 +27,8 @@ public class WindowManager : MonoBehaviour
|
||||
DontDestroyOnLoad(gameObject); // 如果需要全局保留
|
||||
}
|
||||
|
||||
[YarnCommand("OpenSingleButtonWindow")]
|
||||
public IEnumerator OpenSingleButtonWindow(string title, string description,bool ispanelActive=true)
|
||||
[YarnCommand("OpenSingleButtonWindow")]
|
||||
public IEnumerator OpenSingleButtonWindow(string title, string description, bool ispanelActive = true)
|
||||
{
|
||||
bool isConfirmed = false;
|
||||
singleButtonWindowPrefab.transform.GetChild(0).gameObject.SetActive(ispanelActive);
|
||||
@@ -37,7 +36,7 @@ public class WindowManager : MonoBehaviour
|
||||
singleButtonWindowPrefab.TitleValue = title;
|
||||
singleButtonWindowPrefab.DescriptionValue = description;
|
||||
singleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
|
||||
|
||||
singleButtonWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 等待用户确认
|
||||
@@ -46,8 +45,8 @@ public class WindowManager : MonoBehaviour
|
||||
singleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
|
||||
[YarnCommand("OpenMutiSingleButtonWindow")]
|
||||
public IEnumerator OpenMutiSingleButtonWindow(string title, string description,int number)
|
||||
[YarnCommand("OpenMutiSingleButtonWindow")]
|
||||
public IEnumerator OpenMutiSingleButtonWindow(string title, string description, int number)
|
||||
{
|
||||
bool isConfirmed = false;
|
||||
singleButtonWindowPrefab.transform.GetChild(0).gameObject.SetActive(false);
|
||||
@@ -55,7 +54,7 @@ public class WindowManager : MonoBehaviour
|
||||
singleButtonWindowPrefab.TitleValue = title;
|
||||
singleButtonWindowPrefab.DescriptionValue = description;
|
||||
singleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
|
||||
|
||||
singleButtonWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 等待用户确认
|
||||
@@ -63,13 +62,13 @@ public class WindowManager : MonoBehaviour
|
||||
|
||||
singleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
[YarnCommand("OpenProgressWindow")]
|
||||
public IEnumerator OpenProgressWindow(string title, string description,float duration)
|
||||
{
|
||||
|
||||
[YarnCommand("OpenProgressWindow")]
|
||||
public IEnumerator OpenProgressWindow(string title, string description, float duration)
|
||||
{
|
||||
progressWindowPrefab.TitleValue = title;
|
||||
progressWindowPrefab.DescriptionValue = description;
|
||||
float currentProgress=0;
|
||||
float currentProgress = 0;
|
||||
DOTween.To(
|
||||
() => currentProgress,
|
||||
value =>
|
||||
@@ -79,36 +78,33 @@ public class WindowManager : MonoBehaviour
|
||||
},
|
||||
100,
|
||||
duration
|
||||
);
|
||||
);
|
||||
progressWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 等待用户确认
|
||||
yield return new WaitUntil(() => currentProgress>=100);
|
||||
yield return new WaitUntil(() => currentProgress >= 100);
|
||||
progressWindowPrefab.HideModalWindow();
|
||||
}
|
||||
[YarnCommand("OpenImageWindow_UFImage")]
|
||||
|
||||
[YarnCommand("OpenImageWindow_UFImage")]
|
||||
public void OpenImageSingleButtonWindowPrefab(string title, string imageName)
|
||||
{
|
||||
//bool isConfirmed = false;
|
||||
ImageSingleButtonWindowPrefab.IsConfirmButtonActive=false;
|
||||
ImageSingleButtonWindowPrefab.IsConfirmButtonActive = false;
|
||||
ImageSingleButtonWindowPrefab.TitleValue = title;
|
||||
ImageSingleButtonWindowPrefab.ImageValue=Resources.Load<Sprite>("Art/Photos/" + imageName);
|
||||
ImageSingleButtonWindowPrefab.DescriptionValue="";
|
||||
ImageSingleButtonWindowPrefab.ImageValue = Resources.Load<Sprite>("Art/Photos/" + imageName);
|
||||
ImageSingleButtonWindowPrefab.DescriptionValue = "";
|
||||
//progressWindowPrefab.OnFinish.AddListener(() => isConfirmed = true);
|
||||
ImageSingleButtonWindowPrefab.ShowModalWindow();
|
||||
}
|
||||
[YarnCommand("EnableAndWaitForClosingUFImage")]
|
||||
|
||||
[YarnCommand("EnableAndWaitForClosingUFImage")]
|
||||
public IEnumerator EnableAndWaitForClosingUFImage()
|
||||
{
|
||||
bool isConfirmed = false;
|
||||
ImageSingleButtonWindowPrefab.IsConfirmButtonActive=true;
|
||||
ImageSingleButtonWindowPrefab.IsConfirmButtonActive = true;
|
||||
ImageSingleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
yield return new WaitUntil(() => isConfirmed);
|
||||
ImageSingleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user