[Style] 패널매니저의 포인트표시UI 프리팹에서 게임오브젝트 stactive로 로직 변경
This commit is contained in:
parent
e81708c22c
commit
b2e1bd4f10
File diff suppressed because it is too large
Load Diff
@ -2,23 +2,30 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using DG.Tweening;
|
||||||
|
using TMPro;
|
||||||
|
|
||||||
public class RatingPointsController : MonoBehaviour
|
public class RatingPointsController : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] GameObject[] minusImages;
|
[SerializeField] GameObject[] minusImages;
|
||||||
[SerializeField] GameObject[] plusImage;
|
[SerializeField] GameObject[] plusImage;
|
||||||
|
[SerializeField] TMP_Text scoreCountText;
|
||||||
[SerializeField] private float flipDuration = 0.3f;
|
[SerializeField] private float flipDuration = 0.3f;
|
||||||
|
|
||||||
private Color32 _minusColor = new Color32(255, 0, 0, 255);
|
private Color32 _minusColor = new Color32(255, 0, 0, 255);
|
||||||
private Color32 _plusColor = new Color32(34, 87, 255, 255);
|
private Color32 _plusColor = new Color32(34, 87, 255, 255);
|
||||||
private Color32 _defaultColor = new Color32(176, 176, 176, 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)
|
if (oldScore == 0)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
}else if (oldScore > 0)
|
}
|
||||||
|
else if (oldScore > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < oldScore; i++)
|
for (int i = 0; i < oldScore; i++)
|
||||||
{
|
{
|
||||||
|
@ -8,14 +8,11 @@ using UnityEngine.UI;
|
|||||||
public class RatingPanelController : ConfirmPanelController
|
public class RatingPanelController : ConfirmPanelController
|
||||||
{
|
{
|
||||||
[SerializeField] private TMP_Text getPointsText;
|
[SerializeField] private TMP_Text getPointsText;
|
||||||
[SerializeField] private TMP_Text scoreText;
|
|
||||||
[SerializeField] private GameObject threePointsIndicatorGameObject;
|
[SerializeField] private GameObject threePointsIndicatorGameObject;
|
||||||
[SerializeField] private GameObject fivePointsIndicatorGameObject;
|
[SerializeField] private GameObject fivePointsIndicatorGameObject;
|
||||||
[SerializeField] private GameObject tenPointsIndicatorGameObject;
|
[SerializeField] private GameObject tenPointsIndicatorGameObject;
|
||||||
[SerializeField] private Transform pointsIndicatorParent;
|
|
||||||
|
|
||||||
private bool _isWin;
|
private bool _isWin;
|
||||||
private int _requiredScore;
|
|
||||||
private int _oldScore;
|
private int _oldScore;
|
||||||
private int _newScore;
|
private int _newScore;
|
||||||
private int _myRating;
|
private int _myRating;
|
||||||
@ -29,25 +26,25 @@ public class RatingPanelController : ConfirmPanelController
|
|||||||
{
|
{
|
||||||
_isWin = isWin;
|
_isWin = isWin;
|
||||||
_myRating= UserManager.Instance.Rating;
|
_myRating= UserManager.Instance.Rating;
|
||||||
|
int requiredScore = 0;
|
||||||
if (_myRating >= 10 && _myRating <= 18) // 10~18급은 3점 필요
|
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점 필요
|
else if (_myRating >= 5 && _myRating <= 9) // 5~9급은 5점 필요
|
||||||
{
|
{
|
||||||
var fivePointsIndicator = Instantiate(fivePointsIndicatorGameObject, pointsIndicatorParent);
|
requiredScore = 5;
|
||||||
_requiredScore = 5;
|
fivePointsIndicatorGameObject.SetActive(true);
|
||||||
|
_ratingPointsController = fivePointsIndicatorGameObject.GetComponent<RatingPointsController>();
|
||||||
_ratingPointsController = fivePointsIndicator.GetComponent<RatingPointsController>();
|
|
||||||
}
|
}
|
||||||
else if (_myRating >= 1 && _myRating <= 4) // 1~4급은 10점 필요
|
else if (_myRating >= 1 && _myRating <= 4) // 1~4급은 10점 필요
|
||||||
{
|
{
|
||||||
var tenPointsIndicator = Instantiate(tenPointsIndicatorGameObject, pointsIndicatorParent);
|
requiredScore = 10;
|
||||||
_requiredScore = 10;
|
tenPointsIndicatorGameObject.SetActive(true);
|
||||||
_ratingPointsController = tenPointsIndicator.GetComponent<RatingPointsController>();
|
_ratingPointsController = tenPointsIndicatorGameObject.GetComponent<RatingPointsController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
string win = _isWin ? "승리" : "패배";
|
string win = _isWin ? "승리" : "패배";
|
||||||
@ -55,13 +52,11 @@ public class RatingPanelController : ConfirmPanelController
|
|||||||
|
|
||||||
getPointsText.text = $"게임에서 {win}했습니다.\n{Constants.RAING_POINTS} 승급 포인트를 {get}";
|
getPointsText.text = $"게임에서 {win}했습니다.\n{Constants.RAING_POINTS} 승급 포인트를 {get}";
|
||||||
|
|
||||||
//network에 oldScore 요청.
|
//게임 승패 이전의 rating과 score로 패널 초기화
|
||||||
//이 부분은 승,패 패널에서 처리 후 rating,store만 oldData를 가져와서 승급에 전달해주고
|
|
||||||
//
|
|
||||||
NetworkManager.Instance.GetInfo((userInfo) =>
|
NetworkManager.Instance.GetInfo((userInfo) =>
|
||||||
{
|
{
|
||||||
_oldScore = userInfo.score;
|
_oldScore = userInfo.score;
|
||||||
_ratingPointsController.InitRatingPoints(_oldScore);
|
_ratingPointsController.InitRatingPoints(_oldScore,requiredScore);
|
||||||
}, () =>
|
}, () =>
|
||||||
{ });
|
{ });
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user