99.imdk_unity 上传
This commit is contained in:
18
Assets/99.imdk_unity/Runtime/Plugins/iOS/NativeLocation.h
Normal file
18
Assets/99.imdk_unity/Runtime/Plugins/iOS/NativeLocation.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// NativeLocation.h
|
||||
// Immersal SDK
|
||||
//
|
||||
// Created by Mikko on 29/05/2020.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface NativeLocation : NSObject <CLLocationManagerDelegate>
|
||||
|
||||
- (NativeLocation *)init;
|
||||
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,81 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3047a557b77d947608c98b823c7d4d5b
|
||||
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 Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
132
Assets/99.imdk_unity/Runtime/Plugins/iOS/NativeLocation.mm
Normal file
132
Assets/99.imdk_unity/Runtime/Plugins/iOS/NativeLocation.mm
Normal file
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// NativeLocation.m
|
||||
// Immersal SDK
|
||||
//
|
||||
// Created by Mikko on 29/05/2020.
|
||||
//
|
||||
//
|
||||
|
||||
#import "NativeLocation.h"
|
||||
|
||||
double latitude;
|
||||
double longitude;
|
||||
double altitude;
|
||||
double haccuracy;
|
||||
double vaccuracy;
|
||||
|
||||
@implementation NativeLocation
|
||||
|
||||
CLLocationManager *locationManager;
|
||||
static bool isEnabled = NO;
|
||||
|
||||
- (NativeLocation *)init
|
||||
{
|
||||
locationManager = [[CLLocationManager alloc] init];
|
||||
locationManager.delegate = self;
|
||||
locationManager.distanceFilter = kCLDistanceFilterNone;
|
||||
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
|
||||
|
||||
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
|
||||
[locationManager requestWhenInUseAuthorization];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
|
||||
{
|
||||
/* switch (status) {
|
||||
case kCLAuthorizationStatusAuthorizedWhenInUse:
|
||||
case kCLAuthorizationStatusAuthorizedAlways:
|
||||
isEnabled = YES; break;
|
||||
default:
|
||||
isEnabled = NO; break;
|
||||
}*/
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error;
|
||||
{
|
||||
isEnabled = NO;
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations;
|
||||
{
|
||||
CLLocation *location = [locations lastObject];
|
||||
latitude = location.coordinate.latitude;
|
||||
longitude = location.coordinate.longitude;
|
||||
altitude = location.altitude;
|
||||
haccuracy = location.horizontalAccuracy;
|
||||
vaccuracy = location.verticalAccuracy;
|
||||
|
||||
isEnabled = YES;
|
||||
|
||||
//NSLog(@"lat: %f long: %f alt: %f", latitude, longitude, altitude);
|
||||
}
|
||||
|
||||
- (void)start
|
||||
{
|
||||
if (locationManager != NULL) {
|
||||
[locationManager startUpdatingLocation];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stop
|
||||
{
|
||||
if (locationManager != NULL) {
|
||||
[locationManager stopUpdatingLocation];
|
||||
}
|
||||
|
||||
isEnabled = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static NativeLocation* locationDelegate = NULL;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void startLocation()
|
||||
{
|
||||
if (locationDelegate == NULL) {
|
||||
locationDelegate = [[NativeLocation alloc] init];
|
||||
}
|
||||
|
||||
[locationDelegate start];
|
||||
}
|
||||
|
||||
void stopLocation()
|
||||
{
|
||||
if (locationDelegate != NULL) {
|
||||
[locationDelegate stop];
|
||||
}
|
||||
}
|
||||
|
||||
double getLatitude()
|
||||
{
|
||||
return latitude;
|
||||
}
|
||||
|
||||
double getLongitude()
|
||||
{
|
||||
return longitude;
|
||||
}
|
||||
|
||||
double getAltitude()
|
||||
{
|
||||
return altitude;
|
||||
}
|
||||
|
||||
double getHorizontalAccuracy()
|
||||
{
|
||||
return haccuracy;
|
||||
}
|
||||
|
||||
double getVerticalAccuracy()
|
||||
{
|
||||
return vaccuracy;
|
||||
}
|
||||
|
||||
bool locationServicesEnabled()
|
||||
{
|
||||
return isEnabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d437760fb73c64fbea6c103e65c7b46a
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 1
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
tvOS: tvOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/99.imdk_unity/Runtime/Plugins/iOS/libPosePlugin.a
Normal file
BIN
Assets/99.imdk_unity/Runtime/Plugins/iOS/libPosePlugin.a
Normal file
Binary file not shown.
@@ -0,0 +1,81 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e5497290e47344189a08bc45a2d4ec6
|
||||
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 Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Exclude iOS: 0
|
||||
- first:
|
||||
Android: Android
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
iPhone: iOS
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
AddToEmbeddedBinaries: false
|
||||
CPU: AnyCPU
|
||||
CompileFlags:
|
||||
FrameworkDependencies: Security;
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user