2025-03-12 12:04:19 +09:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using WI;
|
|
|
|
|
|
|
|
|
|
namespace CHN
|
|
|
|
|
{
|
|
|
|
|
public class UI_DashboardCheckListBox : UIBase
|
|
|
|
|
{
|
|
|
|
|
public UI_DashboardCheckListItem prf_item;
|
|
|
|
|
|
|
|
|
|
private Dictionary<string, GameObject> originDashBoardItems = new();
|
2025-03-12 18:55:01 +09:00
|
|
|
public SDictionary<string, UI_DashboardCheckListItem> dashboardItemList = new();
|
2025-03-18 13:57:27 +09:00
|
|
|
public Action onCloseDashboard;
|
2025-03-12 12:04:19 +09:00
|
|
|
public void Init(Dictionary<string, GameObject> items)
|
|
|
|
|
{
|
|
|
|
|
prf_item = Resources.Load<UI_DashboardCheckListItem>("Prefabs/UI/UI_DashboardCheckListItem");
|
|
|
|
|
|
|
|
|
|
originDashBoardItems.Clear();
|
2025-03-12 18:55:01 +09:00
|
|
|
dashboardItemList.Clear();
|
2025-03-12 12:04:19 +09:00
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
|
|
|
|
var dashboardItem = CreateItem();
|
|
|
|
|
dashboardItemList.Add(item.Key, dashboardItem);
|
|
|
|
|
originDashBoardItems.Add(item.Key, item.Value);
|
|
|
|
|
}
|
|
|
|
|
SetMenuItem(items);
|
|
|
|
|
}
|
|
|
|
|
private void SetMenuItem(Dictionary<string, GameObject> items)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
|
|
|
|
dashboardItemList[item.Key].SetItem(item.Key, item.Value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-12 18:55:01 +09:00
|
|
|
public void OnOpenDashboardItem(string dashboardKey)
|
2025-03-12 12:04:19 +09:00
|
|
|
{
|
2025-03-12 18:55:01 +09:00
|
|
|
dashboardItemList[dashboardKey].ToggleOnItem();
|
|
|
|
|
}
|
|
|
|
|
public void OnCloseDashbordItem(string dashboardKey)
|
|
|
|
|
{
|
|
|
|
|
dashboardItemList[dashboardKey].ToggleOffItem();
|
2025-03-12 12:04:19 +09:00
|
|
|
}
|
|
|
|
|
private UI_DashboardCheckListItem CreateItem()
|
|
|
|
|
{
|
|
|
|
|
var item = Instantiate(prf_item, transform);
|
|
|
|
|
item.transform.localScale = Vector3.one;
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|