Files
M-Gameton-06/Gameton-06/Assets/Gameton/Scripts/UI/RouletteSpin/RouletteSpin.cs
2025-06-27 00:56:39 +09:00

54 lines
1.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace TON
{
// View
public class RouletteSpin : MonoBehaviour
{
[SerializeField] private Roulette roulette;
[SerializeField] private Button buttonSpin;
private PlayerDataManager playerDataManager;
// Todo : Presenter 변수
private void Awake()
{
// 싱글톤으로 PlayerDataManager 접근
playerDataManager = PlayerDataManager.Singleton;
if (playerDataManager == null)
{
Debug.LogError("PlayerDataManager가 초기화되지 않았습니다.");
}
buttonSpin.onClick.AddListener(()=>
{
buttonSpin.interactable = false;
roulette.Spin(EndOfSpin);
});
// Presenter 생성
}
private void EndOfSpin(RoulettePieceData selectedData)
{
buttonSpin.interactable = true;
// 재화 획득 코드 추가
playerDataManager.AddGold(int.Parse(selectedData.description));
// UI 갱신 코드 추가
UIManager.Singleton.UpdateCashData();
Debug.Log($"{selectedData.index}:{selectedData.description}");
}
public class RoulettePresenter
{
}
}
}