- Assets/_Game/ 하위로 게임 에셋 통합 - External/ 패키지 벤더별 분류 (Synty, Animations, UI) - 에셋 네이밍 컨벤션 확립 및 적용 (Data_Skill_, Data_SkillEffect_, Prefab_, Anim_, Model_, BT_ 등) - pre-commit hook으로 네이밍 컨벤션 자동 검사 추가 - RESTRUCTURE_CHECKLIST.md 작성 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
|
|
public class ChatController : MonoBehaviour {
|
|
|
|
|
|
public TMP_InputField ChatInputField;
|
|
|
|
public TMP_Text ChatDisplayOutput;
|
|
|
|
public Scrollbar ChatScrollbar;
|
|
|
|
void OnEnable()
|
|
{
|
|
ChatInputField.onSubmit.AddListener(AddToChatOutput);
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
ChatInputField.onSubmit.RemoveListener(AddToChatOutput);
|
|
}
|
|
|
|
|
|
void AddToChatOutput(string newText)
|
|
{
|
|
// Clear Input Field
|
|
ChatInputField.text = string.Empty;
|
|
|
|
var timeNow = System.DateTime.Now;
|
|
|
|
string formattedInput = "[<#FFFF80>" + timeNow.Hour.ToString("d2") + ":" + timeNow.Minute.ToString("d2") + ":" + timeNow.Second.ToString("d2") + "</color>] " + newText;
|
|
|
|
if (ChatDisplayOutput != null)
|
|
{
|
|
// No special formatting for first entry
|
|
// Add line feed before each subsequent entries
|
|
if (ChatDisplayOutput.text == string.Empty)
|
|
ChatDisplayOutput.text = formattedInput;
|
|
else
|
|
ChatDisplayOutput.text += "\n" + formattedInput;
|
|
}
|
|
|
|
// Keep Chat input field active
|
|
ChatInputField.ActivateInputField();
|
|
|
|
// Set the scrollbar to the bottom when next text is submitted.
|
|
ChatScrollbar.value = 0;
|
|
}
|
|
|
|
}
|