button ing

This commit is contained in:
2025-05-12 10:35:55 +09:00
parent 8351364168
commit 5266fe1ec2
3 changed files with 24 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
{
"history": "simulation/histories",
"model": "simulation/3d-models",
"logic": "simulation/logics",
"project": "simulation/projects",
"analyses": "simulation/analyses"
"history": "/simulation/histories",
"model": "/simulation/3d-models",
"logic": "/simulation/logics",
"project": "/simulation/projects",
"analyses": "/simulation/analyses"
}

View File

@@ -3,19 +3,35 @@ using System.Collections.Generic;
using System.Collections;
using Octopus.Simulator.Networks;
using Newtonsoft.Json;
using UnityEngine.UI;
namespace Octopus.Simulator
{
public class LogicDataManager : MonoBehaviour
{
SimulationData currentInfo;
public SimulationData currentInfo;
[SerializeField]
GameObject logicPrefab;
Button logicPrefab;
[SerializeField]
RectTransform LogicWindow;
List<Button> logicButtonList = new List<Button>();
Dictionary<Button, string> buttonDict=new Dictionary<Button, string>();
Dictionary<string, ILogicItem> logicDict=new Dictionary<string, ILogicItem>();
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
RequestInfo();
}
void RequestInfo()
{
foreach(var b in logicButtonList)
{
Destroy(b.gameObject);
}
logicButtonList.Clear();
Debug.Log($"{WebManager.webManager.apiConfig.history}/1");
WebManager.webManager.Request_Get($"{WebManager.webManager.apiConfig.history}/1", (flag, value) =>
{
if (flag)

View File

@@ -18,9 +18,6 @@ public class LogicItemButton : MonoBehaviour
// 타입→아이콘 매핑
private Dictionary<LogicItemType, Sprite> IconMap;
private ILogicItem currentItem;
private void Awake()
{
IconMap = new Dictionary<LogicItemType, Sprite>()
@@ -36,10 +33,8 @@ public class LogicItemButton : MonoBehaviour
/// </summary>
public void Setup(ILogicItem item)
{
currentItem = item;
//nameText.text = item.Name;
iconImage.sprite = IconMap[item.ItemType];
nameText.text = item.Name;
button.onClick.RemoveAllListeners();
button.onClick.AddListener(OnClick);
@@ -47,18 +42,5 @@ public class LogicItemButton : MonoBehaviour
private void OnClick()
{
// 클릭됐을 때 타입별로 다른 정보 표시
switch (currentItem.ItemType)
{
case LogicItemType.Queue:
//UIManager.Instance.ShowQueueInfo(currentItem as LogicQueue);
break;
case LogicItemType.Resource:
//UIManager.Instance.ShowResourceInfo(currentItem as LogicResource);
break;
case LogicItemType.Component:
//UIManager.Instance.ShowComponentInfo(currentItem as LogicComponent);
break;
}
}
}