using Newtonsoft.Json; using Simulator.CameraData; using Simulator.Data.Transport; using System; using System.Collections.Generic; using UnityEngine; namespace Simulator.Data { [Serializable] public class Totaljson { public int status; public string code; public LogicRow data; } [Serializable] public class LogicRow { public List rows; public int count; public string timestamp; } [Serializable] public class LogicData { public int id; public string name; public string userId; public LogicDetailData data; public Webconfig webConfig; public User user; } [Serializable] public class LogicDetailData { public string name; public templates templates; public Infrastructure infrastructure; public Transport_System transport_system; public Production_System production_system; public CameraEntity camAngle; } [Serializable] public class templates { public List prefabs; } [Serializable] public class Infrastructure { public List queues; public List resources; } [Serializable] public class Transport_System { public List node_networks=new List(); public List transport_managers=new List(); } [Serializable] public class Node_Networks { public List nodes= new List(); public List edges=new List(); } [Serializable] public class Transport_Manager { public string label; public string manager_id; public string network_id; public string manager_type; public List vehicle_fleets; } [Serializable] public class Vehicle_Fleet { public string label; public string fleet_id; public List vehicles; } [Serializable] public class Production_System { public List sources; public List sinks; public List asrs; public List racks; public List conveyors; public List robot_arms; public List processors; } [Serializable] public class Physical { public event Action onOrientationChanged; public Position position = new Position(); public Dimensions dimensions = new Dimensions(); float _orientation; public float orientation { get => _orientation; set { _orientation = RotationSnap.SnapOrientation(value);onOrientationChanged?.Invoke(); } } public Access_Points access_points = new Access_Points(); } public static class RotationSnap { /// /// angleDeg를 0/90/180/270 중 가장 가까운 값으로 반올림 스냅합니다. /// 반환 범위: {0, 90, 180, 270} /// public static float SnapOrientation(float angleDeg) { // 0~360 정규화 (음수/초과 처리) float a = Mathf.Repeat(angleDeg, 360f); // 90도 단위로 반올림 int snapped = Mathf.RoundToInt(a / 90f) * 90; // 360 -> 0 처리 snapped %= 360; // 결과는 0/90/180/270 중 하나 return snapped; } } [Serializable] public class Position { public event Action onChanged; private float _x; private float _y; private float _z; public float x { get => _x; set {_x = value; onChanged?.Invoke(); } } public float y { get => _y; set {_y = value; onChanged?.Invoke(); } } public float z { get => _z; set {_z = value; onChanged?.Invoke(); } } } [Serializable] public class Dimensions { public float width = 0.0f; public float height = 0.0f; public float depth = 0.0f; } [Serializable] public class Access_Points { public InputPosition input; public OutputPosition output; } [Serializable] public class InputPosition { public Position local_position = new Position(); } [Serializable] public class OutputPosition { public Position local_position = new Position(); } [Serializable] public class Property { public Processor Processor; } [Serializable] public class Processor { public List workbench; } [Serializable] public class Workbench { public string name; public string label; public List input_items; public List output_items; } [Serializable] public class Inout_Items { public string prefab; public List locationCounts; } [Serializable] public class LocationCounts { public string type; public int count; public string label; public string location; } [Serializable] public class User { public string name; } [Serializable] public class Webconfig { public List tags; public Property property; } [Serializable] public class tagData { public string key; public string type; } }