备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#if UNITY_ANDROID
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityNative.Sharing
|
||||
{
|
||||
public class AndroidUnityNativeSharingAdapter : IUnityNativeSharingAdapter
|
||||
{
|
||||
/// <summary>
|
||||
/// Android package name and class
|
||||
/// </summary>
|
||||
private const string AndroidClass = "com.UnityNative.Sharing.UnityNativeSharingAdapter";
|
||||
|
||||
/// <summary>
|
||||
/// Android method name to call to share a screenshot with text
|
||||
/// </summary>
|
||||
private const string ShareScreenshotWithTextMethodName = "ShareScreenshotAndText";
|
||||
|
||||
/// <summary>
|
||||
/// Android method name to call to share text
|
||||
/// </summary>
|
||||
private const string ShareTextMethodName = "ShareText";
|
||||
|
||||
/// <summary>
|
||||
/// UnityNativeSharingAdapter.java
|
||||
/// </summary>
|
||||
private readonly AndroidJavaClass sharingJavaClass;
|
||||
|
||||
public AndroidUnityNativeSharingAdapter()
|
||||
{
|
||||
AndroidJNI.AttachCurrentThread();
|
||||
|
||||
sharingJavaClass = new AndroidJavaClass(AndroidClass);
|
||||
}
|
||||
|
||||
public void ShareScreenshotAndText(string shareText, string filePath, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With", string mimeType = "image/*")
|
||||
{
|
||||
AndroidJNI.AttachCurrentThread();
|
||||
|
||||
sharingJavaClass.CallStatic(ShareScreenshotWithTextMethodName, shareText, filePath, showShareDialogBox, shareDialogBoxText, mimeType);
|
||||
}
|
||||
|
||||
public void ShareText(string shareText, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With")
|
||||
{
|
||||
AndroidJNI.AttachCurrentThread();
|
||||
|
||||
sharingJavaClass.CallStatic(ShareTextMethodName, shareText, showShareDialogBox, shareDialogBoxText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //UNITY_ANDROID
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74b6080c946c47d41b6fbfe5c8daf704
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace UnityNative.Sharing
|
||||
{
|
||||
public interface IUnityNativeSharingAdapter
|
||||
{
|
||||
void ShareScreenshotAndText(string shareText, string filePath, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With", string mimeType = "image/*");
|
||||
void ShareText(string shareText, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa89f20e5e107d8499a45f1275623421
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
#if UNITY_IOS
|
||||
|
||||
namespace UnityNative.Sharing
|
||||
{
|
||||
public class IosUnityNativeSharingAdapter : IUnityNativeSharingAdapter
|
||||
{
|
||||
[System.Runtime.InteropServices.DllImport("__Internal")]
|
||||
private static extern void UnityNative_Sharing_ShareTextAndScreenshot(string shareText, string filePath);
|
||||
|
||||
[System.Runtime.InteropServices.DllImport("__Internal")]
|
||||
private static extern void UnityNative_Sharing_ShareText(string shareText);
|
||||
|
||||
public void ShareScreenshotAndText(string shareText, string filePath, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With", string mimeType = "image/*")
|
||||
{
|
||||
UnityNative_Sharing_ShareTextAndScreenshot(shareText, filePath);
|
||||
}
|
||||
|
||||
public void ShareText(string shareText, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With")
|
||||
{
|
||||
UnityNative_Sharing_ShareText(shareText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //UNITY_IOS
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb75e5e4a938db34aa68fa9d4e41cd01
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace UnityNative.Sharing
|
||||
{
|
||||
public class NullUnityNativeSharingAdapter : IUnityNativeSharingAdapter
|
||||
{
|
||||
public void ShareScreenshotAndText(string shareText, string filePath, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With", string mimeType = "image/*")
|
||||
{
|
||||
}
|
||||
|
||||
public void ShareText(string shareText, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With")
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbc8dd1d45b79994bb11a939cb6fc8d5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user