updated
This commit is contained in:
@@ -56,7 +56,7 @@ namespace Octopus.Simulator
|
||||
panelConnectedObject.gameObject.SetActive(false);
|
||||
panelPlacedObject.gameObject.SetActive(false);
|
||||
//LogicWindow.gameObject.SetActive(false);
|
||||
//FindAnyObjectByType<WebReceiver>().onParameterRecived += RequestInfo;
|
||||
FindAnyObjectByType<WebReceiver>().onParameterRecived += RequestInfo;
|
||||
FindAnyObjectByType<MQTTManager>().onLogicUpdated += RequestInfo;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,16 @@ namespace Octopus.Simulator
|
||||
{
|
||||
currentData = Data;
|
||||
config = Data.webConfig;
|
||||
if (currentData.ModelFiles.Count >= 1)
|
||||
{
|
||||
SimulationModelFile files = currentData.ModelFiles[currentData.ModelFiles.Count - 1];
|
||||
if (files.id.HasValue)
|
||||
{
|
||||
WebParameters.config.modelId = files.id.Value.ToString();
|
||||
var saveload = FindAnyObjectByType<SaveLoadmanager>();
|
||||
saveload.Onclick_Load(files.data.info);
|
||||
}
|
||||
}
|
||||
QueueVisulization(Data.data.queues);
|
||||
ResourceVisulization(Data.data.resources);
|
||||
StoreVisulization(Data.data.stores);
|
||||
|
||||
@@ -47,11 +47,11 @@ namespace Octopus.Simulator.Networks
|
||||
void Awake()
|
||||
{
|
||||
mqttManager = this;
|
||||
//FindAnyObjectByType<WebReceiver>().onMqttConfigReceived += SetMqttConfig;
|
||||
SetMqttConfig();
|
||||
FindAnyObjectByType<WebReceiver>().onMqttConfigReceived += SetMqttConfig;
|
||||
//SetMqttConfig();
|
||||
}
|
||||
|
||||
public void SetMqttConfig()
|
||||
public void SetMqttConfig(string json)
|
||||
{
|
||||
/*
|
||||
string path = Application.streamingAssetsPath + MQTTpath;
|
||||
@@ -59,10 +59,11 @@ namespace Octopus.Simulator.Networks
|
||||
using (StreamReader reader = new StreamReader(path))
|
||||
{
|
||||
json = reader.ReadToEnd();
|
||||
} */
|
||||
}
|
||||
TextAsset json = Resources.Load<TextAsset>(MQTTpath);
|
||||
Debug.Log(json.text);
|
||||
MQTTConfigList ConfigList = JsonConvert.DeserializeObject<MQTTConfigList>(json.text);
|
||||
*/
|
||||
MQTTConfigList ConfigList = JsonConvert.DeserializeObject<MQTTConfigList>(json);
|
||||
var config = ConfigList.configs[0];
|
||||
string clientName = config.name;
|
||||
string host = config.host;
|
||||
|
||||
@@ -33,12 +33,12 @@ namespace Octopus.Simulator.Networks
|
||||
void Awake()
|
||||
{
|
||||
webManager = this;
|
||||
//FindAnyObjectByType<WebReceiver>().onWebConfigReceived += SetWebConfig;
|
||||
SetWebConfig();
|
||||
FindAnyObjectByType<WebReceiver>().onWebConfigReceived += SetWebConfig;
|
||||
//SetWebConfig();
|
||||
SetApiConfig();
|
||||
}
|
||||
|
||||
private void SetWebConfig()
|
||||
private void SetWebConfig(string json)
|
||||
{
|
||||
/*
|
||||
string path = Application.streamingAssetsPath + WebPath;
|
||||
@@ -47,10 +47,9 @@ namespace Octopus.Simulator.Networks
|
||||
{
|
||||
json = reader.ReadToEnd();
|
||||
}
|
||||
*/
|
||||
var json = Resources.Load<TextAsset>(WebPath);
|
||||
|
||||
WebConfigList ConfigList = JsonConvert.DeserializeObject<WebConfigList>(json.text);
|
||||
*/
|
||||
WebConfigList ConfigList = JsonConvert.DeserializeObject<WebConfigList>(json);
|
||||
var config = ConfigList.configs[0];
|
||||
host = config.host;
|
||||
port = config.port;
|
||||
@@ -102,7 +101,7 @@ namespace Octopus.Simulator.Networks
|
||||
}));
|
||||
}
|
||||
|
||||
public void Request_Put(object inputclass,string type, System.Action<bool, string> ResultCallback)
|
||||
public void Request_Put(object inputclass, string type, System.Action<bool, string> ResultCallback)
|
||||
{
|
||||
string json = JsonConvert.SerializeObject(inputclass);
|
||||
StartCoroutine(Web_Put(http + type, json, (result, text) =>
|
||||
@@ -195,7 +194,7 @@ namespace Octopus.Simulator.Networks
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator Web_Put(string URL,string json, System.Action<bool, string> callback)
|
||||
IEnumerator Web_Put(string URL, string json, System.Action<bool, string> callback)
|
||||
{
|
||||
byte[] data = { };
|
||||
using (UnityWebRequest request = UnityWebRequest.Put(URL, data))
|
||||
|
||||
@@ -15,9 +15,8 @@ public class WebReceiver : MonoBehaviour
|
||||
|
||||
public void Start()
|
||||
{
|
||||
/*
|
||||
Application.ExternalCall("loadingComplete");
|
||||
*/
|
||||
/*
|
||||
config.projectId = "17";
|
||||
//config.simulationId = "15";
|
||||
config.logicId = "71";
|
||||
@@ -25,7 +24,9 @@ public class WebReceiver : MonoBehaviour
|
||||
onParameterRecived += FindAnyObjectByType<ProjectDataManager>().RequestInfo;
|
||||
onParameterRecived += FindAnyObjectByType<LogicDataManager>().RequestInfo;
|
||||
onParameterRecived?.Invoke();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ReceiveWebParameterJson(string json)
|
||||
|
||||
Reference in New Issue
Block a user