Merge remote-tracking branch 'origin/main' into lwj/250527
This commit is contained in:
8
Assets/WorkSpace/LH/LogicData/BackUp.meta
Normal file
8
Assets/WorkSpace/LH/LogicData/BackUp.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c13ac8d070806f24ba0626def7015edd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1362
Assets/WorkSpace/LH/LogicData/BackUp/LogicDataWindow.prefab
Normal file
1362
Assets/WorkSpace/LH/LogicData/BackUp/LogicDataWindow.prefab
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96178de0fa414d9498aa7e253fba1d97
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -18,6 +18,8 @@ namespace Octopus.Simulator
|
||||
RectTransform LogicWindow;
|
||||
[SerializeField]
|
||||
Image linePrefab;
|
||||
[SerializeField]
|
||||
Button backGround;
|
||||
|
||||
Dictionary<Button, ILogicItem> logicButtonDict = new Dictionary<Button, ILogicItem>();
|
||||
Dictionary<string, Button> dataMap = new Dictionary<string, Button>();
|
||||
@@ -29,6 +31,7 @@ namespace Octopus.Simulator
|
||||
Panel_ConnectedObject panelConnectedObject;
|
||||
Panel_PlacedObject panelPlacedObject;
|
||||
public event Action<ILogicItem> onLogicButtonClicked;
|
||||
public event Action onLogicDeSelected;
|
||||
private void Awake()
|
||||
{
|
||||
panelLogicData = FindAnyObjectByType<Panel_LogicData>();
|
||||
@@ -38,11 +41,18 @@ namespace Octopus.Simulator
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
//onLogicButtonClicked += panelLogicData.OnLogicDataSelected;
|
||||
onLogicButtonClicked += panelLogicData.OnLogicDataSelected;
|
||||
onLogicButtonClicked += panelConnectedObject.OnLogicDataSelected;
|
||||
onLogicButtonClicked += panelPlacedObject.OnLogicDataSelected;
|
||||
onLogicDeSelected += panelLogicData.DataDeSelected;
|
||||
onLogicDeSelected += panelConnectedObject.DataDeSelected;
|
||||
onLogicDeSelected += panelPlacedObject.DataDeSelected;
|
||||
backGround.onClick.AddListener(() => onLogicDeSelected?.Invoke());
|
||||
panelPlacedObject.onPlacedObjectSelected += panelConnectedObject.OnLogicDataSelected;
|
||||
FindAnyObjectByType<Panel_SimulationUI>().onLogicBTNClicked += SetActive;
|
||||
panelLogicData.gameObject.SetActive(false);
|
||||
panelConnectedObject.gameObject.SetActive(false);
|
||||
panelPlacedObject.gameObject.SetActive(false);
|
||||
LogicWindow.gameObject.SetActive(false);
|
||||
FindAnyObjectByType<WebReceiver>().onParameterRecived += RequestInfo;
|
||||
}
|
||||
@@ -59,19 +69,18 @@ namespace Octopus.Simulator
|
||||
void SetActive()
|
||||
{
|
||||
LogicWindow.gameObject.SetActive(!LogicWindow.gameObject.activeSelf);
|
||||
onLogicDeSelected?.Invoke();
|
||||
}
|
||||
|
||||
void RequestInfo(SimulatorConfig config)
|
||||
{
|
||||
ClearLogicBTN();
|
||||
Debug.Log("1");
|
||||
WebManager.webManager.Request_Get($"{WebManager.webManager.apiConfig.logic}/{WebParameters.config.logicId}", (flag, value) =>
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
var info = JsonConvert.DeserializeObject<LogicInfo>(value);
|
||||
GetDataFromInfo(info.data);
|
||||
Debug.Log("2");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Octopus.Simulator
|
||||
RectTransform rect;
|
||||
[SerializeField]
|
||||
RectTransform contentRect;
|
||||
|
||||
Dictionary<string, string> dataMap = new Dictionary<string, string>
|
||||
{
|
||||
{ "이름","" },
|
||||
@@ -54,11 +53,12 @@ namespace Octopus.Simulator
|
||||
|
||||
public void OnLogicDataSelected(ILogicItem item)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
ClearItem();
|
||||
GetObjectByName(item.Name);
|
||||
|
||||
float itemHeight = logicItem.GetComponent<RectTransform>().rect.height;
|
||||
float panelHeight = dataMap.Count * itemHeight;
|
||||
float panelHeight = dataMap.Count * itemHeight+25f;
|
||||
rect.sizeDelta = new Vector2(rect.sizeDelta.x, panelHeight);
|
||||
int i = 0;
|
||||
foreach (var p in dataMap)
|
||||
@@ -76,11 +76,12 @@ namespace Octopus.Simulator
|
||||
|
||||
public void OnLogicDataSelected(string itemName)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
ClearItem();
|
||||
GetObjectByName(itemName);
|
||||
|
||||
float itemHeight = logicItem.GetComponent<RectTransform>().rect.height;
|
||||
float panelHeight = dataMap.Count * itemHeight;
|
||||
float panelHeight = dataMap.Count * itemHeight+25f;
|
||||
rect.sizeDelta = new Vector2(rect.sizeDelta.x, panelHeight);
|
||||
int i = 0;
|
||||
foreach (var p in dataMap)
|
||||
@@ -95,5 +96,10 @@ namespace Octopus.Simulator
|
||||
}
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(contentRect);
|
||||
}
|
||||
|
||||
public void DataDeSelected()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ namespace Octopus.Simulator
|
||||
|
||||
public void OnLogicDataSelected(ILogicItem item)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
ClearItem();
|
||||
|
||||
Type type = item.GetType();
|
||||
@@ -48,7 +49,7 @@ namespace Octopus.Simulator
|
||||
}
|
||||
FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
|
||||
float itemHeight = logicItem.GetComponent<RectTransform>().rect.height;
|
||||
float panelHeight = fields.Length * itemHeight;
|
||||
float panelHeight = fields.Length * itemHeight+25f;
|
||||
rect.sizeDelta = new Vector2(rect.sizeDelta.x, panelHeight);
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
@@ -61,5 +62,10 @@ namespace Octopus.Simulator
|
||||
}
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(contentRect);
|
||||
}
|
||||
|
||||
public void DataDeSelected()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using TMPro;
|
||||
|
||||
namespace Octopus.Simulator
|
||||
{
|
||||
@@ -13,27 +14,46 @@ namespace Octopus.Simulator
|
||||
RectTransform rect;
|
||||
[SerializeField]
|
||||
RectTransform contentRect;
|
||||
[SerializeField]
|
||||
TMP_Dropdown dropdown;
|
||||
|
||||
public Action<string> onPlacedObjectSelected;
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Awake()
|
||||
{
|
||||
rect = GetComponent<RectTransform>();
|
||||
//DataManager.I.onModelsUpdated += SetButton;
|
||||
}
|
||||
|
||||
void SetButton(string Name)
|
||||
public void SetDropdown(string mappingKey)
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
|
||||
var models = DataManager.I.GetModels();
|
||||
|
||||
dropdown.ClearOptions();
|
||||
|
||||
// 3) 옵션 데이터 생성
|
||||
List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>();
|
||||
foreach (var model in models)
|
||||
{
|
||||
var button = Instantiate(ButtonPrefab, rect);
|
||||
button.GetComponent<LogicPlacedObjectButton>().Set(model.name);
|
||||
button.onClick.AddListener(() => LogicMappingDataBase.SetMapping(Name, model));
|
||||
button.onClick.AddListener(() => Debug.Log(Name));
|
||||
button.onClick.AddListener(() => onPlacedObjectSelected?.Invoke(Name));
|
||||
buttons.Add(button);
|
||||
options.Add(new TMP_Dropdown.OptionData(model.name));
|
||||
}
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(contentRect);
|
||||
dropdown.AddOptions(options);
|
||||
|
||||
// 4) 콜백 초기화 후 등록
|
||||
dropdown.onValueChanged.RemoveAllListeners();
|
||||
dropdown.onValueChanged.AddListener(idx =>
|
||||
{
|
||||
var selectedModel = models[idx];
|
||||
LogicMappingDataBase.SetMapping(mappingKey, selectedModel);
|
||||
Debug.Log(mappingKey);
|
||||
onPlacedObjectSelected?.Invoke(mappingKey);
|
||||
});
|
||||
|
||||
// (선택 기본값 설정 필요 시)
|
||||
// dropdown.value = 0;
|
||||
// dropdown.RefreshShownValue();
|
||||
}
|
||||
|
||||
void ClearButton()
|
||||
@@ -48,7 +68,12 @@ namespace Octopus.Simulator
|
||||
public void OnLogicDataSelected(ILogicItem item)
|
||||
{
|
||||
ClearButton();
|
||||
SetButton(item.Name);
|
||||
SetDropdown(item.Name);
|
||||
}
|
||||
|
||||
public void DataDeSelected()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
basemessage:
|
||||
component_id:
|
||||
text: {fileID: 0}
|
||||
MQTTpath: MQTTConfig
|
||||
_topic:
|
||||
--- !u!114 &8164125700257988699
|
||||
@@ -72,7 +71,6 @@ MonoBehaviour:
|
||||
analyses:
|
||||
WebPath: WebConfig
|
||||
ApiPath: APIEndPointsConfig
|
||||
text: {fileID: 0}
|
||||
--- !u!114 &6191105916327120908
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -113,6 +111,7 @@ MonoBehaviour:
|
||||
logicPrefab: {fileID: 2210399282865539074, guid: 72314043a41090846a8c16ad04f3c028, type: 3}
|
||||
LogicWindow: {fileID: 0}
|
||||
linePrefab: {fileID: 6254276411767355245, guid: c899c98324602eb4fbe900753508f64d, type: 3}
|
||||
backGround: {fileID: 0}
|
||||
references:
|
||||
version: 2
|
||||
RefIds: []
|
||||
@@ -179,7 +178,6 @@ MonoBehaviour:
|
||||
projectId:
|
||||
logicId:
|
||||
simulationId:
|
||||
text: {fileID: 0}
|
||||
--- !u!1 &6518512601816170710
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Reference in New Issue
Block a user