Browse Source

图片显示

蓝色星空 1 year ago
parent
commit
a595929ddb

+ 10 - 13
Assets/Game/Blue/Controller/Item/ShowXunJian_UIItem.cs

@@ -24,7 +24,7 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
 
     [SerializeField] private GameObject mErrorBtn_go;
 
-    private List<Image> ScreenshotList;
+    public List<Image> ScreenshotList;
 
     private void Start()
     {
@@ -53,9 +53,10 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
 
         foreach (var ByteClass in byteDic)
         {
-            Debug.LogError($"是否上传:{ByteClass.Value.upload}");
+            //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 +76,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 +98,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++;
+                        //Destroy(Texture2D);
                     }
                 });
             }

+ 4 - 3
Assets/Game/PrefabTemplate/借用_XunjianToogleUI.prefab

@@ -4485,9 +4485,10 @@ MonoBehaviour:
   WarningPanel_go: {fileID: 3706178895091204087}
   LabelText_Input: {fileID: 975195068224255630}
   mErrorBtn_go: {fileID: 7477279148625475104}
-  Screenshot_0_Image: {fileID: 2159213327334610182}
-  Screenshot_1_Image: {fileID: 3532761808821666237}
-  Screenshot_2_Image: {fileID: 1969936950275804296}
+  ScreenshotList:
+  - {fileID: 2159213327334610182}
+  - {fileID: 3532761808821666237}
+  - {fileID: 1969936950275804296}
 --- !u!1 &7584859786364747502
 GameObject:
   m_ObjectHideFlags: 0

+ 0 - 1
Assets/Game/ShowXunJian/StartXunJian.cs

@@ -143,7 +143,6 @@ namespace GHZLangChao
             sprite.name = arrayImageIndex.ToString();
             arrayImage[arrayImageIndex].sprite = sprite;
 
-            Debug.LogError("第几个:"+ arrayImageIndex / 3+"ID:"+ arrayImageIndex % 3);
             ItemList[arrayImageIndex / 3].ChangeSprite(arrayImageIndex % 3, this.GetUtility<IRawImageForSpriteUtility>().TextureToTexture2D(ShowRawImage.texture));
             
             arrayImageIndex++;