채팅 관련 처리

This commit is contained in:
Ino 2025-09-27 17:41:58 +09:00
parent c28dd6d3f0
commit 668e44d43c
7 changed files with 111 additions and 4 deletions

View File

@ -1 +1 @@
4
5

View File

@ -35585,6 +35585,7 @@ MonoBehaviour:
texts:
- {fileID: 833058661}
- {fileID: 98606680}
- {fileID: 0}
m_ScrollRect: {fileID: 1355353690}
tf_parent: {fileID: 1201734846}
go_chatGirlCard: {fileID: 6396360707933695324, guid: 478c75190a3751c4c8509f0365630070, type: 3}
@ -39814,6 +39815,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1109820679}
- component: {fileID: 1109820683}
- component: {fileID: 1109820682}
- component: {fileID: 1109820681}
- component: {fileID: 1109820680}
@ -39926,7 +39928,19 @@ MonoBehaviour:
m_Calls: []
m_OnDeselect:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1014475707}
m_TargetAssemblyTypeName: ChatUI, Assembly-CSharp
m_MethodName: OnInputDeSelected
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_OnTextSelection:
m_PersistentCalls:
m_Calls: []
@ -39935,7 +39949,19 @@ MonoBehaviour:
m_Calls: []
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1014475707}
m_TargetAssemblyTypeName: ChatUI, Assembly-CSharp
m_MethodName: OnInputChangeValue
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_OnTouchScreenKeyboardStatusChanged:
m_PersistentCalls:
m_Calls: []
@ -39995,6 +40021,21 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1109820678}
m_CullTransparentMesh: 1
--- !u!114 &1109820683
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1109820678}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e5497f1d3a4f3224fa357c49ec14d753, type: 3}
m_Name:
m_EditorClassIdentifier:
inputField: {fileID: 1109820680}
canvasRect: {fileID: 456601672}
keyboardHeightRatio: 0.4
--- !u!1 &1112533209
GameObject:
m_ObjectHideFlags: 0

View File

@ -35,6 +35,8 @@ public class ChatUI : MonoBehaviour
if (chatdata != null)
for (int i = 0; i < chatdata.histories.Count; i++)
Set_Chat(chatdata.histories[i]);
else
Make_Today();
}
void Set_Money() { texts[1].text = SaveMgr.Ins.Get_Money(eMoney.Chat).ToString(); }
@ -46,6 +48,10 @@ public class ChatUI : MonoBehaviour
void Set_Chat(ChatHistory chat)
{
DateTime dt = DateTime.Parse(chat.timestamp);
if (dt.Day != InternetTime.Ins.Time.Day)
Make_Today();
if (chat.role.Equals("assistant"))
{
var chatscript = DSUtil.Get_Clone<ChatGirlCard>(go_chatGirlCard, tf_parent);
@ -63,6 +69,11 @@ public class ChatUI : MonoBehaviour
Invoke("Set_ScrollEnd", Time.deltaTime * 5f);
}
void Make_Today()
{
list_chat.Add(DSUtil.Get_Clone(go_dayCard, tf_parent));
}
void Set_ScrollEnd()
{
m_ScrollRect.verticalNormalizedPosition = 0;

View File

@ -1,3 +1,4 @@
using OneStore.Common; // 지우면 안됨
using System.Collections;
using TMPro;
using UnityEngine;
@ -17,7 +18,12 @@ public class TitleInfo : MonoBehaviour
IEnumerator Start()
{
t_ver.text = DSUtil.Format("{0}({1})", Application.version, "E or G or O");
t_ver.text = Application.version;
#if UNITY_EDITOR
t_ver.text += "(E)";
#else
t_ver.text += StoreEnvironment.GetStoreType() == StoreType.ONESTORE ? "(O)" : "(G)";
#endif
label_msg.text = "게임 데이터를 읽고 있습니다.";
// 테이블 로딩 기다리기

View File

@ -0,0 +1,47 @@
using UnityEngine;
using TMPro;
public class MobileKeyboardHandlerBottomPivot : MonoBehaviour
{
public TMP_InputField inputField;
public RectTransform canvasRect;
private Vector2 originalAnchoredPos;
private RectTransform inputRect;
[Range(0.2f, 0.5f)]
public float keyboardHeightRatio = 0.35f;
void Awake()
{
inputRect = inputField.GetComponent<RectTransform>();
originalAnchoredPos = inputRect.anchoredPosition;
inputField.onSelect.AddListener(OnInputSelected);
inputField.onDeselect.AddListener(OnInputDeselected);
}
void OnInputSelected(string text)
{
StartCoroutine(MoveInputAboveKeyboard());
}
void OnInputDeselected(string text)
{
// 원래 자리로 복원
inputRect.anchoredPosition = originalAnchoredPos;
}
System.Collections.IEnumerator MoveInputAboveKeyboard()
{
// 키보드가 뜨는 동안 잠시 대기
yield return new WaitForSeconds(0.1f);
float canvasHeight = canvasRect.rect.height;
float estimatedKeyboardHeight = canvasHeight * keyboardHeightRatio;
Vector2 newPos = inputRect.anchoredPosition;
newPos.y = estimatedKeyboardHeight + inputRect.rect.height + 10; // 10px 여유
inputRect.anchoredPosition = newPos;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e5497f1d3a4f3224fa357c49ec14d753