[Style] 승패 여부 enum으로 전달. 패널 컨트롤러 show 재정의
This commit is contained in:
parent
b2e1bd4f10
commit
c434d1a277
@ -10,7 +10,7 @@ public class RatingPointsController : MonoBehaviour
|
||||
[SerializeField] GameObject[] minusImages;
|
||||
[SerializeField] GameObject[] plusImage;
|
||||
[SerializeField] TMP_Text scoreCountText;
|
||||
[SerializeField] private float flipDuration = 0.3f;
|
||||
[SerializeField] private float flipDuration = 1f;
|
||||
|
||||
private Color32 _minusColor = new Color32(255, 0, 0, 255);
|
||||
private Color32 _plusColor = new Color32(34, 87, 255, 255);
|
||||
@ -30,14 +30,22 @@ public class RatingPointsController : MonoBehaviour
|
||||
for (int i = 0; i < oldScore; i++)
|
||||
{
|
||||
plusImage[i].GetComponent<Image>().color = _plusColor;
|
||||
plusImage[i].GetComponent<Transform>().DOFlip();
|
||||
}
|
||||
}
|
||||
else if (oldScore < 0)
|
||||
{
|
||||
for (int i = oldScore; i < 0; i++)
|
||||
{
|
||||
minusImages[minusImages.Length+i].GetComponent<Image>().color = _minusColor;
|
||||
minusImages[minusImages.Length+i].GetComponent<Image>().DOColor(_minusColor, flipDuration);
|
||||
plusImage[minusImages.Length+i].GetComponent<Transform>().DOFlip();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int CalculateNewRequiredScore(bool isWin)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -189,12 +189,12 @@ public class PanelManager : MonoBehaviour
|
||||
}
|
||||
|
||||
//승급 패널 생성
|
||||
public void OpenRatingPanel()
|
||||
public void OpenRatingPanel(Enums.GameResult gameResult)
|
||||
{
|
||||
if (_canvas != null)
|
||||
{
|
||||
var replayPanelObject = GetPanel("Rating Panel");
|
||||
replayPanelObject.GetComponent<RatingPanelController>().Show();
|
||||
replayPanelObject.GetComponent<RatingPanelController>().Show(gameResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,26 +5,43 @@ using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RatingPanelController : ConfirmPanelController
|
||||
public class RatingPanelController : PanelController
|
||||
{
|
||||
[SerializeField] private TMP_Text getPointsText;
|
||||
[SerializeField] private GameObject threePointsIndicatorGameObject;
|
||||
[SerializeField] private GameObject fivePointsIndicatorGameObject;
|
||||
[SerializeField] private GameObject tenPointsIndicatorGameObject;
|
||||
|
||||
private bool _isWin;
|
||||
private Enums.GameResult _gameResult;
|
||||
private int _oldScore;
|
||||
private int _newScore;
|
||||
private int _myRating;
|
||||
private RatingPointsController _ratingPointsController;
|
||||
|
||||
public void Show(Enums.GameResult gameResult)
|
||||
{
|
||||
InitRatingPanel(gameResult);
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public void OnClickConfirmButton()
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
public void OnClickRetryButton()
|
||||
{
|
||||
Hide(() => { });
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 텍스트 초기화, 승급포인트 계산
|
||||
/// </summary>
|
||||
/// <param name="isWin"></param>
|
||||
public void InitRatingPanel(bool isWin)
|
||||
public void InitRatingPanel(Enums.GameResult gameResult)
|
||||
{
|
||||
_isWin = isWin;
|
||||
_gameResult = gameResult;
|
||||
_myRating= UserManager.Instance.Rating;
|
||||
int requiredScore = 0;
|
||||
if (_myRating >= 10 && _myRating <= 18) // 10~18급은 3점 필요
|
||||
@ -47,8 +64,8 @@ public class RatingPanelController : ConfirmPanelController
|
||||
_ratingPointsController = tenPointsIndicatorGameObject.GetComponent<RatingPointsController>();
|
||||
}
|
||||
|
||||
string win = _isWin ? "승리" : "패배";
|
||||
string get = _isWin ? "얻었습니다." : "잃었습니다.";
|
||||
string win = _gameResult == Enums.GameResult.Win ? "승리" : "패배";
|
||||
string get = _gameResult == Enums.GameResult.Win ? "얻었습니다." : "잃었습니다.";
|
||||
|
||||
getPointsText.text = $"게임에서 {win}했습니다.\n{Constants.RAING_POINTS} 승급 포인트를 {get}";
|
||||
|
||||
@ -61,9 +78,5 @@ public class RatingPanelController : ConfirmPanelController
|
||||
{ });
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
InitRatingPanel(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user