룰렛에 mvp 패턴 추가중

- 룰렛 결과에 따른 재화 획득 기능 추가
This commit is contained in:
Mingu Kim
2025-06-19 21:29:50 +09:00
parent b125bc748a
commit 8cae00f132
8 changed files with 72 additions and 10 deletions

View File

@@ -6290,32 +6290,32 @@ MonoBehaviour:
pieceParent: {fileID: 4677345320102285489}
lineParent: {fileID: 4972187624572129157}
roulettePieceData:
- icon: {fileID: 21300000, guid: 7cbd9a8330605ee438bb29392f30bc25, type: 3}
- icon: {fileID: 21300000, guid: 50787c1045972c64690b9a12c89b24e1, type: 3}
description: 10
chance: 1
index: 0
weight: 0
- icon: {fileID: 21300000, guid: a96e49d7f9075574b9dc9b77ca8237a2, type: 3}
- icon: {fileID: 21300000, guid: 50787c1045972c64690b9a12c89b24e1, type: 3}
description: 2
chance: 15
index: 0
weight: 0
- icon: {fileID: 21300000, guid: 7cbd9a8330605ee438bb29392f30bc25, type: 3}
- icon: {fileID: 21300000, guid: 50787c1045972c64690b9a12c89b24e1, type: 3}
description: 25
chance: 1
index: 0
weight: 0
- icon: {fileID: 21300000, guid: 50787c1045972c64690b9a12c89b24e1, type: 3}
- icon: {fileID: 21300000, guid: 21fd0468a7699b744bdac375989cf829, type: 3}
description: 400
chance: 72
index: 0
weight: 0
- icon: {fileID: 21300000, guid: 7cbd9a8330605ee438bb29392f30bc25, type: 3}
- icon: {fileID: 21300000, guid: 50787c1045972c64690b9a12c89b24e1, type: 3}
description: 50
chance: 1
index: 0
weight: 0
- icon: {fileID: 21300000, guid: 21fd0468a7699b744bdac375989cf829, type: 3}
- icon: {fileID: 21300000, guid: 94e9fa1ab055f2c48b4dfb5f02901fee, type: 3}
description: 1000
chance: 11
index: 0

View File

@@ -5,6 +5,7 @@ using System.Collections;
namespace TON
{
// View ?
public class Roulette : MonoBehaviour
{
[SerializeField] private Transform piecePrefab; // 룰렛에 표시되는 정보 프리팹

View File

@@ -6,6 +6,7 @@ using UnityEngine.UI;
namespace TON
{
// View?
public class RoulettePiece : MonoBehaviour
{
[SerializeField] private Image imageIcon;

View File

@@ -4,6 +4,7 @@ using UnityEngine;
namespace TON
{
// Model?
[System.Serializable]
public class RoulettePieceData
{

View File

@@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UniRx;
using UnityEngine;
namespace TON
{
public class RoulettePresenter : MonoBehaviour
{
private PlayerDataManager playerDataManager;
private void Awake()
{
// 싱글톤으로 PlayerDataManager 접근
playerDataManager = PlayerDataManager.Singleton;
if (playerDataManager == null)
{
Debug.LogError("PlayerDataManager가 초기화되지 않았습니다.");
}
}
// 재화 획득 메서드
public void InsertRouletteResult()
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f7404ebc47cb7a14aa22c9b25eac2c42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -10,8 +10,18 @@ namespace TON
[SerializeField] private Roulette roulette;
[SerializeField] private Button buttonSpin;
private PlayerDataManager playerDataManager;
private void Awake()
{
// 싱글톤으로 PlayerDataManager 접근
playerDataManager = PlayerDataManager.Singleton;
if (playerDataManager == null)
{
Debug.LogError("PlayerDataManager가 초기화되지 않았습니다.");
}
buttonSpin.onClick.AddListener(()=>
{
buttonSpin.interactable = false;
@@ -23,7 +33,17 @@ namespace TON
{
buttonSpin.interactable = true;
// 재화 획득 코드 추가
playerDataManager.AddGold(int.Parse(selectedData.description));
// UI 갱신 코드 추가
UIManager.Singleton.UpdateCashData();
Debug.Log($"{selectedData.index}:{selectedData.description}");
}
public class RoulettePresenter
{
}
}
}

View File

@@ -22,7 +22,6 @@ namespace TON
.Subscribe(text => title.text = text)
.AddTo(this);
presenter.BuyCommand.BindTo(buyButton).AddTo(this);
}
[ContextMenu("Bind")]