diff --git a/Assets/Scripts/Project/UI/UI_Panel/UI_CustomSessionPanel.cs b/Assets/Scripts/Project/UI/UI_Panel/UI_CustomSessionPanel.cs index c11a7ee..5cf6953 100644 --- a/Assets/Scripts/Project/UI/UI_Panel/UI_CustomSessionPanel.cs +++ b/Assets/Scripts/Project/UI/UI_Panel/UI_CustomSessionPanel.cs @@ -9,8 +9,6 @@ public class UI_CustomSessionPanel : BasePanel { private string triggerID; public Action callBack; - private TextMeshProUGUI UItext; - private string fullText; private float typingSpeed = 0.05f; /// @@ -20,9 +18,9 @@ public class UI_CustomSessionPanel : BasePanel { this.triggerID = triggerID; callBack += _callBack; - GetControl("ClientText_DialogBox").text = clientTalk /*"好的"*/; - UItext = GetControl("ClientText_DialogBox"); - StartTypewriterEffect(); + //GetControl("ClientText_DialogBox").text = clientTalk /*"好的"*/; + //UItext = GetControl("ClientText_DialogBox"); + StartTypewriterEffect(clientTalk); } //} @@ -40,10 +38,10 @@ public class UI_CustomSessionPanel : BasePanel break; } } - void StartTypewriterEffect() + void StartTypewriterEffect(string msg) { // 使用DoTweençš„DOText方法实现打字机效果 - UItext.DOText(fullText, fullText.Length * typingSpeed) + GetControl("ClientText_DialogBox").DOText(msg, msg.Length * typingSpeed) .SetEase(Ease.Linear); } } diff --git a/Assets/Scripts/Project/UI/UI_Panel/UI_PlayerSessionPanel.cs b/Assets/Scripts/Project/UI/UI_Panel/UI_PlayerSessionPanel.cs index 3bee0d9..72f21b0 100644 --- a/Assets/Scripts/Project/UI/UI_Panel/UI_PlayerSessionPanel.cs +++ b/Assets/Scripts/Project/UI/UI_Panel/UI_PlayerSessionPanel.cs @@ -10,8 +10,6 @@ public class UI_PlayerSessionPanel : BasePanel { private string triggerID; public Action callBack; - private TextMeshProUGUI UItext; - private string fullText; private float typingSpeed = 0.05f; /// /// ³õʼ»¯,state 0 ¼¤»îÁíÒ»¸ö²Ù×÷ @@ -20,9 +18,9 @@ public class UI_PlayerSessionPanel : BasePanel { this.triggerID = triggerID; callBack += _callBack; - GetControl("PlayerText_DialogBox").text = clientTalk /*"ºÃµÄ"*/; - UItext = GetControl("PlayerText_DialogBox"); - StartTypewriterEffect(); + //GetControl("PlayerText_DialogBox").text = clientTalk /*"ºÃµÄ"*/; + //UItext = GetControl("PlayerText_DialogBox"); + StartTypewriterEffect(clientTalk); } //} @@ -40,10 +38,10 @@ public class UI_PlayerSessionPanel : BasePanel break; } } - void StartTypewriterEffect() + void StartTypewriterEffect(string msg) { // ʹÓÃDoTweenµÄDOText·½·¨ÊµÏÖ´ò×Ö»úЧ¹û - UItext.DOText(fullText, fullText.Length * typingSpeed) + GetControl("PlayerText_DialogBox").DOText(msg, msg.Length * typingSpeed) .SetEase(Ease.Linear); } }