Project_WL/Assets/Script/UI/Base/TabUIBase.cs

74 lines
1.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using UnityEngine;
2025-02-14 01:57:06 +00:00
public enum eTabType { BGColorChange, BGImageChange, }
public class TabUIData
{
2025-01-29 23:02:08 +00:00
/// <summary>
/// (자동설정) 탭 순서 0~
/// </summary>
public int m_Index;
public string btnImg_on, btnImg_off;
public string btnNameImage_on, btnNameImage_off;
public int n_btnName = 0;
public string btnName;
public Color color_bg_on = Color.white;
public Color color_bg_off = Color.gray;
2025-03-16 02:20:46 +00:00
public int n_Update = 0;
public Action onClick;
2025-01-29 23:02:08 +00:00
/// <summary>
/// (자동설정) 선택된 탭 설정, 탭 UI 상태 갱신
/// </summary>
public Action<int> onTabAction;
}
public class TabUIBase : uScrollViewMgr
{
int m_Index = 0;
2025-03-16 02:20:46 +00:00
List<TabUIData> list_tabData;
public void Set(List<TabUIData> lst)
{
2025-01-29 00:32:40 +00:00
if (go_card.activeSelf) go_card.SetActive(false);
for (int i = 0; i < lst.Count; i++)
{
lst[i].m_Index = i;
lst[i].onTabAction = OnClick_Tab;
}
2025-03-16 02:20:46 +00:00
list_tabData = lst;
Set_ScrollView(lst);
Set_UI();
}
public override void Set_UI()
{
for (int i = 0; i < list_CardBase.Count; i++)
{
if (list_CardBase[i].Get_IntData() == m_Index)
list_CardBase[i].Set_CardType(eUICardType.UI);
else
list_CardBase[i].Set_CardType(eUICardType.NoTouch);
}
}
2025-02-16 23:33:59 +00:00
public void Set_Index(int index) { m_Index = index; }
public int Get_Index() { return m_Index; }
void OnClick_Tab(int index)
{
2025-03-16 02:20:46 +00:00
if (list_tabData[index].n_Update > 0)
Popup.Ins.Set(ePopupType.One, list_tabData[index].n_Update);
else
{
m_Index = index;
Set_UI();
}
}
}