|
@@ -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);
|