diff --git a/Assets/Scripts/UI/LobbyCenterProfileUI.cs b/Assets/Scripts/UI/LobbyCenterProfileUI.cs index 9ca29c8..d572139 100644 --- a/Assets/Scripts/UI/LobbyCenterProfileUI.cs +++ b/Assets/Scripts/UI/LobbyCenterProfileUI.cs @@ -1,5 +1,5 @@ -using UnityEngine; using System.Collections; +using UnityEngine; public class LobbyCenterProfileUI : MonoBehaviour { @@ -15,7 +15,7 @@ public class LobbyCenterProfileUI : MonoBehaviour float scaleCenter = 1f; float scaleSide = 0.7f; - public float animDuration = 0.3f; + float animDuration = 0.3f; public void Set() { @@ -26,7 +26,7 @@ public class LobbyCenterProfileUI : MonoBehaviour SaveMgr.Ins.Set_SelectGirlID(curGirl); } - var pre_girl = curGirl - 1; + var pre_girl = curGirl - 1; if (pre_girl <= 0) pre_girl = 8; arr_profileCard[0].Set(pre_girl); @@ -45,6 +45,10 @@ public class LobbyCenterProfileUI : MonoBehaviour IEnumerator Co_MoveCard(int dir) { + curGirl = curGirl + dir; + if (curGirl > 8) curGirl = 1; + else if (curGirl < 1) curGirl = 8; + isAnimating = true; float elapsed = 0f; @@ -59,6 +63,7 @@ public class LobbyCenterProfileUI : MonoBehaviour if (dir == 1) // 오른쪽으로 이동 { newCard = arr_profileCard[0]; + newCard.Set(curGirl + dir); movingRect = newCard.rect; movingRect.anchoredPosition = posRight + new Vector2(500, 0); movingRect.localScale = Vector3.one * scaleSide; @@ -110,12 +115,12 @@ public class LobbyCenterProfileUI : MonoBehaviour arr_profileCard[1] = arr_profileCard[2]; arr_profileCard[2] = temp; - curGirl = curGirl + 1; - if (curGirl > 8) curGirl = 1; + } else if (dir == -1) // 왼쪽으로 이동 { newCard = arr_profileCard[2]; + newCard.Set(curGirl + dir); movingRect = newCard.rect; movingRect.anchoredPosition = posLeft + new Vector2(-500, 0); movingRect.localScale = Vector3.one * scaleSide; @@ -166,12 +171,8 @@ public class LobbyCenterProfileUI : MonoBehaviour arr_profileCard[2] = arr_profileCard[1]; arr_profileCard[1] = arr_profileCard[0]; arr_profileCard[0] = temp; - - curGirl = curGirl - 1; - if (curGirl <= 0) curGirl = 8; } - Set(); isAnimating = false; } } \ No newline at end of file diff --git a/Assets/Scripts/UI/ProfileCard.cs b/Assets/Scripts/UI/ProfileCard.cs index fa2668b..f76050f 100644 --- a/Assets/Scripts/UI/ProfileCard.cs +++ b/Assets/Scripts/UI/ProfileCard.cs @@ -20,6 +20,9 @@ public class ProfileCard : MonoBehaviour public void Set(int girlid) { + if (girlid < 1) girlid = 8; + else if (girlid > 8) girlid = 1; + m_Data = table_girl.Ins.Get_Data(girlid); i_girl.enabled = false;