|
|
|
@ -269,7 +269,7 @@ public class DevicePanelManager : MonoBehaviour
|
|
|
|
|
} |
|
|
|
|
private void Start() |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
private void OnDestroy() |
|
|
|
|
{ |
|
|
|
@ -281,18 +281,24 @@ public class DevicePanelManager : MonoBehaviour
|
|
|
|
|
LoadDeviceObjConfig(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void RefreshData() |
|
|
|
|
public void RefreshAllData() |
|
|
|
|
{ |
|
|
|
|
StopAllCoroutines(); |
|
|
|
|
LoadDeciceData(); |
|
|
|
|
} |
|
|
|
|
public DeviceList GetDeviceData(DeviceList data) |
|
|
|
|
public void RefreshData(string deviceNo) |
|
|
|
|
{ |
|
|
|
|
StopAllCoroutines(); |
|
|
|
|
LoadDeciceData(deviceNo); |
|
|
|
|
} |
|
|
|
|
public DeviceList GetDeviceData(string deviceNo) |
|
|
|
|
{ |
|
|
|
|
DeviceList data = null; |
|
|
|
|
foreach (var item in AllData) |
|
|
|
|
{ |
|
|
|
|
foreach (var value in item.Value) |
|
|
|
|
{ |
|
|
|
|
if (value.deviceNo == data.deviceNo) |
|
|
|
|
if (value.deviceNo == deviceNo) |
|
|
|
|
{ |
|
|
|
|
data = value; |
|
|
|
|
break; |
|
|
|
@ -301,23 +307,26 @@ public class DevicePanelManager : MonoBehaviour
|
|
|
|
|
} |
|
|
|
|
return data; |
|
|
|
|
} |
|
|
|
|
private void LoadDeciceData() |
|
|
|
|
private void LoadDeciceData(string deviceNo = null) |
|
|
|
|
{ |
|
|
|
|
AllData.Clear(); |
|
|
|
|
foreach (DeviceType i in Enum.GetValues(typeof(DeviceType))) |
|
|
|
|
if (deviceNo == null) |
|
|
|
|
{ |
|
|
|
|
if (i != DeviceType.空) |
|
|
|
|
AllData.Clear(); |
|
|
|
|
foreach (DeviceType i in Enum.GetValues(typeof(DeviceType))) |
|
|
|
|
{ |
|
|
|
|
KeyValuePair<DeviceType, List<DeviceList>> info = new KeyValuePair<DeviceType, List<DeviceList>>( |
|
|
|
|
i, new List<DeviceList>()); |
|
|
|
|
AllData.Add(info); |
|
|
|
|
if (i != DeviceType.空) |
|
|
|
|
{ |
|
|
|
|
KeyValuePair<DeviceType, List<DeviceList>> info = new KeyValuePair<DeviceType, List<DeviceList>>( |
|
|
|
|
i, new List<DeviceList>()); |
|
|
|
|
AllData.Add(info); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
foreach (var item in AllData) |
|
|
|
|
{ |
|
|
|
|
int iType = (int)item.Key; |
|
|
|
|
LoadDiviceData(buildId, iType.ToString(), item.Key); |
|
|
|
|
LoadDiviceData(buildId1, iType.ToString(), item.Key); |
|
|
|
|
LoadDiviceData(buildId, iType.ToString(), item.Key, deviceNo); |
|
|
|
|
LoadDiviceData(buildId1, iType.ToString(), item.Key, deviceNo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
private void LateUpdate() |
|
|
|
@ -362,7 +371,7 @@ public class DevicePanelManager : MonoBehaviour
|
|
|
|
|
{ |
|
|
|
|
timmer = 0; |
|
|
|
|
getDataError = false; |
|
|
|
|
RefreshData(); |
|
|
|
|
RefreshAllData(); |
|
|
|
|
Debug.LogWarning("从对方服务器获取数据错误!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -459,7 +468,7 @@ public class DevicePanelManager : MonoBehaviour
|
|
|
|
|
go.GetComponent<DeviceBind>().DataBind(type, bindData, null == NowClickObject ? null : NowClickObject.name); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
private void LoadDiviceData(long buildId, string diviceId, DeviceType type) |
|
|
|
|
private void LoadDiviceData(long buildId, string diviceId, DeviceType type, string deviceNo = null) |
|
|
|
|
{ |
|
|
|
|
using (MD5 md5Hash = MD5.Create()) |
|
|
|
|
{ |
|
|
|
@ -482,25 +491,49 @@ public class DevicePanelManager : MonoBehaviour
|
|
|
|
|
{ |
|
|
|
|
Post<diveceSourceData, TotaDivecelInfo>($"{baseHttpUrl}?appKey={key}", postData, (d) => |
|
|
|
|
{ |
|
|
|
|
Debug.Log(d.code); |
|
|
|
|
//Debug.Log(d.code); |
|
|
|
|
if (d.code != 200) |
|
|
|
|
{ |
|
|
|
|
getDataError = true; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
foreach (var item in d.data.list) |
|
|
|
|
if (deviceNo == null) |
|
|
|
|
{ |
|
|
|
|
foreach (var data in AllData) |
|
|
|
|
foreach (var item in d.data.list) |
|
|
|
|
{ |
|
|
|
|
if (data.Key == type) |
|
|
|
|
foreach (var data in AllData) |
|
|
|
|
{ |
|
|
|
|
if (!data.Value.Contains(item)) |
|
|
|
|
if (data.Key == type) |
|
|
|
|
{ |
|
|
|
|
data.Value.Add(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
foreach (var item in d.data.list) |
|
|
|
|
{ |
|
|
|
|
if (item.deviceNo == deviceNo) |
|
|
|
|
{ |
|
|
|
|
foreach (var data in AllData) |
|
|
|
|
{ |
|
|
|
|
if (data.Key == type) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < data.Value.Count; i++) |
|
|
|
|
{ |
|
|
|
|
if (data.Value[i].deviceNo == deviceNo) |
|
|
|
|
{ |
|
|
|
|
data.Value[i] = item; |
|
|
|
|
Debug.Log("数据刷新成功!"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, (a, b) => |
|
|
|
|
{ |
|
|
|
|
Debug.LogError(a + b); |
|
|
|
@ -511,19 +544,46 @@ public class DevicePanelManager : MonoBehaviour
|
|
|
|
|
{ |
|
|
|
|
PostJson<diveceSourceData, TotaDivecelInfo>($"?appKey={key}", postData, (d) => |
|
|
|
|
{ |
|
|
|
|
Debug.Log(d.code); |
|
|
|
|
//Debug.Log(d.code); |
|
|
|
|
if (d.code != 200) |
|
|
|
|
{ |
|
|
|
|
getDataError = true; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
foreach (var item in d.data.list) |
|
|
|
|
if (deviceNo == null) |
|
|
|
|
{ |
|
|
|
|
foreach (var data in AllData) |
|
|
|
|
foreach (var item in d.data.list) |
|
|
|
|
{ |
|
|
|
|
if (data.Key == type) |
|
|
|
|
foreach (var data in AllData) |
|
|
|
|
{ |
|
|
|
|
data.Value.Add(item); |
|
|
|
|
if (data.Key == type) |
|
|
|
|
{ |
|
|
|
|
data.Value.Add(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
foreach (var item in d.data.list) |
|
|
|
|
{ |
|
|
|
|
if (item.deviceNo == deviceNo) |
|
|
|
|
{ |
|
|
|
|
foreach (var data in AllData) |
|
|
|
|
{ |
|
|
|
|
if (data.Key == type) |
|
|
|
|
{ |
|
|
|
|
for (int i = 0; i < data.Value.Count; i++) |
|
|
|
|
{ |
|
|
|
|
if (data.Value[i].deviceNo == deviceNo) |
|
|
|
|
{ |
|
|
|
|
data.Value[i] = item; |
|
|
|
|
Debug.Log("数据刷新成功!"); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|