Структуры

This commit is contained in:
ThomasCharester committed 2026-02-26 13:19:15 +03:00
1 parent 06b08f1efe
commit 1b578067f3
82 files changed
+2692 -944

No files matched your search

@@ -0,0 +1,52 @@
#if UNITY_EDITOR || UNITY_ANDROID
using System;
using UnityEngine;
namespace NativeFilePickerNamespace
{
public class FPCallbackHelper : MonoBehaviour
{
private bool autoDestroyWithCallback;
private Action mainThreadAction = null;
public static FPCallbackHelper Create( bool autoDestroyWithCallback )
{
FPCallbackHelper result = new GameObject( "FPCallbackHelper" ).AddComponent<FPCallbackHelper>();
result.autoDestroyWithCallback = autoDestroyWithCallback;
DontDestroyOnLoad( result.gameObject );
return result;
}
public void CallOnMainThread( Action function )
{
lock( this )
{
mainThreadAction += function;
}
}
private void Update()
{
if( mainThreadAction != null )
{
try
{
Action temp;
lock( this )
{
temp = mainThreadAction;
mainThreadAction = null;
}
temp();
}
finally
{
if( autoDestroyWithCallback )
Destroy( gameObject );
}
}
}
}
}
#endif
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 41423473566db0b4ebd62882996f08bc
timeCreated: 1596973837
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 173238
packageName: Native File Picker for Android & iOS
packageVersion: 1.4.1
assetPath: Assets/Plugins/NativeFilePicker/Android/FPCallbackHelper.cs
uploadId: 757770
@@ -0,0 +1,24 @@
#if UNITY_EDITOR || UNITY_ANDROID
using UnityEngine;
namespace NativeFilePickerNamespace
{
public class FPPermissionCallbackAndroid : AndroidJavaProxy
{
private readonly NativeFilePicker.PermissionCallback callback;
private readonly FPCallbackHelper callbackHelper;
public FPPermissionCallbackAndroid( NativeFilePicker.PermissionCallback callback ) : base( "com.yasirkula.unity.NativeFilePickerPermissionReceiver" )
{
this.callback = callback;
callbackHelper = FPCallbackHelper.Create( true );
}
[UnityEngine.Scripting.Preserve]
public void OnPermissionResult( int result )
{
callbackHelper.CallOnMainThread( () => callback( (NativeFilePicker.Permission) result ) );
}
}
}
#endif
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 5f8c2de0178a90140b030975551436a5
timeCreated: 1596973837
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 173238
packageName: Native File Picker for Android & iOS
packageVersion: 1.4.1
assetPath: Assets/Plugins/NativeFilePicker/Android/FPPermissionCallbackAndroid.cs
uploadId: 757770
@@ -0,0 +1,71 @@
#if UNITY_EDITOR || UNITY_ANDROID
using UnityEngine;
namespace NativeFilePickerNamespace
{
public class FPResultCallbackAndroid : AndroidJavaProxy
{
private readonly NativeFilePicker.FilePickedCallback pickCallback;
private readonly NativeFilePicker.MultipleFilesPickedCallback pickCallbackMultiple;
private readonly NativeFilePicker.FilesExportedCallback exportCallback;
private readonly FPCallbackHelper callbackHelper;
public FPResultCallbackAndroid( NativeFilePicker.FilePickedCallback pickCallback, NativeFilePicker.MultipleFilesPickedCallback pickCallbackMultiple, NativeFilePicker.FilesExportedCallback exportCallback ) : base( "com.yasirkula.unity.NativeFilePickerResultReceiver" )
{
this.pickCallback = pickCallback;
this.pickCallbackMultiple = pickCallbackMultiple;
this.exportCallback = exportCallback;
callbackHelper = FPCallbackHelper.Create( true );
}
[UnityEngine.Scripting.Preserve]
public void OnFilePicked( string path )
{
callbackHelper.CallOnMainThread( () => pickCallback( !string.IsNullOrEmpty( path ) ? path : null ) );
}
[UnityEngine.Scripting.Preserve]
public void OnMultipleFilesPicked( string paths )
{
string[] result = null;
if( !string.IsNullOrEmpty( paths ) )
{
string[] pathsSplit = paths.Split( '>' );
int validPathCount = 0;
for( int i = 0; i < pathsSplit.Length; i++ )
{
if( !string.IsNullOrEmpty( pathsSplit[i] ) )
validPathCount++;
}
if( validPathCount == 0 )
pathsSplit = new string[0];
else if( validPathCount != pathsSplit.Length )
{
string[] validPaths = new string[validPathCount];
for( int i = 0, j = 0; i < pathsSplit.Length; i++ )
{
if( !string.IsNullOrEmpty( pathsSplit[i] ) )
validPaths[j++] = pathsSplit[i];
}
pathsSplit = validPaths;
}
result = pathsSplit;
}
callbackHelper.CallOnMainThread( () => pickCallbackMultiple( ( result != null && result.Length > 0 ) ? result : null ) );
}
[UnityEngine.Scripting.Preserve]
public void OnFilesExported( bool result )
{
callbackHelper.CallOnMainThread( () => exportCallback( result ) );
}
}
}
#endif
@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: f43d316f7eb1cdf4abcf327a1fbc025b
timeCreated: 1596973837
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 173238
packageName: Native File Picker for Android & iOS
packageVersion: 1.4.1
assetPath: Assets/Plugins/NativeFilePicker/Android/FPResultCallbackAndroid.cs
uploadId: 757770
@@ -0,0 +1,40 @@
fileFormatVersion: 2
guid: 3ed817dcf924721488f9672995f51cb3
timeCreated: 1607368610
licenseType: Store
PluginImporter:
serializedVersion: 2
iconMap: {}
executionOrder: {}
isPreloaded: 0
isOverridable: 0
platformData:
data:
first:
Android: Android
second:
enabled: 1
settings: {}
data:
first:
Any:
second:
enabled: 0
settings: {}
data:
first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 173238
packageName: Native File Picker for Android & iOS
packageVersion: 1.4.1
assetPath: Assets/Plugins/NativeFilePicker/Android/NativeFilePicker.aar
uploadId: 757770