+事件连琐

+对话框分化完毕
+打包Resources文件夹
This commit is contained in:
2024-09-18 13:16:54 +08:00
parent 5e7e7bbb0e
commit d4a9b7e0a3
34 changed files with 2580 additions and 251 deletions

View File

@@ -1,11 +1,10 @@
using System.Collections;
using Dialog;
using Event;
using Event.EventArgs;
using TMPro;
using UnityEngine;
namespace UI
namespace Dialog
{
public class ScreenDialog : MonoBehaviour
{
@@ -18,7 +17,7 @@ namespace UI
private bool _isBlinking;
public TMP_Text textMeshPro;
public float printTime;
public float maxPrintTime=10;
public float maxPrintTime = 10;
public bool isTime2Break;
private string _eventToBeExc;
private string _eventArg;
@@ -32,10 +31,12 @@ namespace UI
isTime2Break = true;
StartCoroutine(Delay());
}
if (_currentText == introduceText)
{
return;
}
_timer += Time.deltaTime;
if (!(_timer >= typingSpeed)) return;
_timer = 0f;
@@ -48,8 +49,9 @@ namespace UI
private IEnumerator Delay()
{
yield return new WaitForSeconds(1f);
EventManager.Instance.DialogEventSwitch(_eventToBeExc,_eventArg);
EventManager.Instance.DialogEventSwitch(_eventToBeExc, _eventArg);
}
private void Start()
{
EventManager.Instance.DialogPop += StartPrinting;
@@ -68,6 +70,7 @@ namespace UI
textMeshPro.text = "+";
break;
}
if (!_isBlinking)
{
textMeshPro.text += "|";
@@ -78,14 +81,15 @@ namespace UI
textMeshPro.text = textMeshPro.text[..^1];
_isBlinking = false;
}
yield return new WaitForSeconds(0.3f);
}
}
private void StartPrinting(DialogPopArgs e)
{
if(!DialogManager.Instance.GetDialogByIndex(e.Index).Type.Equals("screen")) return;
if(printTime != 0) return;
if (!DialogManager.Instance.GetDialogByIndex(e.Index).Type.Equals("screen")) return;
if (printTime != 0) return;
_start = true;
_currentText = "";
introduceText = DialogManager.Instance.GetDialogByIndex(e.Index).Content;