컴퓨터 ui 완성

This commit is contained in:
dldydtn9755-crypto
2026-07-08 19:03:07 +09:00
parent fb64493648
commit 6e4ff9fcb4
29 changed files with 1541 additions and 151 deletions

View File

@@ -0,0 +1,46 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class HeartAffectionUI : MonoBehaviour
{
[Header("채워지는 하트 10개")]
public Image[] fillHearts;
[Header("퍼센트 텍스트")]
public TMP_Text percentText;
[Header("호감도")]
[Range(0, 100)]
public int affectionPercent = 0;
private void Start()
{
SetAffection(affectionPercent);
}
public void SetAffection(int percent)
{
affectionPercent = Mathf.Clamp(percent, 0, 100);
// 11% = 1.1개 하트
// 45% = 4.5개 하트
// 78% = 7.8개 하트
float heartValue = affectionPercent / 10f;
for (int i = 0; i < fillHearts.Length; i++)
{
fillHearts[i].fillAmount = Mathf.Clamp01(heartValue - i);
}
if (percentText != null)
{
percentText.text = affectionPercent + "%";
}
}
public void AddAffection(int amount)
{
SetAffection(affectionPercent + amount);
}
}

View File

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

View File

@@ -0,0 +1,41 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class MainProgressUI : MonoBehaviour
{
[Header("진행도 채움 이미지")]
public Image progressFill;
[Header("퍼센트 텍스트")]
public TMP_Text percentText;
[Header("메인 진행도")]
[Range(0, 100)]
public int progressPercent = 0;
private void Start()
{
SetProgress(progressPercent);
}
public void SetProgress(int percent)
{
progressPercent = Mathf.Clamp(percent, 0, 100);
if (progressFill != null)
{
progressFill.fillAmount = progressPercent / 100f;
}
if (percentText != null)
{
percentText.text = progressPercent + "%";
}
}
public void AddProgress(int amount)
{
SetProgress(progressPercent + amount);
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 035493732111afa4e907adcfcbbabb3c