备份CatanBuilding瘦身独立工程
This commit is contained in:
@@ -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
|
||||
@@ -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:
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user