备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 084dd17d6626deb42ae2b894f881f504
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

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

View File

@@ -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");
}
}

View File

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

View File

@@ -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

View File

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

View File

@@ -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")
{
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a4a1554b821e7724b939dc8c98e413dc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 5616ab6ca15979148a18d8b4dc1d8a87
folderAsset: yes
timeCreated: 1527520209
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: ce6a3ea3bbf305540849700a5ac163a2
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
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:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3c9112dc7755044df9118288f2c43f24
folderAsset: yes
timeCreated: 1437497813
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
//
// UnityNative_Sharing.h
//
// Created by Nicholas Sheehan on 01/06/2018.
//
#import "UnityAppController.h"
extern UIViewController* UnityGetGLViewController();
#ifdef __cplusplus
extern "C" {
#endif
void UnityNative_Sharing_ShareTextAndScreenshot(const char* shareText, const char* sharePath);
void UnityNative_Sharing_ShareText(const char* shareText);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,113 @@
fileFormatVersion: 2
guid: 7bac6b837f4104b0983468843a0fbe70
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
CompileFlags:
FrameworkDependencies:
- first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,66 @@
//
// UnityNative_Sharing.mm
//
// Created by Nicholas Sheehan on 01/06/2018.
//
#import "UnityNative_Sharing.h"
//
// Shares Text
//
void UnityNative_Sharing_ShareText(const char* shareText)
{
UnityNative_Sharing_ShareTextAndScreenshot(shareText, "");
}
//
// Shares Screenshot and Text
//
void UnityNative_Sharing_ShareTextAndScreenshot(const char* shareText, const char* imagePath)
{
NSString *textToShare = [NSString stringWithUTF8String:shareText];
NSString *pathToImage = [NSString stringWithUTF8String:imagePath];
NSMutableArray *items = [NSMutableArray new];
//Check to see if string is empty or null
if(textToShare != NULL && textToShare.length > 0) [items addObject:textToShare];
//Check to see if string is empty or null
if(pathToImage != NULL && pathToImage.length > 0)
{
NSFileManager *fileMgr = [NSFileManager defaultManager];
//Check to see if the file exists
if([fileMgr fileExistsAtPath:pathToImage])
{
NSURL *formattedURL = [NSURL fileURLWithPath:pathToImage];
[items addObject:formattedURL];
}
//File not found
else
{
NSString *message = [NSString stringWithFormat:@"Cannot find file %@", pathToImage];
NSLog(@"%s", message.UTF8String);
}
}
UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:Nil];
[activity setValue:@"" forKey:@"subject"];
UIViewController *rootViewController = UnityGetGLViewController();
//iPhone share view
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
[rootViewController presentViewController:activity animated:YES completion:nil];
}
//iPad share view
else
{
//custom area to show the share popup
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activity];
[popup presentPopoverFromRect:CGRectMake(rootViewController.view.frame.size.width/2, rootViewController.view.frame.size.height/4, 0, 0)inView:rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}

View File

@@ -0,0 +1,107 @@
fileFormatVersion: 2
guid: 5bb44be1cc44549bd953cf3e3e23d1f4
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
Exclude iOS: 0
Exclude tvOS: 1
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
CompileFlags:
FrameworkDependencies:
- first:
tvOS: tvOS
second:
enabled: 0
settings:
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,103 @@
<h1 align="center">🖼️📷 Unity-Native-Sharing 📷🖼️</h1>
Unity-Native-Sharing is a plugin to open native sharing dialogs on iOS and Android.
<h3 align="center">📱 Social 📱</h3>
![GitHub](https://img.shields.io/github/followers/NicholasSheehan?label=Follow%20on%20GitHub&style=social) ![Twitter](https://img.shields.io/twitter/follow/NSheehanDev?label=Follow%20on%20Twitter)
<h3 align="center">👊 Support 👊</h3>
All of these projects are made during my free time, with more being added over time. If you'd like to support me, you can do it either by [sponsoring me on GitHub](https://github.com/users/NicholasSheehan/sponsorship) or by donating via PayPal
[![](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/NicholasSheehan)
<h3 align="center">📝 Changelog 📝</h3>
[What's New? Check the CHANGELOG](CHANGELOG.md)
Watch this repository to be notified of new releases! ![](https://img.shields.io/github/watchers/NicholasSheehan/Unity-Native-Sharing?style=social)
<h3 align="center">🤝 Contribution 🤝</h3>
For contributing please read [CONTRIBUTING.md](CONTRIBUTING.md)
Don't worry about getting it 100% right, I can tidy it up as I review
<h3 align="center">🖥️ System Requirements 🖥️</h3>
Unity 2018.3.14f1 or later. Older versions may work, feel free to test!
<h3 align="center">🤔 Examples 🤔</h3>
Examples can be found at [Unity-Native-Example-Project](https://github.com/NicholasSheehan/Unity-Native-Example-Project)
<h1 align="center">🛠️ Installation 🛠️</h1>
This was built and tested in Unity 2018.4 LTS, but should still work down to Unity 2018.2
<h2 align="center">Unity 2019.3 or later (Using Unity Package Manager)</h2>
![AddPackageFromGitURL](Images~/AddPackageFromGitURL.PNG)
`https://github.com/NicholasSheehan/Unity-Native-Sharing.git#v1.0.7`
<h2 align="center">Unity 2018.3 or later (Using Unity Package Manager)</h2>
Add this to the projects `manifest.json`
```
"com.unitynative.sharing" : "https://github.com/NicholasSheehan/Unity-Native-Sharing.git"
```
To update the package, change suffix `#{version}` to the target version.
* e.g. `"com.unitynative.sharing" : "https://github.com/NicholasSheehan/Unity-Native-Sharing.git#v1.0.7"`
<h2 align="center">Unity 2018.3 or later (Using OpenUPM)</h2>
[![openupm](https://img.shields.io/npm/v/com.unitynative.sharing?label=openupm&registry_uri=https://package.openupm.com)](https://openupm.com/packages/com.unitynative.sharing/)
This package is available on [OpenUPM](https://openupm.com)
You can install it via [openupm-cli](https://github.com/openupm/openupm-cli)
```
openupm add com.unitynative.sharing
```
<h2 align="center">Unity 2018.2</h2>
`Unity 2018.2` supports embedded packages.
1. Download a source code zip file from the [Releases](https://github.com/NicholasSheehan/Unity-Native-Sharing/releases) page
2. Extract it
3. Import it under the `Packages` directory in your Unity project
<h1 align="center">👍 Features 👍</h1>
- Share text to an app
- Share screenshots with text to an app
<h2 align="center">🧪 Testing 🧪</h2>
-- | `Android 8.0.0` | `iOS 10.3.3` | `iOS 11.3.1`
------------- | -------------- | -------------| ------------
Facebook | No Text | No Text | No Text
Messenger | No Text | No Text | No Text
Instagram | No Text | No Text | No Text
Twitter | ✔ | ✔ | ✔
Discord | ✔ | ✔ | ✔
Slack | ✔ | ✔ | ✔
<h3 align="center">😭 Known Issues 😭</h3>
[Facebook, Messenger and Instagram cannot share text at all, unless passed into their SDK](https://answers.unity.com/questions/871846/can-i-post-to-facebook-with-my-own-text.html)
<h2 align="center">📱 Platform Notes 📱</h2>
<h3 align="center">🤖 Android 🤖</h3>
The Android plugin requires `androidx.appcompat:appcompat:1.1.0` to run.
This plugin has support for [Play Services Resolver for Unity](https://github.com/googlesamples/unity-jar-resolver) which will take care of this for you

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b7874808e55a20a4fa6f20e32111f2d5
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
{
"name": "UnityNative.Sharing",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ef2dc3324a188f84995fe4e29bd967f8
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,58 @@
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);
}
}
}

View File

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

View File

@@ -0,0 +1,22 @@
{
"name": "com.unitynative.sharing",
"version": "1.0.7",
"displayName": "Unity-Native-Sharing",
"description": "A Unity plugin to open native sharing dialogs on iOS and Android",
"unity": "2018.4",
"dependencies": {
"com.unity.modules.screencapture": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0"
},
"keywords": [
"Plugin",
"Native",
"Android",
"iOS",
"Sharing"
],
"author": {
"name": "Nicholas Sheehan",
"url": "https://github.com/NicholasSheehan/Unity-Native-Sharing"
}
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 83e92ff801c4832459a0524f454754de
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: