web
This commit is contained in:
151
Assets/WorkSpace/LH/SimulationInfo.cs
Normal file
151
Assets/WorkSpace/LH/SimulationInfo.cs
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Octopus.Simulator
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SimulationInfo
|
||||||
|
{
|
||||||
|
public int status;
|
||||||
|
public string code;
|
||||||
|
public string message;
|
||||||
|
public SimulationData data;
|
||||||
|
public Meta meta;
|
||||||
|
public string timestamp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class SimulationData
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
public int projectId;
|
||||||
|
public int logicId;
|
||||||
|
public int userId;
|
||||||
|
public string name;
|
||||||
|
public string simulationCode;
|
||||||
|
public logicData logicData;
|
||||||
|
public Parameters parameters;
|
||||||
|
public string status;
|
||||||
|
public string resultData;
|
||||||
|
public string createdAt;
|
||||||
|
public string updatedAt;
|
||||||
|
public string deletedAt;
|
||||||
|
public SimulationProject project;
|
||||||
|
public SimulationComponent component;
|
||||||
|
public SimulationUser user;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class logicData
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public bool trace;
|
||||||
|
public List<LogicQueue> queues;
|
||||||
|
public List<LogicResources> resources;
|
||||||
|
public List<LogicComponents> components;
|
||||||
|
public int simulation_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Parameters
|
||||||
|
{
|
||||||
|
public int speed;
|
||||||
|
public int duration;
|
||||||
|
public bool realtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class LogicQueue
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public string description;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class LogicResources
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public int capacity;
|
||||||
|
public string description;
|
||||||
|
public int repair_time;
|
||||||
|
public double speed_factor;
|
||||||
|
public OperationHours OperationHours;
|
||||||
|
public int breakdown_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class OperationHours
|
||||||
|
{
|
||||||
|
public int end;
|
||||||
|
public int start;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class LogicComponents
|
||||||
|
{
|
||||||
|
public string name;
|
||||||
|
public int rate;
|
||||||
|
public string type;
|
||||||
|
public string description;
|
||||||
|
public string output_queue;
|
||||||
|
public string output_resource;
|
||||||
|
public int transport_time;
|
||||||
|
public string required_resource;
|
||||||
|
public int processing_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class SimulationProject
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
public int userId;
|
||||||
|
public string name;
|
||||||
|
public string description;
|
||||||
|
public string createdAt;
|
||||||
|
public string updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class SimulationComponent
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
public int userId;
|
||||||
|
public string name;
|
||||||
|
public string description;
|
||||||
|
public string createdAt;
|
||||||
|
public string updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SimulationUser
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
public string ccPositionId;
|
||||||
|
public string userid;
|
||||||
|
public string name;
|
||||||
|
public string auth;
|
||||||
|
public string email;
|
||||||
|
public bool active;
|
||||||
|
public string joinDate;
|
||||||
|
public bool activeClassifyRule;
|
||||||
|
public string signatureId;
|
||||||
|
public string employeeNumber;
|
||||||
|
public string resignationDate;
|
||||||
|
public string profileId;
|
||||||
|
public string createdAt;
|
||||||
|
public string updatedAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Meta
|
||||||
|
{
|
||||||
|
public Param param;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Param
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/WorkSpace/LH/SimulationInfo.cs.meta
Normal file
2
Assets/WorkSpace/LH/SimulationInfo.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1072c1c763a385641be459bd4dec0d37
|
||||||
@@ -6,8 +6,9 @@ using System.IO;
|
|||||||
using Unity.VisualScripting.Antlr3.Runtime;
|
using Unity.VisualScripting.Antlr3.Runtime;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
using Octopus.Simulator;
|
||||||
|
|
||||||
namespace LH
|
namespace Octopus.Simulator.Networks
|
||||||
{
|
{
|
||||||
//API를 통해 서버와 통신하기 위한 함수들이 내장되어 있습니다.
|
//API를 통해 서버와 통신하기 위한 함수들이 내장되어 있습니다.
|
||||||
//Post, Get. Put을 사용하며, Post의 경우엔 Class를 입력으로 받아 Json형식으로 변환하여 업로드합니다.
|
//Post, Get. Put을 사용하며, Post의 경우엔 Class를 입력으로 받아 Json형식으로 변환하여 업로드합니다.
|
||||||
@@ -16,6 +17,7 @@ namespace LH
|
|||||||
public class WebManager : MonoBehaviour
|
public class WebManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static WebManager webManager;
|
public static WebManager webManager;
|
||||||
|
public SimulationInfo info;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
string WebPath = "";
|
string WebPath = "";
|
||||||
@@ -28,6 +30,14 @@ namespace LH
|
|||||||
{
|
{
|
||||||
webManager = this;
|
webManager = this;
|
||||||
SetMqttConfig();
|
SetMqttConfig();
|
||||||
|
Request_Get("/simulation/histories/3", (flag, value) =>
|
||||||
|
{
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
Debug.Log(value);
|
||||||
|
info = JsonConvert.DeserializeObject<SimulationInfo>(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetMqttConfig()
|
private void SetMqttConfig()
|
||||||
@@ -43,7 +53,8 @@ namespace LH
|
|||||||
host = config.host;
|
host = config.host;
|
||||||
port = config.port;
|
port = config.port;
|
||||||
token = config.accessToken;
|
token = config.accessToken;
|
||||||
http = $"http://{host}:{port}";
|
http = $"{host}:{port}";
|
||||||
|
Debug.Log(http);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Post동작을 실행하는 함수입니다
|
//Post동작을 실행하는 함수입니다
|
||||||
|
|||||||
Reference in New Issue
Block a user