DataRepository 오류 수정

This commit is contained in:
geondo55
2025-07-30 15:38:52 +09:00
parent 60ce186a2e
commit 57a5fb3b61
6 changed files with 41 additions and 6 deletions

View File

@@ -314,7 +314,7 @@ MonoBehaviour:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1 m_ColorMultiplier: 1
m_FadeDuration: 0.1 m_FadeDuration: 0.1
@@ -347,3 +347,4 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
panel_Repository: {fileID: 0} panel_Repository: {fileID: 0}
bg: {fileID: 0}

View File

@@ -314,7 +314,7 @@ MonoBehaviour:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1} m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.8235294, g: 0.039215688, b: 0.06666667, a: 1} m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1 m_ColorMultiplier: 1
m_FadeDuration: 0.1 m_FadeDuration: 0.1
@@ -347,3 +347,4 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
panel_Repository: {fileID: 0} panel_Repository: {fileID: 0}
bg: {fileID: 0}

View File

@@ -15,6 +15,7 @@ namespace Studio
public Panel_DataRepository panel_Repository; public Panel_DataRepository panel_Repository;
Button button; Button button;
public Image bg;
TextMeshProUGUI buttonName; TextMeshProUGUI buttonName;
string baseDataKey; string baseDataKey;
@@ -23,6 +24,7 @@ namespace Studio
private void Awake() private void Awake()
{ {
button = GetComponent<Button>(); button = GetComponent<Button>();
bg = GetComponent<Image>();
buttonName = GetComponentInChildren<TextMeshProUGUI>(); buttonName = GetComponentInChildren<TextMeshProUGUI>();
button.onClick.AddListener(OnClickButton); button.onClick.AddListener(OnClickButton);
@@ -31,6 +33,7 @@ namespace Studio
void OnClickButton() void OnClickButton()
{ {
panel_Repository.ShowInformation_APIData(baseDataKey, dataValue); panel_Repository.ShowInformation_APIData(baseDataKey, dataValue);
bg.color = new Color32(0xD2, 0x0A, 0x11, 0xFF);
} }
public void SetButtonData<T>(string name, StudioEntityWithState<T> data) public void SetButtonData<T>(string name, StudioEntityWithState<T> data)

View File

@@ -14,6 +14,7 @@ namespace Studio
public Panel_DataRepository panel_Repository; public Panel_DataRepository panel_Repository;
Button button; Button button;
public Image bg;
TextMeshProUGUI buttonName; TextMeshProUGUI buttonName;
string baseDataKey; string baseDataKey;
@@ -23,6 +24,7 @@ namespace Studio
private void Awake() private void Awake()
{ {
button = GetComponent<Button>(); button = GetComponent<Button>();
bg = GetComponent<Image>();
buttonName = GetComponentInChildren<TextMeshProUGUI>(); buttonName = GetComponentInChildren<TextMeshProUGUI>();
button.onClick.AddListener(OnClickButton); button.onClick.AddListener(OnClickButton);
@@ -31,6 +33,7 @@ namespace Studio
void OnClickButton() void OnClickButton()
{ {
panel_Repository.ShowInformation_MQTTData(baseDataKey, dataValue, elapsedTime); panel_Repository.ShowInformation_MQTTData(baseDataKey, dataValue, elapsedTime);
bg.color = new Color32(0xD2, 0x0A, 0x11, 0xFF);
} }
public void SetButtonData(string name, Dictionary<string, Dictionary<string, string>> data, TimeSpan elapsedTime) public void SetButtonData(string name, Dictionary<string, Dictionary<string, string>> data, TimeSpan elapsedTime)

View File

@@ -20,7 +20,9 @@ namespace Studio.UI
public Panel_DataRepository panel_Repository; public Panel_DataRepository panel_Repository;
public Button ClickButton; public Button ClickButton;
Button FoldButton; Button FoldButton;
public Image bg;
TextMeshProUGUI buttonText; TextMeshProUGUI buttonText;
UI_DataRepositoryButtonList dataList; UI_DataRepositoryButtonList dataList;
@@ -31,7 +33,7 @@ namespace Studio.UI
{ {
buttonText = ClickButton.GetComponentInChildren<TextMeshProUGUI>(); buttonText = ClickButton.GetComponentInChildren<TextMeshProUGUI>();
dataList = GetComponentInChildren<UI_DataRepositoryButtonList>(); dataList = GetComponentInChildren<UI_DataRepositoryButtonList>();
bg = ClickButton.GetComponent<Image>();
ClickButton.onClick.AddListener(OnClickButton); ClickButton.onClick.AddListener(OnClickButton);
FoldButton.onClick.AddListener(OnClickFoldButton); FoldButton.onClick.AddListener(OnClickFoldButton);
} }
@@ -46,6 +48,8 @@ namespace Studio.UI
{ {
panel_Repository.ShowInformation_MQTT(); panel_Repository.ShowInformation_MQTT();
} }
bg.color = new Color32(0xD2, 0x0A, 0x11, 0xFF);
} }
void OnClickFoldButton() void OnClickFoldButton()
@@ -53,13 +57,13 @@ namespace Studio.UI
if (isFold) if (isFold)
{ {
dataList.FoldButtons(true); dataList.FoldButtons(true);
FoldButton.GetComponent<RectTransform>().localRotation = Quaternion.Euler(0f, 0f, 0f); FoldButton.GetComponent<RectTransform>().localScale = Vector3.one;
isFold = false; isFold = false;
} }
else else
{ {
dataList.FoldButtons(false); dataList.FoldButtons(false);
FoldButton.GetComponent<RectTransform>().localRotation = Quaternion.Euler(0f, 0f, 180f); FoldButton.GetComponent<RectTransform>().localScale = new Vector3(1, -1, 1);
isFold = true; isFold = true;
} }
panel_Repository.RebuildLayout(); panel_Repository.RebuildLayout();

View File

@@ -34,13 +34,14 @@ namespace Studio
TextMeshProUGUI MaximumResponseTimeAPI; TextMeshProUGUI MaximumResponseTimeAPI;
LayoutGroup[] layoutGroups; LayoutGroup[] layoutGroups;
UI_ProtocolLabel[] protocolLabels;
Dictionary<string, UI_BaseDataButton> apiButtons = new(); Dictionary<string, UI_BaseDataButton> apiButtons = new();
Dictionary<string, UI_MQTTDataButton> mqttButtons = new(); Dictionary<string, UI_MQTTDataButton> mqttButtons = new();
public override void AfterAwake() public override void AfterAwake()
{ {
UI_ProtocolLabel[] protocolLabels = GetComponentsInChildren<UI_ProtocolLabel>(); protocolLabels = GetComponentsInChildren<UI_ProtocolLabel>();
foreach (UI_ProtocolLabel label in protocolLabels) foreach (UI_ProtocolLabel label in protocolLabels)
{ {
label.panel_Repository = this; label.panel_Repository = this;
@@ -132,6 +133,7 @@ namespace Studio
Panel_APIDataInfo.gameObject.SetActive(false); Panel_APIDataInfo.gameObject.SetActive(false);
Panel_MQTTInfo.gameObject.SetActive(false); Panel_MQTTInfo.gameObject.SetActive(false);
Panel_MQTTDataInfo.gameObject.SetActive(false); Panel_MQTTDataInfo.gameObject.SetActive(false);
ResetButtonColor();
if (info == null) if (info == null)
return; return;
@@ -162,6 +164,7 @@ namespace Studio
Panel_APIDataInfo.gameObject.SetActive(true); Panel_APIDataInfo.gameObject.SetActive(true);
Panel_MQTTInfo.gameObject.SetActive(false); Panel_MQTTInfo.gameObject.SetActive(false);
Panel_MQTTDataInfo.gameObject.SetActive(false); Panel_MQTTDataInfo.gameObject.SetActive(false);
ResetButtonColor();
} }
public void ShowInformation_MQTT() public void ShowInformation_MQTT()
@@ -170,6 +173,7 @@ namespace Studio
Panel_APIDataInfo.gameObject.SetActive(false); Panel_APIDataInfo.gameObject.SetActive(false);
Panel_MQTTInfo.gameObject.SetActive(true); Panel_MQTTInfo.gameObject.SetActive(true);
Panel_MQTTDataInfo.gameObject.SetActive(false); Panel_MQTTDataInfo.gameObject.SetActive(false);
ResetButtonColor();
} }
public void ShowInformation_MQTTData(string name, Dictionary<string, Dictionary<string, string>> data, TimeSpan elapsedTime) public void ShowInformation_MQTTData(string name, Dictionary<string, Dictionary<string, string>> data, TimeSpan elapsedTime)
@@ -180,11 +184,30 @@ namespace Studio
Panel_APIDataInfo.gameObject.SetActive(false); Panel_APIDataInfo.gameObject.SetActive(false);
Panel_MQTTInfo.gameObject.SetActive(false); Panel_MQTTInfo.gameObject.SetActive(false);
Panel_MQTTDataInfo.gameObject.SetActive(true); Panel_MQTTDataInfo.gameObject.SetActive(true);
ResetButtonColor();
} }
void Deactivate() void Deactivate()
{ {
gameObject.SetActive(false); gameObject.SetActive(false);
} }
private void ResetButtonColor()
{
foreach (UI_ProtocolLabel label in protocolLabels)
{
label.bg.color = Color.white;
}
foreach (var btn in apiButtons.Values)
{
btn.bg.color = Color.white;
}
foreach (var btn in mqttButtons.Values)
{
btn.bg.color = Color.white;
}
}
} }
} }