|
@@ -1,4 +1,5 @@
|
|
-using Newtonsoft.Json;
|
|
|
|
|
|
+using Best.HTTP.Shared.Compression.Zlib;
|
|
|
|
+using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using Newtonsoft.Json.Linq;
|
|
using System;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections;
|
|
@@ -38,7 +39,11 @@ public class ServerMovePlan {
|
|
public bool isOut;
|
|
public bool isOut;
|
|
public string desc;
|
|
public string desc;
|
|
public string from;
|
|
public string from;
|
|
|
|
+ public float fromLong;
|
|
|
|
+ public float fromLttd;
|
|
public string to;
|
|
public string to;
|
|
|
|
+ public float toLong;
|
|
|
|
+ public float toLttd;
|
|
public int manNum;
|
|
public int manNum;
|
|
public int homeNum;
|
|
public int homeNum;
|
|
public int completeNum;
|
|
public int completeNum;
|
|
@@ -74,9 +79,9 @@ public class RKZYLayer : YZTRootLayer
|
|
|
|
|
|
public Button[] allInOut;
|
|
public Button[] allInOut;
|
|
|
|
|
|
- public RectTransform before;
|
|
|
|
|
|
+ public RectTransform beforeC;
|
|
|
|
|
|
- public RectTransform after;
|
|
|
|
|
|
+ public RectTransform afterC;
|
|
|
|
|
|
public List<LinePath> linePaths = new List<LinePath>();
|
|
public List<LinePath> linePaths = new List<LinePath>();
|
|
|
|
|
|
@@ -102,18 +107,24 @@ public class RKZYLayer : YZTRootLayer
|
|
public ZYYAData[] zYYADatas;
|
|
public ZYYAData[] zYYADatas;
|
|
public int zYYAIndex = 0;
|
|
public int zYYAIndex = 0;
|
|
public Text[] zYYAText;
|
|
public Text[] zYYAText;
|
|
|
|
+
|
|
|
|
+ public Material afterMat;
|
|
|
|
+ public LinePath linePathPrefab;
|
|
// Start is called before the first frame update
|
|
// Start is called before the first frame update
|
|
async void Start()
|
|
async void Start()
|
|
{
|
|
{
|
|
lineInfoStatic = lineInfo;
|
|
lineInfoStatic = lineInfo;
|
|
|
|
+ await InitMovePlan();
|
|
//TODO 这一块的path应该从movePlan里面生成而不是默认
|
|
//TODO 这一块的path应该从movePlan里面生成而不是默认
|
|
InitAllPath();
|
|
InitAllPath();
|
|
- await InitMovePlan();
|
|
|
|
InitButton();
|
|
InitButton();
|
|
InitAtten();
|
|
InitAtten();
|
|
await InitBaseData();
|
|
await InitBaseData();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ private void OnEnable()
|
|
|
|
+ {
|
|
|
|
+ CameraManager.SwitchCamera(1);
|
|
|
|
+ }
|
|
void InitAtten() {
|
|
void InitAtten() {
|
|
RectTransform title = Instantiate(title2);
|
|
RectTransform title = Instantiate(title2);
|
|
title.SetParent(attenContent);
|
|
title.SetParent(attenContent);
|
|
@@ -177,7 +188,7 @@ public class RKZYLayer : YZTRootLayer
|
|
zYYADatas = new ZYYAData[6] { new ZYYAData(), new ZYYAData() , new ZYYAData() , new ZYYAData() , new ZYYAData() , new ZYYAData() };
|
|
zYYADatas = new ZYYAData[6] { new ZYYAData(), new ZYYAData() , new ZYYAData() , new ZYYAData() , new ZYYAData() , new ZYYAData() };
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- if (requestData.result != UnityWebRequest.Result.Success)
|
|
|
|
|
|
+ if (true)
|
|
{
|
|
{
|
|
Debug.LogWarning("RKZYLayer联网不成功,读本地缓存数据,原因:返request不成功");
|
|
Debug.LogWarning("RKZYLayer联网不成功,读本地缓存数据,原因:返request不成功");
|
|
successInternet = false;
|
|
successInternet = false;
|
|
@@ -218,50 +229,82 @@ public class RKZYLayer : YZTRootLayer
|
|
www.Dispose();
|
|
www.Dispose();
|
|
}
|
|
}
|
|
|
|
|
|
- LinePath[] beforeLinePaths = before.GetComponentsInChildren<LinePath>();
|
|
|
|
- LinePath[] afterLinePaths = after.GetComponentsInChildren<LinePath>();
|
|
|
|
|
|
+
|
|
int beforeIndex = 0;
|
|
int beforeIndex = 0;
|
|
int afterIndex = 0;
|
|
int afterIndex = 0;
|
|
|
|
+ List<LinePath> beforeLinePaths = new List<LinePath>();
|
|
|
|
+ List<LinePath> afterLinePaths = new List<LinePath>();
|
|
|
|
+ GameObject shaPan = GameObject.FindGameObjectWithTag("ShaPan");
|
|
|
|
+ Transform runtimPointParent = shaPan.transform.GetChild(10);
|
|
for (int i = 0; i < allServerMovePlans.Count; i++) {
|
|
for (int i = 0; i < allServerMovePlans.Count; i++) {
|
|
bool after = allServerMovePlans[i].isAfter;
|
|
bool after = allServerMovePlans[i].isAfter;
|
|
bool isOut = allServerMovePlans[i].isOut;
|
|
bool isOut = allServerMovePlans[i].isOut;
|
|
if (!after)
|
|
if (!after)
|
|
{
|
|
{
|
|
- beforeLinePaths[beforeIndex].startPos = allServerMovePlans[i].from;
|
|
|
|
- beforeLinePaths[beforeIndex].endPos = allServerMovePlans[i].to;
|
|
|
|
- beforeLinePaths[beforeIndex].lineDir = isOut ? LineDir.Out : LineDir.In;
|
|
|
|
- beforeLinePaths[beforeIndex].linePathContent = allServerMovePlans[i].desc;
|
|
|
|
- beforeLinePaths[beforeIndex].manNum = allServerMovePlans[i].manNum;
|
|
|
|
- beforeLinePaths[beforeIndex].homeNum = allServerMovePlans[i].homeNum;
|
|
|
|
- beforeLinePaths[beforeIndex].completeNum = allServerMovePlans[i].completeNum;
|
|
|
|
- beforeLinePaths[beforeIndex].dateTime = allServerMovePlans[i].dateTime;
|
|
|
|
-
|
|
|
|
- if (beforeLinePaths[beforeIndex].lineDir == LineDir.Out)
|
|
|
|
|
|
+ LinePath linePath = Instantiate(linePathPrefab);
|
|
|
|
+ linePath.transform.SetParent(beforeC);
|
|
|
|
+ linePath.transform.localScale = Vector3.one;
|
|
|
|
+ linePath.startPos = allServerMovePlans[i].from;
|
|
|
|
+ Vector3 localPos = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].fromLong, allServerMovePlans[i].fromLttd);
|
|
|
|
+ Vector3 worldPos = runtimPointParent.TransformPoint(localPos);
|
|
|
|
+ worldPos.z = -583;
|
|
|
|
+ linePath.GetComponent<LineRenderer>().SetPosition(1, worldPos);
|
|
|
|
+ linePath.endPos = allServerMovePlans[i].to;
|
|
|
|
+ Vector3 localPos1 = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].toLong, allServerMovePlans[i].toLttd);
|
|
|
|
+ Vector3 worldPos1 = runtimPointParent.TransformPoint(localPos1);
|
|
|
|
+ worldPos1.z = -583;
|
|
|
|
+ float distance = Vector3.Distance(worldPos, worldPos1);
|
|
|
|
+ linePath.GetComponent<LineRenderer>().material.SetTextureScale("_MainTex", new Vector2(distance * 120 / 25, 1));
|
|
|
|
+ linePath.GetComponent<LineRenderer>().SetPosition(0, worldPos1);
|
|
|
|
+ linePath.lineDir = isOut ? LineDir.Out : LineDir.In;
|
|
|
|
+ linePath.linePathContent = allServerMovePlans[i].desc;
|
|
|
|
+ linePath.manNum = allServerMovePlans[i].manNum;
|
|
|
|
+ linePath.homeNum = allServerMovePlans[i].homeNum;
|
|
|
|
+ linePath.completeNum = allServerMovePlans[i].completeNum;
|
|
|
|
+ linePath.dateTime = allServerMovePlans[i].dateTime;
|
|
|
|
+
|
|
|
|
+ if (linePath.lineDir == LineDir.Out)
|
|
{
|
|
{
|
|
zYYADatas[1].totalmanNum += allServerMovePlans[i].manNum;
|
|
zYYADatas[1].totalmanNum += allServerMovePlans[i].manNum;
|
|
zYYADatas[1].totalVillageCount += allServerMovePlans[i].villageCount;
|
|
zYYADatas[1].totalVillageCount += allServerMovePlans[i].villageCount;
|
|
zYYADatas[1].totalMaterialPrize += allServerMovePlans[i].materialPrize;
|
|
zYYADatas[1].totalMaterialPrize += allServerMovePlans[i].materialPrize;
|
|
zYYADatas[1].totalRoadCount += 1;
|
|
zYYADatas[1].totalRoadCount += 1;
|
|
}
|
|
}
|
|
- else {
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
zYYADatas[2].totalmanNum += allServerMovePlans[i].manNum;
|
|
zYYADatas[2].totalmanNum += allServerMovePlans[i].manNum;
|
|
zYYADatas[2].totalVillageCount += allServerMovePlans[i].villageCount;
|
|
zYYADatas[2].totalVillageCount += allServerMovePlans[i].villageCount;
|
|
zYYADatas[2].totalMaterialPrize += allServerMovePlans[i].materialPrize;
|
|
zYYADatas[2].totalMaterialPrize += allServerMovePlans[i].materialPrize;
|
|
zYYADatas[2].totalRoadCount += 1;
|
|
zYYADatas[2].totalRoadCount += 1;
|
|
}
|
|
}
|
|
- beforeIndex++;
|
|
|
|
|
|
+ beforeLinePaths.Add(linePath);
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- afterLinePaths[afterIndex].startPos = allServerMovePlans[i].from;
|
|
|
|
- afterLinePaths[afterIndex].endPos = allServerMovePlans[i].to;
|
|
|
|
- afterLinePaths[afterIndex].lineDir = isOut ? LineDir.Out : LineDir.In;
|
|
|
|
- afterLinePaths[afterIndex].linePathContent = allServerMovePlans[i].desc;
|
|
|
|
- afterLinePaths[afterIndex].manNum = allServerMovePlans[i].manNum;
|
|
|
|
- afterLinePaths[afterIndex].homeNum = allServerMovePlans[i].homeNum;
|
|
|
|
- afterLinePaths[afterIndex].completeNum = allServerMovePlans[i].completeNum;
|
|
|
|
- afterLinePaths[afterIndex].dateTime = allServerMovePlans[i].dateTime;
|
|
|
|
-
|
|
|
|
- if (afterLinePaths[afterIndex].lineDir == LineDir.Out)
|
|
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ LinePath linePath = Instantiate(linePathPrefab);
|
|
|
|
+ linePath.transform.SetParent(afterC);
|
|
|
|
+ linePath.transform.localScale = Vector3.one;
|
|
|
|
+ linePath.startPos = allServerMovePlans[i].from;
|
|
|
|
+ Vector3 localPos = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].fromLong, allServerMovePlans[i].fromLttd);
|
|
|
|
+ Vector3 worldPos = runtimPointParent.TransformPoint(localPos);
|
|
|
|
+ worldPos.z = -583;
|
|
|
|
+ linePath.GetComponent<LineRenderer>().SetPosition(1, worldPos);
|
|
|
|
+ linePath.endPos = allServerMovePlans[i].to;
|
|
|
|
+ Vector3 localPos1 = CoordinateConverter.GeoToUGUISmall(allServerMovePlans[i].toLong, allServerMovePlans[i].toLttd);
|
|
|
|
+ Vector3 worldPos1 = runtimPointParent.TransformPoint(localPos1);
|
|
|
|
+ worldPos1.z = -583;
|
|
|
|
+ float distance = Vector3.Distance(worldPos, worldPos1);
|
|
|
|
+ linePath.GetComponent<LineRenderer>().material = afterMat;
|
|
|
|
+ linePath.GetComponent<LineRenderer>().material.SetTextureScale("_MainTex", new Vector2(distance * 120 / 25,1));
|
|
|
|
+ linePath.GetComponent<LineRenderer>().SetPosition(0, worldPos1);
|
|
|
|
+ linePath.lineDir = isOut ? LineDir.Out : LineDir.In;
|
|
|
|
+ linePath.linePathContent = allServerMovePlans[i].desc;
|
|
|
|
+ linePath.manNum = allServerMovePlans[i].manNum;
|
|
|
|
+ linePath.homeNum = allServerMovePlans[i].homeNum;
|
|
|
|
+ linePath.completeNum = allServerMovePlans[i].completeNum;
|
|
|
|
+ linePath.dateTime = allServerMovePlans[i].dateTime;
|
|
|
|
+
|
|
|
|
+ if (linePath.lineDir == LineDir.Out)
|
|
{
|
|
{
|
|
zYYADatas[4].totalmanNum += allServerMovePlans[i].manNum;
|
|
zYYADatas[4].totalmanNum += allServerMovePlans[i].manNum;
|
|
zYYADatas[4].totalVillageCount += allServerMovePlans[i].villageCount;
|
|
zYYADatas[4].totalVillageCount += allServerMovePlans[i].villageCount;
|
|
@@ -275,7 +318,7 @@ public class RKZYLayer : YZTRootLayer
|
|
zYYADatas[5].totalMaterialPrize += allServerMovePlans[i].materialPrize;
|
|
zYYADatas[5].totalMaterialPrize += allServerMovePlans[i].materialPrize;
|
|
zYYADatas[5].totalRoadCount += 1;
|
|
zYYADatas[5].totalRoadCount += 1;
|
|
}
|
|
}
|
|
- afterIndex++;
|
|
|
|
|
|
+ afterLinePaths.Add(linePath);
|
|
}
|
|
}
|
|
|
|
|
|
zYYADatas[0].totalmanNum = zYYADatas[1].totalmanNum + zYYADatas[2].totalmanNum;
|
|
zYYADatas[0].totalmanNum = zYYADatas[1].totalmanNum + zYYADatas[2].totalmanNum;
|
|
@@ -300,8 +343,8 @@ public class RKZYLayer : YZTRootLayer
|
|
RectTransform title2 = Instantiate(title1);
|
|
RectTransform title2 = Instantiate(title1);
|
|
title2.localScale = Vector3.one;
|
|
title2.localScale = Vector3.one;
|
|
title2.SetParent(movePlanAfterContent);
|
|
title2.SetParent(movePlanAfterContent);
|
|
- List<ServerMovePlan> serverMovePlans = new List<ServerMovePlan>();
|
|
|
|
- for (int i = 0; i < beforeLinePaths.Length; i++)
|
|
|
|
|
|
+ List<ServerMovePlan> serverMovePlans = new List<ServerMovePlan>();
|
|
|
|
+ for (int i = 0; i < beforeLinePaths.Count; i++)
|
|
{
|
|
{
|
|
int tempI = i;
|
|
int tempI = i;
|
|
RectTransform plan = Instantiate(plan1);
|
|
RectTransform plan = Instantiate(plan1);
|
|
@@ -325,9 +368,9 @@ public class RKZYLayer : YZTRootLayer
|
|
plan.GetChild(3).GetComponent<Text>().text = beforeLinePaths[i].manNum.ToString();
|
|
plan.GetChild(3).GetComponent<Text>().text = beforeLinePaths[i].manNum.ToString();
|
|
plan.GetChild(4).GetComponent<Text>().text = beforeLinePaths[i].dateTime.ToString();
|
|
plan.GetChild(4).GetComponent<Text>().text = beforeLinePaths[i].dateTime.ToString();
|
|
movePlans.Add(thing1);
|
|
movePlans.Add(thing1);
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- for (int i = 0; i < afterLinePaths.Length; i++)
|
|
|
|
|
|
+ for (int i = 0; i < afterLinePaths.Count; i++)
|
|
{
|
|
{
|
|
RectTransform plan = Instantiate(plan1);
|
|
RectTransform plan = Instantiate(plan1);
|
|
plan.SetParent(movePlanAfterContent);
|
|
plan.SetParent(movePlanAfterContent);
|
|
@@ -350,7 +393,7 @@ public class RKZYLayer : YZTRootLayer
|
|
plan.GetChild(3).GetComponent<Text>().text = afterLinePaths[i].manNum.ToString();
|
|
plan.GetChild(3).GetComponent<Text>().text = afterLinePaths[i].manNum.ToString();
|
|
plan.GetChild(4).GetComponent<Text>().text = afterLinePaths[i].dateTime.ToString();
|
|
plan.GetChild(4).GetComponent<Text>().text = afterLinePaths[i].dateTime.ToString();
|
|
movePlans.Add(thing1);
|
|
movePlans.Add(thing1);
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
movePlanAfterContent.gameObject.SetActive(false);
|
|
movePlanAfterContent.gameObject.SetActive(false);
|
|
|
|
|
|
@@ -399,8 +442,8 @@ public class RKZYLayer : YZTRootLayer
|
|
beforeAfterIndex = 0;
|
|
beforeAfterIndex = 0;
|
|
beforeBtn.GetComponent<Image>().sprite = sprites[0];
|
|
beforeBtn.GetComponent<Image>().sprite = sprites[0];
|
|
afterBtn.GetComponent<Image>().sprite = sprites[1];
|
|
afterBtn.GetComponent<Image>().sprite = sprites[1];
|
|
- before.gameObject.SetActive(true);
|
|
|
|
- after.gameObject.SetActive(false);
|
|
|
|
|
|
+ beforeC.gameObject.SetActive(true);
|
|
|
|
+ afterC.gameObject.SetActive(false);
|
|
|
|
|
|
movePlanBeforeContent.gameObject.SetActive(true);
|
|
movePlanBeforeContent.gameObject.SetActive(true);
|
|
movePlanAfterContent.gameObject.SetActive(false);
|
|
movePlanAfterContent.gameObject.SetActive(false);
|
|
@@ -413,8 +456,8 @@ public class RKZYLayer : YZTRootLayer
|
|
beforeAfterIndex = 1;
|
|
beforeAfterIndex = 1;
|
|
beforeBtn.GetComponent<Image>().sprite = sprites[1];
|
|
beforeBtn.GetComponent<Image>().sprite = sprites[1];
|
|
afterBtn.GetComponent<Image>().sprite = sprites[0];
|
|
afterBtn.GetComponent<Image>().sprite = sprites[0];
|
|
- before.gameObject.SetActive(false);
|
|
|
|
- after.gameObject.SetActive(true);
|
|
|
|
|
|
+ beforeC.gameObject.SetActive(false);
|
|
|
|
+ afterC.gameObject.SetActive(true);
|
|
|
|
|
|
movePlanBeforeContent.gameObject.SetActive(false);
|
|
movePlanBeforeContent.gameObject.SetActive(false);
|
|
movePlanAfterContent.gameObject.SetActive(true);
|
|
movePlanAfterContent.gameObject.SetActive(true);
|
|
@@ -472,16 +515,18 @@ public class RKZYLayer : YZTRootLayer
|
|
}
|
|
}
|
|
|
|
|
|
void InitAllPath() {
|
|
void InitAllPath() {
|
|
- for (int i = 0; i < before.childCount; i++) {
|
|
|
|
- if (before.GetChild(i).GetComponent<LinePath>()) {
|
|
|
|
- linePaths.Add(before.GetChild(i).GetComponent<LinePath>());
|
|
|
|
|
|
+ for (int i = 0; i < beforeC.childCount; i++)
|
|
|
|
+ {
|
|
|
|
+ if (beforeC.GetChild(i).GetComponent<LinePath>())
|
|
|
|
+ {
|
|
|
|
+ linePaths.Add(beforeC.GetChild(i).GetComponent<LinePath>());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- for (int i = 0; i < after.childCount; i++)
|
|
|
|
|
|
+ for (int i = 0; i < afterC.childCount; i++)
|
|
{
|
|
{
|
|
- if (after.GetChild(i).GetComponent<LinePath>())
|
|
|
|
|
|
+ if (afterC.GetChild(i).GetComponent<LinePath>())
|
|
{
|
|
{
|
|
- linePaths.Add(after.GetChild(i).GetComponent<LinePath>());
|
|
|
|
|
|
+ linePaths.Add(afterC.GetChild(i).GetComponent<LinePath>());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -509,5 +554,17 @@ public class RKZYLayer : YZTRootLayer
|
|
{
|
|
{
|
|
lineInfo.gameObject.SetActive(false);
|
|
lineInfo.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ Ray ray = CameraManager.instance.secondCamera.ScreenPointToRay(Input.mousePosition);
|
|
|
|
+ RaycastHit hit;
|
|
|
|
+ if (Physics.Raycast(ray, out hit, 10000))
|
|
|
|
+ {
|
|
|
|
+ Debug.Log(hit.collider.gameObject.name);
|
|
|
|
+ // 检查射线是否击中 LineRenderer 所在的物体
|
|
|
|
+ if (hit.collider.GetComponent<LineRenderer>() != null)
|
|
|
|
+ {
|
|
|
|
+ hit.collider.gameObject.GetComponent<LinePath>().OnShow();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|