Browse Source

人员定位配置提交

develop
孟涛 12 months ago
parent
commit
6066f52411
  1. 1
      Assets/Scripts/Common/GameManager.cs
  2. 22
      Assets/Scripts/Main/Core/PersonnelLocation/LocationSimulator.cs
  3. 8
      Assets/Scripts/Manager/Config.cs
  4. 8
      Assets/Scripts/UIManager/View/PersonnelLocationPanel.cs
  5. 7
      Assets/StreamingAssets/Config.json

1
Assets/Scripts/Common/GameManager.cs

@ -48,6 +48,7 @@ public class GameManager : Singleton<GameManager>
Config.Tags = webConfig.Tags;
Config.Range = webConfig.Range;
Config.Interval = webConfig.Interval;
Config.MapId = webConfig.MapId;
Config.AlarmServer = webConfig.AlarmServer;
Config.AlarmInterval = webConfig.AlarmInterval;
Debug.Log("ServerAddress:" + Config.ServerAddress + " Interval:" + Config.Interval + " Range:" + Config.Range);

22
Assets/Scripts/Main/Core/PersonnelLocation/LocationSimulator.cs

@ -64,7 +64,7 @@ public class LocationSimulator : MonoBehaviour
postData.Add(i.ToString(), json);
i++;
}
HttpManager.Instance.Post (url, postData);
HttpManager.Instance.Post(url, postData);
}
}
@ -77,7 +77,7 @@ public class LocationSimulator : MonoBehaviour
if (isOn)
{
LoadTrackData(targetNo, data =>
LoadTrackData(targetNo, data =>
{
trackLocationData = data;
if (trackLocationData.Count > 0)
@ -96,10 +96,10 @@ public class LocationSimulator : MonoBehaviour
/// </summary>
/// <param name="targetNo"></param>
/// <returns></returns>
private void LoadTrackData(long targetNo,Action<List<LocationData>> action)
private void LoadTrackData(long targetNo, Action<List<LocationData>> action)
{
var url = HttpManager.Instance.GetPersonnelHistoryData;
HttpManager.Instance.Get<List<PositionData>>(url, tempData =>
HttpManager.Instance.Get<List<PositionData>>(url, tempData =>
{
var loadedData = new List<LocationData>();
foreach (var item in tempData)
@ -199,7 +199,7 @@ public class LocationSimulator : MonoBehaviour
{
while (true)
{
var url = $"{Config.LocationServer}/le/uwbofferdata/getPositionDataByMapId/12";
var url = $"{Config.LocationServer}/le/uwbofferdata/getPositionDataByMapId/{Config.MapId}";
HttpManager.Instance.Get<PositionData>(url, tempData =>
{
if (tempData.errorCode != 1)
@ -221,7 +221,9 @@ public class LocationSimulator : MonoBehaviour
if (agentControllers.ContainsKey(data.targetNo))
{
agentControllers[data.targetNo].UpdatePosition(data);
//agentControllers[data.targetNo].UpdatePosition(data);
agentControllers[data.targetNo].enabled = false;
agentControllers[data.targetNo].transform.position = Main.LocationSimulator.ConversionTransform(data);
}
else
{
@ -247,7 +249,7 @@ public class LocationSimulator : MonoBehaviour
yield return new WaitForSeconds(Config.Interval);
}
}
/// <summary>
/// 确保角色始终在地面上
@ -273,7 +275,7 @@ public class LocationSimulator : MonoBehaviour
/// <returns></returns>
private AgentController CreateAgent(LocationData data)
{
if (characterCount > 4)
characterCount = 0;
var obj = Instantiate(AssetManager.Instance.characters[characterCount]) as GameObject;
@ -286,7 +288,7 @@ public class LocationSimulator : MonoBehaviour
controller.targetNo = data.targetNo;
controller.ShowStatus(data.createdTime, data.targetNo);
controller.SetToNvMesh(pos);
SetActive(obj,data);
SetActive(obj, data);
characterCount++;
return controller;
@ -312,7 +314,7 @@ public class LocationSimulator : MonoBehaviour
/// <returns></returns>
public Vector3 ConversionTransform(LocationData data)
{
var pos = new Vector3(-((float)data.xAxis+offsetX), -17.7f, -((float)data.yAxis+offsetZ));
var pos = new Vector3(-((float)data.xAxis - offsetX), -17.7f, -((float)data.yAxis - offsetZ));
//pos.y = SetY(pos);
return pos;

8
Assets/Scripts/Manager/Config.cs

@ -23,6 +23,10 @@ public static class Config
/// </summary>
public static string LocationServer { get; set; }
/// <summary>
/// 人员定位接口地图id
/// </summary>
public static string MapId { get; set; }
/// <summary>
/// 人员定位报警接口
/// </summary>
public static string AlarmServer { get; set; }
@ -71,6 +75,10 @@ public class ConfigWebGL
/// </summary>
public string LocationServer { get; set; }
/// <summary>
/// 人员定位接口地图id
/// </summary>
public string MapId { get; set; }
/// <summary>
/// 人员定位报警接口
/// </summary>
public string AlarmServer { get; set; }

8
Assets/Scripts/UIManager/View/PersonnelLocationPanel.cs

@ -74,12 +74,12 @@ public class PersonnelLocationPanel : UIView
alarmScrollView.ResetAllDelegates();
});
}
private void LoadTags(List<string> tags)
{
employeeScrollView.SetUpdateFunc<string>(tags, (index, item) =>
employeeScrollView.SetUpdateFunc<string>(tags, (index, item) =>
{
string info = tags[index];
item.name = info;
@ -90,13 +90,13 @@ public class PersonnelLocationPanel : UIView
item.transform.Find("Show").GetComponent<Toggle>().onValueChanged.AddListener(v => Main.Event.EmployeeActive(long.Parse(info), v));
item.transform.Find("Track").GetComponent<Toggle>().onValueChanged.AddListener(v => Main.LocationSimulator.GetTrackPlaybackData(v, long.Parse(info)));
});
}
private void GetPersonnelData()
{
numbsrs.Clear();
var url = $"{Config.LocationServer}/le/uwbofferdata/getPositionDataByMapId/12";
var url = $"{Config.LocationServer}/le/uwbofferdata/getPositionDataByMapId/{Config.MapId}";
HttpManager.Instance.Get<PositionData>(url, tempData =>
{
if (tempData.list.Count > 0)

7
Assets/StreamingAssets/Config.json

@ -3,10 +3,11 @@
"BucketName": "WebPlan",
"AreaName": "虹口区",
"CompanyName": "凯德龙之梦",
"LocationServer": "http://96291c6.r8.cpolar.top",
"AlarmServer":"http://3949b92f.r6.cpolar.top",
"LocationServer": "http://101.201.70.191:8080",
"AlarmServer":"http://101.201.70.191:8080",
"MapId":"4",
"PersonnelVideoUrl":"https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8",
"Tags": ["10777839","10777836","10777842","10777826","10777827","10774520","10777834","10777831","10774521","10774529","10774519","10774527","10774530","10774508","10770002"],
"Tags": ["10671050","10671051","10671052","10671053","10671054","10671057","10671058","10671059","10671061","10671064"],
"Interval":1,
"Range":0.3,
"AlarmInterval":10

Loading…
Cancel
Save