2025-08-27 21:08:17 +00:00
|
|
|
using System.Collections;
|
|
|
|
|
using CodeJay.Enum;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class GoStopPopup : PopupBase
|
|
|
|
|
{
|
|
|
|
|
[SerializeField] private TMPro.TextMeshProUGUI tmp;
|
|
|
|
|
[SerializeField] private TMPro.TextMeshProUGUI goTMP;
|
|
|
|
|
[SerializeField] private CanvasGroup cg;
|
|
|
|
|
[SerializeField] private GameObject EndLabelGO;
|
|
|
|
|
|
|
|
|
|
private bool _isClicked = false;
|
|
|
|
|
|
|
|
|
|
public override void ShowPopup(int drawOrder)
|
|
|
|
|
{
|
|
|
|
|
base.ShowPopup(drawOrder);
|
|
|
|
|
|
|
|
|
|
long resultScore = GamePanel.Instance.GetTotalScore(true, false);
|
|
|
|
|
int multiply = 0;
|
|
|
|
|
var multipleType = GamePanel.Instance.GetAndUpdateScoreMultiplyType(true);
|
|
|
|
|
|
|
|
|
|
if (multipleType != null)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < multipleType.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (multiply <= 0)
|
|
|
|
|
multiply = 1;
|
|
|
|
|
|
|
|
|
|
if (multipleType[i] == EScoreMutiplyType.Shake)
|
|
|
|
|
multiply *= CodeJay.CodeJayUtility.Utility.GetScoreMultiplyValue(multipleType[i]) * GamePanel.Instance.Player_Bell;
|
2025-08-30 21:09:29 +00:00
|
|
|
else if (multipleType[i] == EScoreMutiplyType.ClickedFromResultPopup)
|
|
|
|
|
multiply *= CodeJay.CodeJayUtility.Utility.GetScoreMultiplyValue(multipleType[i]) * GamePanel.Instance.Player_Milgi;
|
2025-08-27 21:08:17 +00:00
|
|
|
else
|
|
|
|
|
multiply *= CodeJay.CodeJayUtility.Utility.GetScoreMultiplyValue(multipleType[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add Go Scroe Less than 2
|
|
|
|
|
{
|
|
|
|
|
if (GamePanel.Instance.Player_Go > 0 && GamePanel.Instance.Player_Go <= 2)
|
|
|
|
|
resultScore += GamePanel.Instance.Player_Go;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (multiply > 0)
|
|
|
|
|
resultScore *= multiply;
|
|
|
|
|
if(GamePanel.Instance.Player_Go >= 3)
|
|
|
|
|
{
|
|
|
|
|
resultScore *= GamePanel.Instance.Player_Go - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long resultMoney = resultScore * GamePanel.Instance.Stake;
|
|
|
|
|
|
2025-09-02 21:41:09 +00:00
|
|
|
tmp.text = "스톱 시,+" + CodeJay.CodeJayUtility.Converter.MoneyToString_withOutline(resultMoney);
|
2025-08-27 21:08:17 +00:00
|
|
|
|
2025-08-29 13:01:17 +00:00
|
|
|
goTMP.text = (GamePanel.Instance.Player_Go + 1).ToString() + "고";
|
2025-08-27 21:08:17 +00:00
|
|
|
|
|
|
|
|
cg.alpha = 1f;
|
|
|
|
|
|
|
|
|
|
GameManager.Sound.PlaySFX(ESFXType.Open_Popup);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (GamePanel.Instance.IsChallengeMode)
|
|
|
|
|
{
|
2025-08-29 13:01:17 +00:00
|
|
|
var remaining = GameManager.DB.GetReaminingTargetCondition(true);
|
2025-08-27 21:08:17 +00:00
|
|
|
EndLabelGO.SetActive(remaining - resultMoney <= 0);
|
|
|
|
|
|
|
|
|
|
if (remaining - resultMoney < 0)
|
|
|
|
|
{
|
2025-09-02 21:41:09 +00:00
|
|
|
tmp.text = "스톱 시,+" + CodeJay.CodeJayUtility.Converter.MoneyToString_withOutline(remaining);
|
2025-08-27 21:08:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var remaining = GameManager.DB.GetRemainigNormalGameAIGold();
|
|
|
|
|
EndLabelGO.SetActive(remaining - resultMoney <= 0);
|
|
|
|
|
|
|
|
|
|
if (remaining - resultMoney < 0)
|
2025-09-02 21:41:09 +00:00
|
|
|
tmp.text = "스톱 시,+" + CodeJay.CodeJayUtility.Converter.MoneyToString(remaining);
|
2025-08-27 21:08:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void GoButton()
|
|
|
|
|
{
|
|
|
|
|
if (!_isClicked)
|
|
|
|
|
{
|
|
|
|
|
_isClicked = true;
|
|
|
|
|
cg.alpha = 0f;
|
|
|
|
|
cg.blocksRaycasts = false;
|
|
|
|
|
cg.interactable = false;
|
|
|
|
|
StartCoroutine(coroClickGoButton());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerator coroClickGoButton()
|
|
|
|
|
{
|
|
|
|
|
GamePanel.Instance.Player_Go++;
|
|
|
|
|
GameManager.Event.InvokeEvent(EEventType.OnSynchronizeGameData);
|
|
|
|
|
GameManager.UI.BlindPopupEnabled(false);
|
|
|
|
|
yield return GamePanel.Instance.EffectPanel.GoDirect(GamePanel.Instance.Player_Go, true);
|
|
|
|
|
GameManager.UI.HideTopPopup();
|
|
|
|
|
GameManager.Sound.PlaySFX(ESFXType.Button_Hit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void StopButton()
|
|
|
|
|
{
|
|
|
|
|
if (!_isClicked)
|
|
|
|
|
{
|
|
|
|
|
_isClicked = true;
|
|
|
|
|
cg.alpha = 0f;
|
|
|
|
|
cg.blocksRaycasts = false;
|
|
|
|
|
cg.interactable = false;
|
|
|
|
|
StartCoroutine(coroClickStopButton());
|
|
|
|
|
GameManager.Sound.PlaySFX(ESFXType.Button_Hit);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerator coroClickStopButton()
|
|
|
|
|
{
|
|
|
|
|
cg.alpha = 0f;
|
|
|
|
|
cg.blocksRaycasts = false;
|
|
|
|
|
cg.interactable = false;
|
|
|
|
|
|
|
|
|
|
GamePanel.Instance.GameOver = true;
|
|
|
|
|
GameManager.UI.BlindPopupEnabled(false);
|
|
|
|
|
yield return new WaitForSeconds(GamePanel.Instance.EffectPanel.Direct(CodeJay.Enum.EEffectDirectType.Stop, true));
|
|
|
|
|
GameManager.UI.HideTopPopup();
|
|
|
|
|
GameManager.UI.ShowNStackPopup<ResultPopup>(EPopupType.ResultPopup).SetData(true);
|
|
|
|
|
}
|
|
|
|
|
}
|