parent
a7245dd97a
commit
ffdc2a8cf9
113
Assets/ChatWindowController.cs
Normal file
113
Assets/ChatWindowController.cs
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class ChatWindowController : MonoBehaviour, IPointerClickHandler
|
||||||
|
{
|
||||||
|
[SerializeField] private TMP_Text chatText;
|
||||||
|
[SerializeField] private Image clickIndicator;
|
||||||
|
|
||||||
|
private Coroutine _typingCoroutine;
|
||||||
|
private Coroutine _clickCoroutine;
|
||||||
|
private string _inputText;
|
||||||
|
private Queue<string> _inputQueue;
|
||||||
|
|
||||||
|
public delegate void OnComplete();
|
||||||
|
public OnComplete onComplete;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
Init("마무리", () =>
|
||||||
|
{
|
||||||
|
Debug.Log("대화 끝.");
|
||||||
|
});
|
||||||
|
ShowText(_inputQueue.Dequeue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Init(string text, OnComplete onComplete)
|
||||||
|
{
|
||||||
|
_inputQueue = new Queue<string>();
|
||||||
|
_inputQueue.Enqueue("아 망했어 오늘도 지각이다!!!! 이러면 진짜 해고당할 수도 있어!!!\n어떡하지 큰일이다!!!");
|
||||||
|
_inputQueue.Enqueue("톼사하셈 ㅋ");
|
||||||
|
_inputQueue.Enqueue("톼사하셈 ㅋ");
|
||||||
|
_inputQueue.Enqueue("스킵도 가능 톼사하셈 ㅋ톼사하셈 ㅋ톼사하셈 ㅋ톼사하셈 ㅋ톼사하셈 ㅋ");
|
||||||
|
_inputQueue.Enqueue(text);
|
||||||
|
this.onComplete = onComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
//화면에 표시할 텍스트 삽입 함수
|
||||||
|
private void ShowText(string text)
|
||||||
|
{
|
||||||
|
var clickIndicatorColor = clickIndicator.color;
|
||||||
|
clickIndicatorColor.a = 1;
|
||||||
|
clickIndicator.color = clickIndicatorColor;
|
||||||
|
_inputText = text;
|
||||||
|
if (_typingCoroutine != null)
|
||||||
|
{
|
||||||
|
StopCoroutine(_typingCoroutine);
|
||||||
|
}
|
||||||
|
_typingCoroutine = StartCoroutine(TypingEffectCoroutine(_inputText));
|
||||||
|
}
|
||||||
|
|
||||||
|
//텍스트 타이핑효과 코루틴
|
||||||
|
private IEnumerator TypingEffectCoroutine(string text)
|
||||||
|
{
|
||||||
|
StringBuilder strText = new StringBuilder();
|
||||||
|
for (int i = 0; i < text.Length; i++)
|
||||||
|
{
|
||||||
|
strText.Append(text[i]);
|
||||||
|
chatText.text = strText.ToString();
|
||||||
|
yield return new WaitForSeconds(0.1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
_clickCoroutine = StartCoroutine(ClickIndicatorCoroutine());
|
||||||
|
_typingCoroutine = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator ClickIndicatorCoroutine()
|
||||||
|
{
|
||||||
|
bool flag = true;
|
||||||
|
var clickIndicatorColor = clickIndicator.color;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
clickIndicatorColor.a = flag? 0:1;
|
||||||
|
flag = !flag;
|
||||||
|
clickIndicator.color = clickIndicatorColor;
|
||||||
|
yield return new WaitForSeconds(0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//대화창 클릭 시 호출 함수
|
||||||
|
public void OnPointerClick(PointerEventData eventData)
|
||||||
|
{
|
||||||
|
if (_typingCoroutine != null)
|
||||||
|
{
|
||||||
|
StopCoroutine(_typingCoroutine);
|
||||||
|
_typingCoroutine = null;
|
||||||
|
chatText.text = _inputText;
|
||||||
|
_clickCoroutine = StartCoroutine(ClickIndicatorCoroutine());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_clickCoroutine != null)
|
||||||
|
{
|
||||||
|
StopCoroutine(_clickCoroutine);
|
||||||
|
_clickCoroutine = null;
|
||||||
|
}
|
||||||
|
if (_inputQueue.Count > 0)
|
||||||
|
{
|
||||||
|
ShowText(_inputQueue.Dequeue());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onComplete?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
Assets/ChatWindowController.cs.meta
Normal file
11
Assets/ChatWindowController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c6d08eed775f1044ea141c88554ab445
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because one or more lines are too long
BIN
Assets/LYM/Materials/Glass.mat
(Stored with Git LFS)
BIN
Assets/LYM/Materials/Glass.mat
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/Scenes/HousingUI.unity
(Stored with Git LFS)
BIN
Assets/LYM/Scenes/HousingUI.unity
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/LYM/UIPrefabs/ChatWindowPanel.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/LYM/UIPrefabs/ChatWindowPanel.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/LYM/UIPrefabs/ChatWindowPanel.prefab.meta
Normal file
7
Assets/LYM/UIPrefabs/ChatWindowPanel.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 05278c285f7049e49a69778586eb6744
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.ai.navigation": "1.1.5",
|
|
||||||
"com.unity.2d.animation": "9.1.3",
|
"com.unity.2d.animation": "9.1.3",
|
||||||
"com.unity.2d.sprite": "1.0.0",
|
"com.unity.2d.sprite": "1.0.0",
|
||||||
"com.unity.2d.spriteshape": "9.0.5",
|
"com.unity.2d.spriteshape": "9.0.5",
|
||||||
|
"com.unity.ai.navigation": "1.1.5",
|
||||||
"com.unity.collab-proxy": "2.7.1",
|
"com.unity.collab-proxy": "2.7.1",
|
||||||
"com.unity.ide.rider": "3.0.34",
|
"com.unity.ide.rider": "3.0.34",
|
||||||
"com.unity.ide.visualstudio": "2.0.22",
|
"com.unity.ide.visualstudio": "2.0.22",
|
||||||
"com.unity.ide.vscode": "1.2.5",
|
"com.unity.ide.vscode": "1.2.5",
|
||||||
"com.unity.nuget.newtonsoft-json": "3.2.1",
|
"com.unity.nuget.newtonsoft-json": "3.2.1",
|
||||||
"com.unity.postprocessing": "3.4.0",
|
"com.unity.postprocessing": "3.4.0",
|
||||||
|
"com.unity.recorder": "4.0.3",
|
||||||
"com.unity.render-pipelines.universal": "14.0.12",
|
"com.unity.render-pipelines.universal": "14.0.12",
|
||||||
"com.unity.test-framework": "1.1.33",
|
"com.unity.test-framework": "1.1.33",
|
||||||
"com.unity.textmeshpro": "3.0.7",
|
"com.unity.textmeshpro": "3.0.7",
|
||||||
|
@ -134,6 +134,15 @@
|
|||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
|
"com.unity.recorder": {
|
||||||
|
"version": "4.0.3",
|
||||||
|
"depth": 0,
|
||||||
|
"source": "registry",
|
||||||
|
"dependencies": {
|
||||||
|
"com.unity.timeline": "1.0.0"
|
||||||
|
},
|
||||||
|
"url": "https://packages.unity.com"
|
||||||
|
},
|
||||||
"com.unity.render-pipelines.core": {
|
"com.unity.render-pipelines.core": {
|
||||||
"version": "14.0.12",
|
"version": "14.0.12",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
|
@ -3,33 +3,45 @@
|
|||||||
--- !u!159 &1
|
--- !u!159 &1
|
||||||
EditorSettings:
|
EditorSettings:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 9
|
serializedVersion: 12
|
||||||
m_ExternalVersionControlSupport: Visible Meta Files
|
|
||||||
m_SerializationMode: 2
|
m_SerializationMode: 2
|
||||||
m_LineEndingsForNewScripts: 2
|
m_LineEndingsForNewScripts: 2
|
||||||
m_DefaultBehaviorMode: 0
|
m_DefaultBehaviorMode: 0
|
||||||
m_PrefabRegularEnvironment: {fileID: 0}
|
m_PrefabRegularEnvironment: {fileID: 0}
|
||||||
m_PrefabUIEnvironment: {fileID: 0}
|
m_PrefabUIEnvironment: {fileID: 0}
|
||||||
m_SpritePackerMode: 0
|
m_SpritePackerMode: 0
|
||||||
|
m_SpritePackerCacheSize: 10
|
||||||
m_SpritePackerPaddingPower: 1
|
m_SpritePackerPaddingPower: 1
|
||||||
|
m_Bc7TextureCompressor: 0
|
||||||
m_EtcTextureCompressorBehavior: 1
|
m_EtcTextureCompressorBehavior: 1
|
||||||
m_EtcTextureFastCompressor: 1
|
m_EtcTextureFastCompressor: 1
|
||||||
m_EtcTextureNormalCompressor: 2
|
m_EtcTextureNormalCompressor: 2
|
||||||
m_EtcTextureBestCompressor: 4
|
m_EtcTextureBestCompressor: 4
|
||||||
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp
|
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp
|
||||||
m_ProjectGenerationRootNamespace:
|
m_ProjectGenerationRootNamespace:
|
||||||
m_CollabEditorSettings:
|
|
||||||
inProgressEnabled: 1
|
|
||||||
m_EnableTextureStreamingInEditMode: 1
|
m_EnableTextureStreamingInEditMode: 1
|
||||||
m_EnableTextureStreamingInPlayMode: 1
|
m_EnableTextureStreamingInPlayMode: 1
|
||||||
|
m_EnableEditorAsyncCPUTextureLoading: 0
|
||||||
m_AsyncShaderCompilation: 1
|
m_AsyncShaderCompilation: 1
|
||||||
|
m_PrefabModeAllowAutoSave: 1
|
||||||
m_EnterPlayModeOptionsEnabled: 0
|
m_EnterPlayModeOptionsEnabled: 0
|
||||||
m_EnterPlayModeOptions: 3
|
m_EnterPlayModeOptions: 3
|
||||||
m_ShowLightmapResolutionOverlay: 1
|
m_GameObjectNamingDigits: 1
|
||||||
|
m_GameObjectNamingScheme: 0
|
||||||
|
m_AssetNamingUsesSpace: 1
|
||||||
|
m_InspectorUseIMGUIDefaultInspector: 0
|
||||||
m_UseLegacyProbeSampleCount: 0
|
m_UseLegacyProbeSampleCount: 0
|
||||||
|
m_SerializeInlineMappingsOnOneLine: 0
|
||||||
|
m_DisableCookiesInLightmapper: 1
|
||||||
m_AssetPipelineMode: 1
|
m_AssetPipelineMode: 1
|
||||||
|
m_RefreshImportMode: 0
|
||||||
m_CacheServerMode: 0
|
m_CacheServerMode: 0
|
||||||
m_CacheServerEndpoint:
|
m_CacheServerEndpoint:
|
||||||
m_CacheServerNamespacePrefix: default
|
m_CacheServerNamespacePrefix: default
|
||||||
m_CacheServerEnableDownload: 1
|
m_CacheServerEnableDownload: 1
|
||||||
m_CacheServerEnableUpload: 1
|
m_CacheServerEnableUpload: 1
|
||||||
|
m_CacheServerEnableAuth: 0
|
||||||
|
m_CacheServerEnableTls: 0
|
||||||
|
m_CacheServerValidationMode: 2
|
||||||
|
m_CacheServerDownloadBatchSize: 128
|
||||||
|
m_EnableEnlightenBakedGI: 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user