Skip to content

Commit

Permalink
add copy button
Browse files Browse the repository at this point in the history
表示されているメッセージをワンクリックでコピーできるボタンを追加
  • Loading branch information
seibe authored Jan 24, 2023
1 parent aac4dac commit b407332
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Assets/uOSC/Editor/uOscServerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class uOscServerEditor : Editor
uOscServer server { get { return target as uOscServer; } }
Queue<Message> messages = new Queue<Message>();
Vector2 messageScrollPos = Vector2.zero;
System.Text.StringBuilder builder = new System.Text.StringBuilder();

void OnEnable()
{
Expand Down Expand Up @@ -101,13 +102,20 @@ void DrawStatus()

if (EditorUtil.SimpleFoldout("Messages", false))
{
builder.Clear();
EditorGUILayout.BeginVertical(GUILayout.MinHeight(200f));
messageScrollPos = EditorGUILayout.BeginScrollView(messageScrollPos, GUI.skin.box);
foreach (var msg in messages.Reverse())
{
GUILayout.Label(msg.ToString());
builder.AppendLine(msg.ToString());
}
var text = builder.ToString();
GUILayout.Label(text);
EditorGUILayout.EndScrollView();
if (GUILayout.Button("Copy"))
{
EditorGUIUtility.systemCopyBuffer = text;
}
EditorGUILayout.EndVertical();

Repaint();
Expand Down

0 comments on commit b407332

Please sign in to comment.