This commit is contained in:
parent
7c296885b4
commit
6e3ba07fe0
|
@ -9,8 +9,6 @@ public class UI_CustomSessionPanel : BasePanel
|
||||||
{
|
{
|
||||||
private string triggerID;
|
private string triggerID;
|
||||||
public Action<string> callBack;
|
public Action<string> callBack;
|
||||||
private TextMeshProUGUI UItext;
|
|
||||||
private string fullText;
|
|
||||||
private float typingSpeed = 0.05f;
|
private float typingSpeed = 0.05f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -20,9 +18,9 @@ public class UI_CustomSessionPanel : BasePanel
|
||||||
{
|
{
|
||||||
this.triggerID = triggerID;
|
this.triggerID = triggerID;
|
||||||
callBack += _callBack;
|
callBack += _callBack;
|
||||||
GetControl<TextMeshProUGUI>("ClientText_DialogBox").text = clientTalk /*"好的"*/;
|
//GetControl<TextMeshProUGUI>("ClientText_DialogBox").text = clientTalk /*"好的"*/;
|
||||||
UItext = GetControl<TextMeshProUGUI>("ClientText_DialogBox");
|
//UItext = GetControl<TextMeshProUGUI>("ClientText_DialogBox");
|
||||||
StartTypewriterEffect();
|
StartTypewriterEffect(clientTalk);
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
@ -40,10 +38,10 @@ public class UI_CustomSessionPanel : BasePanel
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void StartTypewriterEffect()
|
void StartTypewriterEffect(string msg)
|
||||||
{
|
{
|
||||||
// 使用DoTween的DOText方法实现打字机效果
|
// 使用DoTween的DOText方法实现打字机效果
|
||||||
UItext.DOText(fullText, fullText.Length * typingSpeed)
|
GetControl<TextMeshProUGUI>("ClientText_DialogBox").DOText(msg, msg.Length * typingSpeed)
|
||||||
.SetEase(Ease.Linear);
|
.SetEase(Ease.Linear);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@ public class UI_PlayerSessionPanel : BasePanel
|
||||||
{
|
{
|
||||||
private string triggerID;
|
private string triggerID;
|
||||||
public Action<string> callBack;
|
public Action<string> callBack;
|
||||||
private TextMeshProUGUI UItext;
|
|
||||||
private string fullText;
|
|
||||||
private float typingSpeed = 0.05f;
|
private float typingSpeed = 0.05f;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化,state 0 激活另一个操作
|
/// 初始化,state 0 激活另一个操作
|
||||||
|
@ -20,9 +18,9 @@ public class UI_PlayerSessionPanel : BasePanel
|
||||||
{
|
{
|
||||||
this.triggerID = triggerID;
|
this.triggerID = triggerID;
|
||||||
callBack += _callBack;
|
callBack += _callBack;
|
||||||
GetControl<TextMeshProUGUI>("PlayerText_DialogBox").text = clientTalk /*"ºÃµÄ"*/;
|
//GetControl<TextMeshProUGUI>("PlayerText_DialogBox").text = clientTalk /*"ºÃµÄ"*/;
|
||||||
UItext = GetControl<TextMeshProUGUI>("PlayerText_DialogBox");
|
//UItext = GetControl<TextMeshProUGUI>("PlayerText_DialogBox");
|
||||||
StartTypewriterEffect();
|
StartTypewriterEffect(clientTalk);
|
||||||
}
|
}
|
||||||
|
|
||||||
//}
|
//}
|
||||||
|
@ -40,10 +38,10 @@ public class UI_PlayerSessionPanel : BasePanel
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void StartTypewriterEffect()
|
void StartTypewriterEffect(string msg)
|
||||||
{
|
{
|
||||||
// 使用DoTween的DOText方法实现打字机效果
|
// 使用DoTween的DOText方法实现打字机效果
|
||||||
UItext.DOText(fullText, fullText.Length * typingSpeed)
|
GetControl<TextMeshProUGUI>("PlayerText_DialogBox").DOText(msg, msg.Length * typingSpeed)
|
||||||
.SetEase(Ease.Linear);
|
.SetEase(Ease.Linear);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue