From 774917fd5e574f64b87e1ebcdc4e3ddbad02a4d4 Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Tue, 18 Mar 2025 13:54:32 +0900 Subject: [PATCH] =?UTF-8?q?[Style]=20=ED=99=95=EC=9D=B8=EC=9A=A9=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=82=AD=EC=A0=9C,=20ReplayCell=20SetReco?= =?UTF-8?q?rdDate=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Script/Game/GameManager.cs | 1 - Assets/Script/Replay/ReplayCell.cs | 29 +++++++++++++++++++++++------ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Assets/Script/Game/GameManager.cs b/Assets/Script/Game/GameManager.cs index 982dd2d..c3fff17 100644 --- a/Assets/Script/Game/GameManager.cs +++ b/Assets/Script/Game/GameManager.cs @@ -62,7 +62,6 @@ public class GameManager : Singleton UpdateMainPanelUI(OpenMainPanel); // ScoreData.SetScore(userInfo.score); OpenConfirmPanel(userInfo.nickname + "님 로그인 성공하였습니다.", () => { }); - Debug.Log(userInfo.nickname); }, () => { Debug.Log("자동 로그인 실패"); diff --git a/Assets/Script/Replay/ReplayCell.cs b/Assets/Script/Replay/ReplayCell.cs index a69f08c..2701543 100644 --- a/Assets/Script/Replay/ReplayCell.cs +++ b/Assets/Script/Replay/ReplayCell.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Text; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -45,16 +46,32 @@ public class ReplayCell : MonoBehaviour public void SetRecordDate(string date) { - string text = ""; + if (string.IsNullOrEmpty(date)) + { + // 입력이 비어있거나 null인 경우 예외 처리 + recordDateText.text = "Invalid Date Format"; + return; + } + string[] dateSplit = date.Split(' '); if (dateSplit.Length == 2) { - text += dateSplit[0].Replace("-", "."); - text += "\n"; - text += dateSplit[1].Replace("_", ":"); - } + StringBuilder text = new StringBuilder(); + + // 첫 번째 부분 (날짜) - "-"을 "."으로 교체 + text.Append(dateSplit[0].Replace("-", ".")); + text.Append("\n"); + + // 두 번째 부분 (시간) - "_"을 ":"으로 교체 + text.Append(dateSplit[1].Replace("_", ":")); - recordDateText.text = text; + recordDateText.text = text.ToString(); + } + else + { + // 잘못된 포맷 처리 + recordDateText.text = "Invalid Date Format"; + } } public void SetReplayRecord(ReplayRecord record)