321
This commit is contained in:
parent
0cc0ef38ca
commit
54efd8336f
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -4,7 +4,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Adam;
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class Bootstrap : MonoSingleton<Bootstrap>
|
||||
{
|
||||
|
|
@ -13,8 +15,10 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
/// 0 省会 1 城市 2 区县
|
||||
/// </summary>
|
||||
public int currentLevel = 0;
|
||||
public string currentDisName;
|
||||
public string currentDistCode;
|
||||
|
||||
public List<string> landMarks;
|
||||
private List<string> landMarks = new List<string>();
|
||||
/// <summary>
|
||||
/// 透明
|
||||
/// </summary>
|
||||
|
|
@ -65,20 +69,37 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
[HideInInspector]
|
||||
public RayHitTester rayHitTester;
|
||||
public GameObject lastLand;
|
||||
public GameObject shadowMap;
|
||||
|
||||
|
||||
|
||||
public int clickCurrentLevel = 2;
|
||||
[ContextMenu("1")]
|
||||
private void Awake()
|
||||
{
|
||||
string[] data = FileUtil.ReadAllLineFromLocal("WebAddress.json");
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
var serverConfig = new System.Uri(Path.Combine(Application.streamingAssetsPath + @"/Config", "WebAddress.json"));
|
||||
GetText(serverConfig.ToString(), (temp) =>
|
||||
{
|
||||
string[] urlInfo = data[i].Split("=");
|
||||
urlDic.Add(urlInfo[0], urlInfo[1]);
|
||||
}
|
||||
if (!String.IsNullOrWhiteSpace(temp))
|
||||
{
|
||||
Debug.Log("读取到的内容有:" + temp);
|
||||
urlDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(temp);
|
||||
//urlDic = JsonUtility.FromJson<Dictionary<string, string>>(temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("加载配置文件错误");
|
||||
}
|
||||
});
|
||||
|
||||
//string data = FileUtil.ReadFromLocal("WebAddress.json");
|
||||
//urlDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(data);
|
||||
|
||||
webAdapter = GetComponent<WebAdapter>();
|
||||
rayHitTester = GetComponent<RayHitTester>();
|
||||
}
|
||||
public void GetText(string url, Action<string> actionResult)
|
||||
{
|
||||
StartCoroutine(FileUtil.GetTextAsyn(url, actionResult));
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
//landMarks = new List<string> { "网络负荷:49.84 kw", "上网负荷:49.84 kw", "削峰负荷:49.84 kw", "填谷负荷:49.84 kw", "发电负荷:49.84 kw" };
|
||||
|
|
@ -91,6 +112,23 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
private void Update()
|
||||
{
|
||||
var hit = rayHitTester.HitTest();
|
||||
if (Input.GetMouseButtonDown(2))
|
||||
{
|
||||
if (hit.collider != null)
|
||||
{
|
||||
if (cameraRt.currentLevelIndex == 1) return;
|
||||
clickCurrentLevel--;
|
||||
if (clickCurrentLevel <= 1)
|
||||
{
|
||||
clickCurrentLevel = 1;
|
||||
}
|
||||
cameraRt.currentLevelIndex = clickCurrentLevel;
|
||||
//currentLevel = clickCurrentLevel;
|
||||
SwitchLand(clickCurrentLevel);
|
||||
cameraRt.SetTarget(hit.collider.transform);
|
||||
Debug.Log("clickCurrentLevel==" + clickCurrentLevel);
|
||||
}
|
||||
}
|
||||
if (hit.collider != null)
|
||||
{
|
||||
landMarks.Clear();
|
||||
|
|
@ -106,6 +144,8 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
{
|
||||
CloseLandMark();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -117,12 +157,12 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
public async void ShowLandMark()
|
||||
{
|
||||
if (currentLand == null) return;
|
||||
string distCode = currentLand.GetComponent<CityInfo>().distCode;
|
||||
currentDistCode = currentLand.GetComponent<CityInfo>().distCode;
|
||||
currentLand.GetComponent<MeshRenderer>().materials = select;
|
||||
Vector3 worldToScreenPoint = Camera.main.WorldToScreenPoint(new Vector3(currentLand.transform.position.x, currentLand.transform.position.y, currentLand.transform.position.z));
|
||||
lastLand = currentLand;
|
||||
SwitchLevel(-1);
|
||||
AreaData areaData = await AsyncWebReq.Get<AreaData>($"{urlDic["µØÍ¼µ¯³ö¿ò"]}{distCode}", webAdapter.head, webAdapter.token);
|
||||
AreaData areaData = await AsyncWebReq.Get<AreaData>($"{urlDic["地图弹出框"]}{currentDistCode}", webAdapter.head, webAdapter.token);
|
||||
if (!bool.Parse(areaData.success)) return;
|
||||
for (int i = 0; i < areaData.data.items.Count; i++)
|
||||
{
|
||||
|
|
@ -139,7 +179,6 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
/// </summary>
|
||||
public void CloseLandMark()
|
||||
{
|
||||
|
||||
landMarkAndInfoCotroller.gameObject.SetActive(false);
|
||||
if (lastLand != null)
|
||||
{
|
||||
|
|
@ -160,6 +199,8 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
webAdapter.LevelChange(_currentLevel.ToString());
|
||||
landMarkAndInfoCotroller.gameObject.SetActive(false);
|
||||
currentLevel = _currentLevel;
|
||||
clickCurrentLevel = _currentLevel;
|
||||
shadowMap.gameObject.SetActive(false);
|
||||
switch (currentLevel)
|
||||
{
|
||||
case 2:
|
||||
|
|
@ -169,6 +210,7 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
cityParents.GetChild(i).gameObject.SetActive(false);
|
||||
}
|
||||
lastCity = null;
|
||||
shadowMap.gameObject.SetActive(true);
|
||||
SwitchMatShow(provincialCapital);
|
||||
break;
|
||||
case 1:
|
||||
|
|
@ -191,18 +233,18 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
}
|
||||
break;
|
||||
case 0:
|
||||
lastCity = currentLand.transform.parent;
|
||||
SwitchMatHide(lastCity);
|
||||
for (int i = 0; i < areaParents.childCount; i++)
|
||||
{
|
||||
var child = areaParents.GetChild(i).gameObject;
|
||||
child.SetActive(child.name == currentLand.name);
|
||||
if (child.activeSelf)
|
||||
{
|
||||
currentArea = child;
|
||||
}
|
||||
}
|
||||
//Debug.Log("ÇøÏØ");
|
||||
//lastCity = currentLand.transform.parent;
|
||||
//SwitchMatHide(lastCity);
|
||||
//for (int i = 0; i < areaParents.childCount; i++)
|
||||
//{
|
||||
// var child = areaParents.GetChild(i).gameObject;
|
||||
// child.SetActive(child.name == currentLand.name);
|
||||
// if (child.activeSelf)
|
||||
// {
|
||||
// currentArea = child;
|
||||
// }
|
||||
//}
|
||||
Debug.Log("区县");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -301,7 +343,7 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
switch (currentLevel)
|
||||
{
|
||||
case -1:
|
||||
cameraRt.SetMaxMinDistance(10f, 120f);
|
||||
cameraRt.SetMaxMinDistance(30f, 120f);
|
||||
break;
|
||||
case 0:
|
||||
cameraRt.SetMaxMinDistance(10f, 20f);
|
||||
|
|
|
|||
|
|
@ -96,10 +96,10 @@ public class CameraRT : MonoBehaviour
|
|||
public void SetTarget(Transform _target)
|
||||
{
|
||||
target.position = _target.position;
|
||||
distance = _target.localScale.x;
|
||||
//distance = _target.localScale.x;
|
||||
|
||||
y = _target.eulerAngles.x;
|
||||
x = _target.eulerAngles.y;
|
||||
//y = _target.eulerAngles.x;
|
||||
//x = _target.eulerAngles.y;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -173,6 +173,8 @@ public class CameraRT : MonoBehaviour
|
|||
cam.transform.rotation = rotation;
|
||||
cam.transform.position = position;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,15 +6,18 @@ public class CityInfo : MonoBehaviour
|
|||
{
|
||||
public string distCode;
|
||||
public string cityName;
|
||||
public ScreenTopStatistics sts = new ScreenTopStatistics();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (!GetComponent<Collider>())
|
||||
gameObject.AddComponent<MeshCollider>();
|
||||
OnSetStationInfo();
|
||||
}
|
||||
|
||||
public void OnSetStationInfo()
|
||||
public async void OnSetStationInfo()
|
||||
{
|
||||
ScreenTopStatistics sts = DataController.Instance.GetStationsByDistCode(distCode);
|
||||
sts = await DataController.Instance.GetProvincialLevelStationInfo(distCode,cityName);
|
||||
if (sts != null)
|
||||
{
|
||||
transform.GetChild(0).GetComponent<AggregateStation>().SetInfo(sts.agentCons);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
using Cysharp.Threading.Tasks;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DataController : MonoSingleton<DataController>
|
||||
{
|
||||
public AreaStationData areaStationData = new AreaStationData();
|
||||
public string distCode = "37";
|
||||
public string distCode;
|
||||
// Start is called before the first frame update
|
||||
private async void Awake()
|
||||
{
|
||||
string url = Bootstrap.Instance.urlDic["µØÍ¼ÐÅÏ¢»ã×Ü"];
|
||||
areaStationData = await AsyncWebReq.Get<AreaStationData>(url + distCode, Bootstrap.Instance.webAdapter.head, Bootstrap.Instance.webAdapter.token);
|
||||
}
|
||||
|
||||
public ScreenTopStatistics GetStationsByDistCode(string distCode)
|
||||
public async UniTask<ScreenTopStatistics> GetProvincialLevelStationInfo(string _distCode, string _disName)
|
||||
{
|
||||
DataItem sts = areaStationData.data.Find(s => s.distCode == distCode);
|
||||
await UniTask.Delay(1000);
|
||||
if (_distCode.Length == 4)
|
||||
distCode = _distCode.Substring(0, 2);
|
||||
if (_distCode.Length == 6)
|
||||
distCode = _distCode.Substring(0, 4);
|
||||
string url = Bootstrap.Instance.urlDic["µØÍ¼ÐÅÏ¢»ã×Ü"];
|
||||
AreaStationData areaStationData = await AsyncWebReq.Get<AreaStationData>(url + distCode, Bootstrap.Instance.webAdapter.head, Bootstrap.Instance.webAdapter.token);
|
||||
DataItem sts = areaStationData.data.Find(s => s.disName == _disName);
|
||||
if (sts == null)
|
||||
return null;
|
||||
return sts.screenTopStatistics;
|
||||
|
|
|
|||
|
|
@ -10,20 +10,41 @@ public class TEst : MonoBehaviour
|
|||
public AggregateStation aggregateStation;
|
||||
public List<Sprite> sprites = new List<Sprite>();
|
||||
public List<GameObject> gameObjects = new List<GameObject>();
|
||||
public Transform p;
|
||||
public bool isDeleteStationInstructs;
|
||||
public float h = 2;
|
||||
[ContextMenu("GetInfo")]
|
||||
public void CreateItemAsset()
|
||||
{
|
||||
manager.cityItems = null;
|
||||
manager.cityItems = ExcelTool.CreateItemArrayWithExcel(ExcelConfig.excelsFolderPath + "ɽ¶«ÐÐÕþÇø»®Êý¾Ý.xlsx");
|
||||
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
for (int i = 0; i < p.childCount; i++)
|
||||
{
|
||||
CityInfo c = transform.GetChild(i).GetComponent<CityInfo>();
|
||||
c.cityName = c.gameObject.name;
|
||||
for (int l = 0; l < manager.cityItems.Length; l++)
|
||||
Transform t = p.GetChild(i);
|
||||
|
||||
if (t.childCount > 0)
|
||||
{
|
||||
if (c.cityName == manager.cityItems[l].districtName)
|
||||
c.distCode = manager.cityItems[l].divisionNumber;
|
||||
for (int j = 0; j < t.childCount; j++)
|
||||
{
|
||||
CityInfo cc = t.GetChild(j).GetComponent<CityInfo>();
|
||||
cc.cityName = cc.gameObject.name;
|
||||
for (int l = 0; l < manager.cityItems.Length; l++)
|
||||
{
|
||||
if (cc.cityName == manager.cityItems[l].districtName)
|
||||
cc.distCode = manager.cityItems[l].divisionNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CityInfo c = t.GetComponent<CityInfo>();
|
||||
c.cityName = c.gameObject.name;
|
||||
for (int l = 0; l < manager.cityItems.Length; l++)
|
||||
{
|
||||
if (c.cityName == manager.cityItems[l].districtName)
|
||||
c.distCode = manager.cityItems[l].divisionNumber;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -36,19 +57,37 @@ public class TEst : MonoBehaviour
|
|||
DestroyImmediate(gameObjects[i]);
|
||||
}
|
||||
gameObjects.Clear();
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
if (isDeleteStationInstructs) return;
|
||||
for (int i = 0; i < p.childCount; i++)
|
||||
{
|
||||
Transform t = transform.GetChild(i);
|
||||
Transform t = p.GetChild(i);
|
||||
|
||||
for (int j = 0; j < sprites.Count; j++)
|
||||
if (t.childCount > 0)
|
||||
{
|
||||
AggregateStation _aggregateStation = Instantiate(aggregateStation, t);
|
||||
_aggregateStation.transform.localPosition = new Vector3( Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f), 2f);
|
||||
_aggregateStation.transform.localEulerAngles = new Vector3(90, 0, 0);
|
||||
_aggregateStation.SetInfo(sprites[j], "0");
|
||||
gameObjects.Add(_aggregateStation.gameObject);
|
||||
for (int g = 0; g < t.childCount; g++)
|
||||
{
|
||||
Transform tt = t.GetChild(g);
|
||||
for (int j = 0; j < sprites.Count; j++)
|
||||
{
|
||||
AggregateStation _aggregateStation = Instantiate(aggregateStation, tt);
|
||||
_aggregateStation.transform.localPosition = new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f), h);
|
||||
_aggregateStation.transform.localEulerAngles = new Vector3(90, 0, 0);
|
||||
_aggregateStation.SetInfo(sprites[j], "0");
|
||||
gameObjects.Add(_aggregateStation.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < sprites.Count; j++)
|
||||
{
|
||||
AggregateStation _aggregateStation = Instantiate(aggregateStation, t);
|
||||
_aggregateStation.transform.localPosition = new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-0.5f, 0.5f), h);
|
||||
_aggregateStation.transform.localEulerAngles = new Vector3(90, 0, 0);
|
||||
_aggregateStation.SetInfo(sprites[j], "0");
|
||||
gameObjects.Add(_aggregateStation.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace Adam
|
||||
{
|
||||
|
|
@ -82,5 +84,14 @@ namespace Adam
|
|||
string path = Application.dataPath + "/StreamingAssets/" + file + "/" + fileName;
|
||||
return path;
|
||||
}
|
||||
|
||||
public static IEnumerator GetTextAsyn(string url, Action<string> actionResult)
|
||||
{
|
||||
UnityWebRequest request = UnityWebRequest.Get(url);
|
||||
yield return request.SendWebRequest();
|
||||
string t = request.downloadHandler.text;
|
||||
if (string.IsNullOrEmpty(t)) Debug.LogError("GetTextAsyn()/ Get Text is error! url:" + url);
|
||||
actionResult?.Invoke(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,14 +12,14 @@ public class WebAdapter : MonoBehaviour
|
|||
[DllImport("__Internal")]
|
||||
private static extern void OnLevelChange(string level);
|
||||
#else
|
||||
public string head;
|
||||
public string token;
|
||||
private static void OnLevelChange(string level)
|
||||
{
|
||||
Debug.Log(level);
|
||||
}
|
||||
#endif
|
||||
public UnityEvent<string> onStation;
|
||||
public string head;
|
||||
public string token;
|
||||
public void LevelChange(string level)
|
||||
{
|
||||
OnLevelChange(level);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -88,18 +88,18 @@ MonoBehaviour:
|
|||
m_PrefilterXRKeywords: 1
|
||||
m_PrefilteringModeForwardPlus: 0
|
||||
m_PrefilteringModeDeferredRendering: 0
|
||||
m_PrefilteringModeScreenSpaceOcclusion: 0
|
||||
m_PrefilteringModeScreenSpaceOcclusion: 2
|
||||
m_PrefilterDebugKeywords: 1
|
||||
m_PrefilterWriteRenderingLayers: 1
|
||||
m_PrefilterHDROutput: 1
|
||||
m_PrefilterSSAODepthNormals: 1
|
||||
m_PrefilterSSAODepthNormals: 0
|
||||
m_PrefilterSSAOSourceDepthLow: 1
|
||||
m_PrefilterSSAOSourceDepthMedium: 1
|
||||
m_PrefilterSSAOSourceDepthHigh: 1
|
||||
m_PrefilterSSAOInterleaved: 1
|
||||
m_PrefilterSSAOBlueNoise: 1
|
||||
m_PrefilterSSAOBlueNoise: 0
|
||||
m_PrefilterSSAOSampleCountLow: 1
|
||||
m_PrefilterSSAOSampleCountMedium: 1
|
||||
m_PrefilterSSAOSampleCountMedium: 0
|
||||
m_PrefilterSSAOSampleCountHigh: 1
|
||||
m_PrefilterDBufferMRT1: 1
|
||||
m_PrefilterDBufferMRT2: 1
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7fad919acf08dff4f876dd83912fcdc2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"地图弹出框": "http://vpp.shiyuancloud.com:1443/api/vpp-operation-service/screen/mapRegionSummary/",
|
||||
"地图信息汇总": "http://vpp.shiyuancloud.com:1443/api/vpp-operation-service/screen/mapRegionStatistics/"
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
地图弹出框=http://vpp.shiyuancloud.com:1443/api/vpp-operation-service/screen/mapRegionSummary/
|
||||
地图信息汇总=http://vpp.shiyuancloud.com:1443/api/vpp-operation-service/screen/mapRegionStatistics/
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue