|
@@ -5,7 +5,8 @@ using DG.Tweening;
|
|
|
using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
using System.IO;
|
|
|
-using Newtonsoft.Json;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using UnityAsync;
|
|
|
|
|
|
public class AreaFHXSData
|
|
|
{
|
|
@@ -46,20 +47,22 @@ public class FHSSLayer : YZTRootLayer
|
|
|
public WaterRangeCtrlTool mTools;
|
|
|
public RectTransform[] hotPoints;
|
|
|
|
|
|
- public void InitData() {
|
|
|
+ public async void InitData() {
|
|
|
|
|
|
- if (File.Exists(Application.streamingAssetsPath + "/areaBaseData.json")) {
|
|
|
- string areaBaseDataContent = File.ReadAllText(Application.streamingAssetsPath + "/areaBaseData.json");
|
|
|
- GlobalData.areaFHXSDatas = JsonConvert.DeserializeObject<List<AreaFHXSData>>(areaBaseDataContent);
|
|
|
- for (int i = 0; i < GlobalData.areaFHXSDatas.Count; i++) {
|
|
|
- ShuiShiLieBiaoItem tempItem = Instantiate(shuiShiLieBiaoItem);
|
|
|
- shuiShiLieBiaoItems.Add(tempItem);
|
|
|
- tempItem.transform.SetParent(shuiShiliebiaoParent.transform);
|
|
|
- tempItem.transform.localScale = Vector3.one;
|
|
|
- tempItem.SetData(GlobalData.areaFHXSDatas[i]);
|
|
|
- tempItem.Evaluate(1);
|
|
|
- }
|
|
|
+ WWW www = new WWW(Application.streamingAssetsPath + "/areaBaseData.json");
|
|
|
+ await new UnityAsync.WaitUntil(() => { return www.isDone; });
|
|
|
+ string areaBaseDataContent = www.text;
|
|
|
+ GlobalData.areaFHXSDatas = JsonConvert.DeserializeObject<List<AreaFHXSData>>(areaBaseDataContent);
|
|
|
+ for (int i = 0; i < GlobalData.areaFHXSDatas.Count; i++)
|
|
|
+ {
|
|
|
+ ShuiShiLieBiaoItem tempItem = Instantiate(shuiShiLieBiaoItem);
|
|
|
+ shuiShiLieBiaoItems.Add(tempItem);
|
|
|
+ tempItem.transform.SetParent(shuiShiliebiaoParent.transform);
|
|
|
+ tempItem.transform.localScale = Vector3.one;
|
|
|
+ tempItem.SetData(GlobalData.areaFHXSDatas[i]);
|
|
|
+ tempItem.Evaluate(1);
|
|
|
}
|
|
|
+
|
|
|
mTools.onCtrlChange = (float value) =>
|
|
|
{
|
|
|
float ymmj = 0;
|