Browse Source

修改System设置 扫图重定位后的音视频重置问题

DGJQN 2 years ago
parent
commit
4ef4263f03

+ 10 - 1
Assets/GHZAlter/Agora/AgoraVideoAudioManager.cs

@@ -169,7 +169,8 @@ public class AgoraVideoAudioManager : SingletonMono<AgoraVideoAudioManager>
             RtcEngine.SwitchCamera();
             isSwitchCamera = !isSwitchCamera;
         }
-      
+
+        StartCoroutine(InitVideoAndAduio(1f));
 
         if (_channelName== "0003003")
         {
@@ -178,6 +179,14 @@ public class AgoraVideoAudioManager : SingletonMono<AgoraVideoAudioManager>
         }
     }
 
+    private IEnumerator InitVideoAndAduio(float times)
+    {
+        yield return new WaitForSeconds(times);
+
+        EnableLocalVideo(CustomInfo.isSendVideo);
+        EnableLoacalAudio(CustomInfo.isSendAudio);
+    }
+
     public void OpenAgoraAudio()
     {
         Debug.Log(" 打开   OpenAgoraAudio ");

+ 9 - 0
Assets/GHZAlter/SystemDatas.cs

@@ -0,0 +1,9 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class SystemDatas 
+{
+    public int Camera { get; set; }
+    public int Mic { get; set; }
+}

+ 11 - 0
Assets/GHZAlter/SystemDatas.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c8dbb8e0f3bf90346b68704df5d93d5f
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Assets/StreamingAssets/build_info

@@ -1 +1 @@
-Build from SK-20211220VCWK at 2023/4/23 15:57:01
+Build from SK-20211220VCWK at 2023/5/9 14:43:50

+ 2 - 1
Assets/Studio/Common/Scripts/UserInfo.cs

@@ -1,4 +1,4 @@
-using System.Collections;
+using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
@@ -17,6 +17,7 @@ public class UserInfo {
 	//应用uid
 	public static string uid = string.Empty;
 
+	public static SystemDatas systemDatas;
 	/// <summary>
 	/// 判断是否为游客账号
 	/// </summary>

+ 22 - 2
Assets/Studio/_3HomeScene/HomeSceneScripts_new/AboutMeDlg.cs

@@ -1,4 +1,5 @@
-using ShadowStudio.Mgr;
+using Newtonsoft.Json;
+using ShadowStudio.Mgr;
 using Studio.Scripts;
 using Studio.Scripts.HttpMessage;
 using System;
@@ -95,6 +96,11 @@ namespace ShadowStudio.UI
             CommonMethod.mySetting.Camera = isOn;
             CustomInfo.isSendVideo = isOn;
             //Debug.Log(CommonMethod.mySetting.Camera + "Camera" + isOn);
+
+            SystemDatas data = new SystemDatas();
+            data.Camera = CustomInfo.isSendVideo ? 1 : 0;
+            data.Mic = CustomInfo.isSendAudio ? 1 : 0;
+            SaveSystemData(data);
         }
 
         private void ClickMicToggle(bool isOn)
@@ -102,9 +108,23 @@ namespace ShadowStudio.UI
             CommonMethod.mySetting.Mic = isOn;
             CustomInfo.isSendAudio = isOn;
             //Debug.Log(CommonMethod.mySetting.Mic + "Mic" + isOn);
+
+            SystemDatas data = new SystemDatas();
+            data.Camera = CustomInfo.isSendVideo ? 1 : 0;
+            data.Mic = CustomInfo.isSendAudio ? 1 : 0;
+            SaveSystemData(data);
+        }
+
+        private void SaveSystemData(SystemDatas data)
+        {
+            UserInfo.systemDatas = data;
+            string saveData = JsonConvert.SerializeObject(data);
+            Debug.Log(saveData);
+            PlayerPrefs.SetString(UserInfo.Account + "_SystemSetting", saveData);
         }
+    
 
-        private void OnToggle(bool isOn, XRToggle toggle)
+    private void OnToggle(bool isOn, XRToggle toggle)
         {
             if (isOn)
             {

+ 23 - 1
Assets/Studio/_3HomeScene/HomeSceneScripts_new/CreateSearchRoomDlg.cs

@@ -1,4 +1,5 @@
-using LitJson;
+using LitJson;
+using Newtonsoft.Json;
 using SC.XR.Unity;
 using ShadowStudio.Mgr;
 using ShadowStudio.Model;
@@ -58,6 +59,27 @@ namespace ShadowStudio.UI
                     }
                 }
             }
+            SettingSystem();
+        }
+
+        public void SettingSystem()
+        {
+
+            if (PlayerPrefs.HasKey(UserInfo.Account + "_SystemSetting"))
+            {
+                string SystemData = PlayerPrefs.GetString(UserInfo.Account + "_SystemSetting");
+                SystemDatas data = JsonConvert.DeserializeObject<SystemDatas>(SystemData);
+                CustomInfo.isSendVideo = data.Camera == 1 ? true : false;
+                CustomInfo.isSendAudio = data.Mic == 1 ? true : false;
+
+                UserInfo.systemDatas = data;
+            }
+            else
+            {
+                CustomInfo.isSendVideo = true;
+                CustomInfo.isSendAudio = true;
+            }
+
         }
 
         private void SearchRoomChanged(string searchroom)

+ 1 - 0
Assets/Studio/_4ShowScene/BoardFunctionModule/Scripts/TransferCell.cs

@@ -447,6 +447,7 @@ namespace ShadowStudio.Tool
             {
                 dragTimer = TimerMgr.Instance.CreateTimer(() => { IsDragEnable = false; }, autoDisDrag);
             }
+            if(modelSync!=null)
             modelSync.isSnatch(false);
            
         }

+ 10 - 6
Assets/Studio/_4ShowScene/UserListFunctionModule/Scripts/ItemUserView.cs

@@ -1,4 +1,4 @@
-using ShadowStudio.Mgr;
+using ShadowStudio.Mgr;
 using ShadowStudio.Model;
 using ShadowStudio.UI;
 using System;
@@ -246,7 +246,7 @@ public class ItemUserView : MonoBehaviour
         else
         {
             
-            if (cPeer != null&&cPeer.isAudio&& cPeer.cIdA!=""&&cPeer.isCloseAudio)
+            if (cPeer != null&&cPeer.isAudio&&cPeer.isCloseAudio)
             {
                 pauseCerAudio.SetActive(true); 
                 pauseAudio.SetActive(false);
@@ -306,11 +306,12 @@ public class ItemUserView : MonoBehaviour
                 closeAudioEffect();
                 StudioRtc.Instance.me.cIdA = "";
             }
+            closeAudioEffect();
         }
         else
         {
             
-            if (cPeer != null && cPeer.isAudio && cPeer.cIdA != "" && !cPeer.isCloseAudio)
+            if (cPeer != null && cPeer.isAudio  && !cPeer.isCloseAudio)
             {
                 pauseCerAudio.SetActive(false);
                 pauseAudio.SetActive(true);
@@ -318,8 +319,9 @@ public class ItemUserView : MonoBehaviour
                 cPeer.isCloseAudio = true;
                 AgoraVideoAudioManager.Instance.MuteRemoteAudioStream(_peer.PeerId, true);
 
-              //  cPeer.setInfo("audio", cPeer.cIdA, false);
+                //  cPeer.setInfo("audio", cPeer.cIdA, false);
             }
+          
         }
     }
     public GameObject pauseCerAudio;
@@ -343,7 +345,7 @@ public class ItemUserView : MonoBehaviour
         }
         else
         {
-            if (cPeer != null && cPeer.isVideo && cPeer.cIdV != "" && cPeer.isCloseVideo)
+            if (cPeer != null && cPeer.isVideo && cPeer.isCloseVideo)
             {
                 pauseCerVideo.SetActive(true);
                 pauseVideo.SetActive(false);
@@ -367,6 +369,8 @@ public class ItemUserView : MonoBehaviour
                 closeVideoEffect();
                 StudioRtc.Instance.me.cIdV = "";
             }
+
+            closeVideoEffect();
         }
         else
         {
@@ -378,7 +382,7 @@ public class ItemUserView : MonoBehaviour
                 cPeer.isCloseVideo = true;
                 // cPeer.setInfo("audio", cPeer.cIdA,true);
             }
-
+            
         }
     }
 

+ 5 - 5
ProjectSettings/EditorBuildSettings.asset

@@ -5,19 +5,19 @@ EditorBuildSettings:
   m_ObjectHideFlags: 0
   serializedVersion: 2
   m_Scenes:
-  - enabled: 0
+  - enabled: 1
     path: Assets/Studio/Scenes/Logo/Logo.unity
     guid: c37c1babc7b6f744cb6546625fe87f80
-  - enabled: 0
+  - enabled: 1
     path: Assets/Studio/Scenes/Login/Login.unity
     guid: ed2d84032771c5c4d8b8b3e0a25484f3
-  - enabled: 0
+  - enabled: 1
     path: Assets/Studio/Scenes/Home/Home.unity
     guid: b57022d6f43f69046a88c4312c0e0a67
-  - enabled: 0
+  - enabled: 1
     path: Assets/Studio/Scenes/Show/Show.unity
     guid: ae34a02a0fc4f6e41a4bdf3e80ea1c56
-  - enabled: 1
+  - enabled: 0
     path: Assets/GHZAlter/LANScene.unity
     guid: 0b4e6f654a95ee64d9e2b4c8a349108b
   m_configObjects: {}