|
@@ -7,6 +7,8 @@ using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
using System.Collections.Generic;
|
|
|
using Google.Protobuf;
|
|
|
+using Newtonsoft.Json;
|
|
|
+using System.IO;
|
|
|
|
|
|
public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
{
|
|
@@ -24,7 +26,7 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
|
|
|
[SerializeField] private GameObject mErrorBtn_go;
|
|
|
|
|
|
- private List<Image> ScreenshotList;
|
|
|
+ public List<Image> ScreenshotList;
|
|
|
|
|
|
private void Start()
|
|
|
{
|
|
@@ -32,6 +34,7 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
Warning_Btn.onClick.AddListener(WarningClick);
|
|
|
LabelText_Input.onValueChanged.AddListener(NewStr => mOutliers = NewStr);
|
|
|
}
|
|
|
+
|
|
|
private void OnEnable()
|
|
|
{
|
|
|
StartCoroutine(SetCurrentUIItem());
|
|
@@ -40,9 +43,10 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
{
|
|
|
yield return new WaitForSeconds(0.01f);
|
|
|
StartXunJian.Instance.currentUIItem = this;
|
|
|
+ PlayerPrefs.SetInt("ShowXunJianStep", mItemID);
|
|
|
}
|
|
|
|
|
|
- private int mItemID;
|
|
|
+ private int mItemID = 1;
|
|
|
private bool mNormal = true;
|
|
|
private string mOutliers = "";
|
|
|
private int mInspectionId;
|
|
@@ -53,9 +57,10 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
|
|
|
foreach (var ByteClass in byteDic)
|
|
|
{
|
|
|
- Debug.LogError($"是否上传:{ByteClass.Value.upload}");
|
|
|
+
|
|
|
if (ByteClass.Value.upload)
|
|
|
{
|
|
|
+ byteDic[ByteClass.Key].upload = false;
|
|
|
LangChaoMinIo.Instance.saveFile(ByteClass.Value.bytes,
|
|
|
this.GetService<IInspectionService>().InspectionInfo.id,
|
|
|
mItemID.ToString(),
|
|
@@ -75,15 +80,10 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
Dictionary<int, ByteClass> byteDic = new Dictionary<int, ByteClass>();
|
|
|
public void ChangeSprite(int id, Texture2D Texture2D)
|
|
|
{
|
|
|
- Debug.LogError($"ID:{id}");
|
|
|
if (byteDic.ContainsKey(id))
|
|
|
- {
|
|
|
byteDic[id] = new ByteClass() { upload = true, bytes = Texture2D.EncodeToPNG() };
|
|
|
- }
|
|
|
else
|
|
|
- {
|
|
|
byteDic.Add(id, new ByteClass() { upload = true, bytes = Texture2D.EncodeToPNG() });
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
public void InitData(int ItemID, int InspectionId, InspectionStep InspectionStep = null)
|
|
@@ -102,17 +102,18 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
mOutliers = InspectionStep.outliers;
|
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < InspectionStep.images.Length; i++)
|
|
|
+ int current = 0;
|
|
|
+ for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
- Debug.LogError("getFile");
|
|
|
- LangChaoMinIo.Instance.getFile(this.GetService<IInspectionService>().InspectionInfo.id, mItemID.ToString(), InspectionStep.images[i], Texture2D =>
|
|
|
+ LangChaoMinIo.Instance.getFile(this.GetService<IInspectionService>().InspectionInfo.id, mItemID.ToString(), i, Texture2D =>
|
|
|
{
|
|
|
if (Texture2D != null)
|
|
|
{
|
|
|
- byteDic.Add(i, new ByteClass() { upload = false, bytes = Texture2D.EncodeToPNG() });
|
|
|
+ byteDic.Add(current, new ByteClass() { upload = false, bytes = Texture2D.EncodeToPNG() });
|
|
|
Sprite sprite = Sprite.Create(Texture2D, new Rect(0, 0, Texture2D.width, Texture2D.height), Vector2.zero);
|
|
|
- ScreenshotList[i].sprite = sprite;
|
|
|
- Destroy(Texture2D);
|
|
|
+ sprite.name = current.ToString();
|
|
|
+ ScreenshotList[current].sprite = sprite; current++;
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -165,4 +166,9 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
|
|
|
WarningPanel_go.SetActive(true);
|
|
|
mNormal = false;
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+public static class CurrentStep
|
|
|
+{
|
|
|
+ public static int step;
|
|
|
}
|