button ing
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"history": "simulation/histories",
|
"history": "/simulation/histories",
|
||||||
"model": "simulation/3d-models",
|
"model": "/simulation/3d-models",
|
||||||
"logic": "simulation/logics",
|
"logic": "/simulation/logics",
|
||||||
"project": "simulation/projects",
|
"project": "/simulation/projects",
|
||||||
"analyses": "simulation/analyses"
|
"analyses": "/simulation/analyses"
|
||||||
}
|
}
|
||||||
@@ -3,19 +3,35 @@ using System.Collections.Generic;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using Octopus.Simulator.Networks;
|
using Octopus.Simulator.Networks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace Octopus.Simulator
|
namespace Octopus.Simulator
|
||||||
{
|
{
|
||||||
public class LogicDataManager : MonoBehaviour
|
public class LogicDataManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
SimulationData currentInfo;
|
public SimulationData currentInfo;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
GameObject logicPrefab;
|
Button logicPrefab;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
RectTransform LogicWindow;
|
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
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
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) =>
|
WebManager.webManager.Request_Get($"{WebManager.webManager.apiConfig.history}/1", (flag, value) =>
|
||||||
{
|
{
|
||||||
if (flag)
|
if (flag)
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ public class LogicItemButton : MonoBehaviour
|
|||||||
|
|
||||||
// 타입→아이콘 매핑
|
// 타입→아이콘 매핑
|
||||||
private Dictionary<LogicItemType, Sprite> IconMap;
|
private Dictionary<LogicItemType, Sprite> IconMap;
|
||||||
|
|
||||||
private ILogicItem currentItem;
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
IconMap = new Dictionary<LogicItemType, Sprite>()
|
IconMap = new Dictionary<LogicItemType, Sprite>()
|
||||||
@@ -36,10 +33,8 @@ public class LogicItemButton : MonoBehaviour
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Setup(ILogicItem item)
|
public void Setup(ILogicItem item)
|
||||||
{
|
{
|
||||||
currentItem = item;
|
|
||||||
|
|
||||||
//nameText.text = item.Name;
|
|
||||||
iconImage.sprite = IconMap[item.ItemType];
|
iconImage.sprite = IconMap[item.ItemType];
|
||||||
|
nameText.text = item.Name;
|
||||||
|
|
||||||
button.onClick.RemoveAllListeners();
|
button.onClick.RemoveAllListeners();
|
||||||
button.onClick.AddListener(OnClick);
|
button.onClick.AddListener(OnClick);
|
||||||
@@ -47,18 +42,5 @@ public class LogicItemButton : MonoBehaviour
|
|||||||
|
|
||||||
private void OnClick()
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user