This commit is contained in:
NTG_Lenovo 2024-12-03 17:03:09 +09:00
commit a131e6cc67
12 changed files with 5141 additions and 1528 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 13dc68816b7d25e4f852aa863002aec2
guid: e7a1af91eedbae34b95b935f45e2ea93
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,3 +1,4 @@
using Spine.Unity;
using UnityEngine;
public class TycoonCharacter : MonoBehaviour
@ -6,8 +7,15 @@ public class TycoonCharacter : MonoBehaviour
public RectTransform parentRectTransform; // 부모 UI 객체의 RectTransform
public float smoothSpeed = 5f;
private Vector3 targetPosition;
private Vector3 targetPosition;
[field: SerializeField]
private SkeletonAnimation spine;
[field: SerializeField]
private SkeletonRootMotion spineEye;
void Start()
{
selfRectTransform = GetComponent<RectTransform>();
@ -24,6 +32,21 @@ public class TycoonCharacter : MonoBehaviour
{
UpdateTargetPosition();
SmoothMoveToTarget();
if (spineEye != null)
{
// 본의 위치 변경 (예: 마우스 위치로 이동)
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
spineEye.RootMotionBone.WorldX = mousePosition.x;
spineEye.RootMotionBone.WorldY = mousePosition.y;
Debug.Log(mousePosition);
spineEye.RootMotionBone.UpdateWorldTransform();
// 스켈레톤을 다시 업데이트
}
}
void UpdateTargetPosition()

View File

@ -62,7 +62,12 @@ namespace BlueWater.Uis
[field: SerializeField]
private string cardText;
private Coroutine _currentCreateCoroutine;
private Coroutine _currentRotationCoroutine;
[HideInInspector]
public bool checkRotation = false;
private bool checkCreate = false;
[FormerlySerializedAs("RotationDurationCard")]
[field: Title("카드 회전")]
@ -86,6 +91,7 @@ namespace BlueWater.Uis
private Coroutine _changedLocaleInstance;
private void OnEnable()
{
LocalizationSettings.SelectedLocaleChanged += OnChangedLocale;
@ -122,6 +128,7 @@ namespace BlueWater.Uis
//지정된 IDX값으로 정보값 초기화
public void SetCard(CardData cardData)
{
checkCreate = false;
CardDataForIdx = cardData;
int count = TycoonManager.Instance.TycoonCardController.GetSelectedCardCount(CardDataForIdx.Idx);
@ -163,34 +170,41 @@ namespace BlueWater.Uis
PriceUi.SetActive(true);
}
[Button("회전")]
public void Rotation_Start()
{
Panel.localRotation = Quaternion.Euler(0, -180, 0);
Panel.localScale = new Vector3(0, 0, 0);
[Button("등장")]
public void Create_Start()
{
Panel.localRotation = Quaternion.Euler(0, 0, 0);
Panel.localScale = new Vector3(0, 0, 0);
checkRotation = false;
if (_currentCreateCoroutine != null)
{
StopCoroutine(_currentCreateCoroutine);
_currentCreateCoroutine = null;
}
if (_currentRotationCoroutine != null)
{
StopCoroutine(_currentRotationCoroutine);
_currentRotationCoroutine = null;
}
_currentRotationCoroutine = StartCoroutine(RotateOverTime());
_currentCreateCoroutine = StartCoroutine(CreateOverTime());
}
/// <summary>
/// 카드를 등장하며 회전시킴!
/// 카드를 등장시킴
/// </summary>
/// <returns></returns>
private IEnumerator RotateOverTime()
private IEnumerator CreateOverTime()
{
BackObject.SetActive(true);
_countLayout.SetActive(false);
Quaternion startRotation = Panel.localRotation;
Quaternion targetRotation = Quaternion.Euler(0, 0, 0);
Vector3 initialScale = Panel.localScale;
//확대 시작
float elapsedTime = 0.0f;
while (elapsedTime < 0.5f)
@ -205,7 +219,75 @@ namespace BlueWater.Uis
yield return null;
}
checkCreate = true;
if (checkRotation)
{
_currentRotationCoroutine = StartCoroutine(RotateOverTime());
}
elapsedTime = 0.0f;
while (elapsedTime < rotationDurationCard)
{
elapsedTime += Time.unscaledDeltaTime;
if (elapsedTime > rotationDurationCard / 1.8)
{
CardArea.SetEnable(true);
}
yield return null;
}
}
[Button("회전")]
public void Rotation_Start()
{
if (checkRotation) return;
Panel.localRotation = Quaternion.Euler(0, -180, 0);
checkRotation = true;
if (_currentCreateCoroutine != null)
{
StopCoroutine(_currentCreateCoroutine);
_currentCreateCoroutine = null;
}
if (_currentRotationCoroutine != null)
{
StopCoroutine(_currentRotationCoroutine);
_currentRotationCoroutine = null;
}
if (checkCreate == false)
{
Panel.localScale = new Vector3(0, 0, 0);
_currentRotationCoroutine = StartCoroutine(CreateOverTime());
}
else
{
_currentRotationCoroutine = StartCoroutine(RotateOverTime());
}
}
/// <summary>
/// 카드를 회전시킴!
/// </summary>
/// <returns></returns>
private IEnumerator RotateOverTime()
{
BackObject.SetActive(true);
_countLayout.SetActive(false);
Quaternion startRotation = Panel.localRotation;
Quaternion targetRotation = Quaternion.Euler(0, 0, 0);
Panel.localScale = new Vector3(0.95f, 0.95f, 0.95f);
//회전 시작
float elapsedTime = 0.0f;
while (elapsedTime < rotationDurationCard)
{

View File

@ -132,10 +132,6 @@ namespace BlueWater.Uis
_onSelectAction?.Invoke(_tycoonCard);
//OnPointerExit(null);
}
//해당 밑줄은 따로 메소드를 만들어주자... 여기서 호출하는게 아니라 SelectCardUi에서 호출받는 방식으로...
//this.SetEnable(false);
//_isPointerInside = false;
}
}
@ -224,7 +220,7 @@ namespace BlueWater.Uis
Vector3 initialScale = _panel.localScale;
Vector3 targetScale = new Vector3(1.05f, 1.05f, 1.0f); // 타겟 스케일 설정
/*
/* ...
// RectTransform의 화면 좌표를 가져오기 위한 변수
RectTransform rectTransform = GetComponent<RectTransform>();

View File

@ -1,9 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BlueWater.Audios;
using BlueWater.Tycoons;
using UnityEngine;
using Sirenix.OdinInspector;
using TMPro;
using UnityEngine.UI;
using Random = UnityEngine.Random;
namespace BlueWater.Uis
{
@ -25,11 +29,17 @@ namespace BlueWater.Uis
private string _openSfxName = "RareRewardBox";
private List<TycoonCard> _tycoonCards = new(5);
private int viewCardCount = 0;
private LevelData _currentLevelData;
private TycoonManager _tycoonManager;
private TycoonCardController _tycoonCardController;
[SerializeField]
private Button allOpenCardButton;
[SerializeField]
private Button closeButton;
private void Start()
{
_panel.SetActive(false);
@ -53,6 +63,9 @@ namespace BlueWater.Uis
PopupUiController.RegisterPopup(this);
_panel.SetActive(true);
IsOpened = true;
allOpenCardButton.gameObject.SetActive(true);
closeButton.gameObject.SetActive(false);
}
public override void Close()
@ -64,21 +77,24 @@ namespace BlueWater.Uis
VisualFeedbackManager.Instance.ResetTimeScale();
}
[Button("레어 상자 열기")]
private void CreateCard()
{
if (!Application.isPlaying) return;
viewCardCount = 0;
_currentLevelData = TycoonManager.Instance.GetCurrentLevelData();
_tycoonCardController.DestroyCardList(_tycoonCards);
var randomCount = Random.Range(2, 6);
_contents.GetComponent<HorizontalLayoutGroup>().spacing = randomCount * 10;
for (int i = 0; i < randomCount; i++)
{
var newCard = _tycoonCardController.CreateTycoonCard(_contents);
newCard.SetName($"Card{i:00}");
newCard.CardArea.SetselectAction(OpenCard);
switch (randomCount)
{
case 2: newCard.SetLocalScale(_cardLocalScale_2); break;
@ -87,7 +103,8 @@ namespace BlueWater.Uis
case 5: newCard.SetLocalScale(_cardLocalScale_5); break;
default: newCard.SetLocalScale(_cardLocalScale_5); break;
}
viewCardCount++;
_tycoonCards.Add(newCard);
}
@ -111,10 +128,36 @@ namespace BlueWater.Uis
hashSet.Add(cardIdx);
element.SetCard(cardData);
element.Rotation_Start();
element.Create_Start();
_tycoonCardController.SelectCard(element);
}
}
private void OpenCard(TycoonCard tycoonCard)
{
tycoonCard.Rotation_Start();
tycoonCard.SetSelectAction(null);
viewCardCount--;
if (viewCardCount > 0) return;
allOpenCardButton.gameObject.SetActive(false);
closeButton.gameObject.SetActive(true);
}
[Button("카드 모두 열기")]
public void AllOpenCard()
{
viewCardCount = 0;
//남은 카드가 열리는 연출만 추가하자
foreach (var element in _tycoonCards)
{
element.SetSelectAction(null);
element.Rotation_Start();
}
allOpenCardButton.gameObject.SetActive(false);
closeButton.gameObject.SetActive(true);
}
}
}

View File

@ -70,6 +70,7 @@ namespace BlueWater.Uis
{
var newCard = _tycoonCardController.CreateTycoonCard(_contents);
newCard.SetName($"Card{i:00}");
newCard.transform.localScale = new Vector3(0.9f, 0.9f, 0.9f);
_tycoonCards.Add(newCard);
}

View File

@ -2,6 +2,7 @@ using System.Collections;
using BlueWater.Items;
using UnityEngine;
using UnityEngine.UI;
using Sirenix.OdinInspector;
namespace BlueWater.Uis
{

View File

@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
atlasAssets:
- {fileID: 11400000, guid: 715a9baaf9f9f6042bc95860da66b9f2, type: 2}
scale: 0.01
scale: 0.001
skeletonJSON: {fileID: 4900000, guid: 9454208de48a3e7438c4d5e728a20fc6, type: 3}
isUpgradingBlendModeMaterials: 0
blendModeMaterials:

View File

@ -0,0 +1,6 @@
using UnityEngine;
public class NewEmptyCSharpScript
{
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7a5ecfd35711704418594a91dd23b9cd