-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTalkPanelUI(P)
More file actions
52 lines (45 loc) Β· 1.25 KB
/
TalkPanelUI(P)
File metadata and controls
52 lines (45 loc) Β· 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UI : MonoBehaviour
{
public GameObject talkPanel;
public Text text;
private int clickCount = 0;
void Start()
{
if (talkPanel == null || text == null)
{
Debug.LogError("TalkPanel λλ Textκ° ν λΉλμ§ μμμ΅λλ€.");
}
}
void Update()
{
if (talkPanel.activeSelf && Input.GetMouseButtonDown(0))
{
if (clickCount == 0)
{
text.text = "μΉμ¦νΌμμ μ¬λ¦¬λΈ, νΌλ§ μΆκ°ν΄μ£ΌμΌ";
clickCount++; // 1
}
else
{
talkPanel.SetActive(false);
clickCount = 0;
}
Debug.Log(clickCount);
}
if (Input.GetKeyDown(KeyCode.Return)) // μν° ν€ μ
λ ₯ κ°μ§
{
talkPanel.SetActive(true);
text.text = "μ΄ νΌμλ μ΄μ μ κ»λλ€ ννν";
clickCount = 0;
Invoke("HideText", 1f); // 1μ΄ νμ HideText λ©μλ νΈμΆ
}
}
void HideText()
{
talkPanel.SetActive(false); // ν¨λ λΉνμ±ν
}
}