233
This commit is contained in:
parent
2234a8650f
commit
4d8b296102
File diff suppressed because it is too large
Load Diff
|
|
@ -5586,6 +5586,8 @@ MonoBehaviour:
|
|||
cityParents: {fileID: 951896088}
|
||||
areaParents: {fileID: 4138212277929804823}
|
||||
webAdapter: {fileID: 0}
|
||||
rayHitTester: {fileID: 0}
|
||||
lastLand: {fileID: 0}
|
||||
--- !u!114 &1621379514
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -5601,6 +5603,8 @@ MonoBehaviour:
|
|||
onStation:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
head:
|
||||
token:
|
||||
--- !u!1 &1621389858 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 1438324003541281471, guid: b16821147ecd671449621c2d8bfef6ef,
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
}
|
||||
currentLand = hit.collider.gameObject;
|
||||
if (currentLand == lastLand) return;
|
||||
ShowLandMark(currentLand);
|
||||
ShowLandMark();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -114,27 +114,22 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
/// չʾµØ±ê
|
||||
/// </summary>
|
||||
/// <param name="land"></param>
|
||||
public async void ShowLandMark(GameObject land)
|
||||
public async void ShowLandMark()
|
||||
{
|
||||
|
||||
string distCode = currentLand.GetComponent<CityInfo>().distCode;
|
||||
|
||||
if (currentLand == null) return;
|
||||
string distCode = currentLand.GetComponent<CityInfo>().distCode;
|
||||
currentLand.GetComponent<MeshRenderer>().materials = select;
|
||||
landMarkAndInfoCotroller.gameObject.SetActive(true);
|
||||
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);
|
||||
|
||||
if (!bool.Parse(areaData.success)) return;
|
||||
for (int i = 0; i < areaData.data.items.Count; i++)
|
||||
{
|
||||
string info = $"{areaData.data.items[i].label}:{areaData.data.items[i].value}{areaData.data.items[i].unit}";
|
||||
landMarks.Add(info);
|
||||
}
|
||||
landMarkAndInfoCotroller.gameObject.SetActive(true);
|
||||
landMarkAndInfoCotroller.GetComponent<RectTransform>().position = new Vector3(worldToScreenPoint.x, worldToScreenPoint.y, 0);
|
||||
if (currentLand != null)
|
||||
landMarkAndInfoCotroller.SetMarksInfo(currentLand.name, landMarks);
|
||||
|
|
@ -222,10 +217,11 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
_fadeTweens.Remove(parent);
|
||||
}
|
||||
//bool isChange = true;
|
||||
var renderers = parent.GetComponentsInChildren<MeshRenderer>();
|
||||
var renderers = GetMeshRenderers(parent);
|
||||
List<Material> currentMaters = new List<Material>();
|
||||
for (int i = 0; i < renderers.Length; i++)
|
||||
for (int i = 0; i < renderers.Count; i++)
|
||||
{
|
||||
renderers[i].gameObject.SetActive(true);
|
||||
for (int j = 0; j < renderers[i].materials.Length; j++)
|
||||
{
|
||||
currentMaters.Add(renderers[i].materials[j]);
|
||||
|
|
@ -240,7 +236,7 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
|
||||
}).OnComplete(() =>
|
||||
{
|
||||
for (int i = 0; i < renderers.Length; i++)
|
||||
for (int i = 0; i < renderers.Count; i++)
|
||||
{
|
||||
renderers[i].GetComponent<Collider>().enabled = true;
|
||||
renderers[i].materials = mat;
|
||||
|
|
@ -258,14 +254,14 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
tween.Kill(true);
|
||||
_fadeTweens.Remove(parent);
|
||||
}
|
||||
var renderers = parent.GetComponentsInChildren<MeshRenderer>();
|
||||
for (int i = 0; i < renderers.Length; i++)
|
||||
var renderers = GetMeshRenderers(parent);
|
||||
for (int i = 0; i < renderers.Count; i++)
|
||||
{
|
||||
renderers[i].GetComponent<Collider>().enabled = false;
|
||||
renderers[i].materials = opacity;
|
||||
}
|
||||
List<Material> currentMaters = new List<Material>();
|
||||
for (int i = 0; i < renderers.Length; i++)
|
||||
for (int i = 0; i < renderers.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < renderers[i].materials.Length; j++)
|
||||
{
|
||||
|
|
@ -281,11 +277,25 @@ public class Bootstrap : MonoSingleton<Bootstrap>
|
|||
|
||||
}).OnComplete(() =>
|
||||
{
|
||||
for (int i = 0; i < renderers.Count; i++)
|
||||
{
|
||||
renderers[i].gameObject.SetActive(false);
|
||||
}
|
||||
_fadeTweens.Remove(parent);
|
||||
});
|
||||
|
||||
_fadeTweens.Add(parent, tween);
|
||||
}
|
||||
|
||||
private List<MeshRenderer> GetMeshRenderers(Transform t)
|
||||
{
|
||||
List<MeshRenderer> renderers = new List<MeshRenderer>();
|
||||
for (int i = 0; i < t.childCount; i++)
|
||||
{
|
||||
renderers.Add(t.GetChild(i).GetComponent<MeshRenderer>());
|
||||
}
|
||||
return renderers;
|
||||
}
|
||||
private void SwitchLevel(int currentLevel)
|
||||
{
|
||||
switch (currentLevel)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using TMPro;
|
|||
|
||||
public class AggregateStation : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
public SpriteRenderer instruct;
|
||||
public TMP_Text instructInfo;
|
||||
public void SetInfo(Sprite stationIcon, string num)
|
||||
|
|
@ -13,4 +13,9 @@ public class AggregateStation : MonoBehaviour
|
|||
instruct.sprite = stationIcon;
|
||||
instructInfo.text = num;
|
||||
}
|
||||
public void SetInfo(string num)
|
||||
{
|
||||
instructInfo.text = num;
|
||||
gameObject.SetActive(num != "0");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,28 @@ public class CityInfo : MonoBehaviour
|
|||
|
||||
private void Start()
|
||||
{
|
||||
OnSetStationInfo();
|
||||
}
|
||||
|
||||
public void OnSetStationInfo()
|
||||
{
|
||||
ScreenTopStatistics sts = DataController.Instance.GetStationsByDistCode(distCode);
|
||||
if (sts != null)
|
||||
{
|
||||
transform.GetChild(0).GetComponent<AggregateStation>().SetInfo(sts.agentCons);
|
||||
transform.GetChild(1).GetComponent<AggregateStation>().SetInfo(sts.energyStation);
|
||||
transform.GetChild(2).GetComponent<AggregateStation>().SetInfo(sts.phoStation);
|
||||
transform.GetChild(3).GetComponent<AggregateStation>().SetInfo(sts.microGrid);
|
||||
transform.GetChild(4).GetComponent<AggregateStation>().SetInfo(sts.airCondition);
|
||||
transform.GetChild(5).GetComponent<AggregateStation>().SetInfo(sts.windStation);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
transform.GetChild(i).gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public class DataController : MonoSingleton<DataController>
|
|||
public AreaStationData areaStationData = new AreaStationData();
|
||||
public string distCode = "37";
|
||||
// Start is called before the first frame update
|
||||
private async void Start()
|
||||
private async void Awake()
|
||||
{
|
||||
string url = Bootstrap.Instance.urlDic["µØÍ¼ÐÅÏ¢»ã×Ü"];
|
||||
areaStationData = await AsyncWebReq.Get<AreaStationData>(url + distCode, Bootstrap.Instance.webAdapter.head, Bootstrap.Instance.webAdapter.token);
|
||||
|
|
@ -16,6 +16,8 @@ public class DataController : MonoSingleton<DataController>
|
|||
public ScreenTopStatistics GetStationsByDistCode(string distCode)
|
||||
{
|
||||
DataItem sts = areaStationData.data.Find(s => s.distCode == distCode);
|
||||
if (sts == null)
|
||||
return null;
|
||||
return sts.screenTopStatistics;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ public class ThreeDController : MonoBehaviour
|
|||
{
|
||||
private void OnMouseEnter()
|
||||
{
|
||||
Bootstrap.Instance.ShowLandMark(gameObject);
|
||||
Bootstrap.Instance.ShowLandMark();
|
||||
}
|
||||
private void OnMouseExit()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ Material:
|
|||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _BaseCol: {r: 0.070588246, g: 0.13366303, b: 0.24705882, a: 0}
|
||||
- _BaseColor: {r: 0, g: 0, b: 0, a: 0.6862745}
|
||||
- _Color: {r: 0, g: 0, b: 0, a: 0.6862745}
|
||||
- _BaseColor: {r: 0, g: 0, b: 0, a: 0.78431374}
|
||||
- _Color: {r: 0, g: 0, b: 0, a: 0.78431374}
|
||||
- _EmiCol: {r: 0.40874818, g: 0.7411772, b: 1.2204875, a: 0}
|
||||
- _EmissionColor: {r: 0.5245282, g: 0.5245282, b: 0.5245282, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
|
|
|
|||
Loading…
Reference in New Issue