From c049b4fbf6921abff929de09b45cfa71312e22ce Mon Sep 17 00:00:00 2001 From: HaeinLEE Date: Fri, 28 Mar 2025 15:20:59 +0900 Subject: [PATCH] =?UTF-8?q?[Refactor]=20=EC=8A=B9=EC=88=98=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=20=ED=95=A8=EC=88=98=20=EC=9D=B8=EC=9E=90=EC=99=80=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=ED=83=80=EC=9D=B4=EB=B0=8D=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RatingPointsController.cs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Assets/Script/UI/PanelChildController/RatingPointsController.cs b/Assets/Script/UI/PanelChildController/RatingPointsController.cs index 122b9bc..84967b8 100644 --- a/Assets/Script/UI/PanelChildController/RatingPointsController.cs +++ b/Assets/Script/UI/PanelChildController/RatingPointsController.cs @@ -26,7 +26,7 @@ public class RatingPointsController : MonoBehaviour /// /// /// - private void ChangeImageColor(GameObject imageOBject, Color32 color, Action callback = null) + private void ChangeImageColor(GameObject imageOBject, Color32 color) { Sequence sequence = DOTween.Sequence(); @@ -39,14 +39,14 @@ public class RatingPointsController : MonoBehaviour sequence.OnComplete(()=> { - callback?.Invoke(); + SetScoreCountText(); }); } public void InitRatingPoints(int oldScore,Enums.GameResult gameResult, int defaultRequiredScore) { // TODO: [인덱스계산 ㅇㅖ외처리 ] 계산한 값 절대값이 defaultRequiredScore보다 큰 경우 return. 근데 이런 값이 나온다는게 이미 계산 오류가 어디서 생긴 것이겠죠..? _oldScore = oldScore; - Sequence sequence = DOTween.Sequence(); + _oldRequiredScore = defaultRequiredScore; if (_oldScore == 0) { if (gameResult == Enums.GameResult.Win) @@ -110,32 +110,33 @@ public class RatingPointsController : MonoBehaviour _newRequiredScore = defaultRequiredScore-oldScore; } - SetScoreCountText(_newRequiredScore,defaultRequiredScore); + SetScoreCountText(); } /// /// 승급까지 남은 승수 계산 /// - /// 새로 업데이트 된 승급까지 필요한 승 수 - /// 해당 급수에서 0에서 승급까지 필요한 승수 - private void SetScoreCountText(int scoreCount,int defaultRequiredScore) + /// 새로 업데이트 된 승급까지 필요한 승 수 + /// 해당 급수에서 0에서 승급까지 필요한 승수 + private void SetScoreCountText() { // 남은 승리수가 0인 경우 승급점수 도달 혹은 강등점수 도달 - if (scoreCount == 0 || scoreCount == defaultRequiredScore * 2) + if (_newRequiredScore == 0 || _newRequiredScore == _oldRequiredScore * 2) { + //새로운 급수에 맞춰서 패널 초기화하기 scoreCountText.text = ""; } - else if (scoreCount < 0) + else if (_newRequiredScore < 0) { scoreCountText.text = "더 이상 승급 할 수 없습니다."; } - else if (scoreCount > defaultRequiredScore * 2) + else if (_newRequiredScore > _oldRequiredScore * 2) { scoreCountText.text = "더이상 강등 될 수 없습니다."; } else { - scoreCountText.text = $"{scoreCount} 게임을 승리하면 승급하게 됩니다."; + scoreCountText.text = $"{_newRequiredScore} 게임을 승리하면 승급하게 됩니다."; } }