Prechádzať zdrojové kódy

Merge branch 'F/20231026_RTCChange' of https://gogs.ghz-tech.com:8843/GHzGlass/GHZLangChao into F/20231026_RTCChange

胡佳骏 1 rok pred
rodič
commit
f7f4945a88

+ 20 - 14
Assets/Game/Blue/Controller/Item/ShowXunJian_UIItem.cs

@@ -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; // 检查项目的编号 1-12
+    private int mItemID = 1; // 检查项目的编号 1-12
     private bool mNormal = true; //是否正常
     private string mOutliers = ""; // 标签
     private int mInspectionId; // 巡检编号,巡检开始时返回的id
@@ -53,9 +57,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 +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++;
+                        //Destroy(Texture2D);
                     }
                 });
             }
@@ -165,4 +166,9 @@ public class ShowXunJian_UIItem : MonoBehaviour, IController
         WarningPanel_go.SetActive(true);
         mNormal = false;
     }
+}
+
+public static class CurrentStep
+{
+    public static int step;
 }

+ 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

+ 1 - 2
Assets/Game/ShowXunJian/ShowXunJian.prefab

@@ -7346,7 +7346,6 @@ MonoBehaviour:
   - {fileID: 1848223607491329095}
   - {fileID: 1994716478973536713}
   - {fileID: 2051214061360007007}
-  mScreenshotSprite: {fileID: 21300000, guid: 72a6f38aacb371e4e808f9b74800e742, type: 3}
 --- !u!114 &2159527941179580181
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -12049,7 +12048,7 @@ PrefabInstance:
       objectReference: {fileID: 0}
     - target: {fileID: 7541715656771924501, guid: 7a90b1574b243db46a13f4c5243925bf, type: 3}
       propertyPath: m_IsActive
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 7662955294641609868, guid: 7a90b1574b243db46a13f4c5243925bf, type: 3}
       propertyPath: m_text

+ 11 - 3
Assets/Game/ShowXunJian/StartXunJian.cs

@@ -1,9 +1,14 @@
 using System.Collections.Generic;
 using Blue;
+using System.IO;
 using UnityEngine;
 using UnityEngine.Events;
 using UnityEngine.UI;
 using TMPro;
+using UnityEngine.Networking;
+using System.Collections;
+using UnityEditor.Experimental.GraphView;
+using BestHTTP.JSON;
 
 namespace GHZLangChao
 {
@@ -40,6 +45,10 @@ namespace GHZLangChao
         private void Awake()
         {
             Instance = this;
+
+            var step = PlayerPrefs.GetInt("ShowXunJianStep");
+            ToggleList[step-1].isOn = true;
+            currentUIItem = ItemList[step-1];
         }
         void Start()
         {
@@ -64,6 +73,7 @@ namespace GHZLangChao
             if (mInspectionService == null)
                 mInspectionService = this.GetService<IInspectionService>();
             Init(mInspectionService.InspectionInfo);
+
         }
         private void Update()
         {
@@ -78,7 +88,6 @@ namespace GHZLangChao
             ShowXunJian.Instance.gotoWindow(ScenesManager.SceneType.ShowDH);
         }
 
-
         public void back()
         {
             ScenesManager.Instance.showWindow(ScenesManager.SceneType.ShowChoose);
@@ -143,9 +152,8 @@ 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++;
             if (arrayImageIndex % 3 == 0)
             {

+ 1 - 1
Assets/LangChaoRTC/Remote/ShowRoom/RoomInvite/Prefab/MsgItem.prefab

@@ -211,7 +211,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 138.455, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
   m_SizeDelta: {x: 254.91, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5295285540247215458

+ 35 - 16
Assets/LangChaoRTC/Remote/ShowRoom/RoomInvite/Scripts/PngJpgItem.cs

@@ -1,8 +1,9 @@
-using System;
+using System;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
+using static LangChaoRommMinIo;
 
 public class PngJpgItem : BaseFilePrefabItem
 {
@@ -11,21 +12,39 @@ public class PngJpgItem : BaseFilePrefabItem
     public override void Init(FileConfig fileConfig)
     {
         base.Init(fileConfig);
-        if (!string.IsNullOrEmpty(fileConfig.Url))
-        {
-            string url = fileConfig.Url;
-            if (!fileConfig.Url.Contains("http"))
-            {
-                url = "https://" + fileConfig.Url;
-            }
-            NetWorkHeaders.Instance.getNetTexture(url, null, (Texture tex) => {
-                if (tex)
-                {
-                    Adaption(tex);
-                    mainImage.texture = tex;
-                }
-            });
-        }
+
+        LangChaoRommMinIo.Instance.getFile(MQTTManager.Instance.roomId, fileConfig.Bucket, fileConfig.ObjectName, (RoomFileData rfd) => {
+
+            Debug.Log("rfd==>" + rfd.url);
+            Debug.Log("rfd==>" + rfd.bytes.Length);
+
+            Texture2D texture = new Texture2D(10, 10);
+            texture.LoadImage(rfd.bytes);//流数据转换成Texture2D
+
+            texture.Apply();
+
+            Adaption(texture);
+            mainImage.texture = texture;
+        });
+
+
+        //if (!string.IsNullOrEmpty(fileConfig.Url))
+        //{
+        //    string url = fileConfig.Url;
+        //    if (!fileConfig.Url.Contains("http"))
+        //    {
+        //        url = "https://" + fileConfig.Url;
+        //    }
+        //    NetWorkHeaders.Instance.getNetTexture(url, null, (Texture tex) => {
+        //        if (tex)
+        //        {
+        //            Adaption(tex);
+        //            mainImage.texture = tex;
+        //        }
+        //    });
+
+
+        //}
     }
 
     public void Adaption(Texture tex)

+ 1 - 1
Assets/LangChaoRTC/Remote/ShowRoom/RoomMain.cs

@@ -300,7 +300,7 @@ public class RoomMain : RemoteSingleton<RoomMain>
         }
         if (PopCall.Instance)
         {
-            PopCall.Instance.gameObject.SetActive(false);
+          //  PopCall.Instance.gameObject.SetActive(false);
         }
         if (ShowRoom.Instance)
         {

+ 4 - 52
Assets/LangChaoRTC/Remote/ShowRoom/RoomMain.prefab

@@ -1595,19 +1595,7 @@ MonoBehaviour:
   m_TargetGraphic: {fileID: 2241088651301450029}
   m_OnClick:
     m_PersistentCalls:
-      m_Calls:
-      - m_Target: {fileID: 2507207545101761575}
-        m_TargetAssemblyTypeName: LiveRTCRoomMain, Assembly-CSharp
-        m_MethodName: SetVideo
-        m_Mode: 6
-        m_Arguments:
-          m_ObjectArgument: {fileID: 0}
-          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
-          m_IntArgument: 0
-          m_FloatArgument: 0
-          m_StringArgument: 
-          m_BoolArgument: 1
-        m_CallState: 2
+      m_Calls: []
 --- !u!1 &2241088651333374834
 GameObject:
   m_ObjectHideFlags: 0
@@ -1806,19 +1794,7 @@ MonoBehaviour:
   m_TargetGraphic: {fileID: 2241088651403055089}
   m_OnClick:
     m_PersistentCalls:
-      m_Calls:
-      - m_Target: {fileID: 2507207545101761575}
-        m_TargetAssemblyTypeName: LiveRTCRoomMain, Assembly-CSharp
-        m_MethodName: SetAudio
-        m_Mode: 6
-        m_Arguments:
-          m_ObjectArgument: {fileID: 0}
-          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
-          m_IntArgument: 0
-          m_FloatArgument: 0
-          m_StringArgument: 
-          m_BoolArgument: 1
-        m_CallState: 2
+      m_Calls: []
 --- !u!1 &2241088651471683787
 GameObject:
   m_ObjectHideFlags: 0
@@ -1941,19 +1917,7 @@ MonoBehaviour:
   m_TargetGraphic: {fileID: 2241088651471683788}
   m_OnClick:
     m_PersistentCalls:
-      m_Calls:
-      - m_Target: {fileID: 2507207545101761575}
-        m_TargetAssemblyTypeName: LiveRTCRoomMain, Assembly-CSharp
-        m_MethodName: SetVideo
-        m_Mode: 6
-        m_Arguments:
-          m_ObjectArgument: {fileID: 0}
-          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
-          m_IntArgument: 0
-          m_FloatArgument: 0
-          m_StringArgument: 
-          m_BoolArgument: 0
-        m_CallState: 2
+      m_Calls: []
 --- !u!1 &2241088651505987571
 GameObject:
   m_ObjectHideFlags: 0
@@ -3101,19 +3065,7 @@ MonoBehaviour:
   m_TargetGraphic: {fileID: 2241088652691173818}
   m_OnClick:
     m_PersistentCalls:
-      m_Calls:
-      - m_Target: {fileID: 2507207545101761575}
-        m_TargetAssemblyTypeName: LiveRTCRoomMain, Assembly-CSharp
-        m_MethodName: SetAudio
-        m_Mode: 6
-        m_Arguments:
-          m_ObjectArgument: {fileID: 0}
-          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
-          m_IntArgument: 0
-          m_FloatArgument: 0
-          m_StringArgument: 
-          m_BoolArgument: 0
-        m_CallState: 2
+      m_Calls: []
 --- !u!1 &2316171003018402862
 GameObject:
   m_ObjectHideFlags: 0

+ 2 - 2
Assets/LangChaoRTC/Remote/ShowRoom/ShowRoom.cs

@@ -159,7 +159,7 @@ public class ShowRoom : RemoteSingleton<ShowRoom>
         ShowMainScreen();
         if (PopCall.Instance)
         {
-            PopCall.Instance.gameObject.SetActive(false);
+           // PopCall.Instance.gameObject.SetActive(false);
         }
         transform.position = new Vector3(0, 0.9f, 0);
         transform.eulerAngles = new Vector3(0, 0, 0);
@@ -194,7 +194,7 @@ public class ShowRoom : RemoteSingleton<ShowRoom>
         ShowMainScreen();
         if (PopCall.Instance)
         {
-            PopCall.Instance.gameObject.SetActive(false);
+          //  PopCall.Instance.gameObject.SetActive(false);
         }
     }
 

+ 14 - 13
Assets/Scenes/LangChaoDemo2.unity

@@ -7662,8 +7662,8 @@ GameObject:
   serializedVersion: 6
   m_Component:
   - component: {fileID: 583309982}
-  - component: {fileID: 583309981}
   - component: {fileID: 583309983}
+  - component: {fileID: 583309984}
   m_Layer: 0
   m_Name: Net
   m_TagString: Untagged
@@ -7671,18 +7671,6 @@ GameObject:
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
   m_IsActive: 1
---- !u!114 &583309981
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 583309980}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: 9eb2c1120b825d14dbaf47b974de7085, type: 3}
-  m_Name: 
-  m_EditorClassIdentifier: 
 --- !u!4 &583309982
 Transform:
   m_ObjectHideFlags: 0
@@ -7711,6 +7699,19 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   global: 1
+--- !u!114 &583309984
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 583309980}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 9b586d4b3fcf5d54a945e18d92a99f07, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  global: 1
 --- !u!1 &587736014
 GameObject:
   m_ObjectHideFlags: 0

+ 7 - 1
Assets/Scripts/MQTT/MQTTManager.cs

@@ -5,6 +5,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Text;
 using UnityEngine;
+using static LangChaoRommMinIo;
 
 public class MQTTManager : MonoSingleton<MQTTManager>
 {
@@ -183,7 +184,12 @@ public class MQTTManager : MonoSingleton<MQTTManager>
                 // 拆解用户名  和 文件名称  显示到聊天框里   下载文件
                 FileConfig fileConfig = JsonConvert.DeserializeObject<FileConfig>(obj["chatMessage"].ToString());
                 fileConfig.From = obj["from"].ToString();
-                
+
+                Debug.Log(" DGJ ===> FileConfig  " + JsonConvert.SerializeObject(fileConfig));
+
+            
+
+
                 FileList.Instance.AddItem(fileConfig);
                 break;
             case "remark": // 空间标注

+ 9 - 9
Assets/Scripts/RTC/LiveRTCRoomMain.cs

@@ -47,11 +47,11 @@ public class LiveRTCRoomMain : MonoSingleton<LiveRTCRoomMain>,IController
     }
     private void OnInit()
     {
-        videoOpenBtn.onClick.AddListener(()=> { SetVideo(false); });
-        videoCloseBtn.onClick.AddListener(() => { SetVideo(true); });
+        videoOpenBtn.onClick.AddListener(()=> { SetVideo(true); });
+        videoCloseBtn.onClick.AddListener(() => { SetVideo(false); });
 
-        audioOpenBtn.onClick.AddListener(() => { SetAudio(false); });
-        audioCloseBtn.onClick.AddListener(() => { SetAudio(true); });
+        audioOpenBtn.onClick.AddListener(() => { SetAudio(true); });
+        audioCloseBtn.onClick.AddListener(() => { SetAudio(false); });
 
         clearArrowBtn.onClick.AddListener(ClearAllArrow);
         leaveRoomBtn.onClick.AddListener(() => { SetDefaultUI(true); });
@@ -64,16 +64,16 @@ public class LiveRTCRoomMain : MonoSingleton<LiveRTCRoomMain>,IController
     {
 
         GHZRtcManager.Instance.OnMicrophone(state);
-        audioCloseBtn.gameObject.SetActive(!state);
-        audioOpenBtn.gameObject.SetActive(state);
+        audioCloseBtn.gameObject.SetActive(state);
+        audioOpenBtn.gameObject.SetActive(!state);
     }
 
     public void SetVideo(bool state)
     {
        
         GHZRtcManager.Instance.OnWebCam(state);
-        videoCloseBtn.gameObject.SetActive(!state);
-        videoOpenBtn.gameObject.SetActive(state);
+        videoCloseBtn.gameObject.SetActive(state);
+        videoOpenBtn.gameObject.SetActive(!state);
     }
 
     public void ClearAllArrow()
@@ -132,7 +132,7 @@ public class LiveRTCRoomMain : MonoSingleton<LiveRTCRoomMain>,IController
         }
         if (PopCall.Instance)
         {
-            PopCall.Instance.gameObject.SetActive(false);
+          //  PopCall.Instance.gameObject.SetActive(false);
         }
         if (ShowRoom.Instance)
         {

+ 1 - 0
Assets/Scripts/RTC/RTCRoomManager.cs

@@ -239,6 +239,7 @@ public class RTCRoomManager : MonoSingleton<RTCRoomManager>, IController
 
         if(rtcState != RTCEnum.OFF&& ScenesManager.Instance.getWindow() != ScenesManager.SceneType.ShowRTC)
         {
+            Debug.Log(" GETWindow Scenes   " + ScenesManager.Instance.getWindow());
             // 退出房间
             LeaveChannel();
         }