UI工具翻新
1. 增加UI工具 2. 增加设置页面 3. GameLoop更新 4. 导入ActionKit工具
This commit is contained in:
@@ -9,10 +9,6 @@ using AibisDream.Kit;
|
||||
public class WindowManager : MonoBehaviour
|
||||
{
|
||||
public static WindowManager Instance { get; private set; }
|
||||
|
||||
[Header("Window Prefabs")] public ModalWindow singleButtonWindowPrefab;
|
||||
|
||||
public ModalWindow ImageSingleButtonWindowPrefab;
|
||||
public ModalWindowProgressBar progressWindowPrefab;
|
||||
|
||||
private GameObject currentWindow;
|
||||
@@ -28,43 +24,7 @@ public class WindowManager : MonoBehaviour
|
||||
Instance = this;
|
||||
DontDestroyOnLoad(gameObject); // 如果需要全局保留
|
||||
}
|
||||
[YarnCommand("OpenSingleButtonWindow")]
|
||||
public IEnumerator OpenSingleButtonWindow(string title, string description, bool ispanelActive = true)
|
||||
{
|
||||
AudioManager.Instance.PlaySfx("event:/Scriptal/Ui");
|
||||
bool isConfirmed = false;
|
||||
singleButtonWindowPrefab.transform.GetChild(0).gameObject.SetActive(ispanelActive);
|
||||
|
||||
singleButtonWindowPrefab.TitleValue = title;
|
||||
singleButtonWindowPrefab.DescriptionValue = description;
|
||||
singleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
|
||||
singleButtonWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 等待用户确认
|
||||
yield return new WaitUntil(() => isConfirmed);
|
||||
|
||||
singleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
|
||||
[YarnCommand("OpenMutiSingleButtonWindow")]
|
||||
public IEnumerator OpenMutiSingleButtonWindow(string title, string description, int number)
|
||||
{
|
||||
AudioManager.Instance.PlaySfx("event:/Scriptal/Ui");
|
||||
bool isConfirmed = false;
|
||||
singleButtonWindowPrefab.transform.GetChild(0).gameObject.SetActive(false);
|
||||
|
||||
singleButtonWindowPrefab.TitleValue = title;
|
||||
singleButtonWindowPrefab.DescriptionValue = description;
|
||||
singleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
|
||||
singleButtonWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 等待用户确认
|
||||
yield return new WaitUntil(() => isConfirmed);
|
||||
|
||||
singleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
[YarnCommand("OpenProgressWindow")]
|
||||
public IEnumerator OpenProgressWindow(string title, string description, float duration)
|
||||
{
|
||||
@@ -87,7 +47,8 @@ public class WindowManager : MonoBehaviour
|
||||
progressWindowPrefab.ShowModalWindow();
|
||||
|
||||
// 获取 moveText 的 RectTransform
|
||||
RectTransform moveTextRect = progressWindowPrefab.transform.Find("View/mask/moveText")?.GetComponent<RectTransform>();
|
||||
RectTransform moveTextRect =
|
||||
progressWindowPrefab.transform.Find("View/mask/moveText")?.GetComponent<RectTransform>();
|
||||
if (moveTextRect != null)
|
||||
{
|
||||
moveTextRect.DOAnchorPosY(330f, duration).SetEase(Ease.Linear);
|
||||
@@ -97,29 +58,5 @@ public class WindowManager : MonoBehaviour
|
||||
yield return new WaitUntil(() => currentProgress >= 100);
|
||||
progressWindowPrefab.HideModalWindow();
|
||||
moveTextRect.DOAnchorPosY(-611f, 0.1f).SetEase(Ease.Linear);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[YarnCommand("OpenImageWindow_UFImage")]
|
||||
public void OpenImageSingleButtonWindowPrefab(string title, string imageName)
|
||||
{
|
||||
//bool isConfirmed = false;
|
||||
ImageSingleButtonWindowPrefab.IsConfirmButtonActive = false;
|
||||
ImageSingleButtonWindowPrefab.TitleValue = title;
|
||||
ImageSingleButtonWindowPrefab.ImageValue = Resources.Load<Sprite>("Art/Photos/" + imageName);
|
||||
ImageSingleButtonWindowPrefab.DescriptionValue = "";
|
||||
//progressWindowPrefab.OnFinish.AddListener(() => isConfirmed = true);
|
||||
ImageSingleButtonWindowPrefab.ShowModalWindow();
|
||||
}
|
||||
|
||||
[YarnCommand("EnableAndWaitForClosingUFImage")]
|
||||
public IEnumerator EnableAndWaitForClosingUFImage()
|
||||
{
|
||||
bool isConfirmed = false;
|
||||
ImageSingleButtonWindowPrefab.IsConfirmButtonActive = true;
|
||||
ImageSingleButtonWindowPrefab.OnConfirm.AddListener(() => isConfirmed = true);
|
||||
yield return new WaitUntil(() => isConfirmed);
|
||||
ImageSingleButtonWindowPrefab.OnConfirm.RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user