Merge remote-tracking branch 'origin/main' into main_ZYT

# Conflicts:
#	Assets/StreamingAssets/build_info
This commit is contained in:
ZYT
2025-10-21 11:01:45 +08:00
12 changed files with 136 additions and 16 deletions

View File

@@ -7,6 +7,11 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<data android:scheme="picoapp" android:host="launch" android:path="/com.pineappletech.futuremen.gongsi1lou"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true"/>
</activity>
</application>

View File

@@ -1,6 +1,11 @@
fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Unity.VisualScripting.Generated/VisualScripting.Core/link.xml.meta
guid: 8877eee7fdd9bdc40a1eee419cdea92b
TextScriptImporter:
========
guid: 981b7aa1cb4befb4b8cb3d93a59c3d96
DefaultImporter:
>>>>>>>> origin/main_ZYT:Assets/Resources/银河守护者-扬州邗江区探索中心外带.xlsm.meta
externalObjects: {}
userData:
assetBundleName:

View File

@@ -0,0 +1,40 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;
using System.IO;
using System.Text.RegularExpressions;
public class BuildPostProcessor : IPreprocessBuildWithReport
{
public int callbackOrder => 0;
public void OnPreprocessBuild(BuildReport report)
{
if (report.summary.platform == BuildTarget.Android)
{
UpdateAndroidManifest();
}
}
private void UpdateAndroidManifest()
{
string manifestPath = Path.Combine(Application.dataPath, "Plugins/Android/AndroidManifest.xml");
if (File.Exists(manifestPath))
{
string manifestContent = File.ReadAllText(manifestPath);
string packageName = PlayerSettings.applicationIdentifier;
// 使用正则表达式匹配并替换 android:path 的值
string updatedContent = Regex.Replace(manifestContent,
@"android:path=""[^""]*""",
$"android:path=\"/{packageName}\"");
File.WriteAllText(manifestPath, updatedContent);
Debug.Log($"Updated AndroidManifest.xml with package name: {packageName}");
}
}
}
#endif

View File

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

View File

@@ -35,7 +35,7 @@ public class MRInput : MonoBehaviour
#if !UNITY_EDITOR && UNITY_ANDROID && (PICO || VIVE)
PXR_Input.SendHapticImpulse(VibrateType.RightController, amplitude, duration, frequency);
TrueGearEffectManager.Ins.OnHit(true,4,true);
//TrueGearEffectManager.Ins.OnHit(true,4,true);
#endif
}

View File

@@ -155,9 +155,10 @@ public class GameManager : MonoBehaviour
#if !UNITY_EDITOR
PXR_Enterprise.InitEnterpriseService();
PXR_Enterprise.BindEnterpriseService();
TrueGearEffectManager.Ins.StartRequestTrueGear();
TrueGearEffectManager.Ins.StartRequestTrueGear();
#endif
CoroutineTaskManager.Instance.WaitSecondTodo(ShowPlayerUI, 1.5f);
}
/// <summary>

View File

@@ -18,7 +18,7 @@ public class TrueGearEffectManager : MonoBehaviour
GetConnectIndex = 20;
AddHitPart();
#if !UNITY_EDITOR
TrueGearEffectManager.Ins.StartRequestTrueGear();
//TrueGearEffectManager.Ins.StartRequestTrueGear();
#endif
}
@@ -111,17 +111,27 @@ public class TrueGearEffectManager : MonoBehaviour
if (!res)
return;
List<DeviceData> res1 = androidConnector.GetScanedDevices();
Debug.Log(res1.ToString());
foreach (var item in res1)
List<DeviceData> devices = androidConnector.GetScanedDevices();
if (devices == null || devices.Count == 0)
{
Debug.Log("未扫描到任何设备");
return;
}
foreach (var device in devices)
{
bool connected = androidConnector.ConnectToDevice(device.address);
if (connected)
{
androidConnector.ConnectToDevice(item.address);
Debug.Log(string.Format("Device Connect: {0}, {1}", item.name, item.address));
Debug.Log($"成功连接设备: {device.name} - {device.address}");
isGetConnect = true;
ChangeElectricalLevel();
return;
}
else
{
Debug.LogWarning($"设备被占用或连接失败: {device.name} - {device.address}");
}
}
Debug.Log("No device found");
}
@@ -197,7 +207,7 @@ public class TrueGearEffectManager : MonoBehaviour
}}
]
}}";
SendPlayEffectByContent(json);
}
@@ -208,8 +218,34 @@ public class TrueGearEffectManager : MonoBehaviour
Debug.Log("OnTestClick" + res);
if (!res)
return;
androidConnector.SendPlayEffectByContent(jsonStr);
try
{
androidConnector.SendPlayEffectByContent(jsonStr);
}
catch (Exception ex)
{
Debug.LogError("调用 TrueGear 崩溃保护: " + ex);
ReconnectTrueGear();
}
}
// 当检测蓝牙断开或异常时调用
void ReconnectTrueGear()
{
try
{
var conn = TruegearAndroidConnector.Instance;
conn.InitShellJavaObject();
conn.RequestPermission();
conn.StartScan();
}
catch (Exception e)
{
Debug.LogError("重新初始化 TrueGear 失败:" + e);
}
}
public List<string> hitParts=new List<string>();
public void AddHitPart()
@@ -222,7 +258,28 @@ public class TrueGearEffectManager : MonoBehaviour
}
public void OnHit(bool isUp, int index,bool isArm)
{
//ChangeElectricalLevel();
TruegearAndroidConnector androidConnector = TruegearAndroidConnector.Instance;
if (androidConnector == null)
{
Debug.LogWarning("TrueGear connector 为空,跳过调用");
isGetConnect = false;
return;
}
if (!androidConnector.IsAvailable())
{
Debug.LogWarning("TrueGear 蓝牙不可用或断开,跳过调用");
isGetConnect = false;
return;
}
if (!isGetConnect)
{
androidConnector.InitShellJavaObject();
androidConnector.RequestPermission();
StartCoroutine(TrueGearAndroidConnector());
return;
}
List<int> motorIDs = new List<int>();
string hitPart= hitParts[index];
switch (hitPart)
@@ -241,6 +298,7 @@ public class TrueGearEffectManager : MonoBehaviour
default:
motorIDs.Add(0); break;
}
PlayVibrationEffect(
effectName: $"Hit_{hitPart}",
motorIndex: motorIDs,

View File

@@ -1 +1 @@
Build from ZTT at 2025/10/21 10:47:07
Build from CHINAMI-UKDLSK3 at 2025/10/17 19:33:53

View File

@@ -115,7 +115,7 @@ Material:
- _BaseColor: {r: 0.9921568, g: 0.93333334, b: 0.24705878, a: 0.47058824}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0.9921568, g: 0.93333334, b: 0.24705875, a: 0.47058824}
- _Color: {r: 0.9921568, g: 0.93333334, b: 0.24705878, a: 0.47058824}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 1, g: 1, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}

View File

@@ -114,7 +114,7 @@ Material:
- _BaseColor: {r: 0.99215686, g: 0.93333334, b: 0.24705882, a: 0.47058824}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0.9921568, g: 0.93333334, b: 0.24705878, a: 0.47058824}
- _Color: {r: 0.99215686, g: 0.93333334, b: 0.24705882, a: 0.47058824}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 1, g: 0.7922921, b: 0.5294118, a: 0.5}

View File

@@ -114,7 +114,7 @@ Material:
- _BaseColor: {r: 0.99215686, g: 0.93333334, b: 0.24705882, a: 0.47058824}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0.9921568, g: 0.93333334, b: 0.24705878, a: 0.47058824}
- _Color: {r: 0.99215686, g: 0.93333334, b: 0.24705882, a: 0.47058824}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 1, g: 0.7922921, b: 0.5294118, a: 0.5}

View File

@@ -108,7 +108,7 @@ GraphicsSettings:
m_FogKeepExp: 1
m_FogKeepExp2: 1
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 1
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 1
m_DefaultRenderingLayerMask: 1
m_LogWhenShaderIsCompiled: 0