chore: Assets 디렉토리 구조 정리 및 네이밍 컨벤션 적용
- 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>
This commit is contained in:
78
Assets/External/UI/InterfaceFantasyWarriorHUD/Samples/Scripts/SampleTimeLabel.cs
vendored
Normal file
78
Assets/External/UI/InterfaceFantasyWarriorHUD/Samples/Scripts/SampleTimeLabel.cs
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) 2024 Synty Studios Limited. All rights reserved.
|
||||
//
|
||||
// Use of this software is subject to the terms and conditions of the Synty Studios End User Licence Agreement (EULA)
|
||||
// available at: https://syntystore.com/pages/end-user-licence-agreement
|
||||
//
|
||||
// Sample scripts are included only as examples and are not intended as production-ready.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Synty.Interface.FantasyWarriorHUD.Samples
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple time label that displays the current time.
|
||||
/// </summary>
|
||||
public class SampleTimeLabel : MonoBehaviour
|
||||
{
|
||||
[Header("References")]
|
||||
public TMP_Text label;
|
||||
|
||||
[Header("Parameters")]
|
||||
public bool is24Hour = true;
|
||||
public float timeToRefreshInSeconds = 1;
|
||||
|
||||
private bool beat;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (label == null)
|
||||
{
|
||||
label = GetComponent<TMP_Text>();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
StartCoroutine(C_UpdateTime());
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
StopCoroutine(C_UpdateTime());
|
||||
}
|
||||
|
||||
public string GetCurrentTimeString()
|
||||
{
|
||||
if (!is24Hour)
|
||||
{
|
||||
return DateTime.Now.ToString("hh:mm tt");
|
||||
}
|
||||
|
||||
if (beat)
|
||||
{
|
||||
return DateTime.Now.ToString("HH<color=#AAAAAA>:</color>mm");
|
||||
}
|
||||
|
||||
return DateTime.Now.ToString("HH:mm");
|
||||
}
|
||||
|
||||
[ContextMenu("Update Time")]
|
||||
public void UpdateTime()
|
||||
{
|
||||
label.SetText(GetCurrentTimeString());
|
||||
}
|
||||
|
||||
private IEnumerator C_UpdateTime()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
UpdateTime();
|
||||
beat = !beat;
|
||||
yield return new WaitForSecondsRealtime(timeToRefreshInSeconds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user