先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
59 lines
2.7 KiB
C#
59 lines
2.7 KiB
C#
namespace UnityNative.Sharing
|
|
{
|
|
public interface IUnityNativeSharing
|
|
{
|
|
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");
|
|
}
|
|
|
|
|
|
public class UnityNativeSharing : IUnityNativeSharing
|
|
{
|
|
private readonly IUnityNativeSharingAdapter adapter;
|
|
|
|
/// <summary>
|
|
/// Creates a UnityNativeSharing object with the correct platform setup. Use this if not being used with an IoC container
|
|
/// </summary>
|
|
/// <returns>Interface for the detected platform</returns>
|
|
public static IUnityNativeSharing Create()
|
|
{
|
|
#if UNITY_ANDROID
|
|
return new UnityNativeSharing(new AndroidUnityNativeSharingAdapter());
|
|
#elif UNITY_IOS
|
|
return new UnityNativeSharing(new IosUnityNativeSharingAdapter());
|
|
#else
|
|
return new UnityNativeSharing(new NullUnityNativeSharingAdapter());
|
|
#endif
|
|
}
|
|
|
|
public UnityNativeSharing(IUnityNativeSharingAdapter adapter)
|
|
{
|
|
this.adapter = adapter;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Shares a screenshot with text
|
|
/// </summary>
|
|
/// <param name="shareText">Text to share</param>
|
|
/// <param name="filePath">The path to the attached file</param>
|
|
/// <param name="showShareDialogBox">Should the share dialog be opened (Android only)</param>
|
|
/// <param name="shareDialogBoxText">The text to show on the share dialog (Android only)</param>
|
|
/// <param name="mimeType">Mime type of the file being shared (Android only)</param>
|
|
public void ShareScreenshotAndText(string shareText, string filePath, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With", string mimeType = "image/*")
|
|
{
|
|
adapter.ShareScreenshotAndText(shareText, filePath, showShareDialogBox, shareDialogBoxText, mimeType);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Shares text
|
|
/// </summary>
|
|
/// <param name="shareText">Text to share</param>
|
|
/// <param name="showShareDialogBox">Should the share dialog be opened (Android only)</param>
|
|
/// <param name="shareDialogBoxText">The text to show on the share dialog (Android only)</param>
|
|
public void ShareText(string shareText, bool showShareDialogBox = true, string shareDialogBoxText = "Select App To Share With")
|
|
{
|
|
adapter.ShareText(shareText, showShareDialogBox, shareDialogBoxText);
|
|
}
|
|
}
|
|
}
|