提交日志-20240704-1046:

1、更新了本地配置的堆场、相机、皮带秤数据结构,现在可以根据不同企业id进行配置;
2、优化了路径漫游的可配置内容,现在可以单独对每个节点速度进行配置;
This commit is contained in:
Afeijia 2024-07-04 10:45:54 +08:00
parent feda88e06e
commit d699e335df
7 changed files with 115 additions and 61 deletions

View File

@ -61,10 +61,6 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
/// </summary>
public Quaternion m_Rotation;
/// <summary>
/// ÂþÓÎËÙ¶È
/// </summary>
public float RoamingSpeed = 10;
/// <summary>
/// Dopath参数
/// </summary>
[Range(0, 1)]
@ -122,12 +118,15 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
/// 循环起始点
/// </summary>
public int LoopStartPoint = 3;
///// <summary>
///// ÂþÓÎËÙ¶È
///// </summary>
//[Range(0,100)]
//public float RoamingSpeed = 10;
/// <summary>
/// 是否使用锚点配置速度
/// </summary>
public bool UseAnchorSpeed = false;
/// <summary>
/// 漫游速度
/// </summary>
[Range(0, 100)]
public float RoamingSpeed = 10;
#endregion
@ -319,7 +318,7 @@ public class CameraRoamManager : Singleton<CameraRoamManager>
}
_to += _t;
_rt_pos = Lerp(_pos, _Anchor_Point[_Next_Index].Position, _to / Vector3.Distance(_pos, _Anchor_Point[_Next_Index].Position) * RoamingSpeed);
_rt_pos = Lerp(_pos, _Anchor_Point[_Next_Index].Position, _to / Vector3.Distance(_pos, _Anchor_Point[_Next_Index].Position) * (UseAnchorSpeed ? _Anchor_Point[_Next_Index].Speed : RoamingSpeed));
TargetCamera.position = _rt_pos;
_at_point = TargetCamera.position == _Anchor_Point[_Next_Index].Position;

View File

@ -10,6 +10,7 @@ public class RoamingAnchorEditor : Editor
SerializedProperty LookTransform;
SerializedProperty LookPoint;
SerializedProperty LookType;
SerializedProperty Speed;
private void OnEnable()
{
@ -18,6 +19,7 @@ public class RoamingAnchorEditor : Editor
LookTransform = serializedObject.FindProperty("LookTransform");
LookPoint = serializedObject.FindProperty("LookPoint");
LookType = serializedObject.FindProperty("LookType");
Speed = serializedObject.FindProperty("Speed");
}
public override void OnInspectorGUI()
@ -40,6 +42,8 @@ public class RoamingAnchorEditor : Editor
break;
}
EditorGUILayout.PropertyField(Speed);
serializedObject.ApplyModifiedProperties();
}
}

View File

@ -21,11 +21,22 @@ public class RoamingAnchor : MonoBehaviour
/// 路径用时
/// </summary>
public float Duration;
/// <summary>
/// 视角跟随Transform
/// </summary>
public Transform LookTransform;
/// <summary>
/// 视角跟随三维坐标
/// </summary>
public Vector3 LookPoint;
/// <summary>
/// 相机经过该路径锚点时的视角控制方式
/// </summary>
public LookType LookType = LookType.PATH;
/// <summary>
/// 相机速度
/// </summary>
public float Speed = 10;
//public void Init()
// {
// Position = transform.position;

View File

@ -8,6 +8,13 @@ using Newtonsoft.Json.Linq;
using Competition.Mysql.Model;
using static ZenFulcrum.EmbeddedBrowser.Browser;
public class Configure
{
public string MONITOR_ID { get; set; }
public Dictionary<string, string> DATA { get;set; }
}
public class ApiManager : Singleton<ApiManager>
{
/// <summary>
@ -83,6 +90,18 @@ public class ApiManager : Singleton<ApiManager>
// }
//}));
#if UNITY_EDITOR
if (CallForTest.instance != null)
{
if (string.IsNullOrEmpty(CallForTest.instance.MONITOR_ID))
{
//编辑器测试
CallForTest.instance.MONITOR_ID = "CNMAW350015";
}
}
#endif
var _api_dic_url = Path.Combine(Application.streamingAssetsPath, "configure_api.json");
StartCoroutine(RequestBase.Get(_api_dic_url, (_data, _error) =>
{
@ -100,14 +119,20 @@ public class ApiManager : Singleton<ApiManager>
var _cam_dic_url = Path.Combine(Application.streamingAssetsPath, "configure_camera.json");
StartCoroutine(RequestBase.Get(_cam_dic_url, (_data, _error) =>
{
if (_error != null)
if (_error != null)
{
Debug.Log($"<color=#ff0000> {_error} </color>");
}
else
{
Debug.Log("读取相机文件完成");
CameraDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(_data);
var _datas = JsonConvert.DeserializeObject<List<Configure>>(_data);
var _camera_data = _datas.Find(x => x.MONITOR_ID == CallForTest.instance.MONITOR_ID);
if (_camera_data != null)
{
CameraDic = _camera_data.DATA;
}
//CameraDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(_data);
}
}));
@ -120,8 +145,15 @@ public class ApiManager : Singleton<ApiManager>
}
else
{
Debug.Log("读取相机文件完成");
YardDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(_data);
Debug.Log("读取堆场文件完成");
//YardDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(_data);
var _datas = JsonConvert.DeserializeObject<List<Configure>>(_data);
var _yard_data = _datas.Find(x => x.MONITOR_ID == CallForTest.instance.MONITOR_ID);
if (_yard_data != null)
{
YardDic = _yard_data.DATA;
}
}
}));
//获取摄像机列表

View File

@ -1,8 +1,6 @@
{
"01": "YARD000226",
"02": "YARD000227",
"03": "YARD000228",
"04": "YARD000229",
"05": "YARD000230",
"06": "YARD000231"
}
[
{
"MONITOR_ID": "CNMAW350015",
"DATA": {}
}
]

View File

@ -1,28 +1,33 @@
{
"01": "Camera000100",
"02": "Camera000101",
"03": "Camera000102",
"04": "Camera000103",
"05": "Camera000104",
"06": "Camera000105",
"07": "Camera000106",
"08": "Camera000107",
"09": "",
"10": "",
"11": "",
"12": "",
"13": "",
"14": "",
"15": "",
"16": "",
"17": "",
"18": "",
"19": "",
"20": "",
"21": "",
"22": "",
"23": "",
"24": "",
"25": "",
"26": ""
}
[
{
"MONITOR_ID": "CNMAW350015",
"DATA": {
"01": "Camera000100",
"02": "Camera000101",
"03": "Camera000102",
"04": "Camera000103",
"05": "Camera000104",
"06": "Camera000105",
"07": "Camera000106",
"08": "Camera000107",
"09": "",
"10": "",
"11": "",
"12": "",
"13": "",
"14": "",
"15": "",
"16": "",
"17": "",
"18": "",
"19": "",
"20": "",
"21": "",
"22": "",
"23": "",
"24": "",
"25": "",
"26": ""
}
}
]

View File

@ -1,8 +1,13 @@
{
"01": "YARD000226",
"02": "YARD000227",
"03": "YARD000228",
"04": "YARD000229",
"05": "YARD000230",
"06": "YARD000231"
}
[
{
"MONITOR_ID": "CNMAW350015",
"DATA": {
"01": "YARD000226",
"02": "YARD000227",
"03": "YARD000228",
"04": "YARD000229",
"05": "YARD000230",
"06": "YARD000231"
}
}
]