CapersProject/Assets/02.Scripts/Ui/Tycoon/TycoonResultUi.cs

56 lines
2.0 KiB
C#
Raw Normal View History

2024-11-07 12:02:00 +00:00
using System;
using System.Collections.Generic;
using BlueWater.Tycoons;
using UnityEngine;
using Sirenix.OdinInspector;
using Unity.VisualScripting;
using UnityEngine.UIElements;
namespace BlueWater.Uis
{
public class TycoonResultUi : MonoBehaviour
{
private Dictionary<string, int> selectedCard; //선택한 카드(key , 선택당한 갯수)
private float playTime; //플레이 시간
private int round;
[field: SerializeField, CLabel("카드프리펫")]
private GameObject Card;
private GameObject _panel;
[field: SerializeField, CLabel("카드목록(Cards)")]
private GameObject cards;
public void Start()
{
_panel = transform.Find("Panel").gameObject;
}
public void Update()
{
playTime += Time.deltaTime; //플레이타임 측정 (일시정지나 메뉴얼보는 시간은 제외)
}
[Button("StartResult")]
public void StartResult()
{
_panel.SetActive(true);
selectedCard = TycoonManager.Instance.CardDataSo.GetselectedCard(); //카드 정보 가져오기
//카드 정보 가져오기
foreach (var element in selectedCard)
{
GameObject newObject = Instantiate(Card, new Vector3(0, 0, 0), Quaternion.identity);
newObject.GetComponent<TycoonResultCard>().SetImage(TycoonManager.Instance.CardDataSo.GetDataByIdx(element.Key).Sprite);
newObject.GetComponent<TycoonResultCard>().SetText(TycoonManager.Instance.CardDataSo.GetDataByIdx(element.Key).ScriptText);
newObject.GetComponent<TycoonResultCard>().SetCount(element.Value);
newObject.name = element.Key;
newObject.transform.localPosition = Vector3.zero;
newObject.transform.localRotation = Quaternion.identity;
}
}
}
}