Level save + load
This commit is contained in:
31
Assets/Plugins/SimpleFileBrowser/Android/FBCallbackHelper.cs
Normal file
31
Assets/Plugins/SimpleFileBrowser/Android/FBCallbackHelper.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
#if UNITY_EDITOR || UNITY_ANDROID
|
||||
using UnityEngine;
|
||||
|
||||
namespace SimpleFileBrowser
|
||||
{
|
||||
public class FBCallbackHelper : MonoBehaviour
|
||||
{
|
||||
private System.Action mainThreadAction = null;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
DontDestroyOnLoad( gameObject );
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if( mainThreadAction != null )
|
||||
{
|
||||
System.Action temp = mainThreadAction;
|
||||
mainThreadAction = null;
|
||||
temp();
|
||||
}
|
||||
}
|
||||
|
||||
public void CallOnMainThread( System.Action function )
|
||||
{
|
||||
mainThreadAction = function;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 997bfc59716c24c41ad03bcbd7f8ef0a
|
||||
timeCreated: 1570918076
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
#if UNITY_EDITOR || UNITY_ANDROID
|
||||
using UnityEngine;
|
||||
|
||||
namespace SimpleFileBrowser
|
||||
{
|
||||
public class FBDirectoryReceiveCallbackAndroid : AndroidJavaProxy
|
||||
{
|
||||
private readonly FileBrowser.AndroidSAFDirectoryPickCallback callback;
|
||||
private readonly FBCallbackHelper callbackHelper;
|
||||
|
||||
public FBDirectoryReceiveCallbackAndroid( FileBrowser.AndroidSAFDirectoryPickCallback callback ) : base( "com.yasirkula.unity.FileBrowserDirectoryReceiver" )
|
||||
{
|
||||
this.callback = callback;
|
||||
callbackHelper = new GameObject( "FBCallbackHelper" ).AddComponent<FBCallbackHelper>();
|
||||
}
|
||||
|
||||
public void OnDirectoryPicked( string rawUri, string name )
|
||||
{
|
||||
callbackHelper.CallOnMainThread( () => DirectoryPickedCallback( rawUri, name ) );
|
||||
}
|
||||
|
||||
private void DirectoryPickedCallback( string rawUri, string name )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( callback != null )
|
||||
callback( rawUri, name );
|
||||
}
|
||||
finally
|
||||
{
|
||||
Object.Destroy( callbackHelper.gameObject );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8dec4dc5be16ca84e9c147627361671d
|
||||
timeCreated: 1520199471
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
#if UNITY_EDITOR || UNITY_ANDROID
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SimpleFileBrowser
|
||||
{
|
||||
public class FBPermissionCallbackAndroid : AndroidJavaProxy
|
||||
{
|
||||
private object threadLock;
|
||||
public int Result { get; private set; }
|
||||
|
||||
public FBPermissionCallbackAndroid( object threadLock ) : base( "com.yasirkula.unity.FileBrowserPermissionReceiver" )
|
||||
{
|
||||
Result = -1;
|
||||
this.threadLock = threadLock;
|
||||
}
|
||||
|
||||
public void OnPermissionResult( int result )
|
||||
{
|
||||
Result = result;
|
||||
|
||||
lock( threadLock )
|
||||
{
|
||||
Monitor.Pulse( threadLock );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cd91db0ba676ef47af67e3597037d1a
|
||||
timeCreated: 1520199471
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Plugins/SimpleFileBrowser/Android/SimpleFileBrowser.aar
Normal file
BIN
Assets/Plugins/SimpleFileBrowser/Android/SimpleFileBrowser.aar
Normal file
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cae0a78f915b13748ba09fd56bafb4c8
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user