diff --git a/Assets/Resources/Prefabs/Panels/Main Panel.prefab b/Assets/Resources/Prefabs/Panels/Main Panel.prefab index ca0fdef..de8b421 100644 --- a/Assets/Resources/Prefabs/Panels/Main Panel.prefab +++ b/Assets/Resources/Prefabs/Panels/Main Panel.prefab @@ -1104,7 +1104,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "18\uAE09" + m_text: "1\uAE09" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2} m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2} @@ -1713,7 +1713,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "\uD654\uB791\uB098\uBE44" + m_text: "\uD14C\uC2A4\uD2B8\uC0BC\uBC88" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2} m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2} diff --git a/Assets/Script/Main/MainPanelManager.cs b/Assets/Script/Main/MainPanelManager.cs index 29b2ea6..e95aa0e 100644 --- a/Assets/Script/Main/MainPanelManager.cs +++ b/Assets/Script/Main/MainPanelManager.cs @@ -45,6 +45,8 @@ public class MainPanelManager : MonoBehaviour // GameManager.Instance.panelManager.OpenConfirmPanel(userInfo.nickname + "님" + "\n" + "자동 로그인 되었습니다", () => { }); loadingPanelController.StopLoading(); + //TODO: 테스트용 승급패널 오픈 + GameManager.Instance.panelManager.OpenRatingPanel(Enums.GameResult.Win); }, () => { Debug.Log("자동 로그인 실패"); diff --git a/Assets/Script/UI/PanelChildController/RatingPointsController.cs b/Assets/Script/UI/PanelChildController/RatingPointsController.cs index 6b038e1..2c2bd8e 100644 --- a/Assets/Script/UI/PanelChildController/RatingPointsController.cs +++ b/Assets/Script/UI/PanelChildController/RatingPointsController.cs @@ -146,6 +146,24 @@ public class RatingPointsController : MonoBehaviour scoreCountText.text = $"{scoreCount} 게임을 승리하면 승급하게 됩니다."; } } + + public void SetRatingUpLimit(int winCount) + { + for (int i = 0; i < 10; i++) + { + plusImage[i].GetComponent().color = _plusColor; + scoreCountText.text = $"더 이상 승급 할 수 없습니다.\n누적 {winCount} 승 하셨습니다."; + } + } + + public void SetRatingDownLimit(int loseCount) + { + for (int i = 0; i < 3; i++) + { + minusImages[i].GetComponent().color = _minusColor; + scoreCountText.text = $"더 이상 강등 될 수 없습니다.\n누적 {loseCount*-1} 패 하셨습니다."; + } + } //승급, 강등시 패널을 초기화해서 띄워주는 함수 추가 } diff --git a/Assets/Script/UI/PanelController/RatingPanelController.cs b/Assets/Script/UI/PanelController/RatingPanelController.cs index c382cc7..9208b3d 100644 --- a/Assets/Script/UI/PanelController/RatingPanelController.cs +++ b/Assets/Script/UI/PanelController/RatingPanelController.cs @@ -70,13 +70,38 @@ public class RatingPanelController : PanelController NetworkManager.Instance.GetInfo((userInfo) => { _oldScore = userInfo.score; - // TODO: oldscore가 더이상 강등될 수 없는 상태, 더이상 승급할 수 없는 상태임을 체크해서 더이상 ~할 수 없습니다. 처리하기 - if (_myRating == 1 && userInfo.score >= requiredScore ) + // 1급이고 이미 10승 이상인 경우 + //TODO: IF문 줄일 수 있을 것 같은데 머리가 안돕니다. .. + if (_myRating == 1 && userInfo.score >= 10 ) { - + // 10승에서 패배한 경우 점수 잃는 애니메이션 + if (gameResult == Enums.GameResult.Lose && userInfo.score == 10) + { + _ratingPointsController.InitRatingPoints(_oldScore,_gameResult,requiredScore); + } + else + { + if(gameResult == Enums.GameResult.Lose) + _ratingPointsController.SetRatingUpLimit(_oldScore-1); + else + _ratingPointsController.SetRatingUpLimit(_oldScore+1); + } } - else if (_myRating == 18 && userInfo.score <= requiredScore*2) + // 18급이고 이미 3패 이상인 경우 + else if (_myRating == 18 && userInfo.score <= -3) { + //3승에서 승리한 경우 점수 얻는 애니메이션 + if (gameResult == Enums.GameResult.Win && userInfo.score == -3) + { + _ratingPointsController.InitRatingPoints(_oldScore,_gameResult,requiredScore); + } + else + { + if(gameResult == Enums.GameResult.Lose) + _ratingPointsController.SetRatingDownLimit(_oldScore-1); + else + _ratingPointsController.SetRatingDownLimit(_oldScore+1); + } } else