From 2a845f0babe52ac324b3cbe294db7dcec9346042 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 22 十二月 2025 19:07:24 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts
---
Main/System/Chat/ChatBubbleBehaviour.cs | 58 +++++++++++++++-------------------------------------------
1 files changed, 15 insertions(+), 43 deletions(-)
diff --git a/Main/System/Chat/ChatBubbleBehaviour.cs b/Main/System/Chat/ChatBubbleBehaviour.cs
index 9178ac3..de1a523 100644
--- a/Main/System/Chat/ChatBubbleBehaviour.cs
+++ b/Main/System/Chat/ChatBubbleBehaviour.cs
@@ -37,21 +37,16 @@
Refresh();
}
- public void DisplayContent(string content, bool _left = false)
+ public void DisplayContent(string content)
{
if (m_Target == null)
{
return;
}
- left = _left;
m_PreferredWidth = true;
var richText = m_Target as RichText;
- if (richText != null && !left)
- {
- richText.AutoNewLine = false;
- }
m_Target.text = content;
-
+
if (richText != null)
{
richText.AutoNewLine = true;
@@ -157,50 +152,27 @@
rect.sizeDelta = sizeDelta;
}
- SetAnchor(m_Target.rectTransform);
+ if (m_Target.rectTransform.anchorMin != Vector2.up)
+ {
+ m_Target.rectTransform.anchorMin = Vector2.up;
+ }
+ if (m_Target.rectTransform.anchorMax != Vector2.up)
+ {
+ m_Target.rectTransform.anchorMax = Vector2.up;
+ }
+ if (m_Target.rectTransform.pivot != Vector2.up)
+ {
+ m_Target.rectTransform.pivot = Vector2.up;
+ }
float top = padding.top;
Vector2 position = Vector2.zero;
- position.x = left ? padding.left : -padding.right;
+ position.x = padding.left;
position.y = -top;
if (targetRect.anchoredPosition != position)
{
targetRect.anchoredPosition = position;
- }
- }
-
- void SetAnchor(RectTransform targetRect)
- {
- if (!left)
- {
- if (targetRect.anchorMin != Vector2.one)
- {
- targetRect.anchorMin = Vector2.one;
- }
- if (targetRect.anchorMax != Vector2.one)
- {
- targetRect.anchorMax = Vector2.one;
- }
- if (targetRect.pivot != Vector2.one)
- {
- targetRect.pivot = Vector2.one;
- }
- }
- else
- {
- if (targetRect.anchorMin != Vector2.up)
- {
- targetRect.anchorMin = Vector2.up;
- }
- if (targetRect.anchorMax != Vector2.up)
- {
- targetRect.anchorMax = Vector2.up;
- }
- if (targetRect.pivot != Vector2.up)
- {
- targetRect.pivot = Vector2.up;
- }
}
}
--
Gitblit v1.8.0