[Style] 패널매니저의 포인트표시UI 프리팹에서 게임오브젝트 stactive로 로직 변경

This commit is contained in:
HaeinLEE 2025-03-25 17:48:16 +09:00
parent e81708c22c
commit b2e1bd4f10
3 changed files with 5036 additions and 26 deletions

File diff suppressed because it is too large Load Diff

View File

@ -2,23 +2,30 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
using TMPro;
public class RatingPointsController : MonoBehaviour
{
[SerializeField] GameObject[] minusImages;
[SerializeField] GameObject[] plusImage;
[SerializeField] TMP_Text scoreCountText;
[SerializeField] private float flipDuration = 0.3f;
private Color32 _minusColor = new Color32(255, 0, 0, 255);
private Color32 _plusColor = new Color32(34, 87, 255, 255);
private Color32 _defaultColor = new Color32(176, 176, 176, 255);
public void InitRatingPoints(int oldScore)
private int _requiredScore;
public void InitRatingPoints(int oldScore, int requiredScore)
{
_requiredScore = requiredScore;
if (oldScore == 0)
{
return;
}else if (oldScore > 0)
}
else if (oldScore > 0)
{
for (int i = 0; i < oldScore; i++)
{

View File

@ -8,14 +8,11 @@ using UnityEngine.UI;
public class RatingPanelController : ConfirmPanelController
{
[SerializeField] private TMP_Text getPointsText;
[SerializeField] private TMP_Text scoreText;
[SerializeField] private GameObject threePointsIndicatorGameObject;
[SerializeField] private GameObject fivePointsIndicatorGameObject;
[SerializeField] private GameObject tenPointsIndicatorGameObject;
[SerializeField] private Transform pointsIndicatorParent;
private bool _isWin;
private int _requiredScore;
private int _oldScore;
private int _newScore;
private int _myRating;
@ -29,25 +26,25 @@ public class RatingPanelController : ConfirmPanelController
{
_isWin = isWin;
_myRating= UserManager.Instance.Rating;
int requiredScore = 0;
if (_myRating >= 10 && _myRating <= 18) // 10~18급은 3점 필요
{
var threePointsIndicator = Instantiate(threePointsIndicatorGameObject, pointsIndicatorParent);
_requiredScore = 3;
requiredScore = 3;
threePointsIndicatorGameObject.SetActive(true);
_ratingPointsController = threePointsIndicatorGameObject.GetComponent<RatingPointsController>();
_ratingPointsController = threePointsIndicator.GetComponent<RatingPointsController>();
}
else if (_myRating >= 5 && _myRating <= 9) // 5~9급은 5점 필요
{
var fivePointsIndicator = Instantiate(fivePointsIndicatorGameObject, pointsIndicatorParent);
_requiredScore = 5;
_ratingPointsController = fivePointsIndicator.GetComponent<RatingPointsController>();
requiredScore = 5;
fivePointsIndicatorGameObject.SetActive(true);
_ratingPointsController = fivePointsIndicatorGameObject.GetComponent<RatingPointsController>();
}
else if (_myRating >= 1 && _myRating <= 4) // 1~4급은 10점 필요
{
var tenPointsIndicator = Instantiate(tenPointsIndicatorGameObject, pointsIndicatorParent);
_requiredScore = 10;
_ratingPointsController = tenPointsIndicator.GetComponent<RatingPointsController>();
requiredScore = 10;
tenPointsIndicatorGameObject.SetActive(true);
_ratingPointsController = tenPointsIndicatorGameObject.GetComponent<RatingPointsController>();
}
string win = _isWin ? "승리" : "패배";
@ -55,13 +52,11 @@ public class RatingPanelController : ConfirmPanelController
getPointsText.text = $"게임에서 {win}했습니다.\n{Constants.RAING_POINTS} 승급 포인트를 {get}";
//network에 oldScore 요청.
//이 부분은 승,패 패널에서 처리 후 rating,store만 oldData를 가져와서 승급에 전달해주고
//
//게임 승패 이전의 rating과 score로 패널 초기화
NetworkManager.Instance.GetInfo((userInfo) =>
{
_oldScore = userInfo.score;
_ratingPointsController.InitRatingPoints(_oldScore);
_ratingPointsController.InitRatingPoints(_oldScore,requiredScore);
}, () =>
{ });
}