分化屏幕dialog与对话框dialog
This commit is contained in:
7
Assets/Scripts/Dialog/BoxDialog.cs
Normal file
7
Assets/Scripts/Dialog/BoxDialog.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Dialog
|
||||
{
|
||||
public class BoxDialog
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Dialog/BoxDialog.cs.meta
Normal file
3
Assets/Scripts/Dialog/BoxDialog.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78f180e85e3a4ef095495b2760268559
|
||||
timeCreated: 1726626993
|
||||
@@ -13,8 +13,9 @@ namespace Data
|
||||
public readonly string Animation;
|
||||
public readonly string Character;
|
||||
public readonly string DialogEvent;
|
||||
public readonly string DialogEventArg;
|
||||
|
||||
public Dialog(int index, string content, string type, string animation, string character, string dialogEvent)
|
||||
public Dialog(int index, string content, string type, string animation, string character, string dialogEvent, string dialogEventArg)
|
||||
{
|
||||
Index = index;
|
||||
Content = content;
|
||||
@@ -22,6 +23,7 @@ namespace Data
|
||||
Animation = animation;
|
||||
Character = character;
|
||||
DialogEvent = dialogEvent;
|
||||
DialogEventArg = dialogEventArg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +60,6 @@ namespace Data
|
||||
private void LoadCsv(string path)
|
||||
{
|
||||
var lines = File.ReadAllLines(path);
|
||||
print(lines);
|
||||
for (var i = 1; i < lines.Length; i++)
|
||||
{
|
||||
var values = lines[i].Split(',');
|
||||
@@ -69,7 +70,8 @@ namespace Data
|
||||
values[2],
|
||||
values[3],
|
||||
values[4],
|
||||
values[5]
|
||||
values[5],
|
||||
values[6]
|
||||
);
|
||||
|
||||
_dialog.Add(dialog);
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Collections;
|
||||
using Data;
|
||||
using Dialog;
|
||||
using Event;
|
||||
using Event.EventArgs;
|
||||
using TMPro;
|
||||
@@ -20,7 +20,8 @@ namespace UI
|
||||
public float printTime;
|
||||
public float maxPrintTime=10;
|
||||
public bool isTime2Break;
|
||||
|
||||
private string _eventToBeExc;
|
||||
private string _eventArg;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
@@ -29,8 +30,12 @@ namespace UI
|
||||
if (printTime > maxPrintTime)
|
||||
{
|
||||
isTime2Break = true;
|
||||
StartCoroutine(Delay());
|
||||
}
|
||||
if (_currentText == introduceText)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_currentText == introduceText) return;
|
||||
_timer += Time.deltaTime;
|
||||
if (!(_timer >= typingSpeed)) return;
|
||||
_timer = 0f;
|
||||
@@ -38,7 +43,13 @@ namespace UI
|
||||
textMeshPro.text = _currentText;
|
||||
_currentIndex++;
|
||||
}
|
||||
|
||||
|
||||
// 沟槽的生命周期
|
||||
private IEnumerator Delay()
|
||||
{
|
||||
yield return new WaitForSeconds(1f);
|
||||
EventManager.Instance.DialogEventSwitch(_eventToBeExc,_eventArg);
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
EventManager.Instance.DialogPop += StartPrinting;
|
||||
@@ -73,13 +84,13 @@ namespace UI
|
||||
|
||||
private void StartPrinting(DialogPopArgs e)
|
||||
{
|
||||
if(!e.IsScreenDialog) 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;
|
||||
_eventToBeExc = DialogManager.Instance.GetDialogByIndex(e.Index).DialogEvent;
|
||||
_eventArg = DialogManager.Instance.GetDialogByIndex(e.Index).DialogEventArg;
|
||||
_currentIndex = 0;
|
||||
_timer = 0f;
|
||||
textMeshPro.fontSize = 80;
|
||||
Reference in New Issue
Block a user