mqtt api 업데이트
This commit is contained in:
@@ -356,7 +356,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -0.0000076293945}
|
||||
m_SizeDelta: {x: -10, y: 0}
|
||||
m_SizeDelta: {x: -10, y: 45}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!114 &1695482358976848412
|
||||
MonoBehaviour:
|
||||
@@ -492,7 +492,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &5526574206638406261
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -658,10 +658,10 @@ RectTransform:
|
||||
- {fileID: 6015914731583279537}
|
||||
m_Father: {fileID: 6170707829871908408}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 286.5, y: -12.5}
|
||||
m_SizeDelta: {x: 573, y: 25}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 25}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2662598266185177957
|
||||
CanvasRenderer:
|
||||
@@ -1644,7 +1644,7 @@ GameObject:
|
||||
- component: {fileID: 8884052470916437046}
|
||||
- component: {fileID: 511402088849978217}
|
||||
m_Layer: 5
|
||||
m_Name: Panel
|
||||
m_Name: Panel_Button
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@@ -1668,7 +1668,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 15}
|
||||
m_AnchoredPosition: {x: 0, y: 25}
|
||||
m_SizeDelta: {x: 0, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &8884052470916437046
|
||||
@@ -1797,7 +1797,7 @@ RectTransform:
|
||||
m_Father: {fileID: 6764751412898966732}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 5, y: 0}
|
||||
m_SizeDelta: {x: 10, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace Studio.UI
|
||||
|
||||
private UI_InputTopicItem prf_InputTopicItem;
|
||||
private List<UI_InputTopicItem> inputTopicItems = new List<UI_InputTopicItem>();
|
||||
private List<UI_InputTopicItem> previnputTopicItems = new List<UI_InputTopicItem>();
|
||||
|
||||
|
||||
public Action onMQTTTest;
|
||||
public Action<UI_MQTTConnection> onRemoveMQTTConnectionItem;
|
||||
@@ -45,6 +43,7 @@ namespace Studio.UI
|
||||
panel_MQTTTestResult = CanvasManager.instance.GetCanvas<Canvas_Popup>().panel_mqtttestresult;
|
||||
inputTopicItems.Clear();
|
||||
}
|
||||
|
||||
private void OnClickAddURLItemButton()
|
||||
{
|
||||
CreateTopicItem();
|
||||
@@ -161,8 +160,9 @@ namespace Studio.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void RevertInfo()
|
||||
public void RevertInfo(MQTTConnection mqttconnection)
|
||||
{
|
||||
prevMQTTData = mqttconnection;
|
||||
InputField_Domain.text = prevMQTTData.domain;
|
||||
InputField_Port.text = prevMQTTData.port;
|
||||
ItemRemoveOrCreate();
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Studio.UI
|
||||
private Button Button_OK;
|
||||
private Button Button_Cancel;
|
||||
|
||||
|
||||
private MQTTSetting prevMQTTSetting;
|
||||
private List<UI_MQTTConnection> prevMQTTConnectionItems = new List<UI_MQTTConnection>();
|
||||
public void Active(bool isActive)
|
||||
{
|
||||
@@ -45,10 +45,17 @@ namespace Studio.UI
|
||||
|
||||
private void Save()
|
||||
{
|
||||
var items = new List<MQTTConnection>();
|
||||
foreach (var mqttitem in mqttConnectionItems)
|
||||
{
|
||||
items.Add(mqttitem.GetMQTTConnection());
|
||||
mqttitem.SaveItem();
|
||||
}
|
||||
if(prevMQTTSetting==null)
|
||||
{
|
||||
prevMQTTSetting = GetMQTTSetting();
|
||||
}
|
||||
prevMQTTSetting.mqttConnections = items;
|
||||
Active(false);
|
||||
}
|
||||
|
||||
@@ -73,9 +80,31 @@ namespace Studio.UI
|
||||
|
||||
private void RevertState()
|
||||
{
|
||||
if (prevMQTTSetting == null)
|
||||
{
|
||||
prevMQTTSetting = GetMQTTSetting();
|
||||
}
|
||||
|
||||
ItemCreate();
|
||||
|
||||
var index = 0;
|
||||
foreach (var mqttitem in mqttConnectionItems)
|
||||
{
|
||||
mqttitem.RevertInfo();
|
||||
mqttitem.RevertInfo(prevMQTTSetting.mqttConnections[index]);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
private void ItemCreate()
|
||||
{
|
||||
var gapCount= mqttConnectionItems.Count - prevMQTTSetting.mqttConnections.Count;
|
||||
if (gapCount < 0)
|
||||
{
|
||||
var count = MathF.Abs(gapCount);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
CreateItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +123,11 @@ namespace Studio.UI
|
||||
Button_Close.onClick.AddListener(Close);
|
||||
}
|
||||
private void OnClickAddAPIConnectionItemButton()
|
||||
{
|
||||
CreateItem();
|
||||
}
|
||||
|
||||
private void CreateItem()
|
||||
{
|
||||
var item = Instantiate(prf_MQTTConnectionItem, Content);
|
||||
item.onRemoveMQTTConnectionItem += RemoveMQTTConnectionItem;
|
||||
@@ -122,6 +156,7 @@ namespace Studio.UI
|
||||
}
|
||||
public void SetMQTTSetting(MQTTSetting mqttSetting)
|
||||
{
|
||||
prevMQTTSetting = mqttSetting;
|
||||
foreach(var item in mqttConnectionItems)
|
||||
{
|
||||
Destroy(item.gameObject);
|
||||
|
||||
Reference in New Issue
Block a user