MQTT 테스트 화면 추가

This commit is contained in:
wsh
2025-05-25 14:19:35 +09:00
parent 831d0b17ae
commit 6e7f5fefbb
21 changed files with 2310 additions and 2279 deletions

View File

@@ -0,0 +1,74 @@
using Studio.Manage;
using Studio.UI;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UVC.UI;
using XRLib;
using XRLib.UI;
namespace Studio
{
public class Panel_MQTTTestResult : PanelBase
{
public UVCKeyValueItem Item_Domain;
public UVCKeyValueItem Item_Port;
public ScrollRect scrollView_TopicResults;
public UI_MQTTTestResultItem prf_MQTTTestResultItem;
public Button button_Close;
public struct MQTTTestResult
{
public string topic;
public string message;
public string payload;
}
private void Awake()
{
button_Close = transform.DeepFind<Button>(nameof(button_Close));
button_Close.onClick.AddListener(Close);
scrollView_TopicResults = GetComponentInChildren<ScrollRect>();
Item_Port = transform.Find(nameof(Item_Port)).GetComponent< UVCKeyValueItem>();
Item_Domain = transform.Find(nameof(Item_Domain)).GetComponent< UVCKeyValueItem>();
prf_MQTTTestResultItem = Resources.Load<UI_MQTTTestResultItem>(ResourceURL.mqttTestResultItem);
}
private void Close()
{
Debug.Log("Close MQTT Test Result Panel.");
foreach (var item in items)
{
Destroy(item.gameObject);
}
items.Clear();
topics.Clear();
gameObject.SetActive(false);
}
public void Open(string domain, string port)
{
Debug.Log($"Open MQTT Test Result Panel. Domain: {domain}, Port: {port}");
Item_Domain.SetValue(domain);
Item_Port.SetValue(port);
gameObject.SetActive(true);
}
List<string> topics = new List<string>();
List<UI_MQTTTestResultItem> items = new List<UI_MQTTTestResultItem>();
public void AddResult(MQTTTestResult result)
{
Debug.Log($"Add MQTT Test Result. Topic: {result.topic}, Message: {result.message}, Payload Length: {result.payload.Length}");
if (topics.Contains(result.topic))
{
Debug.LogWarning($"Topic {result.topic} already exists in the results.");
return;
}
var item = Instantiate(prf_MQTTTestResultItem, scrollView_TopicResults.content);
item.SetResult(result.topic, result.message, result.payload);
item.transform.SetParent(scrollView_TopicResults.content);
items.Add(item);
}
}
}

View File

@@ -1,9 +0,0 @@
using UnityEngine;
namespace XED
{
public class Panel_MQTTTesutResult : MonoBehaviour
{
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,364 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3247054695513413912
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 786828592153370158}
- component: {fileID: 3041370518908279293}
- component: {fileID: 2826910970834278222}
m_Layer: 5
m_Name: text_Value
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &786828592153370158
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3247054695513413912}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2769739711048485923}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 331.6025, y: -10}
m_SizeDelta: {x: 256.795, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3041370518908279293
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3247054695513413912}
m_CullTransparentMesh: 1
--- !u!114 &2826910970834278222
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3247054695513413912}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 220.90.135.190
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 69abd87f38225ed46aa612577c25f379, type: 2}
m_sharedMaterial: {fileID: -7290017371581542385, guid: 69abd87f38225ed46aa612577c25f379, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSizeBase: 18
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &6990871414010457830
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5616309992854961322}
- component: {fileID: 3062705649536271554}
- component: {fileID: 538420965549002447}
m_Layer: 5
m_Name: text_Key
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5616309992854961322
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6990871414010457830}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2769739711048485923}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 107.6025, y: -10}
m_SizeDelta: {x: 191.205, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3062705649536271554
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6990871414010457830}
m_CullTransparentMesh: 1
--- !u!114 &538420965549002447
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6990871414010457830}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Domain
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 69abd87f38225ed46aa612577c25f379, type: 2}
m_sharedMaterial: {fileID: -7290017371581542385, guid: 69abd87f38225ed46aa612577c25f379, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSizeBase: 18
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &9091791058432266900
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2769739711048485923}
- component: {fileID: 4648596209726711372}
- component: {fileID: 5281556152534361517}
- component: {fileID: 5310847872014552589}
m_Layer: 5
m_Name: UVCKeyValueItem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2769739711048485923
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9091791058432266900}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 5616309992854961322}
- {fileID: 786828592153370158}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 230, y: -32}
m_SizeDelta: {x: 460, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4648596209726711372
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9091791058432266900}
m_CullTransparentMesh: 1
--- !u!114 &5281556152534361517
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9091791058432266900}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &5310847872014552589
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9091791058432266900}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f80c738472e3a5c4086c08da076b88e8, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fd800c471a582c843b3a9fcf52e879cf
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a53c37bbfe23e284ea252e76e6aa6a89
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2742,28 +2742,11 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 6151036698135753193, guid: 13ace7584c1d4514cb2218354647e355, type: 3}
m_PrefabInstance: {fileID: 396217241}
m_PrefabAsset: {fileID: 0}
--- !u!1 &802579211 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1329990658003581341, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
m_PrefabInstance: {fileID: 3674406319109641156}
m_PrefabAsset: {fileID: 0}
--- !u!224 &802579212 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3904775533281402009, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
m_PrefabInstance: {fileID: 3674406319109641156}
m_PrefabAsset: {fileID: 0}
--- !u!114 &802579216
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 802579211}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1f91279b393079c469a0fa017cb9f642, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &837752632
GameObject:
m_ObjectHideFlags: 0
@@ -9697,21 +9680,13 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 545811781}
m_Modifications:
- target: {fileID: 224955368624265679, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
- target: {fileID: 928561504100581918, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_Horizontal
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224955368624265679, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224955368624265679, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224955368624265679, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
- target: {fileID: 928561504100581918, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_HorizontalScrollbarVisibility
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1329990658003581341, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_Name
@@ -9729,61 +9704,21 @@ PrefabInstance:
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1871913602782728431, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1871913602782728431, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1871913602782728431, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1871913602782728431, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1871913602782728431, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2685580638284742466, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2685580638284742466, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2685580638284742466, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2685580638284742466, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2685580638284742466, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3451800542314492365, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3451800542314492365, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3451800542314492365, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 216.20946
objectReference: {fileID: 0}
- target: {fileID: 3451800542314492365, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -10
objectReference: {fileID: 0}
- target: {fileID: 3904775533281402009, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_Pivot.x
@@ -9875,43 +9810,23 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5208657889103829284, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5208657889103829284, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5208657889103829284, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 446.20947
objectReference: {fileID: 0}
- target: {fileID: 5208657889103829284, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -10
objectReference: {fileID: 0}
- target: {fileID: 5367126745181614260, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0.000038343704
objectReference: {fileID: 0}
- target: {fileID: 5971015670859983669, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5971015670859983669, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5971015670859983669, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5971015670859983669, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5971015670859983669, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: 0.00013829044
objectReference: {fileID: 0}
- target: {fileID: 6343152227034270267, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.x
@@ -9933,69 +9848,10 @@ PrefabInstance:
propertyPath: m_SizeDelta.x
value: -17
objectReference: {fileID: 0}
- target: {fileID: 6712418427872914089, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6712418427872914089, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6712418427872914089, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6712418427872914089, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 230
objectReference: {fileID: 0}
- target: {fileID: 6712418427872914089, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: -43
objectReference: {fileID: 0}
- target: {fileID: 7841515863460374155, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7841515863460374155, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7841515863460374155, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7841515863460374155, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7841515863460374155, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9175712139416052929, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9175712139416052929, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9175712139416052929, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9175712139416052929, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 1329990658003581341, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
insertIndex: -1
addedObject: {fileID: 802579216}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a247a040b2f41a7479cb4dcc20d9ecd0, type: 3}
--- !u!1001 &3913291316500297758
PrefabInstance:

View File

@@ -3,5 +3,6 @@ namespace Studio.Manage
public class ResourceURL
{
public readonly static string materialPath = "Materials";
internal static string mqttTestResultItem = "Prefabs/UI/Item_TopicResult";
}
}

View File

@@ -2,6 +2,7 @@ using Best.MQTT;
using Best.MQTT.Packets.Builders;
using Studio.Util;
using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
@@ -13,13 +14,13 @@ namespace Studio.Connection
MQTTClient client;
string domain;
int port;
string topic;
Action<string> callback;
public TemporaryMQTTClient(string domain, int port, string topic, Action<string> callback)
List<string> topics;
Action<string, string> callback;
public TemporaryMQTTClient(string domain, int port, List<string> topic, Action<string, string> callback)
{
this.domain = domain;
this.port = port;
this.topic = topic;
this.topics = topic;
this.callback = callback;
var optionBuilder = new ConnectionOptionsBuilder()
.WithTCP(domain, port)
@@ -35,7 +36,7 @@ namespace Studio.Connection
public override string ToString()
{
return $"domain={domain}, port={port}, topic={topic}";
return $"domain={domain}, port={port}, topic={topics}";
}
@@ -43,8 +44,14 @@ namespace Studio.Connection
{
string payload = Encoding.UTF8.GetString(message.Payload.Data, message.Payload.Offset, message.Payload.Count);
Debug.Log($"Temporary MQTT is OnTopic. {ToString()}, msg={payload}");
callback(payload);
Disconnect();
callback(topicName, payload);
this.topics.Remove(topicName);
client.CreateUnsubscribePacketBuilder(topicName)
.BeginUnsubscribe();
if (this.topics.Count == 0)
Disconnect();
}
private ConnectPacketBuilder ConnectPacketBuilderCallback(MQTTClient client, ConnectPacketBuilder builder)
@@ -53,8 +60,6 @@ namespace Studio.Connection
}
void Disconnect()
{
client.CreateUnsubscribePacketBuilder(topic)
.BeginUnsubscribe();
client.CreateDisconnectPacketBuilder()
.BeginDisconnect();
}
@@ -78,9 +83,12 @@ namespace Studio.Connection
private void OnConnectedMQTT(MQTTClient client)
{
Debug.Log($"Temporary MQTT Client is OnConnected. {ToString()}");
client.CreateBulkSubscriptionBuilder()
.WithTopic(new SubscribeTopicBuilder(topic).WithMessageCallback(OnTopic))
.BeginSubscribe();
foreach (var t in topics)
{
client.CreateSubscriptionBuilder(t)
.WithMessageCallback(OnTopic)
.BeginSubscribe();
}
}
}
}

View File

@@ -54,6 +54,7 @@ namespace Studio
public Panel_DataConnectModal panel_dataconnectmodal;
public Panel_AlarmConnectModal panel_alarmconnectmodal;
public Panel_DynamicObjectInfo panel_dynamicobjectinfo;
internal Panel_MQTTTestResult panel_mqtttestresult;
private void Awake()
{

View File

@@ -8,6 +8,7 @@ using Studio.Util;
using Studio.Conifg;
using Studio.Connection;
using System.Linq;
using Studio.Manage;
namespace Studio
{
@@ -28,14 +29,15 @@ namespace Studio
public Panel_DataRepository panel_DataRepository;
public Panel_MQTTTestResult panel_MQTTTestResult;
public override void AfterAwake()
{
prf_InputTopicItem = Resources.Load<UI_InputTopicItem>("Prefabs/UI/PRF_InputTopicItem");
Button_AddTopicItem.onClick.AddListener(OnClickAddURLItemButton);
Button_TestMQTT.onClick.AddListener(OnClickMQTTTest);
Button_Remove.onClick.AddListener(OnClickRemoveItemButton);
panel_MQTTTestResult = EventConnector.instance.GetCanvas<Canvas_Popup>().panel_mqtttestresult;
inputTopicItems.Clear();
}
private void OnClickAddURLItemButton()
@@ -57,16 +59,25 @@ namespace Studio
List<string> topics = new();
foreach (UI_InputTopicItem item in inputTopicItems)
{
topics.Add(item.InputField_Topic.text);
var topic = item.InputField_Topic.text;
topics.Add(topic);
}
var tmpClient = new TemporaryMQTTClient(domain, port, topics.First(), OnTopicTest);
var tmpClient = new TemporaryMQTTClient(domain, port, topics, OnTopicTest);
panel_MQTTTestResult.Open(domain, port.ToString());
}
void OnTopicTest(string payload)
void OnTopicTest(string topic, string payload)
{
Debug.Log($"MQTT Test result = {payload}");
Debug.Log($"On Topic Test. topic={topic}, payload={payload}");
var result = new Panel_MQTTTestResult.MQTTTestResult
{
topic = topic,
message = "Test Message",
payload = payload
};
panel_MQTTTestResult.AddResult(result);
}
private void OnClickRemoveItemButton()
{
onRemoveMQTTConnectionItem?.Invoke(this);

View File

@@ -0,0 +1,20 @@
using TMPro;
namespace UVC.UI
{
public class UVCKeyValueItem : MonoBehaviour
{
TextMeshProUGUI text_Key;
TextMeshProUGUI text_Value;
private void Awake()
{
text_Key = transform.Find(nameof(text_Key)).GetComponent<TextMeshProUGUI>();
text_Value = transform.Find(nameof(text_Value)).GetComponent<TextMeshProUGUI>();
}
public void SetValue(string value)
{
text_Value.SetText(value);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f80c738472e3a5c4086c08da076b88e8

View File

@@ -34,7 +34,7 @@ public partial class MonoBehaviour : UnityEngine.MonoBehaviour
public T Find<T>(string name) where T : Component
{
return transform.Find<T>(name);
return transform.DeepFind<T>(name);
}
public new static Object Instantiate(Object original, Vector3 position, Quaternion rotation)
{

View File

@@ -53,7 +53,7 @@ namespace XRLib
}
return result;
}
public static T Find<T>(this Transform root, string name) where T : Component
public static T DeepFind<T>(this Transform root, string name) where T : Component
{
T result = default;
int count = root.childCount;
@@ -67,7 +67,7 @@ namespace XRLib
return result;
}
}
result = child.Find<T>(name);
result = child.DeepFind<T>(name);
if (result != null)
{

View File

@@ -0,0 +1,48 @@
using System;
using TMPro;
using TriLibCore.Extensions;
using UnityEngine;
using UnityEngine.UI;
using UVC.UI;
using XRLib;
namespace Studio.UI
{
public class UI_MQTTTestResultItem : MonoBehaviour
{
public Transform Item_Topic;
public UVCKeyValueItem Item_TopicPayload;
public UVCKeyValueItem Item_TopicPacketSize;
public Button expand;
public Button refresh;
private void Awake()
{
Item_Topic = transform.DeepFind<Transform>(nameof(Item_Topic));
Item_TopicPayload = transform.DeepFind<UVCKeyValueItem>(nameof(Item_TopicPayload));
Item_TopicPacketSize = transform.DeepFind<UVCKeyValueItem>(nameof(Item_TopicPacketSize));
refresh = Item_Topic.GetComponentInChildren<Button>();
expand = Item_TopicPayload.GetComponentInChildren<Button>();
expand.onClick.AddListener(OnClickExpandPayloadView);
}
private void OnClickExpandPayloadView()
{
throw new NotImplementedException();
}
internal void SetResult(string topic, string message, string payload)
{
Debug.Log($"Set MQTT Test Result Item. Topic: {topic}, Message: {message}, Payload Length: {payload.Length}");
if(Item_Topic == null || Item_TopicPayload == null || Item_TopicPacketSize == null)
{
Debug.LogError("UI_MQTTTestResultItem: One or more UI elements are not assigned.");
return;
}
Item_Topic.DeepFind<TextMeshProUGUI>("Text_Topic").SetText(topic);
Item_TopicPayload.SetValue(payload);
Item_TopicPacketSize.SetValue(payload.Length.ToString());
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4c728c0cf08b8aa4c8ef31b2c9a32c76

View File

@@ -203,7 +203,7 @@ namespace Best.HTTP.Shared.Databases
public bool Save()
{
if (!this.rwlock.TryEnterWriteLock(TimeSpan.FromMilliseconds(0)))
if (rwlock!=null && !this.rwlock.TryEnterWriteLock(TimeSpan.FromMilliseconds(0)))
return false;
try

View File

@@ -18,7 +18,7 @@ EditorSettings:
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref
m_ProjectGenerationRootNamespace: XED
m_ProjectGenerationRootNamespace: Studio
m_EnableTextureStreamingInEditMode: 1
m_EnableTextureStreamingInPlayMode: 1
m_EnableEditorAsyncCPUTextureLoading: 0