|
@@ -7,6 +7,7 @@ using UnityEngine.UI;
|
|
|
using System.IO;
|
|
|
using LitJson;
|
|
|
using Newtonsoft.Json;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
|
|
|
public class XunJianDetails : MonoBehaviour
|
|
|
{
|
|
@@ -18,8 +19,16 @@ public class XunJianDetails : MonoBehaviour
|
|
|
public Button normalBtn;
|
|
|
public Button WarningBtn;
|
|
|
|
|
|
+ public Image normalBG1;
|
|
|
+ public Image normalBG2;
|
|
|
+
|
|
|
+ public Image warningBG1;
|
|
|
+ public Image WarningBG2;
|
|
|
+
|
|
|
+
|
|
|
public XunJianException exception;
|
|
|
|
|
|
+
|
|
|
|
|
|
public Button lastBtn;
|
|
|
public Button nextBtn;
|
|
@@ -64,6 +73,13 @@ public class XunJianDetails : MonoBehaviour
|
|
|
|
|
|
recordStatus = "1";
|
|
|
isUpdata = true;
|
|
|
+
|
|
|
+ normalBG1.gameObject.SetActive(true);
|
|
|
+ normalBG2.gameObject.SetActive(false);
|
|
|
+ warningBG1.gameObject.SetActive(false);
|
|
|
+ WarningBG2.gameObject.SetActive(true);
|
|
|
+
|
|
|
+ LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
|
|
|
});
|
|
|
|
|
|
WarningBtn.onClick.AddListener(() =>
|
|
@@ -73,6 +89,11 @@ public class XunJianDetails : MonoBehaviour
|
|
|
recordStatus = "0";
|
|
|
isUpdata = true;
|
|
|
|
|
|
+ normalBG1.gameObject.SetActive(false);
|
|
|
+ normalBG2.gameObject.SetActive(true);
|
|
|
+ warningBG1.gameObject.SetActive(true);
|
|
|
+ WarningBG2.gameObject.SetActive(false);
|
|
|
+
|
|
|
LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
|
|
|
});
|
|
|
|
|
@@ -80,7 +101,7 @@ public class XunJianDetails : MonoBehaviour
|
|
|
{
|
|
|
|
|
|
SubmitData();
|
|
|
-
|
|
|
+ XunJianInitialize.Instance.LastItem();
|
|
|
|
|
|
});
|
|
|
|
|
@@ -89,7 +110,7 @@ public class XunJianDetails : MonoBehaviour
|
|
|
|
|
|
SubmitData();
|
|
|
|
|
|
-
|
|
|
+ XunJianInitialize.Instance.NextItem();
|
|
|
|
|
|
|
|
|
});
|
|
@@ -119,64 +140,112 @@ public class XunJianDetails : MonoBehaviour
|
|
|
if (data.recd != null)
|
|
|
{
|
|
|
|
|
|
- if(!string.IsNullOrEmpty(data.recd.recordImg))
|
|
|
+ if (data.recd.recordImgList != null)
|
|
|
{
|
|
|
|
|
|
- List<string> listurl = JsonConvert.DeserializeObject<List<string>>(data.recd.recordImg);
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- if(listurl!=null)
|
|
|
- for (int i = 0; i < listurl.Count; i++)
|
|
|
+ for (int i = 0; i < data.recd.recordImgList.Count; i++)
|
|
|
{
|
|
|
- if (listurl[i] != null)
|
|
|
+
|
|
|
+ if (!string.IsNullOrEmpty(data.recd.recordImgList[i]))
|
|
|
{
|
|
|
+ Debug.Log(" DGJ ===> recordImgList " + data.recd.recordImgList[i]);
|
|
|
JsonData data2 = new JsonData();
|
|
|
- data2["fileName"] = listurl[i];
|
|
|
- LangChaoJiekou.Instance.DownloadImage(LangChaoJiekou.file_download, data2.ToJson(), (texture,url) => {
|
|
|
+ data2["fileName"] = data.recd.recordImgList[i];
|
|
|
+ StartCoroutine(LangChaoJiekou.Instance.DownloadImage(LangChaoJiekou.file_download, data2.ToJson(), (texture, url) =>
|
|
|
+ {
|
|
|
+
|
|
|
+ Debug.Log("DGJ ===> DownLoadImage " + url);
|
|
|
+ JObject obj = JObject.Parse(url);
|
|
|
+ url = obj["fileName"].ToString();
|
|
|
|
|
|
if (texture != null)
|
|
|
{
|
|
|
- for (int i = 0; i < listurl.Count; i++)
|
|
|
+
|
|
|
+ for (int i = 0; i < data.recd.recordImgList.Count; i++)
|
|
|
{
|
|
|
- if(listurl[i] == url)
|
|
|
+ Debug.Log("DGJ ===> DownLoadImage2 " + url + " " + data.recd.recordImgList[i]);
|
|
|
+ if (data.recd.recordImgList[i] == url)
|
|
|
{
|
|
|
+ Debug.Log("DGJ ===> DownLoadImage3 " + url);
|
|
|
listImages[i].sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- });
|
|
|
+ }));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ switch (data.recd.recordStatus)
|
|
|
+ {
|
|
|
+ case "0":
|
|
|
+ normalBG1.gameObject.SetActive(false);
|
|
|
+ normalBG2.gameObject.SetActive(true);
|
|
|
+ warningBG1.gameObject.SetActive(true);
|
|
|
+ WarningBG2.gameObject.SetActive(false);
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ normalBG1.gameObject.SetActive(true);
|
|
|
+ normalBG2.gameObject.SetActive(false);
|
|
|
+ warningBG1.gameObject.SetActive(false);
|
|
|
+ WarningBG2.gameObject.SetActive(true);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
- exception.gameObject.SetActive(true);
|
|
|
+ exception.gameObject.SetActive(data.recd.recordStatus=="0");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ listImageUrl = new List<string>();
|
|
|
|
|
|
- if (data.recd.recordImg != null)
|
|
|
- listImageUrl = JsonConvert.DeserializeObject<List<string>>(data.recd.recordImg);
|
|
|
+ for (int i = 0; i < data.recd.recordImgList.Count; i++)
|
|
|
+ {
|
|
|
+ listImageUrl.Add(data.recd.recordImgList[i]);
|
|
|
+ }
|
|
|
recordStatus = data.recd.recordStatus;
|
|
|
recordMemo = data.recd.recordMemo;
|
|
|
exception.scInput.text = data.recd.recordMemo;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ else
|
|
|
+ {
|
|
|
+ normalBG1.gameObject.SetActive(true);
|
|
|
+ normalBG2.gameObject.SetActive(false);
|
|
|
+ warningBG1.gameObject.SetActive(true);
|
|
|
+ WarningBG2.gameObject.SetActive(false);
|
|
|
+
|
|
|
+ listImageUrl = new List<string>();
|
|
|
+ recordStatus = null;
|
|
|
+ recordMemo = null;
|
|
|
+ exception.scInput.text = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
|
|
|
}
|
|
|
|
|
|
private void InitUI()
|
|
|
{
|
|
|
- xjName.text = data.inspItemName;
|
|
|
+ xjName.text = data.inspItemDesc;
|
|
|
for (int i = 0; i < listImages.Count; i++)
|
|
|
{
|
|
|
listImages[i].sprite = startImg;
|
|
|
}
|
|
|
exception.InitData(data);
|
|
|
exception.gameObject.SetActive(false);
|
|
|
-
|
|
|
+
|
|
|
+ lastBtn.gameObject.SetActive(true);
|
|
|
+ nextBtn.gameObject.SetActive(true);
|
|
|
+ completeBtn.gameObject.SetActive(false);
|
|
|
|
|
|
-
|
|
|
- if(data == XunJianAllData.listRoomItem[0])
|
|
|
+
|
|
|
+ if (data == XunJianAllData.listRoomItem[0])
|
|
|
{
|
|
|
lastBtn.gameObject.SetActive(false);
|
|
|
}
|
|
@@ -207,6 +276,8 @@ public class XunJianDetails : MonoBehaviour
|
|
|
|
|
|
public void SubmitData()
|
|
|
{
|
|
|
+
|
|
|
+ Debug.Log("DGJ ===> SubmitData " + isUpdata);
|
|
|
if (isUpdata)
|
|
|
{
|
|
|
isUpdata = false;
|
|
@@ -272,7 +343,7 @@ public class XunJianDetails : MonoBehaviour
|
|
|
byte[] bytes = texture2D.EncodeToPNG();
|
|
|
if (!Directory.Exists(Application.persistentDataPath + "/Image"))
|
|
|
Directory.CreateDirectory(Application.persistentDataPath + "/Image");
|
|
|
- string filename = Application.persistentDataPath + "/Image" + "/" +xjName.text+ showImage.name + ".png";
|
|
|
+ string filename = Application.persistentDataPath + "/Image" + "/" +data.inspItemName+ showImage.name + ".png";
|
|
|
if (File.Exists(filename))
|
|
|
File.Delete(filename);
|
|
|
|