Ver código fonte

优化的代码忘了提交

wartheking 19 horas atrás
pai
commit
e0547388b9

+ 75 - 10
Assets/OpenByUrl.cs

@@ -1,11 +1,13 @@
+using HorizonBasedAmbientOcclusion;
 using System;
 using System.Runtime.InteropServices;
 using UnityEngine;
+using UnityEngine.Rendering.PostProcessing;
 
 
 public class OpenByUrl : MonoBehaviour
 {
-    
+
     [DllImport("__Internal")]
     private static extern string StringReturnValueFunction();
 
@@ -18,6 +20,12 @@ public class OpenByUrl : MonoBehaviour
 
     public PageIndex defaultPage;
 
+    public GameObject reflectProbe;
+    public HBAO aoComponent;
+    public PostProcessLayer postProcessComponent;
+    public PostProcessVolume postProcessVolume;
+
+
     private void Awake()
     {
         panel_1 = this.transform.GetChild(0).gameObject;
@@ -30,37 +38,94 @@ public class OpenByUrl : MonoBehaviour
     }
 
 
-   
+
 
     void SelectPage()
     {
-        UrlMsg = "null";
+        UrlMsg = "?panel=1&quality=low";
         try
         {
             UrlMsg = StringReturnValueFunction();
-
         }
         catch (System.Exception e)
         {
-            UrlMsg = "[catch]"+e.Message;
+            UrlMsg = "[catch]" + e.Message;
             Debug.Log("获取URL参数错误!!!");
         }
-        switch (UrlMsg)
+
+        string panelValue = "";
+        string qualityValue = "";
+
+        // 解析URL参数
+        if (UrlMsg.StartsWith("?"))
+        {
+            string[] paramPairs = UrlMsg.Substring(1).Split('&');
+            foreach (string pair in paramPairs)
+            {
+                string[] kv = pair.Split('=');
+                if (kv.Length == 2)
+                {
+                    if (kv[0] == "panel")
+                        panelValue = kv[1];
+                    else if (kv[0] == "quality")
+                        qualityValue = kv[1];
+                }
+            }
+        }
+
+        // 输出qualityValue(用于调试或设置画质)
+        if (!string.IsNullOrEmpty(qualityValue))
+        {
+            Debug.Log("Quality 参数为: " + qualityValue);
+            // 你可以在这里根据qualityValue设置游戏画质
+            // 例如:
+            if (qualityValue == "high")
+            {
+                QualitySettings.SetQualityLevel(3);
+            }
+            else if (qualityValue == "middle")
+            {
+                QualitySettings.SetQualityLevel(2);
+                reflectProbe.gameObject.SetActive(false);
+                aoComponent.enabled = false;
+                postProcessComponent.enabled = false;
+                postProcessVolume.enabled = false;
+            }
+            else
+            {
+                QualitySettings.SetQualityLevel(1);
+                reflectProbe.gameObject.SetActive(false);
+                aoComponent.enabled = false;
+                postProcessComponent.enabled = false;
+                postProcessVolume.enabled = false;
+            }
+        }
+        else {
+            QualitySettings.SetQualityLevel(1);
+            reflectProbe.gameObject.SetActive(false);
+            aoComponent.enabled = false;
+            postProcessComponent.enabled = false;
+            postProcessVolume.enabled = false;
+        }
+
+        // 根据 panel 参数显示对应页面
+        switch (panelValue)
         {
-            case "?panel=1":
+            case "1":
                 GlobalData.pageIndex = PageIndex.Page1;
                 panel_1.SetActive(true);
                 break;
-            case "?panel=2":
+            case "2":
                 GlobalData.pageIndex = PageIndex.Page2;
                 panel_2.SetActive(true);
                 break;
-            case "?panel=3":
+            case "3":
                 GlobalData.pageIndex = PageIndex.Page3;
                 panel_3.SetActive(true);
                 break;
             default:
-                switch (defaultPage) {
+                switch (defaultPage)
+                {
                     case PageIndex.Page1:
                         GlobalData.pageIndex = PageIndex.Page1;
                         panel_1.SetActive(true);

+ 8 - 2
Assets/Scripts/StaticImportant.cs

@@ -35,6 +35,8 @@ public class StaticImportant : MonoBehaviour
     public bool waitCreatModels = false;
     public string model_ab_Name;
 
+    bool onShow = true;
+
     public ModelAniTool _ModelAni;
 
     private List<GameObject> models = new List<GameObject>();
@@ -76,6 +78,8 @@ public class StaticImportant : MonoBehaviour
 
     public void Show()
     {
+        if (onShow) return;
+        onShow = true;
         for (int i = 0; i < models.Count; i++)
         {
             models[i].SetActive(true);
@@ -85,6 +89,8 @@ public class StaticImportant : MonoBehaviour
 
     public void Hide()
     {
+        if (!onShow) return;
+        onShow = false;
         for (int i = 0; i < models.Count; i++)
         {
             models[i].SetActive(false);
@@ -187,10 +193,10 @@ public class StaticImportant : MonoBehaviour
             birdCamera.rotateYAngle = rotateYAngle;
             birdCamera.Blink();
         }
-        ModelCameraCtrl._Instance.SetCameraPos(birdCamera.target,targetDistance,new Vector2(rotateXAngle,rotateYAngle));
+        ModelCameraCtrl._Instance.SetCameraPos(birdCamera.target, targetDistance, new Vector2(rotateXAngle, rotateYAngle));
     }
 
-    public void SetCameraToCenter(Vector3 centerPos, float distance,Vector2 rota)
+    public void SetCameraToCenter(Vector3 centerPos, float distance, Vector2 rota)
     {
         targetDistance = distance;
         rotateXAngle = rota.x;

+ 2 - 1
Assets/Scripts/StaticLod.cs

@@ -32,6 +32,7 @@ public class StaticLod : MonoBehaviour
             {
                 staticImportants.Add(si);
                 staticImportantsDic.Add(si.gameObject.name, si);
+                si.Hide();
             }
         }
 
@@ -75,7 +76,7 @@ public class StaticLod : MonoBehaviour
         {
             if (interVal < 0.0f)
             {
-                interVal = 0.2f;
+                interVal = 0.8f;
                 for (int i = 0; i < staticImportants.Count; i++)
                 {
                     if (Vector3.Distance(CameraManager.instance.mainCamera.transform.position, staticImportants[i].foucusPos) < 3200)

+ 3 - 6
ProjectSettings/ProjectSettings.asset

@@ -50,7 +50,6 @@ PlayerSettings:
   defaultScreenHeightWeb: 1080
   m_StereoRenderingPath: 0
   m_ActiveColorSpace: 1
-  unsupportedMSAAFallback: 0
   m_MTRendering: 1
   mipStripping: 0
   numberOfMipsStripped: 0
@@ -77,7 +76,6 @@ PlayerSettings:
   androidMinimumWindowWidth: 400
   androidMinimumWindowHeight: 300
   androidFullscreenMode: 1
-  androidAutoRotationBehavior: 1
   defaultIsNativeResolution: 1
   macRetinaSupport: 1
   runInBackground: 1
@@ -130,7 +128,6 @@ PlayerSettings:
   switchNVNOtherPoolsGranularity: 16777216
   switchNVNMaxPublicTextureIDCount: 0
   switchNVNMaxPublicSamplerIDCount: 0
-  switchMaxWorkerMultiple: 8
   stadiaPresentMode: 0
   stadiaTargetFramerate: 0
   vulkanNumSwapchainBuffers: 3
@@ -254,7 +251,6 @@ PlayerSettings:
   useCustomLauncherGradleManifest: 0
   useCustomBaseGradleTemplate: 0
   useCustomGradlePropertiesTemplate: 0
-  useCustomGradleSettingsTemplate: 0
   useCustomProguardFile: 0
   AndroidTargetArchitectures: 1
   AndroidTargetDevices: 0
@@ -275,6 +271,7 @@ PlayerSettings:
     banner: {fileID: 0}
   androidGamepadSupportLevel: 0
   chromeosInputEmulation: 1
+  AndroidMinifyWithR8: 0
   AndroidMinifyRelease: 0
   AndroidMinifyDebug: 0
   AndroidValidateAppBundleSize: 1
@@ -418,7 +415,7 @@ PlayerSettings:
   switchSocketConcurrencyLimit: 14
   switchScreenResolutionBehavior: 2
   switchUseCPUProfiler: 0
-  switchEnableFileSystemTrace: 0
+  switchUseGOLDLinker: 0
   switchLTOSetting: 0
   switchApplicationID: 0x01004b9000490000
   switchNSODependencies: 
@@ -547,6 +544,7 @@ PlayerSettings:
   switchSocketBufferEfficiency: 4
   switchSocketInitializeEnabled: 1
   switchNetworkInterfaceManagerInitializeEnabled: 1
+  switchPlayerConnectionEnabled: 1
   switchUseNewStyleFilepaths: 0
   switchUseLegacyFmodPriorities: 1
   switchUseMicroSleepForYield: 1
@@ -702,7 +700,6 @@ PlayerSettings:
   metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0}
   metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1}
   metroSplashScreenUseBackgroundColor: 0
-  syncCapabilities: 0
   platformCapabilities: {}
   metroTargetDeviceFamilies: {}
   metroFTAName: 

+ 2 - 19
ProjectSettings/QualitySettings.asset

@@ -56,7 +56,7 @@ QualitySettings:
     shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
     shadowmaskMode: 0
     skinWeights: 2
-    textureQuality: 0
+    textureQuality: 1
     anisotropicTextures: 0
     antiAliasing: 0
     softParticles: 0
@@ -228,21 +228,4 @@ QualitySettings:
     resolutionScalingFixedDPIFactor: 1
     customRenderPipeline: {fileID: 0}
     excludedTargetPlatforms: []
-  m_PerPlatformDefaultQuality:
-    Android: 1
-    EmbeddedLinux: 5
-    GameCoreScarlett: 5
-    GameCoreXboxOne: 5
-    LinuxHeadlessSimulation: 5
-    Lumin: 5
-    Nintendo Switch: 5
-    PS4: 5
-    PS5: 5
-    Server: 1
-    Stadia: 5
-    Standalone: 1
-    WebGL: 1
-    Windows Store Apps: 1
-    XboxOne: 5
-    iPhone: 2
-    tvOS: 2
+  m_PerPlatformDefaultQuality: {}