Commit b2b689e8c77a658eb1331d3ef11f95220895d4b5

Authored by Thiago Filipe Soares da Rocha
1 parent 17fc9d06

Finish DialogMobile VideoShare

Showing 174 changed files with 17757 additions and 67 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 174 files displayed.

Assets/Plugins.meta
1 1 fileFormatVersion: 2
2   -guid: 2f76639d276d256418c4d22174caf2aa
  2 +guid: 0dcf6818ab246694393c4e93b6f3cd97
3 3 folderAsset: yes
4   -timeCreated: 1443633364
  4 +timeCreated: 1485641150
5 5 licenseType: Free
6 6 DefaultImporter:
7 7 userData:
... ...
Assets/Plugins/Android.meta
1 1 fileFormatVersion: 2
2   -guid: c09545e387c50874db2086d6b06b2a1c
  2 +guid: 8256d158a8cc06d468288ae03a61fab8
3 3 folderAsset: yes
4   -timeCreated: 1442947850
  4 +timeCreated: 1485657324
5 5 licenseType: Free
6 6 DefaultImporter:
7 7 userData:
... ...
Assets/Plugins/Android/AndroidManifest.xml
... ... @@ -7,11 +7,13 @@
7 7 <uses-sdk android:minSdkVersion="14" />
8 8 <uses-permission android:name="android.permission.INTERNET" />
9 9 <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  10 + <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
10 11 <application
11 12 android:icon="@drawable/app_icon"
12 13 android:label="@string/app_name"
13 14 android:screenOrientation="portrait"
14 15 android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
  16 +
15 17 <activity android:name=".MainActivity"
16 18 android:label="@string/app_name"
17 19 android:screenOrientation="portrait"
... ...
Assets/Plugins/Android/mobile-native-popups.aar 0 → 100644
No preview for this file type
Assets/Plugins/Android/mobile-native-popups.aar.meta 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +fileFormatVersion: 2
  2 +guid: 7ce6f697f58ee8b4491530cd5f0c3b61
  3 +timeCreated: 1485642295
  4 +licenseType: Free
  5 +PluginImporter:
  6 + serializedVersion: 1
  7 + iconMap: {}
  8 + executionOrder: {}
  9 + isPreloaded: 0
  10 + platformData:
  11 + Android:
  12 + enabled: 1
  13 + settings: {}
  14 + Any:
  15 + enabled: 0
  16 + settings: {}
  17 + Editor:
  18 + enabled: 0
  19 + settings:
  20 + DefaultValueInitialized: true
  21 + userData:
  22 + assetBundleName:
  23 + assetBundleVariant:
... ...
Assets/Plugins/IOS.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 7f4745515eb5092469a988f0ad787de9
  3 +folderAsset: yes
  4 +timeCreated: 1485642295
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/IOS/ISN_NativeCore.h 0 → 100644
... ... @@ -0,0 +1,123 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module IOS Native Plugin
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +// @website https://stansassets.com
  7 +//
  8 +////////////////////////////////////////////////////////////////////////////////
  9 +
  10 +
  11 +@interface NSData (Base64)
  12 +
  13 ++ (NSData *)InitFromBase64String:(NSString *)aString;
  14 +- (NSString *)AsBase64String;
  15 +
  16 +@end
  17 +
  18 +@interface NSDictionary (JSON)
  19 +
  20 +- (NSString *)AsJSONString;
  21 +
  22 +@end
  23 +
  24 +@interface ISN_DataConvertor : NSObject
  25 +
  26 ++ (NSString*) charToNSString: (char*)value;
  27 ++ (const char *) NSIntToChar: (NSInteger) value;
  28 ++ (const char *) NSStringToChar: (NSString *) value;
  29 ++ (NSArray*) charToNSArray: (char*)value;
  30 +
  31 ++ (const char *) serializeErrorWithData:(NSString *)description code: (int) code;
  32 ++ (const char *) serializeError:(NSError *)error;
  33 +
  34 ++ (NSMutableString *) serializeErrorWithDataToNSString:(NSString *)description code: (int) code;
  35 ++ (NSMutableString *) serializeErrorToNSString:(NSError *)error;
  36 +
  37 +
  38 ++ (const char *) NSStringsArrayToChar:(NSArray *) array;
  39 ++ (NSString *) serializeNSStringsArray:(NSArray *) array;
  40 +
  41 +@end
  42 +
  43 +
  44 +@interface ISN_NativeUtility : NSObject
  45 +
  46 +@property (strong) UIActivityIndicatorView *spinner;
  47 +
  48 ++ (id) sharedInstance;
  49 ++ (int) majorIOSVersion;
  50 ++ (BOOL) IsIPad;
  51 +
  52 +- (void) redirectToRatingPage: (NSString *) appId;
  53 +- (void) setApplicationBagesNumber:(int) count;
  54 +
  55 +- (void) ShowSpinner;
  56 +- (void) HideSpinner;
  57 +- (void) ISN_NativeLog: (NSString *) appId, ...;
  58 +- (void) ISN_SetLogState: (BOOL) appId;
  59 +
  60 +@end
  61 +
  62 +@interface CloudManager : NSObject
  63 +
  64 +
  65 ++ (id) sharedInstance;
  66 +
  67 +- (void) initialize;
  68 +- (void) setString:(NSString*) val key:(NSString*) key;
  69 +- (void) setDouble:(double) val key:(NSString*) key;
  70 +- (void) setData:(NSData*) val key:(NSString*) key;
  71 +
  72 +-(void) requestDataForKey:(NSString*) key;
  73 +
  74 +@end
  75 +
  76 +
  77 +
  78 +
  79 +
  80 +
  81 +
  82 +@interface ISNSharedApplication : NSObject
  83 +
  84 ++ (id) sharedInstance;
  85 +
  86 +- (void) checkUrl:(NSString*)url;
  87 +- (void) openUrl:(NSString*)url;
  88 +
  89 +
  90 +@end
  91 +
  92 +
  93 +
  94 +
  95 +
  96 +
  97 +@interface ISN_NativePopUpsManager : NSObject
  98 ++ (ISN_NativePopUpsManager *) sharedInstance;
  99 +@end
  100 +
  101 +
  102 +
  103 +@interface IOSNativeNotificationCenter : NSObject
  104 +
  105 +
  106 ++ (IOSNativeNotificationCenter *)sharedInstance;
  107 +- (void) scheduleNotification: (int) time message: (NSString*) message sound: (bool *)sound alarmID:(NSString *)alarmID badges: (int)badges notificationData: (NSString*) notificationData notificationSoundName: (NSString*) notificationSoundName;
  108 +- (void) cleanUpLocalNotificationWithAlarmID: (NSString *)alarmID;
  109 +- (void) cancelNotifications;
  110 +- (void) applicationIconBadgeNumber: (int)badges;
  111 +- (void) RegisterForNotifications;
  112 +
  113 +@end
  114 +
  115 +
  116 +
  117 +
  118 +
  119 +
  120 +
  121 +
  122 +
  123 +
... ...
Assets/Plugins/IOS/ISN_NativeCore.h.meta 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +fileFormatVersion: 2
  2 +guid: 1f55fafffc0251e4d93bd9c101123dcc
  3 +timeCreated: 1485642295
  4 +licenseType: Free
  5 +PluginImporter:
  6 + serializedVersion: 1
  7 + iconMap: {}
  8 + executionOrder: {}
  9 + isPreloaded: 0
  10 + platformData:
  11 + Any:
  12 + enabled: 0
  13 + settings: {}
  14 + Editor:
  15 + enabled: 0
  16 + settings:
  17 + DefaultValueInitialized: true
  18 + iOS:
  19 + enabled: 1
  20 + settings: {}
  21 + userData:
  22 + assetBundleName:
  23 + assetBundleVariant:
... ...
Assets/Plugins/IOS/ISN_NativeCore.mm 0 → 100644
... ... @@ -0,0 +1,1714 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module IOS Native Plugin
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +// @website https://stansassets.com
  7 +//
  8 +////////////////////////////////////////////////////////////////////////////////
  9 +
  10 +#import <Foundation/Foundation.h>
  11 +
  12 +#import "ISN_NativeCore.h"
  13 +#import "AppDelegateListener.h"
  14 +#if UNITY_VERSION < 450
  15 +#include "iPhone_View.h"§§
  16 +#endif
  17 +
  18 +
  19 +
  20 +NSString * const UNITY_SPLITTER = @"|";
  21 +NSString * const UNITY_EOF = @"endofline";
  22 +NSString * const ARRAY_SPLITTER = @"%%%";
  23 +
  24 +
  25 +@implementation NSData (Base64)
  26 +
  27 ++ (NSData *)InitFromBase64String:(NSString *)aString {
  28 + return [[NSData alloc] initWithBase64Encoding:aString];
  29 +}
  30 +
  31 +- (NSString *)AsBase64String {
  32 + return [self base64EncodedStringWithOptions:0];
  33 +}
  34 +
  35 +@end
  36 +
  37 +
  38 +@implementation NSDictionary (JSON)
  39 +
  40 +- (NSString *)AsJSONString {
  41 + NSError *error;
  42 + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:0 error:&error];
  43 +
  44 + if (!jsonData) {
  45 + return @"{}";
  46 + } else {
  47 + return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
  48 + }
  49 +}
  50 +
  51 +@end
  52 +
  53 +
  54 +@implementation ISN_DataConvertor
  55 +
  56 +
  57 ++(NSString *) charToNSString:(char *)value {
  58 + if (value != NULL) {
  59 + return [NSString stringWithUTF8String: value];
  60 + } else {
  61 + return [NSString stringWithUTF8String: ""];
  62 + }
  63 +}
  64 +
  65 ++(const char *)NSIntToChar:(NSInteger)value {
  66 + NSString *tmp = [NSString stringWithFormat:@"%ld", (long)value];
  67 + return [tmp UTF8String];
  68 +}
  69 +
  70 ++ (const char *) NSStringToChar:(NSString *)value {
  71 + return [value UTF8String];
  72 +}
  73 +
  74 ++ (NSArray *)charToNSArray:(char *)value {
  75 + NSString* strValue = [ISN_DataConvertor charToNSString:value];
  76 +
  77 + NSArray *array;
  78 + if([strValue length] == 0) {
  79 + array = [[NSArray alloc] init];
  80 + } else {
  81 + array = [strValue componentsSeparatedByString:ARRAY_SPLITTER];
  82 + }
  83 +
  84 + return array;
  85 +}
  86 +
  87 ++ (const char *) NSStringsArrayToChar:(NSArray *) array {
  88 + return [ISN_DataConvertor NSStringToChar:[ISN_DataConvertor serializeNSStringsArray:array]];
  89 +}
  90 +
  91 ++ (NSString *) serializeNSStringsArray:(NSArray *) array {
  92 +
  93 + NSMutableString * data = [[NSMutableString alloc] init];
  94 +
  95 +
  96 + for(NSString* str in array) {
  97 + [data appendString:str];
  98 + [data appendString: ARRAY_SPLITTER];
  99 + }
  100 +
  101 + [data appendString: UNITY_EOF];
  102 +
  103 + NSString *str = [data copy];
  104 +#if UNITY_VERSION < 500
  105 + [str autorelease];
  106 +#endif
  107 +
  108 + return str;
  109 +}
  110 +
  111 +
  112 ++ (NSMutableString *)serializeErrorToNSString:(NSError *)error {
  113 + NSString* description = @"";
  114 + if(error.description != nil) {
  115 + description = error.description;
  116 + }
  117 +
  118 + return [self serializeErrorWithDataToNSString:description code: (int) error.code];
  119 +}
  120 +
  121 ++ (NSMutableString *)serializeErrorWithDataToNSString:(NSString *)description code:(int)code {
  122 + NSMutableString * data = [[NSMutableString alloc] init];
  123 +
  124 + [data appendFormat:@"%i", code];
  125 + [data appendString: UNITY_SPLITTER];
  126 + [data appendString: description];
  127 +
  128 + return data;
  129 +}
  130 +
  131 +
  132 +
  133 ++ (const char *) serializeErrorWithData:(NSString *)description code: (int) code {
  134 + NSString *str = [ISN_DataConvertor serializeErrorWithDataToNSString:description code:code];
  135 + return [ISN_DataConvertor NSStringToChar:str];
  136 +}
  137 +
  138 ++ (const char *) serializeError:(NSError *)error {
  139 + NSString *str = [ISN_DataConvertor serializeErrorToNSString:error];
  140 + return [ISN_DataConvertor NSStringToChar:str];
  141 +}
  142 +
  143 +@end
  144 +
  145 +
  146 +
  147 +
  148 +@implementation ISN_NativeUtility
  149 +
  150 +static bool logState = true;
  151 +static ISN_NativeUtility * na_sharedInstance;
  152 +static NSString* templateReviewURLIOS7 = @"itms-apps://itunes.apple.com/app/idAPP_ID";
  153 +NSString *templateReviewURL = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID";
  154 +
  155 ++ (id)sharedInstance {
  156 +
  157 + if (na_sharedInstance == nil) {
  158 + na_sharedInstance = [[self alloc] init];
  159 + }
  160 +
  161 + return na_sharedInstance;
  162 +}
  163 +
  164 ++ (BOOL) IsIPad {
  165 + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  166 + return true;
  167 + } else {
  168 + return false;
  169 + }
  170 +}
  171 +
  172 ++ (int) majorIOSVersion {
  173 + NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
  174 + return [[vComp objectAtIndex:0] intValue];
  175 +}
  176 +
  177 +-(void) redirectToRatingPage:(NSString *)appId {
  178 +#if TARGET_IPHONE_SIMULATOR
  179 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page."];
  180 +#else
  181 +
  182 +
  183 + NSString *reviewURL;
  184 + NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
  185 +
  186 +
  187 + if ([[vComp objectAtIndex:0] intValue] >= 7) {
  188 + reviewURL = [templateReviewURLIOS7 stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%@", appId]];
  189 + } else {
  190 + reviewURL = [templateReviewURL stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%@", appId]];
  191 + }
  192 +
  193 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"redirecting to iTunes page, iOS version: %i", [[vComp objectAtIndex:0] intValue]];
  194 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"redirect URL: %@", reviewURL];
  195 +
  196 +
  197 +
  198 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:reviewURL]];
  199 +#endif
  200 +}
  201 +
  202 +-(void) ISN_SetLogState:(BOOL)state {
  203 + logState = state;
  204 +}
  205 +
  206 +-(void) ISN_NativeLog:(NSString *)msg, ... {
  207 + if(logState) {
  208 + va_list argumentList;
  209 + va_start(argumentList, msg);
  210 +
  211 + NSString *message = [[NSString alloc] initWithFormat:msg arguments:argumentList];
  212 +
  213 + // clean up
  214 + va_end(argumentList);
  215 +
  216 + NSLog(@"ISN_NativeLog: %@", message);
  217 + }
  218 +}
  219 +
  220 +-(void) setApplicationBagesNumber:(int) count {
  221 +#if !TARGET_OS_TV
  222 + [UIApplication sharedApplication].applicationIconBadgeNumber = count;
  223 +#endif
  224 +}
  225 +
  226 +- (void) ShowSpinner {
  227 +
  228 +#if !TARGET_OS_TV
  229 + [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
  230 +
  231 + if([self spinner] != nil) {
  232 + return;
  233 + }
  234 +
  235 + UIViewController *vc = UnityGetGLViewController();
  236 +
  237 +
  238 + [self setSpinner:[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]];
  239 +
  240 +
  241 +
  242 + [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
  243 +
  244 +
  245 +
  246 +
  247 +
  248 + NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
  249 + if ([[vComp objectAtIndex:0] intValue] >= 8) {
  250 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"iOS 8 detected"];
  251 + [[self spinner] setFrame:CGRectMake(0,0, vc.view.frame.size.width, vc.view.frame.size.height)];
  252 + } else {
  253 +
  254 + if([[UIDevice currentDevice] orientation] == UIDeviceOrientationPortrait || [[UIDevice currentDevice] orientation] == UIDeviceOrientationPortraitUpsideDown) {
  255 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"portrait detected"];
  256 + [[self spinner] setFrame:CGRectMake(0,0, vc.view.frame.size.width, vc.view.frame.size.height)];
  257 +
  258 + } else {
  259 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"landscape detected"];
  260 + [[self spinner] setFrame:CGRectMake(0,0, vc.view.frame.size.height, vc.view.frame.size.width)];
  261 + }
  262 +
  263 + }
  264 +
  265 +
  266 + [self spinner].opaque = NO;
  267 + [self spinner].backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.0f];
  268 +
  269 +
  270 + [UIView animateWithDuration:0.8 animations:^{
  271 + [self spinner].backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.5f];
  272 + }];
  273 +
  274 +
  275 +
  276 +
  277 + [vc.view addSubview:[self spinner]];
  278 + [[self spinner] startAnimating];
  279 +
  280 + // [[self spinner] retain];
  281 +
  282 +#endif
  283 +
  284 +}
  285 +
  286 +
  287 +
  288 +- (void) HideSpinner {
  289 +
  290 + [[UIApplication sharedApplication] endIgnoringInteractionEvents];
  291 +
  292 + if([self spinner] != nil) {
  293 + // [[UIApplication sharedApplication] endIgnoringInteractionEvents];
  294 +
  295 + [self spinner].backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.5f];
  296 + [UIView animateWithDuration:0.8 animations:^{
  297 + [self spinner].backgroundColor = [UIColor colorWithWhite:0.0f alpha:0.0f];
  298 +
  299 + } completion:^(BOOL finished) {
  300 + [[self spinner] removeFromSuperview];
  301 +#if UNITY_VERSION < 500
  302 + [[self spinner] release];
  303 +#endif
  304 +
  305 + [self setSpinner:nil];
  306 + }];
  307 +
  308 +
  309 + }
  310 +
  311 +}
  312 +
  313 +- (CGFloat) GetW {
  314 +
  315 + UIViewController *vc = UnityGetGLViewController();
  316 +
  317 + bool IsLandscape = true;
  318 +
  319 +#if !TARGET_OS_TV
  320 +
  321 + UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
  322 + if(orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
  323 + IsLandscape = true;
  324 + } else {
  325 + IsLandscape = false;
  326 + }
  327 +#endif
  328 +
  329 + CGFloat w;
  330 + if(IsLandscape) {
  331 + w = vc.view.frame.size.height;
  332 + } else {
  333 + w = vc.view.frame.size.width;
  334 + }
  335 +
  336 +
  337 + NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
  338 + if ([[vComp objectAtIndex:0] intValue] >= 8) {
  339 + w = vc.view.frame.size.width;
  340 + }
  341 +
  342 +
  343 + return w;
  344 +}
  345 +
  346 +#if !TARGET_OS_TV
  347 +
  348 +- (void)DP_changeDate:(UIDatePicker *)sender {
  349 +
  350 + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  351 +#if UNITY_VERSION < 500
  352 + [dateFormatter autorelease];
  353 +#endif
  354 +
  355 + [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];
  356 + NSString *dateString = [dateFormatter stringFromDate:sender.date];
  357 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"DateChangedEvent: %@", dateString];
  358 +
  359 + UnitySendMessage("IOSDateTimePicker", "DateChangedEvent", [ISN_DataConvertor NSStringToChar:dateString]);
  360 +}
  361 +
  362 +-(void) DP_PickerClosed:(UIDatePicker *)sender {
  363 + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  364 +#if UNITY_VERSION < 500
  365 + [dateFormatter autorelease];
  366 +#endif
  367 + [dateFormatter setDateFormat: @"yyyy-MM-dd HH:mm:ss"];
  368 + NSString *dateString = [dateFormatter stringFromDate:sender.date];
  369 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"DateChangedEvent: %@", dateString];
  370 +
  371 + UnitySendMessage("IOSDateTimePicker", "PickerClosed", [ISN_DataConvertor NSStringToChar:dateString]);
  372 +
  373 +}
  374 +
  375 +
  376 +UIDatePicker *datePicker;
  377 +
  378 +- (void) DP_show:(int)mode date: (NSDate*) date {
  379 + UIViewController *vc = UnityGetGLViewController();
  380 +
  381 + CGRect toolbarTargetFrame = CGRectMake(0, vc.view.bounds.size.height-216-44, [self GetW], 44);
  382 + CGRect datePickerTargetFrame = CGRectMake(0, vc.view.bounds.size.height-216, [self GetW], 216);
  383 + CGRect darkViewTargetFrame = CGRectMake(0, vc.view.bounds.size.height-216-44, [self GetW], 260);
  384 +
  385 + UIView *darkView = [[UIView alloc] initWithFrame:CGRectMake(0, vc.view.bounds.size.height, [self GetW], 260)];
  386 + darkView.alpha = 1;
  387 + darkView.backgroundColor = [UIColor whiteColor];
  388 + darkView.tag = 9;
  389 +
  390 + UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(DP_dismissDatePicker:)];
  391 + [darkView addGestureRecognizer:tapGesture];
  392 + [vc.view addSubview:darkView];
  393 +
  394 +
  395 + datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, vc.view.bounds.size.height+44, [self GetW], 216)];
  396 + datePicker.tag = 10;
  397 + if(date != nil) {
  398 + [datePicker setDate:date];
  399 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"DateChangedEventManually date: %@", date];
  400 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"DateChangedEventManually datePicker: %@", [datePicker date]];
  401 + }
  402 +
  403 +#if UNITY_VERSION < 500
  404 + [darkView autorelease];
  405 + [tapGesture autorelease];
  406 + [datePicker autorelease];
  407 +#endif
  408 +
  409 +
  410 + [datePicker addTarget:self action:@selector(DP_changeDate:) forControlEvents:UIControlEventValueChanged];
  411 + switch (mode) {
  412 + case 1:
  413 + datePicker.datePickerMode = UIDatePickerModeTime;
  414 + break;
  415 +
  416 + case 2:
  417 + datePicker.datePickerMode = UIDatePickerModeDate;
  418 + break;
  419 +
  420 + case 3:
  421 + datePicker.datePickerMode = UIDatePickerModeDateAndTime;
  422 + break;
  423 +
  424 + case 4:
  425 + datePicker.datePickerMode = UIDatePickerModeCountDownTimer;
  426 + break;
  427 +
  428 + default:
  429 + break;
  430 + }
  431 +
  432 + // NSLog(@"dtp mode: %ld", (long)datePicker.datePickerMode);
  433 +
  434 +
  435 + [vc.view addSubview:datePicker];
  436 +
  437 + UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, vc.view.bounds.size.height, [self GetW], 44)];
  438 +
  439 + toolBar.tag = 11;
  440 + toolBar.barStyle = UIBarStyleDefault;
  441 + UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
  442 + UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(DP_dismissDatePicker:)];
  443 +
  444 +#if UNITY_VERSION < 500
  445 + [toolBar autorelease];
  446 + [spacer autorelease];
  447 + [doneButton autorelease];
  448 +#endif
  449 +
  450 + [toolBar setItems:[NSArray arrayWithObjects:spacer, doneButton, nil]];
  451 + [vc.view addSubview:toolBar];
  452 +
  453 + [UIView beginAnimations:@"MoveIn" context:nil];
  454 + toolBar.frame = toolbarTargetFrame;
  455 + datePicker.frame = datePickerTargetFrame;
  456 + darkView.frame = darkViewTargetFrame;
  457 +
  458 + [UIView commitAnimations];
  459 +
  460 +}
  461 +
  462 +- (void)DP_removeViews:(id)object {
  463 + UIViewController *vc = UnityGetGLViewController();
  464 +
  465 + [[vc.view viewWithTag:9] removeFromSuperview];
  466 + [[vc.view viewWithTag:10] removeFromSuperview];
  467 + [[vc.view viewWithTag:11] removeFromSuperview];
  468 +}
  469 +
  470 +- (void)DP_dismissDatePicker:(id)sender {
  471 + UIViewController *vc = UnityGetGLViewController();
  472 +
  473 + [self DP_PickerClosed:datePicker];
  474 +
  475 + CGRect toolbarTargetFrame = CGRectMake(0, vc.view.bounds.size.height, [self GetW], 44);
  476 + CGRect datePickerTargetFrame = CGRectMake(0, vc.view.bounds.size.height+44, [self GetW], 216);
  477 + CGRect darkViewTargetFrame = CGRectMake(0, vc.view.bounds.size.height, [self GetW], 260);
  478 +
  479 +
  480 + [UIView beginAnimations:@"MoveOut" context:nil];
  481 + [vc.view viewWithTag:9].frame = darkViewTargetFrame;
  482 + [vc.view viewWithTag:10].frame = datePickerTargetFrame;
  483 + [vc.view viewWithTag:11].frame = toolbarTargetFrame;
  484 + [UIView setAnimationDelegate:self];
  485 + [UIView setAnimationDidStopSelector:@selector(DP_removeViews:)];
  486 + [UIView commitAnimations];
  487 +}
  488 +
  489 +#endif
  490 +
  491 +
  492 +
  493 +- (void) GetLocale {
  494 +
  495 + NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
  496 + NSArray* arrayLanguages = [userDefaults objectForKey:@"AppleLanguages"];
  497 + NSString* currentLanguage = [arrayLanguages firstObject];
  498 +
  499 + NSLocale *countryLocale = [NSLocale currentLocale];
  500 + NSString *countryCode = [countryLocale objectForKey:NSLocaleCountryCode];
  501 + NSString *country = [countryLocale displayNameForKey:NSLocaleCountryCode value:countryCode];
  502 +
  503 + NSString *languageID = [[NSBundle mainBundle] preferredLocalizations].firstObject;
  504 + NSLocale *locale = [NSLocale localeWithLocaleIdentifier:languageID];
  505 + NSString *languageCode = [locale displayNameForKey:NSLocaleIdentifier value:languageID];
  506 +
  507 + NSMutableString * data = [[NSMutableString alloc] init];
  508 +
  509 + [data appendString:countryCode];
  510 + [data appendString: UNITY_SPLITTER];
  511 +
  512 + [data appendString:country];
  513 + [data appendString: UNITY_SPLITTER];
  514 +
  515 + [data appendString:currentLanguage];
  516 + [data appendString: UNITY_SPLITTER];
  517 +
  518 + [data appendString:languageCode];
  519 +
  520 +
  521 + NSString *str = [data copy];
  522 +
  523 + UnitySendMessage("IOSNativeUtility", "OnLocaleLoadedHandler", [ISN_DataConvertor NSStringToChar:str]);
  524 +
  525 +}
  526 +
  527 +@end
  528 +
  529 +
  530 +
  531 +
  532 +
  533 +
  534 +
  535 +
  536 +@implementation CloudManager
  537 +static CloudManager * cm_sharedInstance;
  538 +
  539 +
  540 ++ (id)sharedInstance {
  541 +
  542 + if (cm_sharedInstance == nil) {
  543 + cm_sharedInstance = [[self alloc] init];
  544 + [cm_sharedInstance initialize];
  545 + }
  546 +
  547 + return cm_sharedInstance;
  548 +}
  549 +
  550 +
  551 +-(void) initialize {
  552 +
  553 + /*
  554 +
  555 + [[NSNotificationCenter defaultCenter]
  556 + addObserver: self
  557 + selector: @selector (iCloudAccountAvailabilityChanged:)
  558 + name: NSUbiquityIdentityDidChangeNotification
  559 + object: nil];
  560 +
  561 + */
  562 +
  563 +
  564 + NSFileManager* fileManager = [NSFileManager defaultManager];
  565 + id currentToken = [fileManager ubiquityIdentityToken];
  566 + bool isSignedIntoICloud = (currentToken!=nil);
  567 +
  568 + if(isSignedIntoICloud) {
  569 + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
  570 + [[NSNotificationCenter defaultCenter] addObserver:self
  571 + selector:@selector(storeDidChange:)
  572 + name:NSUbiquitousKeyValueStoreDidChangeExternallyNotification
  573 + object:store];
  574 + [store synchronize];
  575 + }
  576 +
  577 +
  578 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"iCloud Initialize"];
  579 +
  580 +}
  581 +
  582 +-(void)setString:(NSString *)val key:(NSString *)key {
  583 + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
  584 + [store setString:val forKey:key];
  585 +
  586 + [store synchronize];
  587 +}
  588 +
  589 +-(void) setData:(NSData *)val key:(NSString *)key {
  590 + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
  591 + [store setData:val forKey:key];
  592 +
  593 + [store synchronize];
  594 +}
  595 +
  596 +-(void) setDouble:(double)val key:(NSString *)key {
  597 + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
  598 + [store setDouble:val forKey:key];
  599 +
  600 + [store synchronize];
  601 +
  602 +}
  603 +
  604 +
  605 +-(void) requestDataForKey:(NSString *)key {
  606 + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
  607 +
  608 + id data = [store objectForKey:key];
  609 +
  610 +
  611 +
  612 + NSMutableString * array = [[NSMutableString alloc] init];
  613 + [array appendString:key];
  614 + [array appendString:UNITY_SPLITTER];
  615 +
  616 +
  617 + NSString* stringData;
  618 +
  619 + if(data != nil) {
  620 + if([data isKindOfClass:[NSString class]]) {
  621 + stringData = (NSString*) data;
  622 + }
  623 +
  624 + if([data isKindOfClass:[NSData class]]) {
  625 + NSData *b = (NSData*) data;
  626 + stringData = [b base64Encoding];
  627 + }
  628 +
  629 + if([data isKindOfClass:[NSNumber class]]) {
  630 + NSNumber* n = (NSNumber*) data;
  631 + stringData = [n stringValue];
  632 + }
  633 +
  634 + } else {
  635 + stringData = @"null";
  636 + }
  637 +
  638 +
  639 + [array appendString:stringData];
  640 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"data: %@", stringData];
  641 +
  642 +
  643 + NSString *package = [array copy];
  644 +#if UNITY_VERSION < 500
  645 + [package autorelease];
  646 +#endif
  647 +
  648 + if(data == nil) {
  649 + UnitySendMessage("iCloudManager", "OnCloudDataEmpty", [ISN_DataConvertor NSStringToChar:package]);
  650 + } else {
  651 + UnitySendMessage("iCloudManager", "OnCloudData", [ISN_DataConvertor NSStringToChar:package]);
  652 +
  653 + }
  654 +
  655 +
  656 +
  657 +}
  658 +
  659 +
  660 +
  661 +- (void)storeDidChange:(NSNotification *)notification {
  662 + NSDictionary* userInfo = [notification userInfo];
  663 + NSNumber* reasonForChange = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangeReasonKey];
  664 + NSInteger reason = -1;
  665 +
  666 + // If a reason could not be determined, do not update anything.
  667 + if (!reasonForChange)
  668 + return;
  669 +
  670 +
  671 + NSMutableString * array = [[NSMutableString alloc] init];
  672 +
  673 +
  674 +
  675 + // Update only for changes from the server.
  676 + reason = [reasonForChange integerValue];
  677 + if ((reason == NSUbiquitousKeyValueStoreServerChange) || (reason == NSUbiquitousKeyValueStoreInitialSyncChange)) {
  678 +
  679 + NSArray* changedKeys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey];
  680 + NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore];
  681 +
  682 + for (NSString* key in changedKeys) {
  683 + id value = [store objectForKey:key];
  684 +
  685 + [array appendString:key];
  686 + [array appendString:UNITY_SPLITTER];
  687 +
  688 + NSString* stringData;
  689 +
  690 + if(value != nil) {
  691 + if([value isKindOfClass:[NSString class]]) {
  692 + stringData = (NSString*) value;
  693 + }
  694 +
  695 + if([value isKindOfClass:[NSData class]]) {
  696 +
  697 + NSData *b = (NSData*) value;
  698 +
  699 + NSMutableString *str = [[NSMutableString alloc] init];
  700 + const char *db = (const char *) [b bytes];
  701 + for (int i = 0; i < [b length]; i++) {
  702 + if(i != 0) {
  703 + [str appendFormat:@","];
  704 + }
  705 +
  706 + [str appendFormat:@"%i", (unsigned char)db[i]];
  707 + }
  708 +
  709 + stringData = str;
  710 +
  711 + }
  712 +
  713 + if([value isKindOfClass:[NSNumber class]]) {
  714 + NSNumber* n = (NSNumber*) value;
  715 + stringData = [n stringValue];
  716 + }
  717 +
  718 + } else {
  719 + stringData = @"null";
  720 + }
  721 +
  722 +
  723 + [array appendString:stringData];
  724 + [array appendString:UNITY_SPLITTER];
  725 + }
  726 +
  727 + [array appendString:UNITY_EOF];
  728 +
  729 + }
  730 +
  731 + UnitySendMessage("iCloudManager", "OnCloudDataChanged", [ISN_DataConvertor NSStringToChar:array]);
  732 +}
  733 +
  734 +-(void) iCloudAccountAvailabilityChanged {
  735 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"iCloudAccountAvailabilityChanged:"];
  736 +}
  737 +
  738 +@end
  739 +
  740 +
  741 +
  742 +
  743 +@implementation ISN_NativePopUpsManager
  744 +
  745 +static UIAlertController* _currentAlert = nil;
  746 +
  747 +
  748 +static ISN_NativePopUpsManager *_sharedInstance;
  749 +
  750 ++ (id)sharedInstance {
  751 + if (_sharedInstance == nil) {
  752 + _sharedInstance = [[self alloc] init];
  753 + }
  754 +
  755 + return _sharedInstance;
  756 +}
  757 +
  758 +
  759 +
  760 ++(void) dismissCurrentAlert {
  761 + if(_currentAlert != nil) {
  762 + [_currentAlert dismissViewControllerAnimated:true completion:^{
  763 + UnitySendMessage("IOSPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"0"]);
  764 + UnitySendMessage("IOSRateUsPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"0"]);
  765 + }];
  766 +
  767 +
  768 +#if UNITY_VERSION < 500
  769 + // [_currentAlert release];
  770 +#endif
  771 + _currentAlert = nil;
  772 + }
  773 +}
  774 +
  775 ++(void) showRateUsPopUp: (NSString *) title message: (NSString*) msg b1: (NSString*) b1 b2: (NSString*) b2 b3: (NSString*) b3 {
  776 +
  777 + UIAlertController* alert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
  778 +
  779 +
  780 +
  781 + UIAlertAction* rateAction = [UIAlertAction actionWithTitle:b1 style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  782 + UnitySendMessage("IOSRateUsPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"0"]);
  783 + _currentAlert = nil;
  784 + }];
  785 +
  786 +
  787 + UIAlertAction* laterAction = [UIAlertAction actionWithTitle:b2 style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  788 + UnitySendMessage("IOSRateUsPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"1"]);
  789 + _currentAlert = nil;
  790 + }];
  791 +
  792 +
  793 + UIAlertAction* declineAction = [UIAlertAction actionWithTitle:b3 style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  794 + UnitySendMessage("IOSRateUsPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"2"]);
  795 + _currentAlert = nil;
  796 + }];
  797 +
  798 +
  799 + [alert addAction:rateAction];
  800 + [alert addAction:laterAction];
  801 + [alert addAction:declineAction];
  802 +
  803 + _currentAlert = alert;
  804 +
  805 +
  806 + UIViewController *vc = UnityGetGLViewController();
  807 + [vc presentViewController:alert animated:YES completion:nil];
  808 +
  809 +
  810 +
  811 +}
  812 +
  813 +
  814 +
  815 +
  816 ++ (void) showDialog: (NSString *) title message: (NSString*) msg yesTitle:(NSString*) b1 noTitle: (NSString*) b2{
  817 +
  818 + UIAlertController* alert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
  819 +
  820 + UIAlertAction* okAction = [UIAlertAction actionWithTitle:b1 style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  821 + UnitySendMessage("IOSPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"0"]);
  822 + _currentAlert = nil;
  823 + }];
  824 +
  825 +
  826 + UIAlertAction* yesAction = [UIAlertAction actionWithTitle:b2 style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  827 + UnitySendMessage("IOSPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"1"]);
  828 + _currentAlert = nil;
  829 + }];
  830 +
  831 + [alert addAction:yesAction];
  832 + [alert addAction:okAction];
  833 +
  834 + _currentAlert = alert;
  835 +
  836 +
  837 + UIViewController *vc = UnityGetGLViewController();
  838 + [vc presentViewController:alert animated:YES completion:nil];
  839 +
  840 +}
  841 +
  842 +
  843 ++(void) showMessage: (NSString *) title message: (NSString*) msg okTitle:(NSString*) b1 {
  844 +
  845 +
  846 + UIAlertController* alert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
  847 +
  848 + UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:b1 style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  849 + UnitySendMessage("IOSPopUp", "onPopUpCallBack", [ISN_DataConvertor NSStringToChar:@"0"]);
  850 + _currentAlert = nil;
  851 + }];
  852 +
  853 +
  854 + [alert addAction:defaultAction];
  855 + _currentAlert = alert;
  856 +
  857 +
  858 + UIViewController *vc = UnityGetGLViewController();
  859 + [vc presentViewController:alert animated:YES completion:nil];
  860 +
  861 +}
  862 +
  863 +//--------------------------------------
  864 +// IOS 6,7 implementation
  865 +//--------------------------------------
  866 +
  867 +#if !TARGET_OS_TV
  868 +
  869 +static UIAlertView* _currentAllert = nil;
  870 +
  871 ++ (void) unregisterAllertView_old {
  872 + if(_currentAllert != nil) {
  873 +#if UNITY_VERSION < 500
  874 + [_currentAlert release];
  875 +#endif
  876 + _currentAllert = nil;
  877 + }
  878 +}
  879 +
  880 ++(void) dismissCurrentAlert_old {
  881 + if(_currentAllert != nil) {
  882 + [_currentAllert dismissWithClickedButtonIndex:0 animated:YES];
  883 +#if UNITY_VERSION < 500
  884 + [_currentAlert release];
  885 +#endif
  886 + _currentAllert = nil;
  887 + }
  888 +}
  889 +
  890 ++(void) showRateUsPopUp_old: (NSString *) title message: (NSString*) msg b1: (NSString*) b1 b2: (NSString*) b2 b3: (NSString*) b3 {
  891 +
  892 + UIAlertView *alert = [[UIAlertView alloc] init];
  893 + [alert setTitle:title];
  894 + [alert setMessage:msg];
  895 + [alert setDelegate: [ISN_NativePopUpsManager sharedInstance]];
  896 +
  897 + [alert addButtonWithTitle:b1];
  898 + [alert addButtonWithTitle:b2];
  899 + [alert addButtonWithTitle:b3];
  900 +
  901 + [alert show];
  902 +
  903 + _currentAllert = alert;
  904 +
  905 +}
  906 +
  907 +
  908 +
  909 +
  910 ++ (void) showDialog_old: (NSString *) title message: (NSString*) msg yesTitle:(NSString*) b1 noTitle: (NSString*) b2{
  911 +
  912 + UIAlertView *alert = [[UIAlertView alloc] init];
  913 + [alert setTitle:title];
  914 + [alert setMessage:msg];
  915 + [alert setDelegate: [ISN_NativePopUpsManager sharedInstance]];
  916 + [alert addButtonWithTitle:b1];
  917 + [alert addButtonWithTitle:b2];
  918 + [alert show];
  919 +
  920 + _currentAllert = alert;
  921 +
  922 +}
  923 +
  924 +
  925 ++(void) showMessage_old: (NSString *) title message: (NSString*) msg okTitle:(NSString*) b1 {
  926 +
  927 + UIAlertView *alert = [[UIAlertView alloc] init];
  928 + [alert setTitle:title];
  929 + [alert setMessage:msg];
  930 + [alert setDelegate: [ISN_NativePopUpsManager sharedInstance]];
  931 + [alert addButtonWithTitle:b1];
  932 + [alert show];
  933 +
  934 + _currentAllert = alert;
  935 +}
  936 +
  937 +
  938 +
  939 +
  940 +
  941 +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
  942 + [ISN_NativePopUpsManager unregisterAllertView_old];
  943 + UnitySendMessage("IOSPopUp", "onPopUpCallBack", [ISN_DataConvertor NSIntToChar:buttonIndex]);
  944 + UnitySendMessage("IOSRateUsPopUp", "onPopUpCallBack", [ISN_DataConvertor NSIntToChar:buttonIndex]);
  945 +}
  946 +#endif
  947 +
  948 +@end
  949 +
  950 +
  951 +
  952 +
  953 +
  954 +
  955 +
  956 +
  957 +
  958 +
  959 +
  960 +
  961 +@implementation IOSNativeNotificationCenter
  962 +
  963 +
  964 +static IOSNativeNotificationCenter *sharedHelper = nil;
  965 +
  966 ++ (IOSNativeNotificationCenter *) sharedInstance {
  967 + if (!sharedHelper) {
  968 + sharedHelper = [[IOSNativeNotificationCenter alloc] init];
  969 +
  970 +
  971 + }
  972 + return sharedHelper;
  973 +}
  974 +
  975 +- (id)init {
  976 + if ((self = [super init])) {
  977 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"Subscibing..."];
  978 + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
  979 + [notificationCenter addObserver: self
  980 + selector: @selector (handle_NotificationEvent:)
  981 + name: kUnityDidReceiveLocalNotification
  982 + object: nil];
  983 +
  984 +
  985 + }
  986 +
  987 + return self;
  988 +}
  989 +
  990 +
  991 +
  992 +
  993 +#pragma mark Music notification handlers
  994 +
  995 +
  996 +
  997 +#if !TARGET_OS_TV
  998 +
  999 +
  1000 +- (void) handle_NotificationEvent: (NSNotification *) receivedNotification {
  1001 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"ISN: handle_NotificationEvent"];
  1002 + UILocalNotification* notification = (UILocalNotification*) receivedNotification.userInfo;
  1003 +
  1004 +
  1005 + NSMutableString * data = [[NSMutableString alloc] init];
  1006 +
  1007 + if(notification.alertBody != nil) {
  1008 + [data appendString:notification.alertBody];
  1009 + } else {
  1010 + [data appendString:@""];
  1011 + }
  1012 +
  1013 + [data appendString:@"|"];
  1014 +
  1015 +
  1016 + NSString* AlarmKey =[notification.userInfo objectForKey:@"AlarmKey"];
  1017 + if(AlarmKey != nil) {
  1018 + [data appendString:AlarmKey];
  1019 + } else {
  1020 + [data appendString:@""];
  1021 + }
  1022 + [data appendString:@"|"];
  1023 +
  1024 +
  1025 + NSString* dataKey =[notification.userInfo objectForKey:@"data"];
  1026 + if(dataKey != nil) {
  1027 + [data appendString:dataKey];
  1028 + } else {
  1029 + [data appendString:@""];
  1030 + }
  1031 + [data appendString:@"|"];
  1032 +
  1033 +
  1034 + [data appendString: [NSString stringWithFormat:@"%ld", (long)notification.applicationIconBadgeNumber]];
  1035 +
  1036 +
  1037 + NSString *str = [data copy];
  1038 +
  1039 +#if UNITY_VERSION < 500
  1040 + [str autorelease];
  1041 +#endif
  1042 +
  1043 +
  1044 + UnitySendMessage("ISN_LocalNotificationsController", "OnLocalNotificationReceived_Event", [ISN_DataConvertor NSStringToChar:str]);
  1045 +
  1046 +}
  1047 +
  1048 +#endif
  1049 +
  1050 +- (void) RegisterForNotifications {
  1051 +#if !TARGET_OS_TV
  1052 +
  1053 + NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
  1054 + if ([[vComp objectAtIndex:0] intValue] >= 8) {
  1055 + [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
  1056 +
  1057 + }
  1058 +#endif
  1059 +}
  1060 +
  1061 +
  1062 +-(void) scheduleNotification:(int)time message:(NSString *)message sound:(bool *)sound alarmID:(NSString *)alarmID badges:(int)badges notificationData:(NSString *)notificationData notificationSoundName:(NSString *)notificationSoundName{
  1063 +
  1064 +#if !TARGET_OS_TV
  1065 +
  1066 + NSArray *vComp = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."];
  1067 + if ([[vComp objectAtIndex:0] intValue] >= 8) {
  1068 + UIUserNotificationSettings* NotificationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings];
  1069 +
  1070 + if((NotificationSettings.types & UIUserNotificationTypeAlert) == 0) {
  1071 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"ISN: user disabled local notification for this app, sending fail event."];
  1072 +
  1073 + NSMutableString * data = [[NSMutableString alloc] init];
  1074 + [data appendString: @"0" ];
  1075 + [data appendString:@"|"];
  1076 + [data appendString: [NSString stringWithFormat:@"%u",[[UIApplication sharedApplication] currentUserNotificationSettings].types]];
  1077 +
  1078 + UnitySendMessage("ISN_LocalNotificationsController", "OnNotificationScheduleResultAction", [ISN_DataConvertor NSStringToChar:data]);
  1079 +
  1080 + [self RegisterForNotifications];
  1081 + return;
  1082 + }
  1083 +
  1084 + if((NotificationSettings.types & UIUserNotificationTypeBadge) == 0) {
  1085 +
  1086 + if(badges > 0) {
  1087 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"ISN: no badges allowed for this user. Notification badge disabled."];
  1088 + badges = 0;
  1089 + }
  1090 +
  1091 +
  1092 + }
  1093 +
  1094 + if((NotificationSettings.types & UIUserNotificationTypeSound) == 0) {
  1095 + if(sound) {
  1096 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"ISN: no sound allowed for this user. Notification sound disabled."];
  1097 +#if UNITY_VERSION < 500
  1098 + sound = false;
  1099 +#endif
  1100 + }
  1101 +
  1102 + }
  1103 + }
  1104 +
  1105 +
  1106 + UILocalNotification* localNotification = [[UILocalNotification alloc] init];
  1107 + localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:time];
  1108 + localNotification.alertBody = message;
  1109 + localNotification.timeZone = [NSTimeZone defaultTimeZone];
  1110 +
  1111 +
  1112 + if (badges > 0)
  1113 + localNotification.applicationIconBadgeNumber = badges;
  1114 +
  1115 + if(sound) {
  1116 + if([notificationSoundName isEqual:@""]) {
  1117 + localNotification.soundName = UILocalNotificationDefaultSoundName;
  1118 + } else {
  1119 + localNotification.soundName = notificationSoundName;
  1120 + }
  1121 + }
  1122 +
  1123 +
  1124 +
  1125 + NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
  1126 + [userInfo setObject:alarmID forKey:@"AlarmKey"];
  1127 + [userInfo setObject:notificationData forKey:@"data"];
  1128 +
  1129 + // Set some extra info to your alarm
  1130 + localNotification.userInfo = userInfo;
  1131 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"ISN: scheduleNotification AlarmKey: %@", alarmID];
  1132 +
  1133 + [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
  1134 +
  1135 +
  1136 + NSMutableString * data = [[NSMutableString alloc] init];
  1137 + [data appendString: @"1" ];
  1138 + [data appendString:@"|"];
  1139 +
  1140 + if ([[vComp objectAtIndex:0] intValue] >= 8) {
  1141 + [data appendString: [NSString stringWithFormat:@"%u",[[UIApplication sharedApplication] currentUserNotificationSettings].types]];
  1142 + } else {
  1143 + [data appendString:@"7"];
  1144 + }
  1145 +
  1146 +
  1147 + UnitySendMessage("ISN_LocalNotificationsController", "OnNotificationScheduleResultAction", [ISN_DataConvertor NSStringToChar:data]);
  1148 +
  1149 +#endif
  1150 +}
  1151 +
  1152 +#if !TARGET_OS_TV
  1153 +
  1154 +- (UILocalNotification *)existingNotificationWithAlarmID:(NSString *)alarmID {
  1155 + for (UILocalNotification *notification in [[UIApplication sharedApplication] scheduledLocalNotifications]) {
  1156 + if ([[notification.userInfo objectForKey:@"AlarmKey"] isEqualToString:alarmID]) {
  1157 + return notification;
  1158 + }
  1159 + }
  1160 +
  1161 + return nil;
  1162 +}
  1163 +
  1164 +#endif
  1165 +
  1166 +
  1167 +
  1168 +- (void)cleanUpLocalNotificationWithAlarmID:(NSString *)alarmID {
  1169 +#if !TARGET_OS_TV
  1170 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"cleanUpLocalNotificationWithAlarmID AlarmKey: %@", alarmID];
  1171 +
  1172 + UILocalNotification *notification = [self existingNotificationWithAlarmID:alarmID];
  1173 + if (notification) {
  1174 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: @"notification canceled"];
  1175 + [[UIApplication sharedApplication] cancelLocalNotification:notification];
  1176 + }
  1177 +
  1178 +#endif
  1179 +}
  1180 +
  1181 +
  1182 +
  1183 +
  1184 +
  1185 +
  1186 +- (void) cancelNotifications {
  1187 +#if !TARGET_OS_TV
  1188 + [[UIApplication sharedApplication] cancelAllLocalNotifications];
  1189 +#endif
  1190 +}
  1191 +
  1192 +- (void) applicationIconBadgeNumber:(int) badges {
  1193 +#if !TARGET_OS_TV
  1194 + [UIApplication sharedApplication].applicationIconBadgeNumber = badges;
  1195 +#endif
  1196 +}
  1197 +
  1198 +
  1199 +@end
  1200 +
  1201 +
  1202 +@implementation ISNSharedApplication
  1203 +
  1204 +static ISNSharedApplication *sha_sharedInstance;
  1205 +
  1206 +
  1207 ++ (id)sharedInstance {
  1208 +
  1209 + if (sha_sharedInstance == nil) {
  1210 + sha_sharedInstance = [[self alloc] init];
  1211 + }
  1212 +
  1213 + return sha_sharedInstance;
  1214 +}
  1215 +
  1216 +
  1217 +
  1218 +-(void) openUrl:(NSString *)url {
  1219 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
  1220 +}
  1221 +
  1222 +
  1223 +@end
  1224 +
  1225 +
  1226 +extern "C" {
  1227 +
  1228 +
  1229 + //--------------------------------------
  1230 + // Date Time Picker
  1231 + //--------------------------------------
  1232 +
  1233 + void _ISN_ShowDP(int mode) {
  1234 +#if !TARGET_OS_TV
  1235 + [[ISN_NativeUtility sharedInstance] DP_show:mode date:nil];
  1236 +#endif
  1237 + }
  1238 +
  1239 + void _ISN_ShowDPWithTime(int mode, double seconds) {
  1240 +#if !TARGET_OS_TV
  1241 + NSTimeInterval _interval = seconds;
  1242 + NSDate *date = [NSDate dateWithTimeIntervalSince1970:_interval];
  1243 + [[ISN_NativeUtility sharedInstance] DP_show:mode date:date];
  1244 +#endif
  1245 + }
  1246 +
  1247 + //--------------------------------------
  1248 + // IOS Native Utility
  1249 + //--------------------------------------
  1250 +
  1251 + void _ISN_SetApplicationBagesNumber(int count) {
  1252 + [[ISN_NativeUtility sharedInstance] setApplicationBagesNumber:count];
  1253 + }
  1254 +
  1255 +
  1256 + void _ISN_RedirectToAppStoreRatingPage(char* appId) {
  1257 + [[ISN_NativeUtility sharedInstance] redirectToRatingPage: [ISN_DataConvertor charToNSString:appId ]];
  1258 + }
  1259 +
  1260 +
  1261 + void _ISN_ShowPreloader() {
  1262 + [[ISN_NativeUtility sharedInstance] ShowSpinner];
  1263 + }
  1264 +
  1265 +
  1266 + void _ISN_HidePreloader() {
  1267 + [[ISN_NativeUtility sharedInstance] HideSpinner];
  1268 + }
  1269 +
  1270 +
  1271 + void _ISN_GetLocale() {
  1272 + [[ISN_NativeUtility sharedInstance] GetLocale];
  1273 + }
  1274 +
  1275 + void _ISN_SetLogState(bool state) {
  1276 + [[ISN_NativeUtility sharedInstance] ISN_SetLogState:(state)];
  1277 + }
  1278 +
  1279 + void _ISN_NativeLog(char* message) {
  1280 + [[ISN_NativeUtility sharedInstance] ISN_NativeLog: [ISN_DataConvertor charToNSString:message]];
  1281 + }
  1282 +
  1283 + void _ISN_RequestGuidedAccessSession(bool enable) {
  1284 + UIAccessibilityRequestGuidedAccessSession(enable, ^(BOOL didSucceed) {
  1285 + if(didSucceed) {
  1286 + UnitySendMessage("IOSNativeUtility", "OnGuidedAccessSessionRequestResult", "true");
  1287 + } else {
  1288 + UnitySendMessage("IOSNativeUtility", "OnGuidedAccessSessionRequestResult", "false");
  1289 + }
  1290 + });
  1291 + }
  1292 +
  1293 + bool _ISN_IsGuidedAccessEnabled() {
  1294 +
  1295 + return UIAccessibilityIsGuidedAccessEnabled;
  1296 + }
  1297 +
  1298 + bool _ISN_IsRunningTestFlightBeta() {
  1299 + if ([[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) {
  1300 + // TestFlight
  1301 + return true;
  1302 + } else {
  1303 + // App Store (and Apple reviewers too)
  1304 + return false;
  1305 + }
  1306 + }
  1307 +
  1308 +
  1309 + // Helper method to create C string copy
  1310 + char* ISN_MakeStringCopy (const char* string)
  1311 + {
  1312 + if (string == NULL)
  1313 + return NULL;
  1314 +
  1315 + char* res = (char*)malloc(strlen(string) + 1);
  1316 + strcpy(res, string);
  1317 + return res;
  1318 + }
  1319 +
  1320 +
  1321 +
  1322 + const char* _ISN_BuildInfo() {
  1323 + NSMutableString * data = [[NSMutableString alloc] init];
  1324 +
  1325 + NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
  1326 + NSString *appVersion = [infoDict objectForKey:@"CFBundleShortVersionString"]; // example: 1.0.0
  1327 + NSString *buildNumber = [infoDict objectForKey:@"CFBundleVersion"]; // example: 42
  1328 +
  1329 +
  1330 +
  1331 + [data appendString:appVersion];
  1332 + [data appendString:@"|"];
  1333 +
  1334 +
  1335 + [data appendString: buildNumber];
  1336 +
  1337 +
  1338 + return ISN_MakeStringCopy([ISN_DataConvertor NSStringToChar:data]);
  1339 + }
  1340 +
  1341 +
  1342 + const char* _ISN_TimeZoneInfo() {
  1343 +
  1344 + NSMutableString * data = [[NSMutableString alloc] init];
  1345 +
  1346 +
  1347 + [data appendString:[[NSTimeZone localTimeZone] name]];
  1348 + [data appendString:@"|"];
  1349 +
  1350 +
  1351 + [data appendString: [NSString stringWithFormat:@"%u",[[NSTimeZone localTimeZone] secondsFromGMT]]];
  1352 +
  1353 +
  1354 + return ISN_MakeStringCopy([ISN_DataConvertor NSStringToChar:data]);
  1355 +
  1356 + }
  1357 +
  1358 +
  1359 + const char* _ISN_RetriveDeviceData() {
  1360 +
  1361 +
  1362 +
  1363 +
  1364 + NSMutableString * data = [[NSMutableString alloc] init];
  1365 +
  1366 + if([[UIDevice currentDevice] name] != nil) {
  1367 + [data appendString:[[UIDevice currentDevice] name]];
  1368 +
  1369 + } else {
  1370 + [data appendString:@""];
  1371 + }
  1372 + [data appendString:@"|"];
  1373 +
  1374 +
  1375 + if([[UIDevice currentDevice] systemName] != nil) {
  1376 + [data appendString:[[UIDevice currentDevice] systemName]];
  1377 +
  1378 + } else {
  1379 + [data appendString:@""];
  1380 + }
  1381 + [data appendString:@"|"];
  1382 +
  1383 +
  1384 + if([[UIDevice currentDevice] model] != nil) {
  1385 + [data appendString:[[UIDevice currentDevice] model]];
  1386 +
  1387 + } else {
  1388 + [data appendString:@""];
  1389 + }
  1390 + [data appendString:@"|"];
  1391 +
  1392 +
  1393 +
  1394 + if([[UIDevice currentDevice] localizedModel] != nil) {
  1395 + [data appendString:[[UIDevice currentDevice] localizedModel]];
  1396 +
  1397 + } else {
  1398 + [data appendString:@""];
  1399 + }
  1400 + [data appendString:@"|"];
  1401 +
  1402 +
  1403 +
  1404 + [data appendString:[[UIDevice currentDevice] systemVersion]];
  1405 + [data appendString:@"|"];
  1406 +
  1407 + [data appendString:[NSString stringWithFormat: @"%d", [ISN_NativeUtility majorIOSVersion]]];
  1408 + [data appendString:@"|"];
  1409 +
  1410 +
  1411 + int Idiom = -1;
  1412 + switch ([[UIDevice currentDevice] userInterfaceIdiom]) {
  1413 + case UIUserInterfaceIdiomPhone:
  1414 + Idiom = 0;
  1415 + break;
  1416 + case UIUserInterfaceIdiomPad:
  1417 + Idiom = 1;
  1418 + break;
  1419 +
  1420 + default:
  1421 + Idiom = -1;
  1422 + break;
  1423 + }
  1424 +
  1425 + [data appendString:[NSString stringWithFormat: @"%d", Idiom]];
  1426 + [data appendString:@"|"];
  1427 +
  1428 +
  1429 + NSUUID *vendorIdentifier = [[UIDevice currentDevice] identifierForVendor];
  1430 + uuid_t uuid;
  1431 + [vendorIdentifier getUUIDBytes:uuid];
  1432 +
  1433 + NSData *vendorData = [NSData dataWithBytes:uuid length:16];
  1434 + NSString *encodedString = [vendorData base64Encoding];
  1435 + [data appendString:encodedString];
  1436 + [data appendString:@"|"];
  1437 +
  1438 +
  1439 +
  1440 + NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0];
  1441 + [data appendString:language];
  1442 +
  1443 +
  1444 +#if UNITY_VERSION < 500
  1445 + [data autorelease];
  1446 +#endif
  1447 +
  1448 + return ISN_MakeStringCopy([ISN_DataConvertor NSStringToChar:data]);
  1449 + }
  1450 +
  1451 +
  1452 +
  1453 +
  1454 + //--------------------------------------
  1455 + // IOS Native Utility PopUps Plugin Section
  1456 + //--------------------------------------
  1457 +
  1458 +
  1459 + void _MNP_RedirectToAppStoreRatingPage(char* appId) {
  1460 + _ISN_RedirectToAppStoreRatingPage(appId);
  1461 + }
  1462 +
  1463 +
  1464 + void _MNP_ShowPreloader() {
  1465 + _ISN_ShowPreloader();
  1466 + }
  1467 +
  1468 +
  1469 + void _MNP_HidePreloader() {
  1470 + _ISN_HidePreloader();
  1471 + }
  1472 +
  1473 +
  1474 + //--------------------------------------
  1475 + // IOS Native iCloud Section
  1476 + //--------------------------------------
  1477 +
  1478 +
  1479 +
  1480 +
  1481 + void _initCloud () {
  1482 + // [[CloudManager sharedInstance] initialize];
  1483 + }
  1484 +
  1485 + void _setString(char* key, char* val) {
  1486 + NSString* k = [ISN_DataConvertor charToNSString:key];
  1487 + NSString* v = [ISN_DataConvertor charToNSString:val];
  1488 +
  1489 + [[CloudManager sharedInstance] setString:v key:k];
  1490 + }
  1491 +
  1492 +
  1493 + void _setDouble(char* key, float val) {
  1494 + NSString* k = [ISN_DataConvertor charToNSString:key];
  1495 + double v = (double) val;
  1496 +
  1497 + [[CloudManager sharedInstance] setDouble:v key:k];
  1498 + }
  1499 +
  1500 + void _setData(char* key, char* data) {
  1501 + NSString* k = [ISN_DataConvertor charToNSString:key];
  1502 +
  1503 + NSString* mDataString = [ISN_DataConvertor charToNSString:data];
  1504 + NSData *mData = [[NSData alloc] initWithBase64Encoding:mDataString];
  1505 +
  1506 + [[CloudManager sharedInstance] setData:mData key:k];
  1507 +
  1508 + }
  1509 +
  1510 +
  1511 + void _requestDataForKey(char* key) {
  1512 + NSString* k = [ISN_DataConvertor charToNSString:key];
  1513 + [[CloudManager sharedInstance] requestDataForKey:k];
  1514 + }
  1515 +
  1516 +
  1517 + //--------------------------------------
  1518 + // IOS Native Shared App API Section
  1519 + //--------------------------------------
  1520 +
  1521 +
  1522 +
  1523 + BOOL _ISN_CheckUrl(char* url) {
  1524 + NSString *urlString = [ISN_DataConvertor charToNSString:url];
  1525 + NSURL *uri = [NSURL URLWithString:urlString];
  1526 +
  1527 + return [[UIApplication sharedApplication] canOpenURL:uri];
  1528 + }
  1529 +
  1530 + void _ISN_OpenUrl(char* url) {
  1531 + NSString *uri = [ISN_DataConvertor charToNSString:url];
  1532 + [[ISNSharedApplication sharedInstance] openUrl:uri];
  1533 + }
  1534 +
  1535 +
  1536 +
  1537 +
  1538 + //--------------------------------------
  1539 + // IOS Native PopUps API Section
  1540 + //--------------------------------------
  1541 +
  1542 + void _ISN_ShowRateUsPopUp(char* title, char* message, char* b1, char* b2, char* b3) {
  1543 +
  1544 + if([ISN_NativeUtility majorIOSVersion] >= 8) {
  1545 + [ISN_NativePopUpsManager showRateUsPopUp:[ISN_DataConvertor charToNSString:title] message:[ISN_DataConvertor charToNSString:message] b1:[ISN_DataConvertor charToNSString:b1] b2:[ISN_DataConvertor charToNSString:b2] b3:[ISN_DataConvertor charToNSString:b3]];
  1546 + } else {
  1547 +
  1548 +#if !TARGET_OS_TV
  1549 +
  1550 + [ISN_NativePopUpsManager showRateUsPopUp_old:[ISN_DataConvertor charToNSString:title] message:[ISN_DataConvertor charToNSString:message] b1:[ISN_DataConvertor charToNSString:b1] b2:[ISN_DataConvertor charToNSString:b2] b3:[ISN_DataConvertor charToNSString:b3]];
  1551 +
  1552 +#endif
  1553 + }
  1554 + }
  1555 +
  1556 +
  1557 +
  1558 + void _ISN_ShowDialog(char* title, char* message, char* yes, char* no) {
  1559 + if([ISN_NativeUtility majorIOSVersion] >= 8) {
  1560 + [ISN_NativePopUpsManager showDialog:[ISN_DataConvertor charToNSString:title] message:[ISN_DataConvertor charToNSString:message] yesTitle:[ISN_DataConvertor charToNSString:yes] noTitle:[ISN_DataConvertor charToNSString:no]];
  1561 + } else {
  1562 +
  1563 +#if !TARGET_OS_TV
  1564 +
  1565 + [ISN_NativePopUpsManager showDialog_old:[ISN_DataConvertor charToNSString:title] message:[ISN_DataConvertor charToNSString:message] yesTitle:[ISN_DataConvertor charToNSString:yes] noTitle:[ISN_DataConvertor charToNSString:no]];
  1566 +
  1567 +#endif
  1568 + }
  1569 +
  1570 + }
  1571 +
  1572 + void _ISN_ShowMessage(char* title, char* message, char* ok) {
  1573 + if([ISN_NativeUtility majorIOSVersion] >= 8) {
  1574 + [ISN_NativePopUpsManager showMessage:[ISN_DataConvertor charToNSString:title] message:[ISN_DataConvertor charToNSString:message] okTitle:[ISN_DataConvertor charToNSString:ok]];
  1575 + } else {
  1576 +
  1577 +#if !TARGET_OS_TV
  1578 +
  1579 + [ISN_NativePopUpsManager showMessage_old:[ISN_DataConvertor charToNSString:title] message:[ISN_DataConvertor charToNSString:message] okTitle:[ISN_DataConvertor charToNSString:ok]];
  1580 +#endif
  1581 + }
  1582 + }
  1583 +
  1584 +
  1585 +
  1586 + void _ISN_DismissCurrentAlert() {
  1587 + if([ISN_NativeUtility majorIOSVersion] >= 8) {
  1588 + [ISN_NativePopUpsManager dismissCurrentAlert];
  1589 + } else {
  1590 +#if !TARGET_OS_TV
  1591 + [ISN_NativePopUpsManager dismissCurrentAlert_old];
  1592 +#endif
  1593 + }
  1594 +
  1595 + }
  1596 +
  1597 +
  1598 + //--------------------------------------
  1599 + // Native PopUps API PopUps Plugin Section
  1600 + //--------------------------------------
  1601 +
  1602 + void _MNP_ShowRateUsPopUp(char* title, char* message, char* b1, char* b2, char* b3) {
  1603 + _ISN_ShowRateUsPopUp(title, message, b1, b2, b3);
  1604 + }
  1605 +
  1606 +
  1607 + void _MNP_ShowDialog(char* title, char* message, char* yes, char* no) {
  1608 + _ISN_ShowDialog(title, message, yes, no);
  1609 + }
  1610 +
  1611 + void _MNP_ShowMessage(char* title, char* message, char* ok) {
  1612 + _ISN_ShowMessage(title, message, ok);
  1613 + }
  1614 +
  1615 + void _MNP_DismissCurrentAlert() {
  1616 + _ISN_DismissCurrentAlert();
  1617 + }
  1618 +
  1619 +
  1620 + //--------------------------------------
  1621 + // IOS Native Notifications API Section
  1622 + //--------------------------------------
  1623 +
  1624 +
  1625 +
  1626 + void _ISN_CancelNotifications() {
  1627 + [[IOSNativeNotificationCenter sharedInstance] cancelNotifications];
  1628 + }
  1629 +
  1630 +
  1631 + void _ISN_CancelNotificationById(char* nId) {
  1632 + NSString* alarmID = [ISN_DataConvertor charToNSString:nId];
  1633 + [[IOSNativeNotificationCenter sharedInstance] cleanUpLocalNotificationWithAlarmID:alarmID];
  1634 + }
  1635 +
  1636 + void _ISN_RequestNotificationPermissions () {
  1637 + [[IOSNativeNotificationCenter sharedInstance] RegisterForNotifications];
  1638 + }
  1639 +
  1640 +
  1641 + void _ISN_ScheduleNotification (int time, char* message, bool* sound, char* nId, int badges, char* data, char* soundName) {
  1642 + NSString* alarmID = [ISN_DataConvertor charToNSString:nId];
  1643 + NSString* soundNameString = [ISN_DataConvertor charToNSString:soundName];
  1644 + [[IOSNativeNotificationCenter sharedInstance] scheduleNotification:time message:[ISN_DataConvertor charToNSString:message] sound:sound alarmID:alarmID badges:badges notificationData :[ISN_DataConvertor charToNSString:data] notificationSoundName:soundNameString];
  1645 + }
  1646 +
  1647 +
  1648 +
  1649 + void _ISN_ApplicationIconBadgeNumber (int badges) {
  1650 + [[IOSNativeNotificationCenter sharedInstance] applicationIconBadgeNumber:badges];
  1651 + }
  1652 +
  1653 +
  1654 + int _ISN_CurrentNotificationSettings () {
  1655 +#if !TARGET_OS_TV
  1656 + UIUserNotificationSettings* NotificationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings];
  1657 + return NotificationSettings.types;
  1658 +#else
  1659 + return 0;
  1660 +#endif
  1661 + }
  1662 +
  1663 +
  1664 + //--------------------------------------
  1665 + // Cache Section
  1666 + //--------------------------------------
  1667 +
  1668 + void _ISN_CacheSave(char* c_key, char* c_data) {
  1669 +
  1670 + NSString *KEY = [ISN_DataConvertor charToNSString:c_key];
  1671 + NSString *DATA = [ISN_DataConvertor charToNSString:c_data];
  1672 +
  1673 + NSString *file = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:KEY];
  1674 + [DATA writeToFile:file atomically:YES encoding:NSUTF8StringEncoding error:nil];
  1675 + }
  1676 +
  1677 + char* _ISN_CacheGet(char* c_key) {
  1678 + NSString *KEY = [ISN_DataConvertor charToNSString:c_key];
  1679 + NSString *file = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:KEY];
  1680 +
  1681 + NSString *Data = [NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil];
  1682 +
  1683 + if(Data == nil) {
  1684 + Data = @"";
  1685 + }
  1686 +
  1687 +
  1688 + const char* string = [ISN_DataConvertor NSStringToChar:Data];
  1689 + char* res = (char*)malloc(strlen(string) + 1);
  1690 + strcpy(res, string);
  1691 + return res;
  1692 + }
  1693 +
  1694 +
  1695 + void _ISN_CacheRemove(char* c_key) {
  1696 +
  1697 +
  1698 + NSString *KEY = [ISN_DataConvertor charToNSString:c_key];
  1699 + NSString *file = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:KEY];
  1700 +
  1701 +
  1702 + NSFileManager *fm = [NSFileManager defaultManager];
  1703 + [fm removeItemAtPath:file error:nil];
  1704 +
  1705 + }
  1706 +
  1707 +
  1708 +}
  1709 +
  1710 +
  1711 +
  1712 +
  1713 +
  1714 +
... ...
Assets/Plugins/IOS/ISN_NativeCore.mm.meta 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +fileFormatVersion: 2
  2 +guid: c4ebc7b763677c5498b6bd83250a1d4e
  3 +timeCreated: 1485642295
  4 +licenseType: Free
  5 +PluginImporter:
  6 + serializedVersion: 1
  7 + iconMap: {}
  8 + executionOrder: {}
  9 + isPreloaded: 0
  10 + platformData:
  11 + Any:
  12 + enabled: 0
  13 + settings: {}
  14 + Editor:
  15 + enabled: 0
  16 + settings:
  17 + DefaultValueInitialized: true
  18 + iOS:
  19 + enabled: 1
  20 + settings: {}
  21 + userData:
  22 + assetBundleName:
  23 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 51dcebb6a7295ca43b3b2e4b53fc8eeb
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 9d1db1d335b5c434ebb608f9c621a64e
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: d77c3843128c746449f0403a477440fa
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Documentation.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 09e7712df1a85544c97a43f11ec1d721
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Documentation/MNP_VersionNotes 0 → 100644
... ... @@ -0,0 +1,98 @@
  1 +4.7:
  2 +Overall performance improvements
  3 +Compatibility updates & fixes
  4 +
  5 +4.6:
  6 +Overall performance improvements
  7 +Compatibility updates & fixes
  8 +
  9 +4.5:
  10 +!!!Important!!! This version of the plugin is not compatible with the previous one.
  11 +Please, remove the previous version and import the new one after.
  12 +If you will face any kind of issues, please, contact Support Team via support@stansassets.com for assistance.
  13 +
  14 +Overall performance improvements
  15 +Compatibility updates & fixes
  16 +
  17 +4.4:
  18 +Compatibility update
  19 +Refactor changes
  20 +
  21 +4.3:
  22 +Unity v4.6.x compatibility update
  23 +
  24 +4.2:
  25 +Compatibility update
  26 +
  27 +4.1:
  28 +New Features:
  29 +New DismissDialog API
  30 +
  31 +Compatibility update
  32 +
  33 +4.0:
  34 +Compatibility update
  35 +
  36 +3.9:
  37 +Compatibility update
  38 +
  39 +3.3:
  40 +Lollipop Theme Material Light Dialog added for Android Popups
  41 +
  42 +3.2:
  43 +Now uses Holo Theme for Android Popups
  44 +
  45 +3.1:
  46 +Android Native classes dependencies removed
  47 +Android folder clean up
  48 +
  49 +
  50 +3.0:
  51 +Compatibility update
  52 +
  53 +2.9:
  54 +Compatibility update
  55 +Plugin not requires main activity anymore
  56 +
  57 +2.8:
  58 +
  59 +Updates:
  60 +Compatibility update
  61 +C# Actions support added
  62 +
  63 +Refactor:
  64 +Flash Like event system now use own namespace: UnionAssets.FLE
  65 +
  66 +
  67 +Updates:
  68 +C# Actions Support added
  69 +
  70 +Read more
  71 +http://goo.gl/uS4OjX
  72 +
  73 +
  74 +2.4:
  75 +Compatibility update
  76 +
  77 +1.7:
  78 +Compatibility update
  79 +
  80 +1.6:
  81 +Compatibility update
  82 +Android Build Fix
  83 +
  84 +1.5:
  85 +WP8 preloader added
  86 +
  87 +1.4:
  88 +Compatibility update
  89 +
  90 +1.3:
  91 +Rate app Play Maker action fixed
  92 +
  93 +1.2:
  94 +Example Scene Improved
  95 +Coflict with IOS Native fixed
  96 +
  97 +1.0:
  98 +Initial version.
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Documentation/MNP_VersionNotes.meta 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +fileFormatVersion: 2
  2 +guid: da67b55dd77c94c659e9bb271e0a810f
  3 +DefaultImporter:
  4 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Documentation/ReadMe.txt 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +Documentation:
  2 +Documentation links is inside Unity Main Menu:
  3 +
  4 +Window -> Stan's Assets -> Android Native
  5 +
  6 +Support:
  7 +https://stansassets.com/#contacts
  8 +
  9 +More Products:
  10 +https://goo.gl/PE66IU
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Documentation/ReadMe.txt.meta 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +fileFormatVersion: 2
  2 +guid: ff2f9f413512449d7a3537673f578e37
  3 +TextScriptImporter:
  4 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Editor.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 876dd87232e6eec4fa462c15ff401236
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Editor/MNPInit.cs 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +#if UNITY_EDITOR
  2 +using UnityEngine;
  3 +using System.Collections;
  4 +using UnityEditor;
  5 +
  6 +[InitializeOnLoad]
  7 +public class MNPInit {
  8 +
  9 + static MNPInit () {
  10 +
  11 + if(!MNP_PlatformSettingsEditor.IsInstalled) {
  12 + EditorApplication.update += OnEditorLoaded;
  13 + } else {
  14 + if(!MNP_PlatformSettingsEditor.IsUpToDate) {
  15 + EditorApplication.update += OnEditorLoaded;
  16 + }
  17 + }
  18 +
  19 + }
  20 +
  21 + private static void OnEditorLoaded() {
  22 +
  23 + EditorApplication.update -= OnEditorLoaded;
  24 + Debug.LogWarning("Mobile Native Pop Up Plugin Install Required. Opening Plugin settings...");
  25 + Selection.activeObject = MNP_PlatformSettings.Instance;
  26 + }
  27 +}
  28 +#endif
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Editor/MNPInit.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: a17ebb2c287c24de5a378d137c12a4cb
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Editor/MNP_PlatformMenu.cs 0 → 100644
... ... @@ -0,0 +1,27 @@
  1 +#if UNITY_EDITOR
  2 +using UnityEngine;
  3 +using UnityEditor;
  4 +using System.Collections;
  5 +
  6 +public class MNP_PlatformMenu : EditorWindow {
  7 +
  8 + #if UNITY_EDITOR
  9 +
  10 + //--------------------------------------
  11 + // GENERAL
  12 + //--------------------------------------
  13 +
  14 + [MenuItem("Window/Stan's Assets/Mobile Native Popups/Edit Settings", false, 107)]
  15 + public static void Edit() {
  16 + Selection.activeObject = MNP_PlatformSettings.Instance;
  17 + }
  18 +
  19 + [MenuItem("Window/Stan's Assets/Mobile Native Popups/Documentation", false, 107)]
  20 + public static void Documentation() {
  21 + Application.OpenURL("https://goo.gl/zdCgFx");
  22 + }
  23 +
  24 +
  25 + #endif
  26 +}
  27 +#endif
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Editor/MNP_PlatformMenu.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 00ebf6bdcb46e4a318186d89630c327a
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Editor/MNP_PlatformSettingsEditor.cs 0 → 100644
... ... @@ -0,0 +1,169 @@
  1 +#if UNITY_EDITOR
  2 +using UnityEngine;
  3 +using UnityEditor;
  4 +using System.Collections;
  5 +using System.Collections.Generic;
  6 +using System.Reflection;
  7 +
  8 +[CustomEditor(typeof(MNP_PlatformSettings))]
  9 +public class MNP_PlatformSettingsEditor : Editor {
  10 +
  11 + static GUIContent SdkVersion = new GUIContent("Plugin Version [?]", "This is Plugin version. If you have problems or compliments please include this so we know exactly what version to look out for.");
  12 + static GUIContent SupportEmail = new GUIContent("Support [?]", "If you have any technical quastion, feel free to drop an e-mail");
  13 +
  14 +
  15 +
  16 + private const string IOS_SOURCE_PATH = "Plugins/StansAssets/IOS/";
  17 + private const string IOS_DESTANATION_PATH = "Plugins/IOS/";
  18 + private const string ANDROID_SOURCE_PATH = "Plugins/StansAssets/Android/";
  19 + private const string ANDROID_DESTANATION_PATH = "Plugins/Android/";
  20 +
  21 +
  22 + public override void OnInspectorGUI() {
  23 +
  24 + #if UNITY_WEBPLAYER
  25 +
  26 +
  27 + if(Application.isEditor) {
  28 + return;
  29 + }
  30 +
  31 + #endif
  32 +
  33 + GUI.changed = false;
  34 +
  35 + EditorGUILayout.Space();
  36 +
  37 + GeneralOptions ();
  38 +
  39 + EditorGUILayout.HelpBox("Android Platform-Specific Settings", MessageType.None);
  40 + EditorGUILayout.BeginHorizontal();
  41 + EditorGUILayout.LabelField("Android Dialogs Theme");
  42 + MNP_PlatformSettings.Instance.AndroidDialogTheme = (MNAndroidDialogTheme) EditorGUILayout.EnumPopup(MNP_PlatformSettings.Instance.AndroidDialogTheme);
  43 + EditorGUILayout.EndHorizontal();
  44 + EditorGUILayout.Space();
  45 +
  46 + AboutGUI();
  47 +
  48 + if(GUI.changed) {
  49 + DirtyEditor();
  50 + }
  51 + }
  52 +
  53 +
  54 + private void GeneralOptions() {
  55 +
  56 + if(!IsInstalled) {
  57 + EditorGUILayout.HelpBox("Install Required ", MessageType.Error);
  58 +
  59 + EditorGUILayout.BeginHorizontal();
  60 + EditorGUILayout.Space();
  61 + Color c = GUI.color;
  62 + GUI.color = Color.cyan;
  63 + if(GUILayout.Button("Install Plugin", GUILayout.Width(120))) {
  64 + SA.Common.Editor.Instalation.Android_InstallPlugin();
  65 + SA.Common.Editor.Instalation.IOS_InstallPlugin();
  66 + UpdateVersionInfo();
  67 + }
  68 + GUI.color = c;
  69 + EditorGUILayout.EndHorizontal();
  70 + }
  71 +
  72 + if(IsInstalled) {
  73 + if(!IsUpToDate) {
  74 + EditorGUILayout.HelpBox("Update Required \nResources version: " + SA.Common.Editor.VersionsManager.MNP_StringVersionId + " Plugin version: " + MNP_PlatformSettings.VERSION_NUMBER, MessageType.Warning);
  75 +
  76 +
  77 +
  78 +
  79 + EditorGUILayout.BeginHorizontal();
  80 + EditorGUILayout.Space();
  81 + Color c = GUI.color;
  82 + GUI.color = Color.cyan;
  83 +
  84 + Debug.Log(SA.Common.Editor.VersionsManager.MNP_Version);
  85 + if(CurrentVersion != SA.Common.Editor.VersionsManager.MNP_Version) {
  86 + if(GUILayout.Button("Upgrade Resources", GUILayout.Width(250))) {
  87 + SA.Common.Editor.Instalation.Android_InstallPlugin();
  88 + SA.Common.Editor.Instalation.IOS_InstallPlugin();
  89 + UpdateVersionInfo();
  90 + }
  91 + }
  92 +
  93 + GUI.color = c;
  94 + EditorGUILayout.Space();
  95 + EditorGUILayout.EndHorizontal();
  96 +
  97 + EditorGUILayout.Space();
  98 +
  99 + } else {
  100 + EditorGUILayout.HelpBox("Mobile Native Pop Up v" + MNP_PlatformSettings.VERSION_NUMBER + " is installed", MessageType.Info);
  101 +
  102 + }
  103 + }
  104 +
  105 + EditorGUILayout.Space();
  106 +
  107 + }
  108 + /*****************/
  109 +
  110 + public static void UpdateVersionInfo() {
  111 + SA.Common.Util.Files.Write(SA.Common.Config.MNP_VERSION_INFO_PATH, MNP_PlatformSettings.VERSION_NUMBER);
  112 +
  113 + }
  114 +
  115 +
  116 + public static bool IsInstalled {
  117 + get {
  118 + return SA.Common.Editor.VersionsManager.Is_MNP_Installed;
  119 + }
  120 + }
  121 +
  122 + public static bool IsUpToDate {
  123 + get {
  124 + if(CurrentVersion == SA.Common.Editor.VersionsManager.MNP_Version) {
  125 + return true;
  126 + } else {
  127 + return false;
  128 + }
  129 + }
  130 + }
  131 +
  132 + public static int CurrentVersion {
  133 + get {
  134 + return SA.Common.Editor.VersionsManager.ParceVersion(MNP_PlatformSettings.VERSION_NUMBER);
  135 + }
  136 + }
  137 +
  138 + public static int CurrentMagorVersion {
  139 + get {
  140 + return SA.Common.Editor.VersionsManager.ParceMagorVersion(MNP_PlatformSettings.VERSION_NUMBER);
  141 + }
  142 + }
  143 +
  144 + public static void DirtyEditor() {
  145 + #if UNITY_EDITOR
  146 + EditorUtility.SetDirty(MNP_PlatformSettings.Instance);
  147 + #endif
  148 + }
  149 +
  150 + private void AboutGUI() {
  151 +
  152 +
  153 + EditorGUILayout.HelpBox("Version Info", MessageType.None);
  154 + EditorGUILayout.Space();
  155 + SelectableLabelField(SdkVersion, MNP_PlatformSettings.VERSION_NUMBER);
  156 + EditorGUILayout.Space();
  157 + SelectableLabelField(SupportEmail, "stans.assets@gmail.com");
  158 +
  159 + }
  160 +
  161 + private static void SelectableLabelField(GUIContent label, string value) {
  162 + EditorGUILayout.BeginHorizontal();
  163 + EditorGUILayout.LabelField(label, GUILayout.Width(180), GUILayout.Height(16));
  164 + EditorGUILayout.SelectableLabel(value, GUILayout.Height(16));
  165 + EditorGUILayout.EndHorizontal();
  166 + }
  167 +
  168 + }
  169 +#endif
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Editor/MNP_PlatformSettingsEditor.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: af89499e718c3444992fe8f090f41dcc
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Example.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 063ee938fcbd031429044c739864c0f9
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Example/MNFeaturePreview.cs 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module IOS Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System.Collections;
  11 +
  12 +public class MNFeaturePreview : MonoBehaviour {
  13 +
  14 + protected GUIStyle style;
  15 +
  16 + protected int buttonWidth = 200;
  17 + protected int buttonHeight = 50;
  18 + protected float StartY = 20;
  19 + protected float StartX = 10;
  20 +
  21 +
  22 +
  23 + protected float XStartPos = 10;
  24 + protected float YStartPos = 10;
  25 +
  26 + protected float XButtonStep = 220;
  27 + protected float YButtonStep = 60;
  28 +
  29 + protected float YLableStep = 40;
  30 +
  31 +
  32 + //--------------------------------------
  33 + // INITIALIZE
  34 + //--------------------------------------
  35 +
  36 + protected virtual void InitStyles () {
  37 + style = new GUIStyle();
  38 + style.normal.textColor = Color.white;
  39 + style.fontSize = 16;
  40 + style.fontStyle = FontStyle.BoldAndItalic;
  41 + style.alignment = TextAnchor.UpperLeft;
  42 + style.wordWrap = true;
  43 +
  44 + }
  45 +
  46 +
  47 + public virtual void Start() {
  48 + InitStyles();
  49 + }
  50 +
  51 + public void UpdateToStartPos() {
  52 + StartY = YStartPos;
  53 + StartX = XStartPos;
  54 + }
  55 +}
  56 +
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Example/MNFeaturePreview.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 29cb2e81c58fe4dbb90ee64550e09b9a
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Example/MNUseExample.cs 0 → 100644
... ... @@ -0,0 +1,133 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module <module_name>
  4 +// @author Osipov Stanislav lacost.st@gmail.com
  5 +//
  6 +////////////////////////////////////////////////////////////////////////////////
  7 +
  8 +using UnityEngine;
  9 +using System.Collections;
  10 +
  11 +public class MNUseExample : MNFeaturePreview {
  12 +
  13 + public string appleId = "";
  14 + public string androidAppUrl = "market://details?id=com.google.earth";
  15 +
  16 + void Awake() {
  17 +
  18 + }
  19 +
  20 + void OnGUI() {
  21 +
  22 + UpdateToStartPos();
  23 +
  24 + GUI.Label(new Rect(StartX, StartY, Screen.width, 40), "Native Pop Ups", style);
  25 + StartY+= YLableStep;
  26 +
  27 +
  28 + if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Rate PopUp with events")) {
  29 + MobileNativeRateUs ratePopUp = new MobileNativeRateUs("Like this game?", "Please rate to support future updates!");
  30 + ratePopUp.SetAppleId(appleId);
  31 + ratePopUp.SetAndroidAppUrl(androidAppUrl);
  32 + ratePopUp.OnComplete += OnRatePopUpClose;
  33 +
  34 + ratePopUp.Start();
  35 +
  36 +
  37 + }
  38 +
  39 +
  40 + StartX += XButtonStep;
  41 + if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Dialog PopUp")) {
  42 + MobileNativeDialog dialog = new MobileNativeDialog("Dialog Titile", "Dialog message");
  43 + dialog.OnComplete += OnDialogClose;
  44 +
  45 + Invoke("Dismiss", 2.0f);
  46 + }
  47 +
  48 +
  49 + StartX += XButtonStep;
  50 + if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Message PopUp")) {
  51 + MobileNativeMessage msg = new MobileNativeMessage("Message Titile", "Message message");
  52 + msg.OnComplete += OnMessageClose;
  53 + }
  54 +
  55 + StartY += YButtonStep;
  56 + StartX = XStartPos;
  57 + if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Show Prealoder")) {
  58 + MNP.ShowPreloader("Title", "Message");
  59 + Invoke("OnPreloaderTimeOut", 3f);
  60 + }
  61 +
  62 + StartX += XButtonStep;
  63 + if(GUI.Button(new Rect(StartX, StartY, buttonWidth, buttonHeight), "Hide Prealoder")) {
  64 + MNP.HidePreloader();
  65 + }
  66 +
  67 + }
  68 +
  69 + private void Dismiss() {
  70 + Debug.Log("DIALOG DISMISS");
  71 + MNAndroidNative.dismissDialog();
  72 + }
  73 +
  74 + //--------------------------------------
  75 + // GET/SET
  76 + //--------------------------------------
  77 +
  78 + //--------------------------------------
  79 + // EVENTS
  80 + //--------------------------------------
  81 +
  82 +
  83 + private void OnPreloaderTimeOut() {
  84 + MNP.HidePreloader();
  85 + }
  86 +
  87 +
  88 +
  89 + private void OnRatePopUpClose(MNDialogResult result) {
  90 +
  91 + //parsing result
  92 + switch(result) {
  93 + case MNDialogResult.RATED:
  94 + Debug.Log ("Rate Option pickied");
  95 + break;
  96 + case MNDialogResult.REMIND:
  97 + Debug.Log ("Remind Option pickied");
  98 + break;
  99 + case MNDialogResult.DECLINED:
  100 + Debug.Log ("Declined Option pickied");
  101 + break;
  102 + }
  103 +
  104 + new MobileNativeMessage("Result", result.ToString() + " button pressed");
  105 +
  106 + }
  107 +
  108 + private void OnDialogClose(MNDialogResult result) {
  109 +
  110 +
  111 + //parsing result
  112 + switch(result) {
  113 + case MNDialogResult.YES:
  114 + Debug.Log ("Yes button pressed");
  115 + break;
  116 + case MNDialogResult.NO:
  117 + Debug.Log ("No button pressed");
  118 + break;
  119 +
  120 + }
  121 +
  122 + new MobileNativeMessage("Result", result.ToString() + " button pressed");
  123 + }
  124 +
  125 + private void OnMessageClose() {
  126 +
  127 + new MobileNativeMessage("Result", "Message Closed");
  128 + }
  129 +
  130 +
  131 +
  132 +
  133 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Example/MNUseExample.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 3c579605fe8654b658e7d9238ead4a54
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Example/MobilePopUpsExample.unity 0 → 100644
... ... @@ -0,0 +1,221 @@
  1 +%YAML 1.1
  2 +%TAG !u! tag:unity3d.com,2011:
  3 +--- !u!29 &1
  4 +SceneSettings:
  5 + m_ObjectHideFlags: 0
  6 + m_PVSData:
  7 + m_PVSObjectsArray: []
  8 + m_PVSPortalsArray: []
  9 + m_OcclusionBakeSettings:
  10 + smallestOccluder: 5
  11 + smallestHole: 0.25
  12 + backfaceThreshold: 100
  13 +--- !u!104 &2
  14 +RenderSettings:
  15 + m_ObjectHideFlags: 0
  16 + serializedVersion: 7
  17 + m_Fog: 0
  18 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
  19 + m_FogMode: 3
  20 + m_FogDensity: 0.01
  21 + m_LinearFogStart: 0
  22 + m_LinearFogEnd: 300
  23 + m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
  24 + m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
  25 + m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
  26 + m_AmbientIntensity: 1
  27 + m_AmbientMode: 3
  28 + m_SkyboxMaterial: {fileID: 0}
  29 + m_HaloStrength: 0.5
  30 + m_FlareStrength: 1
  31 + m_FlareFadeSpeed: 3
  32 + m_HaloTexture: {fileID: 0}
  33 + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
  34 + m_DefaultReflectionMode: 0
  35 + m_DefaultReflectionResolution: 128
  36 + m_ReflectionBounces: 1
  37 + m_ReflectionIntensity: 1
  38 + m_CustomReflection: {fileID: 0}
  39 + m_Sun: {fileID: 0}
  40 + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
  41 +--- !u!157 &4
  42 +LightmapSettings:
  43 + m_ObjectHideFlags: 0
  44 + serializedVersion: 7
  45 + m_GIWorkflowMode: 1
  46 + m_GISettings:
  47 + serializedVersion: 2
  48 + m_BounceScale: 1
  49 + m_IndirectOutputScale: 1
  50 + m_AlbedoBoost: 1
  51 + m_TemporalCoherenceThreshold: 1
  52 + m_EnvironmentLightingMode: 0
  53 + m_EnableBakedLightmaps: 1
  54 + m_EnableRealtimeLightmaps: 0
  55 + m_LightmapEditorSettings:
  56 + serializedVersion: 4
  57 + m_Resolution: 1
  58 + m_BakeResolution: 50
  59 + m_TextureWidth: 1024
  60 + m_TextureHeight: 1024
  61 + m_AO: 1
  62 + m_AOMaxDistance: 1
  63 + m_CompAOExponent: 1
  64 + m_CompAOExponentDirect: 0
  65 + m_Padding: 2
  66 + m_LightmapParameters: {fileID: 0}
  67 + m_LightmapsBakeMode: 1
  68 + m_TextureCompression: 0
  69 + m_DirectLightInLightProbes: 1
  70 + m_FinalGather: 0
  71 + m_FinalGatherFiltering: 1
  72 + m_FinalGatherRayCount: 256
  73 + m_ReflectionCompression: 2
  74 + m_LightingDataAsset: {fileID: 0}
  75 + m_RuntimeCPUUsage: 25
  76 +--- !u!196 &5
  77 +NavMeshSettings:
  78 + serializedVersion: 2
  79 + m_ObjectHideFlags: 0
  80 + m_BuildSettings:
  81 + serializedVersion: 2
  82 + agentRadius: 0.5
  83 + agentHeight: 2
  84 + agentSlope: 45
  85 + agentClimb: 0.4
  86 + ledgeDropHeight: 0
  87 + maxJumpAcrossDistance: 0
  88 + accuratePlacement: 0
  89 + minRegionArea: 2
  90 + cellSize: 0.16666666
  91 + manualCellSize: 0
  92 + m_NavMeshData: {fileID: 0}
  93 +--- !u!1 &772199679
  94 +GameObject:
  95 + m_ObjectHideFlags: 0
  96 + m_PrefabParentObject: {fileID: 0}
  97 + m_PrefabInternal: {fileID: 0}
  98 + serializedVersion: 4
  99 + m_Component:
  100 + - 4: {fileID: 772199684}
  101 + - 20: {fileID: 772199683}
  102 + - 92: {fileID: 772199682}
  103 + - 124: {fileID: 772199681}
  104 + - 81: {fileID: 772199680}
  105 + m_Layer: 0
  106 + m_Name: Main Camera
  107 + m_TagString: MainCamera
  108 + m_Icon: {fileID: 0}
  109 + m_NavMeshLayer: 0
  110 + m_StaticEditorFlags: 0
  111 + m_IsActive: 1
  112 +--- !u!81 &772199680
  113 +AudioListener:
  114 + m_ObjectHideFlags: 0
  115 + m_PrefabParentObject: {fileID: 0}
  116 + m_PrefabInternal: {fileID: 0}
  117 + m_GameObject: {fileID: 772199679}
  118 + m_Enabled: 1
  119 +--- !u!124 &772199681
  120 +Behaviour:
  121 + m_ObjectHideFlags: 0
  122 + m_PrefabParentObject: {fileID: 0}
  123 + m_PrefabInternal: {fileID: 0}
  124 + m_GameObject: {fileID: 772199679}
  125 + m_Enabled: 1
  126 +--- !u!92 &772199682
  127 +Behaviour:
  128 + m_ObjectHideFlags: 0
  129 + m_PrefabParentObject: {fileID: 0}
  130 + m_PrefabInternal: {fileID: 0}
  131 + m_GameObject: {fileID: 772199679}
  132 + m_Enabled: 1
  133 +--- !u!20 &772199683
  134 +Camera:
  135 + m_ObjectHideFlags: 0
  136 + m_PrefabParentObject: {fileID: 0}
  137 + m_PrefabInternal: {fileID: 0}
  138 + m_GameObject: {fileID: 772199679}
  139 + m_Enabled: 1
  140 + serializedVersion: 2
  141 + m_ClearFlags: 1
  142 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
  143 + m_NormalizedViewPortRect:
  144 + serializedVersion: 2
  145 + x: 0
  146 + y: 0
  147 + width: 1
  148 + height: 1
  149 + near clip plane: 0.3
  150 + far clip plane: 1000
  151 + field of view: 60
  152 + orthographic: 0
  153 + orthographic size: 5
  154 + m_Depth: -1
  155 + m_CullingMask:
  156 + serializedVersion: 2
  157 + m_Bits: 4294967295
  158 + m_RenderingPath: -1
  159 + m_TargetTexture: {fileID: 0}
  160 + m_TargetDisplay: 0
  161 + m_TargetEye: 3
  162 + m_HDR: 0
  163 + m_OcclusionCulling: 1
  164 + m_StereoConvergence: 10
  165 + m_StereoSeparation: 0.022
  166 + m_StereoMirrorMode: 0
  167 +--- !u!4 &772199684
  168 +Transform:
  169 + m_ObjectHideFlags: 0
  170 + m_PrefabParentObject: {fileID: 0}
  171 + m_PrefabInternal: {fileID: 0}
  172 + m_GameObject: {fileID: 772199679}
  173 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
  174 + m_LocalPosition: {x: 0, y: 1, z: -10}
  175 + m_LocalScale: {x: 1, y: 1, z: 1}
  176 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
  177 + m_Children: []
  178 + m_Father: {fileID: 0}
  179 + m_RootOrder: 1
  180 +--- !u!1 &844646522
  181 +GameObject:
  182 + m_ObjectHideFlags: 0
  183 + m_PrefabParentObject: {fileID: 0}
  184 + m_PrefabInternal: {fileID: 0}
  185 + serializedVersion: 4
  186 + m_Component:
  187 + - 4: {fileID: 844646524}
  188 + - 114: {fileID: 844646523}
  189 + m_Layer: 0
  190 + m_Name: Exmaple
  191 + m_TagString: Untagged
  192 + m_Icon: {fileID: 0}
  193 + m_NavMeshLayer: 0
  194 + m_StaticEditorFlags: 0
  195 + m_IsActive: 1
  196 +--- !u!114 &844646523
  197 +MonoBehaviour:
  198 + m_ObjectHideFlags: 0
  199 + m_PrefabParentObject: {fileID: 0}
  200 + m_PrefabInternal: {fileID: 0}
  201 + m_GameObject: {fileID: 844646522}
  202 + m_Enabled: 1
  203 + m_EditorHideFlags: 0
  204 + m_Script: {fileID: 11500000, guid: 3c579605fe8654b658e7d9238ead4a54, type: 3}
  205 + m_Name:
  206 + m_EditorClassIdentifier:
  207 + appleId: 323933363232303937
  208 + apdroidAppUrl: 6d61726b65743a2f2f64657461696c733f69643d636f6d2e676f6f676c652e6561727468
  209 +--- !u!4 &844646524
  210 +Transform:
  211 + m_ObjectHideFlags: 0
  212 + m_PrefabParentObject: {fileID: 0}
  213 + m_PrefabInternal: {fileID: 0}
  214 + m_GameObject: {fileID: 844646522}
  215 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
  216 + m_LocalPosition: {x: 0, y: 0, z: 0}
  217 + m_LocalScale: {x: 1, y: 1, z: 1}
  218 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
  219 + m_Children: []
  220 + m_Father: {fileID: 0}
  221 + m_RootOrder: 0
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Example/MobilePopUpsExample.unity.meta 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +fileFormatVersion: 2
  2 +guid: 9ab2603f448014cdaa217433b8cd3698
  3 +DefaultImporter:
  4 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 314b4a96bb044ab4bb986d0a7e088513
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 574d605bfe6d7d24a83ac64533a03d68
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MNP.cs 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +using UnityEngine;
  2 +using System.Collections;
  3 +
  4 +public class MNP {
  5 +
  6 + public static void ShowPreloader(string title, string message) {
  7 +
  8 + #if UNITY_ANDROID
  9 + MNAndroidNative.ShowPreloader(title, message, MNP_PlatformSettings.Instance.AndroidDialogTheme);
  10 + #endif
  11 +
  12 + #if UNITY_IPHONE
  13 + MNIOSNative.ShowPreloader();
  14 + #endif
  15 +
  16 + #if UNITY_WP8
  17 + WP8PopUps.PopUp.ShowPreLoader(100);
  18 + #endif
  19 +
  20 +
  21 + }
  22 +
  23 + public static void HidePreloader() {
  24 +
  25 + #if UNITY_ANDROID
  26 + MNAndroidNative.HidePreloader();
  27 + #endif
  28 +
  29 +
  30 + #if UNITY_IPHONE
  31 + MNIOSNative.HidePreloader();
  32 + #endif
  33 +
  34 +
  35 + #if UNITY_WP8
  36 + WP8PopUps.PopUp.HidePreLoader();
  37 + #endif
  38 + }
  39 +}
  40 +
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MNP.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 4f8381ddd09564c50acfe0673e854f75
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MNP_PlatformSettings.cs 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +using UnityEngine;
  2 +using System.IO;
  3 +using System.Collections.Generic;
  4 +
  5 +#if UNITY_EDITOR
  6 +using UnityEditor;
  7 +[InitializeOnLoad]
  8 +#endif
  9 +
  10 +public class MNP_PlatformSettings : ScriptableObject {
  11 +
  12 + private const string ISNSettingsAssetName = "MNPSettings";
  13 + private const string ISNSettingsPath = SA.Common.Config.SETTINGS_PATH;
  14 + private const string ISNSettingsAssetExtension = ".asset";
  15 +
  16 + public MNAndroidDialogTheme AndroidDialogTheme = MNAndroidDialogTheme.ThemeDeviceDefaultDark;
  17 +
  18 + public const string VERSION_NUMBER = "4.7";
  19 +
  20 + private static MNP_PlatformSettings instance = null;
  21 +
  22 +
  23 + public static MNP_PlatformSettings Instance {
  24 +
  25 + get {
  26 + if (instance == null) {
  27 + instance = Resources.Load(ISNSettingsAssetName) as MNP_PlatformSettings;
  28 +
  29 + if (instance == null) {
  30 +
  31 + // If not found, autocreate the asset object.
  32 + instance = CreateInstance<MNP_PlatformSettings>();
  33 + #if UNITY_EDITOR
  34 + SA.Common.Util.Files.CreateFolder(ISNSettingsPath);
  35 + string fullPath = Path.Combine(Path.Combine("Assets", ISNSettingsPath),
  36 + ISNSettingsAssetName + ISNSettingsAssetExtension);
  37 +
  38 + AssetDatabase.CreateAsset(instance, fullPath);
  39 +
  40 +
  41 +
  42 +
  43 + #endif
  44 + }
  45 + }
  46 + return instance;
  47 + }
  48 + }
  49 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MNP_PlatformSettings.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: a6846815ec00c4d53bf726ba97916536
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MNPopup.cs 0 → 100644
... ... @@ -0,0 +1,49 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Android Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System;
  11 +using System.Collections;
  12 +using System.Collections.Generic;
  13 +
  14 +public class MNPopup : MonoBehaviour {
  15 +
  16 +
  17 + public string title;
  18 + public string message;
  19 +
  20 +
  21 + public Action<MNDialogResult> OnComplete = delegate {};
  22 +
  23 + //--------------------------------------
  24 + // INITIALIZE
  25 + //--------------------------------------
  26 +
  27 + //--------------------------------------
  28 + // PUBLIC METHODS
  29 + //--------------------------------------
  30 +
  31 + //--------------------------------------
  32 + // GET/SET
  33 + //--------------------------------------
  34 +
  35 + //--------------------------------------
  36 + // EVENTS
  37 + //--------------------------------------
  38 +
  39 +
  40 + //--------------------------------------
  41 + // PRIVATE METHODS
  42 + //--------------------------------------
  43 +
  44 + //--------------------------------------
  45 + // DESTROY
  46 + //--------------------------------------
  47 +
  48 +
  49 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MNPopup.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 267ef38fad60c470ebc7ad569bea48b7
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MobileNativeDialog.cs 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 +using UnityEngine;
  2 +using System;
  3 +using System.Collections;
  4 +
  5 +public class MobileNativeDialog {
  6 +
  7 + public Action<MNDialogResult> OnComplete = delegate {};
  8 +
  9 + public MobileNativeDialog(string title, string message) {
  10 + init(title, message, "Yes", "No");
  11 + }
  12 +
  13 + public MobileNativeDialog(string title, string message, string yes, string no) {
  14 + init(title, message, yes, no);
  15 + }
  16 +
  17 +
  18 + private void init(string title, string message, string yes, string no) {
  19 +
  20 + #if UNITY_WP8
  21 + MNWP8Dialog dialog = MNWP8Dialog.Create(title, message);
  22 + dialog.OnComplete += OnCompleteListener;
  23 + #endif
  24 +
  25 +
  26 + #if UNITY_IPHONE
  27 + MNIOSDialog dialog = MNIOSDialog.Create(title, message, yes, no);
  28 + dialog.OnComplete += OnCompleteListener;
  29 + #endif
  30 +
  31 + #if UNITY_ANDROID
  32 + MNAndroidDialog dialog = MNAndroidDialog.Create(title, message, yes, no);
  33 + dialog.OnComplete += OnCompleteListener;
  34 + #endif
  35 +
  36 +
  37 + }
  38 +
  39 +
  40 +
  41 + private void OnCompleteListener(MNDialogResult res) {
  42 + OnComplete(res);
  43 + }
  44 +}
  45 +
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MobileNativeDialog.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 419a3fe8320aa4da8b2288d6598e3d61
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MobileNativeMessage.cs 0 → 100644
... ... @@ -0,0 +1,46 @@
  1 +using UnityEngine;
  2 +using System;
  3 +using System.Collections;
  4 +
  5 +public class MobileNativeMessage {
  6 +
  7 + public Action OnComplete = delegate {};
  8 +
  9 +
  10 + public MobileNativeMessage(string title, string message) {
  11 + init(title, message, "Ok");
  12 + }
  13 +
  14 + public MobileNativeMessage(string title, string message, string ok) {
  15 + init(title, message, ok);
  16 + }
  17 +
  18 +
  19 + private void init(string title, string message, string ok) {
  20 +
  21 + #if UNITY_WP8
  22 + MNWP8Message msg = MNWP8Message.Create(title, message);
  23 + msg.OnComplete += OnCompleteListener;
  24 + #endif
  25 +
  26 +
  27 + #if UNITY_IPHONE
  28 + MNIOSMessage msg = MNIOSMessage.Create(title, message, ok);
  29 + msg.OnComplete += OnCompleteListener;
  30 + #endif
  31 +
  32 + #if UNITY_ANDROID
  33 + MNAndroidMessage msg = MNAndroidMessage.Create(title, message, ok);
  34 + msg.OnComplete += OnCompleteListener;
  35 + #endif
  36 +
  37 +
  38 + }
  39 +
  40 +
  41 +
  42 + private void OnCompleteListener(MNDialogResult res) {
  43 + OnComplete();
  44 + }
  45 +}
  46 +
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MobileNativeMessage.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 13f6844fea97f4094b8122ad48f31b94
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MobileNativeRateUs.cs 0 → 100644
... ... @@ -0,0 +1,76 @@
  1 +using UnityEngine;
  2 +using System;
  3 +using System.Collections;
  4 +
  5 +public class MobileNativeRateUs {
  6 +
  7 + public string title;
  8 + public string message;
  9 + public string yes;
  10 + public string later;
  11 + public string no;
  12 +
  13 +
  14 + public string url;
  15 + public string appleId;
  16 +
  17 + public Action<MNDialogResult> OnComplete = delegate {};
  18 +
  19 +
  20 +
  21 +
  22 + public MobileNativeRateUs(string title, string message) {
  23 +
  24 + this.title = title;
  25 + this.message = message;
  26 + this.yes = "Rate app";
  27 + this.later = "Later";
  28 + this.no = "No, thanks";
  29 +
  30 + }
  31 +
  32 + public MobileNativeRateUs(string title, string message, string yes, string later, string no) {
  33 + this.title = title;
  34 + this.message = message;
  35 + this.yes = yes;
  36 + this.later = later;
  37 + this.no = no;
  38 + }
  39 +
  40 +
  41 + public void SetAndroidAppUrl(string _url) {
  42 + url = _url;
  43 + }
  44 +
  45 + public void SetAppleId(string _appleId) {
  46 + appleId = _appleId;
  47 + }
  48 +
  49 + public void Start() {
  50 +
  51 + #if UNITY_WP8
  52 + MNWP8RateUsPopUp rate = MNWP8RateUsPopUp.Create(title, message);
  53 + rate.OnComplete += OnCompleteListener;
  54 + #endif
  55 +
  56 +
  57 + #if UNITY_IPHONE
  58 + MNIOSRateUsPopUp rate = MNIOSRateUsPopUp.Create(title, message, yes, later, no);
  59 + rate.appleId = appleId;
  60 + rate.OnComplete += OnCompleteListener;
  61 + #endif
  62 +
  63 + #if UNITY_ANDROID
  64 + MNAndroidRateUsPopUp rate = MNAndroidRateUsPopUp.Create(title, message, url, yes, later, no);
  65 + rate.OnComplete += OnCompleteListener;
  66 + #endif
  67 +
  68 + }
  69 +
  70 +
  71 +
  72 + private void OnCompleteListener(MNDialogResult res) {
  73 + OnComplete(res);
  74 + }
  75 +}
  76 +
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Core/MobileNativeRateUs.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: be6dc3df380ba46faa7ee78c23e6d052
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Enum.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 58d3ba2440777634d964650e1a80ce0d
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Enum/MNAndroidDialogTheme.cs 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +using UnityEngine;
  2 +using System.Collections;
  3 +
  4 +public enum MNAndroidDialogTheme {
  5 + ThemeDeviceDefaultDark,
  6 + ThemeDeviceDefaultLight,
  7 + ThemeHoloDark,
  8 + ThemeHoloLight,
  9 + ThemeTraditional
  10 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Enum/MNAndroidDialogTheme.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: 4a8d341fbc9c51146a6c88add23abdf9
  3 +timeCreated: 1461936530
  4 +licenseType: Store
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Enum/MNDialogResult.cs 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Android Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System.Collections;
  11 +using System.Collections.Generic;
  12 +
  13 +public enum MNDialogResult {
  14 + YES,
  15 + NO,
  16 + RATED,
  17 + REMIND,
  18 + DECLINED,
  19 + CLOSED
  20 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Enum/MNDialogResult.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: f200c17c27985486c95ebd9e3935a79a
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 075c71c4f4100e54eaecd845dd8ed41d
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 14b8ca723528e1a4787b0977a9c2a029
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 57269299e7aece744bbeea24d7da0caf
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/Base.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 5bd7603cdd23ed743a21526aacff5060
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/Base/MNAndroidNative.cs 0 → 100644
... ... @@ -0,0 +1,61 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Common Android Native Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System.Collections;
  11 +
  12 +public class MNAndroidNative {
  13 +
  14 + private const string CLASS_NAME = "com.mnp.popups.NativePopupsManager";
  15 +
  16 + private static void CallActivityFunction(string methodName, params object[] args) {
  17 + MNProxyPool.CallStatic(CLASS_NAME, methodName, args);
  18 + }
  19 +
  20 + //--------------------------------------
  21 + // MESSAGING
  22 + //--------------------------------------
  23 +
  24 +
  25 + public static void showDialog(string title, string message, MNAndroidDialogTheme theme) {
  26 + showDialog (title, message, "Yes", "No", theme);
  27 + }
  28 +
  29 + public static void showDialog(string title, string message, string yes, string no, MNAndroidDialogTheme theme) {
  30 + CallActivityFunction("ShowDialog", title, message, yes, no, (int)theme);
  31 + }
  32 +
  33 + public static void dismissDialog() {
  34 + CallActivityFunction("DismissDialog");
  35 + }
  36 +
  37 + public static void showMessage(string title, string message, MNAndroidDialogTheme theme) {
  38 + showMessage (title, message, "Ok", theme);
  39 + }
  40 +
  41 + public static void showMessage(string title, string message, string ok, MNAndroidDialogTheme theme) {
  42 + CallActivityFunction("ShowMessage", title, message, ok, (int)theme);
  43 + }
  44 +
  45 + public static void showRateDialog(string title, string message, string yes, string laiter, string no, MNAndroidDialogTheme theme) {
  46 + CallActivityFunction("ShowRateDialog", title, message, yes, laiter, no, (int)theme);
  47 + }
  48 +
  49 + public static void ShowPreloader(string title, string message, MNAndroidDialogTheme theme) {
  50 + CallActivityFunction("ShowPreloader", title, message, (int)theme);
  51 + }
  52 +
  53 + public static void HidePreloader() {
  54 + CallActivityFunction("HidePreloader");
  55 + }
  56 +
  57 + public static void RedirectStoreRatingPage(string url) {
  58 + CallActivityFunction("OpenAppRatingPage", url);
  59 + }
  60 +
  61 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/Base/MNAndroidNative.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 3697660e38d724862be1aeddba17b6e1
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/Base/MNProxyPool.cs 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +using UnityEngine;
  2 +using System.Collections.Generic;
  3 +
  4 +public abstract class MNProxyPool {
  5 +
  6 + #if UNITY_ANDROID
  7 + private static Dictionary<string, AndroidJavaObject> pool = new Dictionary<string, AndroidJavaObject>();
  8 + #endif
  9 +
  10 +
  11 + public static void CallStatic(string className, string methodName, params object[] args) {
  12 + #if UNITY_ANDROID
  13 +
  14 +
  15 +
  16 + if(Application.platform != RuntimePlatform.Android) {
  17 + return;
  18 + }
  19 + Debug.Log("AN: Using proxy for class: " + className + " method:" + methodName);
  20 +
  21 + try {
  22 +
  23 + AndroidJavaObject bridge;
  24 + if(pool.ContainsKey(className)) {
  25 + bridge = pool[className];
  26 + } else {
  27 + bridge = new AndroidJavaObject(className);
  28 + pool.Add(className, bridge);
  29 + }
  30 +
  31 + AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  32 + AndroidJavaObject act = jc.GetStatic<AndroidJavaObject>("currentActivity");
  33 +
  34 + act.Call("runOnUiThread", new AndroidJavaRunnable(() => { bridge.CallStatic(methodName, args); }));
  35 +
  36 +
  37 + } catch(System.Exception ex) {
  38 + Debug.LogWarning(ex.Message);
  39 + }
  40 + #endif
  41 + }
  42 +
  43 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/Base/MNProxyPool.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: ac2bb9566c7d87e48b758f64fb9eb685
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/MNAndroidDialog.cs 0 → 100644
... ... @@ -0,0 +1,89 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Android Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System.Collections;
  11 +using System.Collections.Generic;
  12 +
  13 +
  14 +
  15 +public class
  16 + MNAndroidDialog: MNPopup {
  17 +
  18 +
  19 + public string yes;
  20 + public string no;
  21 +
  22 + //--------------------------------------
  23 + // INITIALIZE
  24 + //--------------------------------------
  25 +
  26 + public static MNAndroidDialog Create(string title, string message) {
  27 + return Create(title, message, "Yes", "No");
  28 + }
  29 +
  30 + public static MNAndroidDialog Create(string title, string message, string yes, string no) {
  31 + MNAndroidDialog dialog;
  32 + dialog = new GameObject("AndroidPopUp").AddComponent<MNAndroidDialog>();
  33 + dialog.title = title;
  34 + dialog.message = message;
  35 + dialog.yes = yes;
  36 + dialog.no = no;
  37 + dialog.init();
  38 +
  39 + return dialog;
  40 + }
  41 +
  42 +
  43 + //--------------------------------------
  44 + // PUBLIC METHODS
  45 + //--------------------------------------
  46 +
  47 + public void init() {
  48 + MNAndroidNative.showDialog(title, message, yes, no, MNP_PlatformSettings.Instance.AndroidDialogTheme);
  49 + }
  50 +
  51 + //--------------------------------------
  52 + // GET/SET
  53 + //--------------------------------------
  54 +
  55 + //--------------------------------------
  56 + // EVENTS
  57 + //--------------------------------------
  58 +
  59 + public void onPopUpCallBack(string buttonIndex) {
  60 + int index = System.Convert.ToInt16(buttonIndex);
  61 +
  62 +
  63 + switch(index) {
  64 + case 0:
  65 + OnComplete(MNDialogResult.YES);
  66 + break;
  67 + case 1:
  68 + OnComplete(MNDialogResult.NO);
  69 +
  70 + break;
  71 +
  72 + }
  73 +
  74 +
  75 + Destroy(gameObject);
  76 + }
  77 +
  78 +
  79 +
  80 + //--------------------------------------
  81 + // PRIVATE METHODS
  82 + //--------------------------------------
  83 +
  84 + //--------------------------------------
  85 + // DESTROY
  86 + //--------------------------------------
  87 +
  88 +
  89 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/MNAndroidDialog.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: a9ebf62645bfa473789facb8a4b4cc85
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/MNAndroidMessage.cs 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Android Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System.Collections;
  11 +using System.Collections.Generic;
  12 +
  13 +public class MNAndroidMessage : MNPopup {
  14 +
  15 +
  16 + public string ok;
  17 +
  18 + //--------------------------------------
  19 + // INITIALIZE
  20 + //--------------------------------------
  21 +
  22 + public static MNAndroidMessage Create(string title, string message) {
  23 + return Create(title, message, "Ok");
  24 + }
  25 +
  26 + public static MNAndroidMessage Create(string title, string message, string ok) {
  27 + MNAndroidMessage dialog;
  28 + dialog = new GameObject("AndroidPopUp").AddComponent<MNAndroidMessage>();
  29 + dialog.title = title;
  30 + dialog.message = message;
  31 + dialog.ok = ok;
  32 +
  33 + dialog.init();
  34 +
  35 + return dialog;
  36 + }
  37 +
  38 +
  39 + //--------------------------------------
  40 + // PUBLIC METHODS
  41 + //--------------------------------------
  42 +
  43 + public void init() {
  44 + MNAndroidNative.showMessage(title, message, ok, MNP_PlatformSettings.Instance.AndroidDialogTheme);
  45 + }
  46 +
  47 + //--------------------------------------
  48 + // GET/SET
  49 + //--------------------------------------
  50 +
  51 + //--------------------------------------
  52 + // EVENTS
  53 + //--------------------------------------
  54 +
  55 + public void onPopUpCallBack(string buttonIndex) {
  56 + OnComplete(MNDialogResult.YES);
  57 + Destroy(gameObject);
  58 + }
  59 +
  60 + //--------------------------------------
  61 + // PRIVATE METHODS
  62 + //--------------------------------------
  63 +
  64 + //--------------------------------------
  65 + // DESTROY
  66 + //--------------------------------------
  67 +
  68 +
  69 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/MNAndroidMessage.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 7e578c3fc66b34b9db23f56fca01e284
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/MNAndroidRateUsPopUp.cs 0 → 100644
... ... @@ -0,0 +1,94 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Android Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System.Collections;
  11 +using System.Collections.Generic;
  12 +
  13 +public class MNAndroidRateUsPopUp : MNPopup {
  14 +
  15 +
  16 +
  17 + public string yes;
  18 + public string later;
  19 + public string no;
  20 + public string url;
  21 +
  22 +
  23 + //--------------------------------------
  24 + // INITIALIZE
  25 + //--------------------------------------
  26 +
  27 + public static MNAndroidRateUsPopUp Create(string title, string message, string url) {
  28 + return Create(title, message, url, "Rate app", "Later", "No, thanks");
  29 + }
  30 +
  31 + public static MNAndroidRateUsPopUp Create(string title, string message, string url, string yes, string later, string no) {
  32 + MNAndroidRateUsPopUp rate = new GameObject("AndroidRateUsPopUp").AddComponent<MNAndroidRateUsPopUp>();
  33 + rate.title = title;
  34 + rate.message = message;
  35 + rate.url = url;
  36 +
  37 + rate.yes = yes;
  38 + rate.later = later;
  39 + rate.no = no;
  40 +
  41 + rate.init();
  42 +
  43 + return rate;
  44 + }
  45 +
  46 +
  47 + //--------------------------------------
  48 + // PUBLIC METHODS
  49 + //--------------------------------------
  50 +
  51 +
  52 + public void init() {
  53 + MNAndroidNative.showRateDialog(title, message, yes, later, no, MNP_PlatformSettings.Instance.AndroidDialogTheme);
  54 + }
  55 +
  56 +
  57 + //--------------------------------------
  58 + // GET/SET
  59 + //--------------------------------------
  60 +
  61 + //--------------------------------------
  62 + // EVENTS
  63 + //--------------------------------------
  64 +
  65 + public void onPopUpCallBack(string buttonIndex) {
  66 + int index = System.Convert.ToInt16(buttonIndex);
  67 + switch(index) {
  68 + case 0:
  69 + MNAndroidNative.RedirectStoreRatingPage(url);
  70 + OnComplete(MNDialogResult.RATED);
  71 + break;
  72 + case 1:
  73 + OnComplete(MNDialogResult.REMIND);
  74 + break;
  75 + case 2:
  76 + OnComplete(MNDialogResult.DECLINED);
  77 + break;
  78 + }
  79 +
  80 +
  81 +
  82 + Destroy(gameObject);
  83 + }
  84 +
  85 + //--------------------------------------
  86 + // PRIVATE METHODS
  87 + //--------------------------------------
  88 +
  89 + //--------------------------------------
  90 + // DESTROY
  91 + //--------------------------------------
  92 +
  93 +
  94 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/AndroidImpl/PopUps/MNAndroidRateUsPopUp.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: a8e0c727231f4421baa29ef32044c7cc
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: b74f23d88fa1aad4cac00b75979602d0
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 27d2ef99035215649a597a05356f853b
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/MNIOSDialog.cs 0 → 100644
... ... @@ -0,0 +1,82 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module IOS Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +
  10 +
  11 +using UnityEngine;
  12 +using System.Collections;
  13 +using System.Collections.Generic;
  14 +
  15 +public class MNIOSDialog : MNPopup {
  16 +
  17 +
  18 + public string yes;
  19 + public string no;
  20 +
  21 + //--------------------------------------
  22 + // INITIALIZE
  23 + //--------------------------------------
  24 +
  25 + public static MNIOSDialog Create(string title, string message) {
  26 + return Create(title, message, "Yes", "No");
  27 + }
  28 +
  29 + public static MNIOSDialog Create(string title, string message, string yes, string no) {
  30 + MNIOSDialog dialog;
  31 + dialog = new GameObject("IOSPopUp").AddComponent<MNIOSDialog>();
  32 + dialog.title = title;
  33 + dialog.message = message;
  34 + dialog.yes = yes;
  35 + dialog.no = no;
  36 + dialog.init();
  37 +
  38 + return dialog;
  39 + }
  40 +
  41 +
  42 + //--------------------------------------
  43 + // PUBLIC METHODS
  44 + //--------------------------------------
  45 +
  46 + public void init() {
  47 + MNIOSNative.showDialog(title, message, yes, no);
  48 + }
  49 +
  50 + //--------------------------------------
  51 + // GET/SET
  52 + //--------------------------------------
  53 +
  54 + //--------------------------------------
  55 + // EVENTS
  56 + //--------------------------------------
  57 +
  58 + public void onPopUpCallBack(string buttonIndex) {
  59 + int index = System.Convert.ToInt16(buttonIndex);
  60 +
  61 + switch(index) {
  62 + case 0:
  63 + OnComplete(MNDialogResult.YES);
  64 + break;
  65 + case 1:
  66 + OnComplete(MNDialogResult.NO);
  67 + break;
  68 + }
  69 +
  70 + Destroy(gameObject);
  71 + }
  72 +
  73 + //--------------------------------------
  74 + // PRIVATE METHODS
  75 + //--------------------------------------
  76 +
  77 + //--------------------------------------
  78 + // DESTROY
  79 + //--------------------------------------
  80 +
  81 +
  82 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/MNIOSDialog.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 76b91770cb83c432887eb439d81aa1be
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/MNIOSMessage.cs 0 → 100644
... ... @@ -0,0 +1,73 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module IOS Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +
  10 +using UnityEngine;
  11 +using System.Collections;
  12 +using System.Collections.Generic;
  13 +
  14 +public class MNIOSMessage : MNPopup {
  15 +
  16 +
  17 + public string ok;
  18 +
  19 + //--------------------------------------
  20 + // INITIALIZE
  21 + //--------------------------------------
  22 +
  23 + public static MNIOSMessage Create(string title, string message) {
  24 + return Create(title, message, "Ok");
  25 + }
  26 +
  27 + public static MNIOSMessage Create(string title, string message, string ok) {
  28 + MNIOSMessage dialog;
  29 + dialog = new GameObject("IOSPopUp").AddComponent<MNIOSMessage>();
  30 + dialog.title = title;
  31 + dialog.message = message;
  32 + dialog.ok = ok;
  33 +
  34 + dialog.init();
  35 +
  36 + return dialog;
  37 + }
  38 +
  39 +
  40 + //--------------------------------------
  41 + // PUBLIC METHODS
  42 + //--------------------------------------
  43 +
  44 + public void init() {
  45 + MNIOSNative.showMessage(title, message, ok);
  46 + }
  47 +
  48 + //--------------------------------------
  49 + // GET/SET
  50 + //--------------------------------------
  51 +
  52 + //--------------------------------------
  53 + // EVENTS
  54 + //--------------------------------------
  55 +
  56 + public void onPopUpCallBack(string buttonIndex) {
  57 +
  58 + OnComplete(MNDialogResult.YES);
  59 + Destroy(gameObject);
  60 +
  61 +
  62 + }
  63 +
  64 + //--------------------------------------
  65 + // PRIVATE METHODS
  66 + //--------------------------------------
  67 +
  68 + //--------------------------------------
  69 + // DESTROY
  70 + //--------------------------------------
  71 +
  72 +
  73 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/MNIOSMessage.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 40e0b9c7243344cfda9d23b5e67dad07
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/MNIOSRateUsPopUp.cs 0 → 100644
... ... @@ -0,0 +1,94 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module IOS Native Plugin for Unity3D
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support stans.assets@gmail.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +using UnityEngine;
  10 +using System.Collections;
  11 +using System.Collections.Generic;
  12 +
  13 +public class MNIOSRateUsPopUp : MNPopup {
  14 +
  15 + public string rate;
  16 + public string remind;
  17 + public string declined;
  18 + public string appleId;
  19 +
  20 + //--------------------------------------
  21 + // INITIALIZE
  22 + //--------------------------------------
  23 +
  24 + public static MNIOSRateUsPopUp Create() {
  25 + return Create("Like the Game?", "Rate US");
  26 + }
  27 +
  28 + public static MNIOSRateUsPopUp Create(string title, string message) {
  29 + return Create(title, message, "Rate Now", "Ask me later", "No, thanks");
  30 + }
  31 +
  32 + public static MNIOSRateUsPopUp Create(string title, string message, string rate, string remind, string declined) {
  33 + MNIOSRateUsPopUp popup = new GameObject("IOSRateUsPopUp").AddComponent<MNIOSRateUsPopUp>();
  34 + popup.title = title;
  35 + popup.message = message;
  36 + popup.rate = rate;
  37 + popup.remind = remind;
  38 + popup.declined = declined;
  39 +
  40 + popup.init();
  41 +
  42 +
  43 + return popup;
  44 + }
  45 +
  46 +
  47 + //--------------------------------------
  48 + // PUBLIC METHODS
  49 + //--------------------------------------
  50 +
  51 +
  52 + public void init() {
  53 + MNIOSNative.showRateUsPopUP(title, message, rate, remind, declined);
  54 + }
  55 +
  56 +
  57 + //--------------------------------------
  58 + // GET/SET
  59 + //--------------------------------------
  60 +
  61 + //--------------------------------------
  62 + // EVENTS
  63 + //--------------------------------------
  64 +
  65 + public void onPopUpCallBack(string buttonIndex) {
  66 + int index = System.Convert.ToInt16(buttonIndex);
  67 + switch(index) {
  68 + case 0:
  69 + MNIOSNative.RedirectToAppStoreRatingPage(appleId);
  70 + OnComplete(MNDialogResult.RATED);
  71 + break;
  72 + case 1:
  73 + OnComplete( MNDialogResult.REMIND);
  74 + break;
  75 + case 2:
  76 + OnComplete( MNDialogResult.DECLINED);
  77 + break;
  78 + }
  79 +
  80 +
  81 +
  82 + Destroy(gameObject);
  83 + }
  84 +
  85 + //--------------------------------------
  86 + // PRIVATE METHODS
  87 + //--------------------------------------
  88 +
  89 + //--------------------------------------
  90 + // DESTROY
  91 + //--------------------------------------
  92 +
  93 +
  94 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/MNIOSRateUsPopUp.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 5b1841885b45146769cbf746750c7aad
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/base.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 8daf14a8426f0cc4f9c120f7b39131fc
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/base/MNIOSNative.cs 0 → 100644
... ... @@ -0,0 +1,94 @@
  1 +#define SA_DEBUG_MODE
  2 +
  3 +using UnityEngine;
  4 +using System.Collections;
  5 +#if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  6 +using System.Runtime.InteropServices;
  7 +#endif
  8 +
  9 +public class MNIOSNative {
  10 +
  11 + //--------------------------------------
  12 + // NATIVE FUNCTIONS
  13 + //--------------------------------------
  14 +
  15 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  16 + [DllImport ("__Internal")]
  17 + private static extern void _MNP_ShowRateUsPopUp(string title, string message, string rate, string remind, string declined);
  18 +
  19 + [DllImport ("__Internal")]
  20 + private static extern void _MNP_ShowDialog(string title, string message, string yes, string no);
  21 +
  22 + [DllImport ("__Internal")]
  23 + private static extern void _MNP_ShowMessage(string title, string message, string ok);
  24 +
  25 + [DllImport ("__Internal")]
  26 + private static extern void _MNP_DismissCurrentAlert();
  27 +
  28 +
  29 + [DllImport ("__Internal")]
  30 + private static extern void _MNP_RedirectToAppStoreRatingPage(string appId);
  31 +
  32 + [DllImport ("__Internal")]
  33 + private static extern void _MNP_ShowPreloader();
  34 +
  35 +
  36 + [DllImport ("__Internal")]
  37 + private static extern void _MNP_HidePreloader();
  38 + #endif
  39 +
  40 +
  41 +
  42 + public static void dismissCurrentAlert() {
  43 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  44 + _MNP_DismissCurrentAlert();
  45 + #endif
  46 + }
  47 +
  48 + public static void showRateUsPopUP(string title, string message, string rate, string remind, string declined) {
  49 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  50 + _MNP_ShowRateUsPopUp(title, message, rate, remind, declined);
  51 + #endif
  52 + }
  53 +
  54 +
  55 + public static void showDialog(string title, string message) {
  56 + showDialog(title, message, "Yes", "No");
  57 + }
  58 +
  59 + public static void showDialog(string title, string message, string yes, string no) {
  60 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  61 + _MNP_ShowDialog(title, message, yes, no);
  62 + #endif
  63 + }
  64 +
  65 +
  66 + public static void showMessage(string title, string message) {
  67 + showMessage(title, message, "Ok");
  68 + }
  69 +
  70 + public static void showMessage(string title, string message, string ok) {
  71 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  72 + _MNP_ShowMessage(title, message, ok);
  73 + #endif
  74 + }
  75 +
  76 + public static void RedirectToAppStoreRatingPage(string appleId) {
  77 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  78 + _MNP_RedirectToAppStoreRatingPage(appleId);
  79 + #endif
  80 + }
  81 +
  82 +
  83 + public static void ShowPreloader() {
  84 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  85 + _MNP_ShowPreloader();
  86 + #endif
  87 + }
  88 +
  89 + public static void HidePreloader() {
  90 + #if (UNITY_IPHONE && !UNITY_EDITOR) || SA_DEBUG_MODE
  91 + _MNP_HidePreloader();
  92 + #endif
  93 + }
  94 +}
... ...
Assets/Plugins/StansAssets/Modules/MobileNativePopUps/Scripts/Platfroms/IOSImpl/PopUps/base/MNIOSNative.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: cd9bd17c335224127bf6df4de433c37a
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Support.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: d871c13df672bfe45a51a8ccc58d47f3
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 394bac467ece4314bba8fe9f58ef4c29
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Data.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 8a412865586d67a448c5555a479678dd
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Data/SA_Converter.cs 0 → 100644
... ... @@ -0,0 +1,77 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Assets Common Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +// @website https://stansassets.com
  7 +//
  8 +////////////////////////////////////////////////////////////////////////////////
  9 +
  10 +using UnityEngine;
  11 +using System;
  12 +using System.Collections;
  13 +using System.Collections.Generic;
  14 +
  15 +
  16 +namespace SA.Common.Data {
  17 +
  18 + public class Converter {
  19 +
  20 + //--------------------------------------
  21 + // Constants
  22 + //--------------------------------------
  23 +
  24 + public const char DATA_SPLITTER = '|';
  25 + public const string DATA_SPLITTER2 = "|%|";
  26 +
  27 +
  28 + public const string ARRAY_SPLITTER = "%%%";
  29 + public const string DATA_EOF = "endofline";
  30 +
  31 +
  32 + public static string SerializeArray(List<string> array, string splitter = ARRAY_SPLITTER) {
  33 + return SerializeArray (array.ToArray(), splitter);
  34 + }
  35 +
  36 + public static string SerializeArray(string[] array, string splitter = ARRAY_SPLITTER) {
  37 +
  38 + if(array == null) {
  39 + return string.Empty;
  40 + } else {
  41 + if(array.Length == 0) {
  42 + return string.Empty;
  43 + } else {
  44 +
  45 + string serializedArray = "";
  46 + int len = array.Length;
  47 + for(int i = 0; i < len; i++) {
  48 + if(i != 0) {
  49 + serializedArray += splitter;
  50 + }
  51 +
  52 + serializedArray += array[i];
  53 + }
  54 +
  55 + return serializedArray;
  56 + }
  57 + }
  58 + }
  59 +
  60 + public static string[] ParseArray(string arrayData, string splitter = ARRAY_SPLITTER) {
  61 +
  62 + List<string> ParsedArray = new List<string>();
  63 + string[] DataArray = arrayData.Split(new string[] { splitter }, StringSplitOptions.None);
  64 +
  65 +
  66 + for(int i = 0; i < DataArray.Length; i ++ ) {
  67 + if(DataArray[i] == DATA_EOF) {
  68 + break;
  69 + }
  70 + ParsedArray.Add(DataArray[i]);
  71 + }
  72 +
  73 + return ParsedArray.ToArray();
  74 + }
  75 + }
  76 +
  77 +}
... ...
Assets/Plugins/StansAssets/Support/Common/Data/SA_Converter.cs.meta 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +fileFormatVersion: 2
  2 +guid: 1c7b7d3362ed047069b06f7980cde982
  3 +MonoImporter:
  4 + serializedVersion: 2
  5 + defaultReferences: []
  6 + executionOrder: 0
  7 + icon: {instanceID: 0}
  8 + userData:
... ...
Assets/Plugins/StansAssets/Support/Common/Data/SA_MiniJSON.cs 0 → 100644
... ... @@ -0,0 +1,532 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Assets Common Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +// @website https://stansassets.com
  7 +//
  8 +////////////////////////////////////////////////////////////////////////////////
  9 +
  10 +
  11 +
  12 +using System;
  13 +using System.Collections;
  14 +using System.Collections.Generic;
  15 +using System.IO;
  16 +using System.Text;
  17 +
  18 +namespace SA.Common.Data {
  19 + // Example usage:
  20 + //
  21 + // using UnityEngine;
  22 + // using System.Collections;
  23 + // using System.Collections.Generic;
  24 + // using MiniJSON;
  25 + //
  26 + // public class MiniJSONTest : MonoBehaviour {
  27 + // void Start () {
  28 + // var jsonString = "{ \"array\": [1.44,2,3], " +
  29 + // "\"object\": {\"key1\":\"value1\", \"key2\":256}, " +
  30 + // "\"string\": \"The quick brown fox \\\"jumps\\\" over the lazy dog \", " +
  31 + // "\"unicode\": \"\\u3041 Men\u00fa sesi\u00f3n\", " +
  32 + // "\"int\": 65536, " +
  33 + // "\"float\": 3.1415926, " +
  34 + // "\"bool\": true, " +
  35 + // "\"null\": null }";
  36 + //
  37 + // var dict = Json.Deserialize(jsonString) as Dictionary<string,object>;
  38 + //
  39 + // Debug.Log("deserialized: " + dict.GetType());
  40 + // Debug.Log("dict['array'][0]: " + ((List<object>) dict["array"])[0]);
  41 + // Debug.Log("dict['string']: " + (string) dict["string"]);
  42 + // Debug.Log("dict['float']: " + (double) dict["float"]); // floats come out as doubles
  43 + // Debug.Log("dict['int']: " + (long) dict["int"]); // ints come out as longs
  44 + // Debug.Log("dict['unicode']: " + (string) dict["unicode"]);
  45 + //
  46 + // var str = Json.Serialize(dict);
  47 + //
  48 + // Debug.Log("serialized: " + str);
  49 + // }
  50 + // }
  51 +
  52 + /// <summary>
  53 + /// This class encodes and decodes JSON strings.
  54 + /// Spec. details, see http://www.json.org/
  55 + ///
  56 + /// JSON uses Arrays and Objects. These correspond here to the datatypes IList and IDictionary.
  57 + /// All numbers are parsed to doubles.
  58 + /// </summary>
  59 + public static class Json {
  60 + /// <summary>
  61 + /// Parses the string json into a value
  62 + /// </summary>
  63 + /// <param name="json">A JSON string.</param>
  64 + /// <returns>An List&lt;object&gt;, a Dictionary&lt;string, object&gt;, a double, an integer,a string, null, true, or false</returns>
  65 + public static object Deserialize(string json) {
  66 + // save the string for debug information
  67 + if (json == null) {
  68 + return null;
  69 + }
  70 +
  71 + return Parser.Parse(json);
  72 + }
  73 +
  74 + sealed class Parser : IDisposable {
  75 + const string WHITE_SPACE = " \t\n\r";
  76 + const string WORD_BREAK = " \t\n\r{}[],:\"";
  77 +
  78 + enum TOKEN {
  79 + NONE,
  80 + CURLY_OPEN,
  81 + CURLY_CLOSE,
  82 + SQUARED_OPEN,
  83 + SQUARED_CLOSE,
  84 + COLON,
  85 + COMMA,
  86 + STRING,
  87 + NUMBER,
  88 + TRUE,
  89 + FALSE,
  90 + NULL
  91 + };
  92 +
  93 + StringReader json;
  94 +
  95 + Parser(string jsonString) {
  96 + json = new StringReader(jsonString);
  97 + }
  98 +
  99 + public static object Parse(string jsonString) {
  100 + using (var instance = new Parser(jsonString)) {
  101 + return instance.ParseValue();
  102 + }
  103 + }
  104 +
  105 + public void Dispose() {
  106 + json.Dispose();
  107 + json = null;
  108 + }
  109 +
  110 + Dictionary<string, object> ParseObject() {
  111 + Dictionary<string, object> table = new Dictionary<string, object>();
  112 +
  113 + // ditch opening brace
  114 + json.Read();
  115 +
  116 + // {
  117 + while (true) {
  118 + switch (NextToken) {
  119 + case TOKEN.NONE:
  120 + return null;
  121 + case TOKEN.COMMA:
  122 + continue;
  123 + case TOKEN.CURLY_CLOSE:
  124 + return table;
  125 + default:
  126 + // name
  127 + string name = ParseString();
  128 + if (name == null) {
  129 + return null;
  130 + }
  131 +
  132 + // :
  133 + if (NextToken != TOKEN.COLON) {
  134 + return null;
  135 + }
  136 + // ditch the colon
  137 + json.Read();
  138 +
  139 + // value
  140 + table[name] = ParseValue();
  141 + break;
  142 + }
  143 + }
  144 + }
  145 +
  146 + List<object> ParseArray() {
  147 + List<object> array = new List<object>();
  148 +
  149 + // ditch opening bracket
  150 + json.Read();
  151 +
  152 + // [
  153 + var parsing = true;
  154 + while (parsing) {
  155 + TOKEN nextToken = NextToken;
  156 +
  157 + switch (nextToken) {
  158 + case TOKEN.NONE:
  159 + return null;
  160 + case TOKEN.COMMA:
  161 + continue;
  162 + case TOKEN.SQUARED_CLOSE:
  163 + parsing = false;
  164 + break;
  165 + default:
  166 + object value = ParseByToken(nextToken);
  167 +
  168 + array.Add(value);
  169 + break;
  170 + }
  171 + }
  172 +
  173 + return array;
  174 + }
  175 +
  176 + object ParseValue() {
  177 + TOKEN nextToken = NextToken;
  178 + return ParseByToken(nextToken);
  179 + }
  180 +
  181 + object ParseByToken(TOKEN token) {
  182 + switch (token) {
  183 + case TOKEN.STRING:
  184 + return ParseString();
  185 + case TOKEN.NUMBER:
  186 + return ParseNumber();
  187 + case TOKEN.CURLY_OPEN:
  188 + return ParseObject();
  189 + case TOKEN.SQUARED_OPEN:
  190 + return ParseArray();
  191 + case TOKEN.TRUE:
  192 + return true;
  193 + case TOKEN.FALSE:
  194 + return false;
  195 + case TOKEN.NULL:
  196 + return null;
  197 + default:
  198 + return null;
  199 + }
  200 + }
  201 +
  202 + string ParseString() {
  203 + StringBuilder s = new StringBuilder();
  204 + char c;
  205 +
  206 + // ditch opening quote
  207 + json.Read();
  208 +
  209 + bool parsing = true;
  210 + while (parsing) {
  211 +
  212 + if (json.Peek() == -1) {
  213 + parsing = false;
  214 + break;
  215 + }
  216 +
  217 + c = NextChar;
  218 + switch (c) {
  219 + case '"':
  220 + parsing = false;
  221 + break;
  222 + case '\\':
  223 + if (json.Peek() == -1) {
  224 + parsing = false;
  225 + break;
  226 + }
  227 +
  228 + c = NextChar;
  229 + switch (c) {
  230 + case '"':
  231 + case '\\':
  232 + case '/':
  233 + s.Append(c);
  234 + break;
  235 + case 'b':
  236 + s.Append('\b');
  237 + break;
  238 + case 'f':
  239 + s.Append('\f');
  240 + break;
  241 + case 'n':
  242 + s.Append('\n');
  243 + break;
  244 + case 'r':
  245 + s.Append('\r');
  246 + break;
  247 + case 't':
  248 + s.Append('\t');
  249 + break;
  250 + case 'u':
  251 + var hex = new StringBuilder();
  252 +
  253 + for (int i=0; i< 4; i++) {
  254 + hex.Append(NextChar);
  255 + }
  256 +
  257 + s.Append((char) Convert.ToInt32(hex.ToString(), 16));
  258 + break;
  259 + }
  260 + break;
  261 + default:
  262 + s.Append(c);
  263 + break;
  264 + }
  265 + }
  266 +
  267 + return s.ToString();
  268 + }
  269 +
  270 + object ParseNumber() {
  271 + string number = NextWord;
  272 +
  273 + if (number.IndexOf('.') == -1) {
  274 + long parsedInt;
  275 + Int64.TryParse(number, out parsedInt);
  276 + return parsedInt;
  277 + }
  278 +
  279 + double parsedDouble;
  280 + Double.TryParse(number, out parsedDouble);
  281 + return parsedDouble;
  282 + }
  283 +
  284 + void EatWhitespace() {
  285 + while (WHITE_SPACE.IndexOf(PeekChar) != -1) {
  286 + json.Read();
  287 +
  288 + if (json.Peek() == -1) {
  289 + break;
  290 + }
  291 + }
  292 + }
  293 +
  294 + char PeekChar {
  295 + get {
  296 + return Convert.ToChar(json.Peek());
  297 + }
  298 + }
  299 +
  300 + char NextChar {
  301 + get {
  302 + return Convert.ToChar(json.Read());
  303 + }
  304 + }
  305 +
  306 + string NextWord {
  307 + get {
  308 + StringBuilder word = new StringBuilder();
  309 +
  310 + while (WORD_BREAK.IndexOf(PeekChar) == -1) {
  311 + word.Append(NextChar);
  312 +
  313 + if (json.Peek() == -1) {
  314 + break;
  315 + }
  316 + }
  317 +
  318 + return word.ToString();
  319 + }
  320 + }
  321 +
  322 + TOKEN NextToken {
  323 + get {
  324 + EatWhitespace();
  325 +
  326 + if (json.Peek() == -1) {
  327 + return TOKEN.NONE;
  328 + }
  329 +
  330 + char c = PeekChar;
  331 + switch (c) {
  332 + case '{':
  333 + return TOKEN.CURLY_OPEN;
  334 + case '}':
  335 + json.Read();
  336 + return TOKEN.CURLY_CLOSE;
  337 + case '[':
  338 + return TOKEN.SQUARED_OPEN;
  339 + case ']':
  340 + json.Read();
  341 + return TOKEN.SQUARED_CLOSE;
  342 + case ',':
  343 + json.Read();
  344 + return TOKEN.COMMA;
  345 + case '"':
  346 + return TOKEN.STRING;
  347 + case ':':
  348 + return TOKEN.COLON;
  349 + case '0':
  350 + case '1':
  351 + case '2':
  352 + case '3':
  353 + case '4':
  354 + case '5':
  355 + case '6':
  356 + case '7':
  357 + case '8':
  358 + case '9':
  359 + case '-':
  360 + return TOKEN.NUMBER;
  361 + }
  362 +
  363 + string word = NextWord;
  364 +
  365 + switch (word) {
  366 + case "false":
  367 + return TOKEN.FALSE;
  368 + case "true":
  369 + return TOKEN.TRUE;
  370 + case "null":
  371 + return TOKEN.NULL;
  372 + }
  373 +
  374 + return TOKEN.NONE;
  375 + }
  376 + }
  377 + }
  378 +
  379 + /// <summary>
  380 + /// Converts a IDictionary / IList object or a simple type (string, int, etc.) into a JSON string
  381 + /// </summary>
  382 + /// <param name="json">A Dictionary&lt;string, object&gt; / List&lt;object&gt;</param>
  383 + /// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
  384 + public static string Serialize(object obj) {
  385 + return Serializer.Serialize(obj);
  386 + }
  387 +
  388 + sealed class Serializer {
  389 + StringBuilder builder;
  390 +
  391 + Serializer() {
  392 + builder = new StringBuilder();
  393 + }
  394 +
  395 + public static string Serialize(object obj) {
  396 + var instance = new Serializer();
  397 +
  398 + instance.SerializeValue(obj);
  399 +
  400 + return instance.builder.ToString();
  401 + }
  402 +
  403 + void SerializeValue(object value) {
  404 + IList asList;
  405 + IDictionary asDict;
  406 + string asStr;
  407 +
  408 + if (value == null) {
  409 + builder.Append("null");
  410 + }
  411 + else if ((asStr = value as string) != null) {
  412 + SerializeString(asStr);
  413 + }
  414 + else if (value is bool) {
  415 + builder.Append(value.ToString().ToLower());
  416 + }
  417 + else if ((asList = value as IList) != null) {
  418 + SerializeArray(asList);
  419 + }
  420 + else if ((asDict = value as IDictionary) != null) {
  421 + SerializeObject(asDict);
  422 + }
  423 + else if (value is char) {
  424 + SerializeString(value.ToString());
  425 + }
  426 + else {
  427 + SerializeOther(value);
  428 + }
  429 + }
  430 +
  431 + void SerializeObject(IDictionary obj) {
  432 + bool first = true;
  433 +
  434 + builder.Append('{');
  435 +
  436 + foreach (object e in obj.Keys) {
  437 + if (!first) {
  438 + builder.Append(',');
  439 + }
  440 +
  441 + SerializeString(e.ToString());
  442 + builder.Append(':');
  443 +
  444 + SerializeValue(obj[e]);
  445 +
  446 + first = false;
  447 + }
  448 +
  449 + builder.Append('}');
  450 + }
  451 +
  452 + void SerializeArray(IList anArray) {
  453 + builder.Append('[');
  454 +
  455 + bool first = true;
  456 +
  457 + foreach (object obj in anArray) {
  458 + if (!first) {
  459 + builder.Append(',');
  460 + }
  461 +
  462 + SerializeValue(obj);
  463 +
  464 + first = false;
  465 + }
  466 +
  467 + builder.Append(']');
  468 + }
  469 +
  470 + void SerializeString(string str) {
  471 + builder.Append('\"');
  472 +
  473 + char[] charArray = str.ToCharArray();
  474 + foreach (var c in charArray) {
  475 + switch (c) {
  476 + case '"':
  477 + builder.Append("\\\"");
  478 + break;
  479 + case '\\':
  480 + builder.Append("\\\\");
  481 + break;
  482 + case '\b':
  483 + builder.Append("\\b");
  484 + break;
  485 + case '\f':
  486 + builder.Append("\\f");
  487 + break;
  488 + case '\n':
  489 + builder.Append("\\n");
  490 + break;
  491 + case '\r':
  492 + builder.Append("\\r");
  493 + break;
  494 + case '\t':
  495 + builder.Append("\\t");
  496 + break;
  497 + default:
  498 + int codepoint = Convert.ToInt32(c);
  499 + if ((codepoint >= 32) && (codepoint <= 126)) {
  500 + builder.Append(c);
  501 + }
  502 + else {
  503 + builder.Append("\\u" + Convert.ToString(codepoint, 16).PadLeft(4, '0'));
  504 + }
  505 + break;
  506 + }
  507 + }
  508 +
  509 + builder.Append('\"');
  510 + }
  511 +
  512 + void SerializeOther(object value) {
  513 + if (value is float
  514 + || value is int
  515 + || value is uint
  516 + || value is long
  517 + || value is double
  518 + || value is sbyte
  519 + || value is byte
  520 + || value is short
  521 + || value is ushort
  522 + || value is ulong
  523 + || value is decimal) {
  524 + builder.Append(value.ToString());
  525 + }
  526 + else {
  527 + SerializeString(value.ToString());
  528 + }
  529 + }
  530 + }
  531 + }
  532 +}
0 533 \ No newline at end of file
... ...
Assets/Plugins/StansAssets/Support/Common/Data/SA_MiniJSON.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: 84bd872c37534db4e9bf080d5db55bd2
  3 +timeCreated: 1465739088
  4 +licenseType: Store
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 5f72f02d020cd2c4f9ab33567b9f2b62
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Content.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 7b8f81fd4bd78884b8b91bf3f0a13f21
  3 +folderAsset: yes
  4 +timeCreated: 1485641151
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Content/sa_logo_small.png 0 → 100644

27.1 KB

Assets/Plugins/StansAssets/Support/Common/Editor/Content/sa_logo_small.png.meta 0 → 100644
... ... @@ -0,0 +1,55 @@
  1 +fileFormatVersion: 2
  2 +guid: 5ed8b0ea998a383458e4a5f6cceeb8e1
  3 +timeCreated: 1465739134
  4 +licenseType: Store
  5 +TextureImporter:
  6 + fileIDToRecycleName: {}
  7 + serializedVersion: 2
  8 + mipmaps:
  9 + mipMapMode: 0
  10 + enableMipMap: 1
  11 + linearTexture: 0
  12 + correctGamma: 0
  13 + fadeOut: 0
  14 + borderMipMap: 0
  15 + mipMapFadeDistanceStart: 1
  16 + mipMapFadeDistanceEnd: 3
  17 + bumpmap:
  18 + convertToNormalMap: 0
  19 + externalNormalMap: 0
  20 + heightScale: .25
  21 + normalMapFilter: 0
  22 + isReadable: 0
  23 + grayScaleToAlpha: 0
  24 + generateCubemap: 0
  25 + cubemapConvolution: 0
  26 + cubemapConvolutionSteps: 8
  27 + cubemapConvolutionExponent: 1.5
  28 + seamlessCubemap: 0
  29 + textureFormat: -1
  30 + maxTextureSize: 2048
  31 + textureSettings:
  32 + filterMode: -1
  33 + aniso: -1
  34 + mipBias: -1
  35 + wrapMode: -1
  36 + nPOTScale: 1
  37 + lightmap: 0
  38 + rGBM: 0
  39 + compressionQuality: 50
  40 + spriteMode: 0
  41 + spriteExtrude: 1
  42 + spriteMeshType: 1
  43 + alignment: 0
  44 + spritePivot: {x: .5, y: .5}
  45 + spriteBorder: {x: 0, y: 0, z: 0, w: 0}
  46 + spritePixelsToUnits: 100
  47 + alphaIsTransparency: 0
  48 + textureType: -1
  49 + buildTargetSettings: []
  50 + spriteSheet:
  51 + sprites: []
  52 + spritePackingTag:
  53 + userData:
  54 + assetBundleName:
  55 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Content/sa_logo_small_light.png 0 → 100644

24.7 KB

Assets/Plugins/StansAssets/Support/Common/Editor/Content/sa_logo_small_light.png.meta 0 → 100644
... ... @@ -0,0 +1,68 @@
  1 +fileFormatVersion: 2
  2 +guid: e57ff8a19ebb0af49aad6d02ab7bd867
  3 +timeCreated: 1482321588
  4 +licenseType: Store
  5 +TextureImporter:
  6 + fileIDToRecycleName: {}
  7 + serializedVersion: 4
  8 + mipmaps:
  9 + mipMapMode: 0
  10 + enableMipMap: 0
  11 + sRGBTexture: 0
  12 + linearTexture: 1
  13 + fadeOut: 0
  14 + borderMipMap: 0
  15 + mipMapFadeDistanceStart: 1
  16 + mipMapFadeDistanceEnd: 3
  17 + bumpmap:
  18 + convertToNormalMap: 0
  19 + externalNormalMap: 0
  20 + heightScale: 0.25
  21 + normalMapFilter: 0
  22 + isReadable: 0
  23 + grayScaleToAlpha: 0
  24 + generateCubemap: 6
  25 + cubemapConvolution: 0
  26 + seamlessCubemap: 0
  27 + textureFormat: -1
  28 + maxTextureSize: 2048
  29 + textureSettings:
  30 + filterMode: -1
  31 + aniso: 1
  32 + mipBias: -1
  33 + wrapMode: 1
  34 + nPOTScale: 0
  35 + lightmap: 0
  36 + compressionQuality: 50
  37 + spriteMode: 0
  38 + spriteExtrude: 1
  39 + spriteMeshType: 1
  40 + alignment: 0
  41 + spritePivot: {x: 0.5, y: 0.5}
  42 + spriteBorder: {x: 0, y: 0, z: 0, w: 0}
  43 + spritePixelsToUnits: 100
  44 + alphaUsage: 1
  45 + alphaIsTransparency: 1
  46 + spriteTessellationDetail: -1
  47 + textureType: 2
  48 + textureShape: 1
  49 + maxTextureSizeSet: 0
  50 + compressionQualitySet: 0
  51 + textureFormatSet: 0
  52 + platformSettings:
  53 + - buildTarget: DefaultTexturePlatform
  54 + maxTextureSize: 2048
  55 + textureFormat: -1
  56 + textureCompression: 1
  57 + compressionQuality: 50
  58 + crunchedCompression: 0
  59 + allowsAlphaSplitting: 0
  60 + overridden: 0
  61 + spriteSheet:
  62 + serializedVersion: 2
  63 + sprites: []
  64 + outline: []
  65 + spritePackingTag:
  66 + userData:
  67 + assetBundleName:
  68 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts.meta 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +fileFormatVersion: 2
  2 +guid: 4c30eddc01e2a5744ab73dd73fa0e106
  3 +folderAsset: yes
  4 +timeCreated: 1485641150
  5 +licenseType: Free
  6 +DefaultImporter:
  7 + userData:
  8 + assetBundleName:
  9 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_Bool.cs 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Stan's Assets Commons Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +
  10 +using UnityEngine;
  11 +using System.Collections;
  12 +
  13 +
  14 +namespace SA.Common.Editor {
  15 +
  16 + public enum Bool {
  17 + Enabled,
  18 + Disabled
  19 + }
  20 +}
0 21 \ No newline at end of file
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_Bool.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: 01435460693584718811cac7bff7a07b
  3 +timeCreated: 1472657094
  4 +licenseType: Store
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_Instalation.cs 0 → 100644
... ... @@ -0,0 +1,688 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Stan's Assets Commons Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +#if UNITY_EDITOR
  10 +using UnityEngine;
  11 +using UnityEditor;
  12 +using System.Collections;
  13 +
  14 +namespace SA.Common.Editor {
  15 +
  16 + public class Instalation : MonoBehaviour {
  17 +
  18 +
  19 +
  20 +
  21 +
  22 +
  23 +
  24 +
  25 + public static void IOS_UpdatePlugin() {
  26 + IOS_InstallPlugin(false);
  27 + }
  28 +
  29 + public static void IOS_InstallPlugin(bool IsFirstInstall = true) {
  30 +
  31 + IOS_CleanUp();
  32 +
  33 +
  34 +
  35 +
  36 +
  37 + //IOS Native
  38 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_Camera.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_Camera.mm");
  39 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_GameCenter.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_GameCenter.mm");
  40 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_iAd.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_iAd.mm");
  41 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_InApp.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_InApp.mm");
  42 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_Media.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_Media.mm");
  43 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_ReplayKit.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_ReplayKit.mm");
  44 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_GestureRecognizer.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_GestureRecognizer.mm");
  45 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_CloudKit.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_CloudKit.mm");
  46 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_NSData+Base64.h.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_NSData+Base64.h");
  47 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_NSData+Base64.m.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_NSData+Base64.m");
  48 +
  49 +
  50 + IOS_Install_SocialPart();
  51 + InstallGMAPart();
  52 +
  53 +
  54 +
  55 + }
  56 +
  57 + public static void InstallGMAPart() {
  58 + //GMA
  59 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "GMA_SA_Lib_Proxy.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "GMA_SA_Lib_Proxy.mm");
  60 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "GMA_SA_Lib.h.txt", SA.Common.Config.IOS_DESTANATION_PATH + "GMA_SA_Lib.h");
  61 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "GMA_SA_Lib.m.txt", SA.Common.Config.IOS_DESTANATION_PATH + "GMA_SA_Lib.m");
  62 +
  63 + }
  64 +
  65 +
  66 + public static void IOS_Install_SocialPart() {
  67 + //IOS Native + MSP
  68 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_SocialGate.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_SocialGate.mm");
  69 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_NativeCore.h.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_NativeCore.h");
  70 + SA.Common.Util.Files.CopyFile(SA.Common.Config.IOS_SOURCE_PATH + "ISN_NativeCore.mm.txt", SA.Common.Config.IOS_DESTANATION_PATH + "ISN_NativeCore.mm");
  71 + }
  72 +
  73 +
  74 +
  75 +
  76 + public static void Remove_FB_SDK_WithDialog() {
  77 + bool result = EditorUtility.DisplayDialog(
  78 + "Removing Facebook SDK",
  79 + "Are you sure you want to remove Facebook OAuth API?",
  80 + "Remove",
  81 + "Cansel");
  82 +
  83 + if(result) {
  84 + Remove_FB_SDK();
  85 + }
  86 + }
  87 + public static void Remove_FB_SDK() {
  88 +
  89 + SA.Common.Util.Files.DeleteFolder(SA.Common.Config.ANDROID_DESTANATION_PATH + "facebook");
  90 + SA.Common.Util.Files.DeleteFolder("Plugins/facebook", false);
  91 + SA.Common.Util.Files.DeleteFolder("Facebook", false);
  92 + SA.Common.Util.Files.DeleteFolder("FacebookSDK", false);
  93 +
  94 + //MSP
  95 + SA.Common.Util.Files.DeleteFile("Extensions/MobileSocialPlugin/Example/Scripts/MSPFacebookUseExample.cs", false);
  96 + SA.Common.Util.Files.DeleteFile("Extensions/MobileSocialPlugin/Example/Scripts/MSP_FacebookAnalyticsExample.cs", false);
  97 + SA.Common.Util.Files.DeleteFile("Extensions/MobileSocialPlugin/Example/Scripts/MSP_FacebookAndroidTurnBasedAndGiftsExample.cs", false);
  98 +
  99 + //FB v7
  100 + SA.Common.Util.Files.DeleteFolder("Examples", false);
  101 + SA.Common.Util.Files.DeleteFolder(SA.Common.Config.IOS_DESTANATION_PATH + "Facebook", false);
  102 +
  103 +
  104 + SA.Common.Util.Files.DeleteFolder(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/bolts-android-1.2.0.jar");
  105 + SA.Common.Util.Files.DeleteFolder(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/facebook-android-sdk-4.7.0.jar");
  106 + SA.Common.Util.Files.DeleteFolder(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/facebook-android-wrapper-release.jar");
  107 +
  108 + AssetDatabase.Refresh();
  109 + }
  110 +
  111 +
  112 + private static string AN_SoomlaGrowContent = SA.Common.Config.MODULS_PATH + "AndroidNative/Other/Soomla/AN_SoomlaGrow.cs";
  113 + public static void DisableSoomlaFB() {
  114 + ChnageDefineState(AN_SoomlaGrowContent, "FACEBOOK_ENABLED", false);
  115 + }
  116 +
  117 +
  118 +
  119 +
  120 +
  121 + private static void ChnageDefineState(string file, string tag, bool IsEnabled) {
  122 +
  123 + if(!SA.Common.Util.Files.IsFileExists(file)) {
  124 + Debug.Log("ChnageDefineState for tag: " + tag + " File not found at path: " + file);
  125 + return;
  126 + }
  127 +
  128 + string content = SA.Common.Util.Files.Read(file);
  129 +
  130 + int endlineIndex;
  131 + endlineIndex = content.IndexOf(System.Environment.NewLine);
  132 + if(endlineIndex == -1) {
  133 + endlineIndex = content.IndexOf("\n");
  134 + }
  135 +
  136 + string TagLine = content.Substring(0, endlineIndex);
  137 +
  138 + if(IsEnabled) {
  139 + content = content.Replace(TagLine, "#define " + tag);
  140 + } else {
  141 + content = content.Replace(TagLine, "//#define " + tag);
  142 + }
  143 +
  144 + SA.Common.Util.Files.Write(file, content);
  145 +
  146 + }
  147 +
  148 +
  149 + public static void IOS_CleanUp() {
  150 +
  151 +
  152 + //Old APi
  153 + RemoveIOSFile("AppEventListener");
  154 + RemoveIOSFile("CloudManager");
  155 + RemoveIOSFile("CustomBannerView");
  156 + RemoveIOSFile("GameCenterManager");
  157 + RemoveIOSFile("GCHelper");
  158 + RemoveIOSFile("iAdBannerController");
  159 + RemoveIOSFile("iAdBannerObject");
  160 + RemoveIOSFile("InAppPurchaseManager");
  161 + RemoveIOSFile("IOSGameCenterManager");
  162 + RemoveIOSFile("IOSNativeNotificationCenter");
  163 + RemoveIOSFile("IOSNativePopUpsManager");
  164 + RemoveIOSFile("IOSNativeUtility");
  165 + RemoveIOSFile("ISN_NSData+Base64");
  166 + RemoveIOSFile("ISN_Reachability");
  167 + RemoveIOSFile("ISNCamera");
  168 + RemoveIOSFile("ISNDataConvertor");
  169 + RemoveIOSFile("ISNSharedApplication");
  170 + RemoveIOSFile("ISNVideo");
  171 + RemoveIOSFile("PopUPDelegate");
  172 + RemoveIOSFile("RatePopUPDelegate");
  173 + RemoveIOSFile("SKProduct+LocalizedPrice");
  174 + RemoveIOSFile("SocialGate");
  175 + RemoveIOSFile("StoreProductView");
  176 + RemoveIOSFile("TransactionServer");
  177 +
  178 + RemoveIOSFile("OneSignalUnityRuntime");
  179 + RemoveIOSFile("OneSignal");
  180 + RemoveIOSFile("libOneSignal");
  181 + RemoveIOSFile("ISN_Security");
  182 + RemoveIOSFile("ISN_NativeUtility");
  183 + RemoveIOSFile("ISN_NativePopUpsManager");
  184 + RemoveIOSFile("ISN_Media");
  185 + RemoveIOSFile("ISN_GameCenterTBM");
  186 + RemoveIOSFile("ISN_GameCenterRTM");
  187 + RemoveIOSFile("ISN_GameCenterManager");
  188 + RemoveIOSFile("ISN_GameCenterListner");
  189 + RemoveIOSFile("IOSNativeNotificationCenter");
  190 +
  191 +
  192 +
  193 + //New API
  194 + RemoveIOSFile("ISN_Camera");
  195 + RemoveIOSFile("ISN_GameCenter");
  196 + RemoveIOSFile("ISN_InApp");
  197 + RemoveIOSFile("ISN_iAd");
  198 + RemoveIOSFile("ISN_NativeCore");
  199 + RemoveIOSFile("ISN_SocialGate");
  200 + RemoveIOSFile("ISN_ReplayKit");
  201 + RemoveIOSFile("ISN_CloudKit");
  202 + RemoveIOSFile("ISN_Soomla");
  203 + RemoveIOSFile("ISN_GestureRecognizer");
  204 +
  205 +
  206 +
  207 + //Google Ad old v1
  208 + RemoveIOSFile("GADAdMobExtras");
  209 + RemoveIOSFile("GADAdNetworkExtras");
  210 + RemoveIOSFile("GADAdSize");
  211 + RemoveIOSFile("GADBannerViewDelegate");
  212 + RemoveIOSFile("GADInAppPurchase");
  213 + RemoveIOSFile("GADInAppPurchaseDelegate");
  214 + RemoveIOSFile("GADInterstitialDelegate");
  215 + RemoveIOSFile("GADModules");
  216 + RemoveIOSFile("GADRequest");
  217 + RemoveIOSFile("GADRequestError");
  218 + RemoveIOSFile("libGoogleAdMobAds");
  219 +
  220 + //Google Ad old v2
  221 + RemoveIOSFile("GoogleMobileAdBanner");
  222 + RemoveIOSFile("GoogleMobileAdController");
  223 +
  224 +
  225 + //Google Ad new
  226 + RemoveIOSFile("GMA_SA_Lib");
  227 +
  228 +
  229 + //MSP old
  230 + RemoveIOSFile("IOSInstaPlugin");
  231 + RemoveIOSFile("IOSTwitterPlugin");
  232 + RemoveIOSFile("MGInstagram");
  233 +
  234 +
  235 +
  236 +
  237 +
  238 + }
  239 +
  240 +
  241 + public static void RemoveIOSFile(string filename) {
  242 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.IOS_DESTANATION_PATH + filename + ".h");
  243 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.IOS_DESTANATION_PATH + filename + ".m");
  244 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.IOS_DESTANATION_PATH + filename + ".mm");
  245 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.IOS_DESTANATION_PATH + filename + ".a");
  246 + }
  247 +
  248 +
  249 + public static void Android_UpdatePlugin() {
  250 + Android_InstallPlugin(false);
  251 + }
  252 +
  253 + public static void EnableFirebaseAnalytics() {
  254 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "firebase/firebase-analytics.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-analytics.aar");
  255 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "firebase/firebase-analytics-impl.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-analytics-impl.aar");
  256 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "firebase/firebase-common.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-common.aar");
  257 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "firebase/firebase-iid.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-iid.aar");
  258 + }
  259 +
  260 + public static void DisableFirebaseAnalytics() {
  261 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-analytics.aar");
  262 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-analytics-impl.aar");
  263 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-common.aar");
  264 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/firebase-iid.aar");
  265 + }
  266 +
  267 + public static void EnableGooglePlayAPI() {
  268 + #if UNITY_4_6 || UNITY_4_7
  269 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/an_googleplay.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_googleplay.jar");
  270 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-base.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-base.jar");
  271 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-basement.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-basement.jar");
  272 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.jar");
  273 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads-lite.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.jar");
  274 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-games.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.jar");
  275 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-iid.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.jar");
  276 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-gcm.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.jar");
  277 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-plus.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.jar");
  278 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-appinvite.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.jar");
  279 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.jar");
  280 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics-impl.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.jar");
  281 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.jar");
  282 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth-base.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.jar");
  283 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-drive.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.jar");
  284 + #else
  285 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/an_googleplay.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_googleplay.aar");
  286 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-base.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-base.aar");
  287 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-basement.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-basement.aar");
  288 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.aar");
  289 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads-lite.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.aar");
  290 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-games.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.aar");
  291 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-iid.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.aar");
  292 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-gcm.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.aar");
  293 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-plus.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.aar");
  294 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-appinvite.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.aar");
  295 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.aar");
  296 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics-impl.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.aar");
  297 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.aar");
  298 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth-base.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.aar");
  299 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-drive.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.aar");
  300 + #endif
  301 + }
  302 +
  303 + public static void DisableGooglePlayAPI() {
  304 + #if UNITY_4_6 || UNITY_4_7
  305 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_googleplay.jar");
  306 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-base.jar");
  307 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-basement.jar");
  308 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.jar");
  309 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.jar");
  310 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.jar");
  311 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.jar");
  312 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.jar");
  313 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.jar");
  314 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.jar");
  315 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.jar");
  316 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.jar");
  317 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.jar");
  318 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.jar");
  319 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.jar");
  320 + #else
  321 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_googleplay.aar");
  322 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-base.aar");
  323 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-basement.aar");
  324 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.aar");
  325 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.aar");
  326 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.aar");
  327 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.aar");
  328 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.aar");
  329 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.aar");
  330 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.aar");
  331 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.aar");
  332 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.aar");
  333 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.aar");
  334 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.aar");
  335 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.aar");
  336 + #endif
  337 + }
  338 +
  339 + public static void EnableDriveAPI() {
  340 + #if UNITY_4_6 || UNITY_4_7
  341 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-drive.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.jar");
  342 + #else
  343 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-drive.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.aar");
  344 + #endif
  345 + }
  346 +
  347 + public static void DisableDriveAPI() {
  348 + #if UNITY_4_6 || UNITY_4_7
  349 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.jar");
  350 + #else
  351 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-drive.aar");
  352 + #endif
  353 + }
  354 +
  355 + public static void EnableOAuthAPI() {
  356 + #if UNITY_4_6 || UNITY_4_7
  357 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.jar");
  358 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth-base.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.aar");
  359 + #else
  360 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.aar");
  361 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-auth-base.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.aar");
  362 + #endif
  363 + }
  364 +
  365 + public static void DisableOAuthAPI(){
  366 + #if UNITY_4_6 || UNITY_4_7
  367 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.jar");
  368 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.jar");
  369 + #else
  370 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth.aar");
  371 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-auth-base.aar");
  372 + #endif
  373 + }
  374 +
  375 + public static void EnableAnalyticsAPI() {
  376 + #if UNITY_4_6 || UNITY_4_7
  377 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.jar");
  378 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics-impl.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.aar");
  379 + #else
  380 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.aar");
  381 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-analytics-impl.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.aar");
  382 + #endif
  383 + }
  384 +
  385 + public static void DisableAnalyticsAPI() {
  386 + #if UNITY_4_6 || UNITY_4_7
  387 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.jar");
  388 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.jar");
  389 + #else
  390 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics.aar");
  391 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-analytics-impl.aar");
  392 + #endif
  393 + }
  394 +
  395 + public static void EnableAppInvitesAPI() {
  396 + #if UNITY_4_6 || UNITY_4_7
  397 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-appinvite.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.jar");
  398 + #else
  399 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-appinvite.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.aar");
  400 + #endif
  401 + }
  402 +
  403 + public static void DisableAppInvitesAPI() {
  404 + #if UNITY_4_6 || UNITY_4_7
  405 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.jar");
  406 + #else
  407 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-appinvite.aar");
  408 + #endif
  409 + }
  410 +
  411 + public static void EnableGooglePlusAPI() {
  412 + #if UNITY_4_6 || UNITY_4_7
  413 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-plus.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.jar");
  414 + #else
  415 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-plus.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.aar");
  416 + #endif
  417 + }
  418 +
  419 + public static void DisableGooglePlusAPI() {
  420 + #if UNITY_4_6 || UNITY_4_7
  421 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.jar");
  422 + #else
  423 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-plus.aar");
  424 + #endif
  425 + }
  426 +
  427 + public static void EnablePushNotificationsAPI() {
  428 + #if UNITY_4_6 || UNITY_4_7
  429 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-iid.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.jar");
  430 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-gcm.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.jar");
  431 + #else
  432 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-iid.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.aar");
  433 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-gcm.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.aar");
  434 + #endif
  435 + }
  436 +
  437 + public static void DisablePushNotificationsAPI() {
  438 + #if UNITY_4_6 || UNITY_4_7
  439 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.jar");
  440 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.jar");
  441 + #else
  442 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-iid.aar");
  443 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-gcm.aar");
  444 + #endif
  445 + }
  446 +
  447 + public static void EnableGoogleAdMobAPI() {
  448 + #if UNITY_4_6 || UNITY_4_7
  449 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.jar");
  450 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads-lite.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.jar");
  451 + #else
  452 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.aar");
  453 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-ads-lite.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.aar");
  454 + #endif
  455 + }
  456 +
  457 + public static void DisableGoogleAdMobAPI() {
  458 + #if UNITY_4_6 || UNITY_4_7
  459 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.jar");
  460 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.jar");
  461 + #else
  462 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads.aar");
  463 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-ads-lite.aar");
  464 + #endif
  465 + }
  466 +
  467 + public static void EnableGooglePlayServicesAPI () {
  468 + #if UNITY_4_6 || UNITY_4_7
  469 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-games.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.jar");
  470 + #else
  471 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/play-services-games.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.aar");
  472 + #endif
  473 + }
  474 +
  475 + public static void DisableGooglePlayServicesAPI() {
  476 + #if UNITY_4_6 || UNITY_4_7
  477 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.jar");
  478 + #else
  479 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/play-services-games.aar");
  480 + #endif
  481 + }
  482 +
  483 + public static void EnableAndroidCampainAPI() {
  484 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/sa_analytics.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/sa_analytics.jar");
  485 + }
  486 +
  487 +
  488 + public static void DisableAndroidCampainAPI() {
  489 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/sa_analytics.jar");
  490 + }
  491 +
  492 +
  493 + public static void EnableAppLicensingAPI() {
  494 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "app_licensing/an_licensing_library.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_licensing_library.jar");
  495 + }
  496 +
  497 +
  498 + public static void DisableAppLicensingAPI() {
  499 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_licensing_library.jar");
  500 + }
  501 +
  502 +
  503 + public static void EnableSoomlaAPI() {
  504 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/an_sa_soomla.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_sa_soomla.jar");
  505 + }
  506 +
  507 +
  508 + public static void DisableSoomlaAPI() {
  509 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_sa_soomla.jar");
  510 + }
  511 +
  512 +
  513 +
  514 + public static void EnableBillingAPI() {
  515 + #if UNITY_4_6 || UNITY_4_7
  516 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "billing/an_billing.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_billing.jar");
  517 + #else
  518 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "billing/an_billing.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_billing.aar");
  519 + #endif
  520 + }
  521 +
  522 + public static void DisableBillingAPI() {
  523 + #if UNITY_4_6 || UNITY_4_7
  524 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_billing.jar");
  525 + #else
  526 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_billing.aar");
  527 + #endif
  528 + }
  529 +
  530 +
  531 +
  532 +
  533 + public static void EnableSocialAPI() {
  534 + #if UNITY_4_6 || UNITY_4_7
  535 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "social/an_social.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_social.jar");
  536 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "social/twitter4j-core-4.0.4.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/twitter4j-core-4.0.4.jar");
  537 + #else
  538 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "social/an_social.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_social.aar");
  539 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "social/twitter4j-core-4.0.4.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/twitter4j-core-4.0.4.jar");
  540 + #endif
  541 + }
  542 +
  543 + public static void DisableSocialAPI() {
  544 + #if UNITY_4_6 || UNITY_4_7
  545 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_social.jar");
  546 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/twitter4j-core-4.0.4.jar");
  547 + #else
  548 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/an_social.aar");
  549 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/twitter4j-core-4.0.4.jar");
  550 + #endif
  551 + }
  552 +
  553 +
  554 +
  555 +
  556 +
  557 +
  558 + public static void EnableCameraAPI() {
  559 + //Unity 5 upgdare:
  560 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/image-chooser-library-1.6.0.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/image-chooser-library-1.6.0.jar");
  561 + }
  562 +
  563 + public static void DisableCameraAPI() {
  564 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/image-chooser-library-1.6.0.jar");
  565 + }
  566 +
  567 +
  568 +
  569 +
  570 +
  571 + public static void Android_InstallPlugin(bool IsFirstInstall = true) {
  572 +
  573 +
  574 + //Unity 5 upgdare:
  575 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/httpclient-4.3.1.jar");
  576 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/signpost-commonshttp4-1.2.1.2.jar");
  577 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/signpost-core-1.2.1.2.jar");
  578 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/libGoogleAnalyticsServices.jar");
  579 +
  580 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/android-support-v4.jar");
  581 +
  582 + //Remove previous Image Chooser Library version
  583 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/image-chooser-library-1.3.0.jar");
  584 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/image-chooser-library-1.6.0.jar");
  585 +
  586 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/twitter4j-core-3.0.5.jar");
  587 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/google-play-services.jar");
  588 +
  589 +
  590 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "social/an_social.jar");
  591 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "social/twitter4j-core-3.0.5.jar");
  592 +
  593 +
  594 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/an_googleplay.jar");
  595 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "google_play/google-play-services.jar");
  596 +
  597 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_SOURCE_PATH + "billing/an_billing.jar");
  598 +
  599 + #if UNITY_4_6 || UNITY_4_7
  600 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/android-support-v4.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/android-support-v4.jar");
  601 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "androidnative.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "androidnative.jar");
  602 + #else
  603 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "libs/support-v4-24.1.1.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "libs/support-v4-24.1.1.aar");
  604 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "androidnative.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "androidnative.aar");
  605 + #endif
  606 +
  607 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "sa_analytics.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "sa_analytics.jar");
  608 +
  609 + #if UNITY_4_6 || UNITY_4_7
  610 + SA.Common.Util.Files.CopyFile (SA.Common.Config.ANDROID_SOURCE_PATH + "mobile-native-popups.jar.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "mobile-native-popups.jar");
  611 + #else
  612 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + "mobile-native-popups.txt", SA.Common.Config.ANDROID_DESTANATION_PATH + "mobile-native-popups.aar");
  613 + #endif
  614 + SA.Common.Util.Files.DeleteFile (SA.Common.Config.ANDROID_SOURCE_PATH + "mobilenativepopups.txt");
  615 + SA.Common.Util.Files.DeleteFile (SA.Common.Config.ANDROID_DESTANATION_PATH + "mobilenativepopups.jar");
  616 +
  617 + SA.Common.Util.Files.CopyFolder(SA.Common.Config.ANDROID_SOURCE_PATH + "facebook", SA.Common.Config.ANDROID_DESTANATION_PATH + "facebook");
  618 +
  619 + #if UNITY_3_5 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
  620 +
  621 + #else
  622 + SA.Common.Util.Files.DeleteFolder(SA.Common.Config.ANDROID_SOURCE_PATH + "facebook");
  623 + #endif
  624 +
  625 + if(IsFirstInstall) {
  626 + EnableBillingAPI();
  627 + EnableGooglePlayAPI();
  628 + EnableSocialAPI();
  629 + EnableCameraAPI();
  630 + EnableAppLicensingAPI();
  631 + }
  632 +
  633 +
  634 +
  635 +
  636 + string file;
  637 + file = "AN_Res/res/values/analytics.xml";
  638 + if(!SA.Common.Util.Files.IsFileExists(SA.Common.Config.ANDROID_DESTANATION_PATH + file)) {
  639 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + file, SA.Common.Config.ANDROID_DESTANATION_PATH + file);
  640 + }
  641 +
  642 +
  643 + file = "AN_Res/res/values/ids.xml";
  644 + if(!SA.Common.Util.Files.IsFileExists(SA.Common.Config.ANDROID_DESTANATION_PATH + file)) {
  645 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + file, SA.Common.Config.ANDROID_DESTANATION_PATH + file);
  646 + }
  647 +
  648 + file = "AN_Res/res/xml/file_paths.xml";
  649 + if(!SA.Common.Util.Files.IsFileExists(SA.Common.Config.ANDROID_DESTANATION_PATH + file)) {
  650 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + file, SA.Common.Config.ANDROID_DESTANATION_PATH + file);
  651 + }
  652 +
  653 +
  654 + file = "AN_Res/res/values/version.xml";
  655 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + file, SA.Common.Config.ANDROID_DESTANATION_PATH + file);
  656 +
  657 + file = "AN_Res/project.properties";
  658 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + file, SA.Common.Config.ANDROID_DESTANATION_PATH + file);
  659 +
  660 + file = "AN_Res/AndroidManifest";
  661 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + file + ".txt", SA.Common.Config.ANDROID_DESTANATION_PATH + file + ".xml");
  662 +
  663 + //First install dependense
  664 +
  665 + file = "AndroidManifest";
  666 + if(!SA.Common.Util.Files.IsFileExists(SA.Common.Config.ANDROID_DESTANATION_PATH + file)) {
  667 + SA.Common.Util.Files.CopyFile(SA.Common.Config.ANDROID_SOURCE_PATH + file + ".txt", SA.Common.Config.ANDROID_DESTANATION_PATH + file + ".xml");
  668 + }
  669 +
  670 + AssetDatabase.Refresh();
  671 +
  672 + }
  673 +
  674 +
  675 +
  676 + public static bool IsFacebookInstalled {
  677 + get {
  678 + return SA.Common.Util.Files.IsFileExists("Facebook/Scripts/FB.cs")
  679 + || SA.Common.Util.Files.IsFileExists("FacebookSDK/SDK/Scripts/FB.cs")
  680 + || SA.Common.Util.Files.IsFileExists("FacebookSDK/Plugins/Facebook.Unity.dll");
  681 + }
  682 + }
  683 +
  684 +
  685 + }
  686 +
  687 +}
  688 +#endif
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_Instalation.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: f3deafb3b39e043eb8317363a4b60014
  3 +timeCreated: 1472657094
  4 +licenseType: Store
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_RemoveTool.cs 0 → 100644
... ... @@ -0,0 +1,194 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Stan's Assets Commons Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +#if UNITY_EDITOR
  10 +using UnityEngine;
  11 +using UnityEditor;
  12 +using System.Collections;
  13 +using System.IO;
  14 +using System.Collections.Generic;
  15 +
  16 +
  17 +namespace SA.Common.Editor {
  18 +
  19 + public class RemoveTool {
  20 +
  21 +
  22 + public static void RemoveOneSignal() {
  23 + RemoveNativeFileIOS("libOneSignal");
  24 + RemoveNativeFileIOS("OneSignal");
  25 + RemoveNativeFileIOS("OneSignalUnityRuntime");
  26 + SA.Common.Util.Files.DeleteFolder("StansAssetsCommon/OneSignal");
  27 + }
  28 +
  29 +
  30 +
  31 + public static void RemovePlugins() {
  32 +
  33 + int option = EditorUtility.DisplayDialogComplex(
  34 + "Remove Stan's Assets Plugins",
  35 + "Following plugins wiil be removed:\n" + VersionsManager.InstalledPluginsList,
  36 + "Remove",
  37 + "Cancel",
  38 + "Documentation");
  39 +
  40 +
  41 + switch(option) {
  42 + case 0:
  43 + ProcessRemove();
  44 + break;
  45 +
  46 + case 2:
  47 + string url = "https://goo.gl/CCBFIZ";
  48 + Application.OpenURL(url);
  49 + break;
  50 + }
  51 +
  52 + }
  53 +
  54 +
  55 +
  56 + private static void ProcessRemove() {
  57 +
  58 + //Old plugins location, just in case
  59 + SA.Common.Util.Files.DeleteFolder ("Extensions/AllDocumentation");
  60 + SA.Common.Util.Files.DeleteFolder ("Extensions/FlashLikeEvents");
  61 + SA.Common.Util.Files.DeleteFolder ("Extensions/AndroidManifestManager");
  62 + SA.Common.Util.Files.DeleteFolder ("Extensions/GooglePlayCommon");
  63 + SA.Common.Util.Files.DeleteFolder ("Extensions/StansAssetsCommon");
  64 + SA.Common.Util.Files.DeleteFolder ("Extensions/StansAssetsPreviewUI");
  65 + SA.Common.Util.Files.DeleteFolder ("Extensions/IOSDeploy");
  66 + SA.Common.Util.Files.DeleteFolder ("Extensions/AndroidNative");
  67 + SA.Common.Util.Files.DeleteFolder ("Extensions/MobileSocialPlugin");
  68 + SA.Common.Util.Files.DeleteFolder ("Extensions/GoogleMobileAd");
  69 + SA.Common.Util.Files.DeleteFolder("Extensions/IOSNative");
  70 + SA.Common.Util.Files.DeleteFolder("Extensions/UltimateMobile");
  71 + SA.Common.Util.Files.DeleteFolder("Extensions/WP8Native");
  72 + SA.Common.Util.Files.DeleteFolder("WebPlayerTemplates");
  73 + SA.Common.Util.Files.DeleteFolder("Extensions/GoogleAnalytics");
  74 + SA.Common.Util.Files.DeleteFolder("Extensions/MobileNativePopUps");
  75 +
  76 +
  77 +
  78 +
  79 + RemoveWP8Part();
  80 + RemoveIOSPart();
  81 + RemoveAndroidPart();
  82 +
  83 +
  84 + SA.Common.Util.Files.DeleteFolder (SA.Common.Config.MODULS_PATH);
  85 + SA.Common.Util.Files.DeleteFolder (SA.Common.Config.BUNDLES_PATH);
  86 +
  87 +
  88 + SA.Common.Util.Files.DeleteFolder (SA.Common.Config.COMMON_LIB_PATH);
  89 + SA.Common.Util.Files.DeleteFolder (SA.Common.Config.VERSION_INFO_PATH);
  90 + SA.Common.Util.Files.DeleteFolder (SA.Common.Config.NATIVE_LIBRARIES_PATH);
  91 + SA.Common.Util.Files.DeleteFolder (SA.Common.Config.EDITOR_TESTING_LIB_PATH);
  92 +
  93 +
  94 +
  95 +
  96 + AssetDatabase.Refresh();
  97 + EditorUtility.DisplayDialog("Plugins Removed Successfully", "Unity Editor Restart Required.", "Okay");
  98 + }
  99 +
  100 +
  101 +
  102 +
  103 +
  104 + private static void RemoveAndroidPart() {
  105 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "androidnative.jar");
  106 + SA.Common.Util.Files.DeleteFile(SA.Common.Config.ANDROID_DESTANATION_PATH + "mobilenativepopups.jar");
  107 +
  108 + SA.Common.Util.Files.DeleteFolder (SA.Common.Config.ANDROID_DESTANATION_PATH + "libs");
  109 + }
  110 +
  111 +
  112 + private static void RemoveWP8Part() {
  113 + SA.Common.Util.Files.DeleteFile ("Plugins/WP8/GoogleAds.dll");
  114 + SA.Common.Util.Files.DeleteFile ("Plugins/WP8/GoogleAds.xml");
  115 + SA.Common.Util.Files.DeleteFile ("Plugins/WP8/MockIAPLib.dll");
  116 + SA.Common.Util.Files.DeleteFile ("Plugins/WP8/WP8Native.dll");
  117 + SA.Common.Util.Files.DeleteFile ("Plugins/WP8/WP8PopUps.dll");
  118 + SA.Common.Util.Files.DeleteFile ("Plugins/WP8/GoogleAdsWP8.dll");
  119 + SA.Common.Util.Files.DeleteFile ("Plugins/GoogleAdsWP8.dll");
  120 + SA.Common.Util.Files.DeleteFile ("Plugins/Metro/WP8Native.dll");
  121 + SA.Common.Util.Files.DeleteFile ("Plugins/Metro/WP8PopUps.dll");
  122 + }
  123 +
  124 +
  125 + private static void RemoveIOSPart() {
  126 + //TODO просмотреть не забыли ли чего лучге смотреть в УМ
  127 +
  128 + //ISN
  129 + RemoveNativeFileIOS("AppEventListener");
  130 + RemoveNativeFileIOS("CloudManager");
  131 + RemoveNativeFileIOS("CustomBannerView");
  132 + RemoveNativeFileIOS("iAdBannerController");
  133 + RemoveNativeFileIOS("iAdBannerObject");
  134 + RemoveNativeFileIOS("InAppPurchaseManager");
  135 + RemoveNativeFileIOS("IOSNativeNotificationCenter");
  136 + RemoveNativeFileIOS("ISN_GameCenterListner");
  137 + RemoveNativeFileIOS("ISN_GameCenterManager");
  138 + RemoveNativeFileIOS("ISN_GameCenter");
  139 + RemoveNativeFileIOS("ISN_Media");
  140 + RemoveNativeFileIOS("ISN_iAd");
  141 + RemoveNativeFileIOS("ISN_InApp");
  142 + RemoveNativeFileIOS("ISN_NativePopUpsManager");
  143 + RemoveNativeFileIOS("ISN_NativeUtility");
  144 + RemoveNativeFileIOS("ISN_NSData+Base64");
  145 + RemoveNativeFileIOS("ISN_Reachability");
  146 + RemoveNativeFileIOS("ISN_Security");
  147 + RemoveNativeFileIOS("ISN_Camera");
  148 + RemoveNativeFileIOS("ISN_ReplayKit");
  149 + RemoveNativeFileIOS("ISN_SocialGate");
  150 + RemoveNativeFileIOS("ISN_NativeCore");
  151 + RemoveNativeFileIOS("ISNDataConvertor");
  152 + RemoveNativeFileIOS("ISNSharedApplication");
  153 + RemoveNativeFileIOS("ISNVideo");
  154 + RemoveNativeFileIOS("SKProduct+LocalizedPrice");
  155 + RemoveNativeFileIOS("SocialGate");
  156 + RemoveNativeFileIOS("StoreProductView");
  157 + RemoveNativeFileIOS("TransactionServer");
  158 +
  159 +
  160 + //UM
  161 + RemoveNativeFileIOS("UM_IOS_INSTALATION_MARK");
  162 +
  163 + //GMA
  164 + RemoveNativeFileIOS("GoogleMobileAdBanner");
  165 + RemoveNativeFileIOS("GoogleMobileAdController");
  166 +
  167 + //MPS
  168 + RemoveNativeFileIOS("IOSInstaPlugin");
  169 + RemoveNativeFileIOS("IOSTwitterPlugin");
  170 + RemoveNativeFileIOS("MGInstagram");
  171 +
  172 +
  173 + RemoveOneSignal();
  174 + }
  175 +
  176 +
  177 +
  178 +
  179 +
  180 +
  181 + private static void RemoveNativeFileIOS(string filename) {
  182 + string filePath = SA.Common.Config.IOS_DESTANATION_PATH + filename;
  183 +
  184 + SA.Common.Util.Files.DeleteFile (filePath + ".h");
  185 + SA.Common.Util.Files.DeleteFile (filePath + ".m");
  186 + SA.Common.Util.Files.DeleteFile (filePath + ".mm");
  187 + SA.Common.Util.Files.DeleteFile (filePath + ".a");
  188 + SA.Common.Util.Files.DeleteFile (filePath + ".txt");
  189 +
  190 + }
  191 +
  192 + }
  193 +}
  194 +#endif
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_RemoveTool.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: 862f8d34776734b9d8f2c11674a3e67f
  3 +timeCreated: 1472657094
  4 +licenseType: Store
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_Tools.cs 0 → 100644
... ... @@ -0,0 +1,260 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Stan's Assets Commons Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +#if UNITY_EDITOR
  10 +using UnityEngine;
  11 +using UnityEditor;
  12 +using System.Collections;
  13 +
  14 +namespace SA.Common.Editor {
  15 +
  16 + public class Tools {
  17 +
  18 +
  19 + public static void ContactSupportWithSubject(string subject) {
  20 + string url = "mailto:support@stansassets.com?subject=" + EscapeURL(subject);
  21 + Application.OpenURL(url);
  22 + }
  23 +
  24 + static string EscapeURL (string url){
  25 + return WWW.EscapeURL(url).Replace("+","%20");
  26 + }
  27 +
  28 + private static Texture2D _SALogo = null;
  29 +
  30 + public static Texture2D SALogo {
  31 + get {
  32 + if(_SALogo == null) {
  33 +
  34 + string path = "Assets/" + SA.Common.Config.SUPPORT_MODULS_PATH + "Common/Editor/Content/";
  35 +
  36 + if(EditorGUIUtility.isProSkin) {
  37 + path = path + "sa_logo_small.png";
  38 + } else {
  39 + path = path + "sa_logo_small_light.png";
  40 + }
  41 +
  42 + TextureImporter importer = (TextureImporter)TextureImporter.GetAtPath(path);
  43 + importer.textureType = TextureImporterType.GUI;
  44 + AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
  45 +
  46 + _SALogo = AssetDatabase.LoadAssetAtPath(path, typeof(Texture2D)) as Texture2D;
  47 + }
  48 +
  49 + return _SALogo;
  50 + }
  51 + }
  52 +
  53 +
  54 + public static void DrawSALogo() {
  55 +
  56 + GUIStyle s = new GUIStyle();
  57 + GUIContent content = new GUIContent(SALogo, "Visit site");
  58 +
  59 + bool click = GUILayout.Button(content, s);
  60 + if(click) {
  61 + Application.OpenURL(SA.Common.Config.WEBSITE_ROOT_URL);
  62 + }
  63 + }
  64 +
  65 + public static bool ToggleFiled(string title, bool value, string tooltip = "") {
  66 + return ToggleFiled (new GUIContent (title, tooltip), value);
  67 + }
  68 +
  69 +
  70 + public static bool ToggleFiled(GUIContent title, bool value) {
  71 +
  72 + Bool initialValue = Bool.Enabled;
  73 + if(!value) {
  74 + initialValue = Bool.Disabled;
  75 + }
  76 + EditorGUILayout.BeginHorizontal();
  77 + EditorGUILayout.LabelField(title);
  78 +
  79 + initialValue = (Bool) EditorGUILayout.EnumPopup(initialValue);
  80 + if(initialValue == Bool.Enabled) {
  81 + value = true;
  82 + } else {
  83 + value = false;
  84 + }
  85 + EditorGUILayout.EndHorizontal();
  86 +
  87 + return value;
  88 + }
  89 +
  90 + public static bool YesNoFiled(string title, bool value, string tooltip = "") {
  91 + return YesNoFiled (new GUIContent (title, tooltip), value);
  92 + }
  93 +
  94 + public static bool YesNoFiled(GUIContent title, bool value) {
  95 +
  96 + SA_YesNoBool initialValue = SA_YesNoBool.Yes;
  97 + if(!value) {
  98 + initialValue = SA_YesNoBool.No;
  99 + }
  100 + EditorGUILayout.BeginHorizontal();
  101 + EditorGUILayout.LabelField(title);
  102 +
  103 + initialValue = (SA_YesNoBool) EditorGUILayout.EnumPopup(initialValue);
  104 + if(initialValue == SA_YesNoBool.Yes) {
  105 + value = true;
  106 + } else {
  107 + value = false;
  108 + }
  109 + EditorGUILayout.EndHorizontal();
  110 +
  111 + return value;
  112 + }
  113 +
  114 +
  115 + public static System.Enum EnumPopup(string title, System.Enum selected, string tooltip = "") {
  116 + GUIContent c = new GUIContent(title, tooltip);
  117 + return EnumPopup(c, selected);
  118 + }
  119 +
  120 + public static System.Enum EnumPopup(GUIContent title, System.Enum selected) {
  121 +
  122 + EditorGUILayout.BeginHorizontal();
  123 + EditorGUILayout.LabelField(title);
  124 + System.Enum value = EditorGUILayout.EnumPopup (selected);
  125 + EditorGUILayout.EndHorizontal();
  126 +
  127 + return value;
  128 +
  129 + }
  130 +
  131 +
  132 +
  133 +
  134 +
  135 + public static string TextField(string title, string value, string tooltip = "") {
  136 + GUIContent c = new GUIContent(title, tooltip);
  137 + return TextField(c, value);
  138 + }
  139 +
  140 + public static string TextField(GUIContent title, string value) {
  141 +
  142 +
  143 + EditorGUILayout.BeginHorizontal();
  144 + EditorGUILayout.LabelField(title);
  145 + value = EditorGUILayout.TextField(value);
  146 + if(value.Length > 0) {
  147 + value = value.Trim();
  148 + }
  149 + EditorGUILayout.EndHorizontal();
  150 +
  151 + return value;
  152 +
  153 + }
  154 +
  155 +
  156 +
  157 +
  158 + public static bool SrotingButtons(object currentObject, IList ObjectsList) {
  159 +
  160 + int ObjectIndex = ObjectsList.IndexOf(currentObject);
  161 + if(ObjectIndex == 0) {
  162 + GUI.enabled = false;
  163 + }
  164 +
  165 + bool up = GUILayout.Button("↑", EditorStyles.miniButtonLeft, GUILayout.Width(20));
  166 + if(up) {
  167 + object c = currentObject;
  168 + ObjectsList[ObjectIndex] = ObjectsList[ObjectIndex - 1];
  169 + ObjectsList[ObjectIndex - 1] = c;
  170 + }
  171 +
  172 +
  173 + if(ObjectIndex >= ObjectsList.Count -1) {
  174 + GUI.enabled = false;
  175 + } else {
  176 + GUI.enabled = true;
  177 + }
  178 +
  179 + bool down = GUILayout.Button("↓", EditorStyles.miniButtonMid, GUILayout.Width(20));
  180 + if(down) {
  181 + object c = currentObject;
  182 + ObjectsList[ObjectIndex] = ObjectsList[ObjectIndex + 1];
  183 + ObjectsList[ObjectIndex + 1] = c;
  184 + }
  185 +
  186 +
  187 + GUI.enabled = true;
  188 + bool r = GUILayout.Button("-", EditorStyles.miniButtonRight, GUILayout.Width(20));
  189 + if(r) {
  190 + ObjectsList.Remove(currentObject);
  191 + }
  192 +
  193 + return r;
  194 + }
  195 +
  196 +
  197 +
  198 + public static void ChnageDefineState(string file, string tag, bool IsEnabled) {
  199 + if(SA.Common.Util.Files.IsFileExists(file)) {
  200 + string content = SA.Common.Util.Files.Read(file);
  201 + // Debug.Log(file);
  202 + //Debug.Log(content);
  203 +
  204 + int endlineIndex;
  205 + endlineIndex = content.IndexOf(System.Environment.NewLine);
  206 + if(endlineIndex == -1) {
  207 + endlineIndex = content.IndexOf("\n");
  208 + }
  209 + string TagLine = content.Substring(0, endlineIndex);
  210 +
  211 + if(IsEnabled) {
  212 + content = content.Replace(TagLine, "#define " + tag);
  213 + } else {
  214 + content = content.Replace(TagLine, "//#define " + tag);
  215 + }
  216 + // Debug.Log(content);
  217 +
  218 + SA.Common.Util.Files.Write(file, content);
  219 + }
  220 + }
  221 +
  222 +
  223 + public static void BlockHeader(string header) {
  224 + EditorGUILayout.Space();
  225 + EditorGUILayout.HelpBox(header, MessageType.None);
  226 + EditorGUILayout.Space();
  227 + }
  228 +
  229 +
  230 + private static GUIContent SupportEmail = new GUIContent("Support [?]", "If you have any technical questions, feel free to drop us an e-mail");
  231 + public static void SupportMail() {
  232 + SelectableLabelField(SupportEmail, SA.Common.Config.SUPPORT_EMAIL);
  233 + }
  234 +
  235 + private static GUIContent FBdkVersion = new GUIContent("Facebook SDK Version [?]", "Version of Unity Facebook SDK Plugin");
  236 + public static void FBSdkVersionLabel () {
  237 +
  238 + string SdkVersionCode = SA.Common.Config.FB_SDK_VersionCode;
  239 +
  240 +
  241 +
  242 +
  243 + SelectableLabelField(FBdkVersion, SdkVersionCode);
  244 + }
  245 +
  246 +
  247 +
  248 +
  249 + public static void SelectableLabelField(GUIContent label, string value) {
  250 + EditorGUILayout.BeginHorizontal();
  251 + EditorGUILayout.LabelField(label, GUILayout.Width(180), GUILayout.Height(16));
  252 + EditorGUILayout.SelectableLabel(value, GUILayout.Height(16));
  253 + EditorGUILayout.EndHorizontal();
  254 + }
  255 +
  256 + }
  257 +
  258 +}
  259 +
  260 +#endif
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_Tools.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: a57141aa1ebec4184ad121b1729cf734
  3 +timeCreated: 1482600643
  4 +licenseType: Store
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_VersionsManager.cs 0 → 100644
... ... @@ -0,0 +1,281 @@
  1 +////////////////////////////////////////////////////////////////////////////////
  2 +//
  3 +// @module Stan's Assets Commons Lib
  4 +// @author Osipov Stanislav (Stan's Assets)
  5 +// @support support@stansassets.com
  6 +//
  7 +////////////////////////////////////////////////////////////////////////////////
  8 +
  9 +#if UNITY_EDITOR
  10 +using UnityEngine;
  11 +using UnityEditor;
  12 +using System;
  13 +using System.Collections;
  14 +
  15 +namespace SA.Common.Editor {
  16 +
  17 +
  18 + public static class VersionsManager {
  19 +
  20 +
  21 +
  22 +
  23 + //private const string UM_IOS_INSTALATION_MARK = SA.Common.Config.IOS_DESTANATION_PATH + "UM_IOS_INSTALATION_MARK.txt";
  24 +
  25 +
  26 + //--------------------------------------
  27 + // Android Native
  28 + //--------------------------------------
  29 +
  30 +
  31 + public static bool Is_AN_Installed {
  32 + get {
  33 + return SA.Common.Util.Files.IsFileExists(SA.Common.Config.AN_VERSION_INFO_PATH);
  34 + }
  35 + }
  36 +
  37 + public static int AN_Version {
  38 + get {
  39 + return GetVersionCode(SA.Common.Config.AN_VERSION_INFO_PATH);
  40 + }
  41 + }
  42 +
  43 + public static int AN_MagorVersion {
  44 + get {
  45 + return GetMagorVersionCode(SA.Common.Config.AN_VERSION_INFO_PATH);
  46 + }
  47 + }
  48 +
  49 +
  50 + public static string AN_StringVersionId {
  51 + get {
  52 + return GetStringVersionId(SA.Common.Config.AN_VERSION_INFO_PATH);
  53 + }
  54 + }
  55 +
  56 + //--------------------------------------
  57 + // Mobile Social
  58 + //--------------------------------------
  59 +
  60 +
  61 + public static bool Is_MSP_Installed {
  62 + get {
  63 + return SA.Common.Util.Files.IsFileExists(SA.Common.Config.MSP_VERSION_INFO_PATH);
  64 + }
  65 + }
  66 +
  67 + public static int MSP_Version {
  68 +
  69 + get {
  70 + return GetVersionCode(SA.Common.Config.MSP_VERSION_INFO_PATH);
  71 + }
  72 + }
  73 +
  74 + public static int MSP_MagorVersion {
  75 +
  76 + get {
  77 + return GetMagorVersionCode(SA.Common.Config.MSP_VERSION_INFO_PATH);
  78 + }
  79 + }
  80 +
  81 + public static string MSP_StringVersionId {
  82 + get {
  83 + return GetStringVersionId(SA.Common.Config.MSP_VERSION_INFO_PATH);
  84 + }
  85 + }
  86 +
  87 + //--------------------------------------
  88 + // Ultimate Mobile
  89 + //--------------------------------------
  90 +
  91 + public static bool Is_UM_Installed {
  92 + get {
  93 + return SA.Common.Util.Files.IsFileExists(SA.Common.Config.UM_VERSION_INFO_PATH);
  94 + }
  95 + }
  96 +
  97 + public static int UM_Version {
  98 + get {
  99 + return GetVersionCode(SA.Common.Config.UM_VERSION_INFO_PATH);
  100 + }
  101 + }
  102 +
  103 + public static int UM_MagorVersion {
  104 + get {
  105 + return GetMagorVersionCode(SA.Common.Config.UM_VERSION_INFO_PATH);
  106 + }
  107 + }
  108 +
  109 + public static string UM_StringVersionId {
  110 + get {
  111 + return GetStringVersionId(SA.Common.Config.UM_VERSION_INFO_PATH);
  112 + }
  113 + }
  114 +
  115 +
  116 + //--------------------------------------
  117 + // Google Mobile Ad
  118 + //--------------------------------------
  119 +
  120 + public static bool Is_GMA_Installed {
  121 + get {
  122 + return SA.Common.Util.Files.IsFileExists(SA.Common.Config.GMA_VERSION_INFO_PATH);
  123 + }
  124 + }
  125 +
  126 + public static int GMA_Version {
  127 + get {
  128 + return GetVersionCode(SA.Common.Config.GMA_VERSION_INFO_PATH);
  129 + }
  130 + }
  131 +
  132 + public static int GMA_MagorVersion {
  133 + get {
  134 + return GetMagorVersionCode(SA.Common.Config.GMA_VERSION_INFO_PATH);
  135 + }
  136 + }
  137 +
  138 + public static string GMA_StringVersionId {
  139 + get {
  140 + return GetStringVersionId(SA.Common.Config.GMA_VERSION_INFO_PATH);
  141 + }
  142 + }
  143 + //--------------------------------------
  144 + // Mobile Native Pop Up
  145 + //--------------------------------------
  146 + public static bool Is_MNP_Installed {
  147 + get {
  148 + return SA.Common.Util.Files.IsFileExists(SA.Common.Config.MNP_VERSION_INFO_PATH);
  149 + }
  150 + }
  151 +
  152 + public static int MNP_Version {
  153 + get {
  154 + return GetVersionCode(SA.Common.Config.MNP_VERSION_INFO_PATH);
  155 + }
  156 + }
  157 +
  158 + public static int MNP_MagorVersion {
  159 + get {
  160 + return GetMagorVersionCode(SA.Common.Config.MNP_VERSION_INFO_PATH);
  161 + }
  162 + }
  163 +
  164 + public static string MNP_StringVersionId {
  165 + get {
  166 + return GetStringVersionId(SA.Common.Config.MNP_VERSION_INFO_PATH);
  167 + }
  168 + }
  169 +
  170 + //--------------------------------------
  171 + // IOS Native
  172 + //--------------------------------------
  173 +
  174 + public static bool Is_ISN_Installed {
  175 + get {
  176 + return SA.Common.Util.Files.IsFileExists(SA.Common.Config.ISN_VERSION_INFO_PATH);
  177 + }
  178 + }
  179 +
  180 + public static int ISN_Version {
  181 + get {
  182 + return GetVersionCode(SA.Common.Config.ISN_VERSION_INFO_PATH);
  183 + }
  184 + }
  185 +
  186 + public static int ISN_MagorVersion {
  187 + get {
  188 + return GetMagorVersionCode(SA.Common.Config.ISN_VERSION_INFO_PATH);
  189 + }
  190 + }
  191 +
  192 +
  193 + public static string ISN_StringVersionId {
  194 + get {
  195 + return GetStringVersionId(SA.Common.Config.ISN_VERSION_INFO_PATH);
  196 + }
  197 + }
  198 +
  199 +
  200 + //--------------------------------------
  201 + // Utilities
  202 + //--------------------------------------
  203 +
  204 + public static int ParceMagorVersion(string stringVersionId) {
  205 + string[] versions = stringVersionId.Split (new char[] {'.'});
  206 + int intVersion = Int32.Parse(versions[0]) * 100 + Int32.Parse(versions[1]) * 10;
  207 + return intVersion;
  208 + }
  209 +
  210 +
  211 + private static int GetMagorVersionCode(string versionFilePath) {
  212 + string stringVersionId = SA.Common.Util.Files.Read (versionFilePath);
  213 + return ParceMagorVersion(stringVersionId);
  214 + }
  215 +
  216 +
  217 +
  218 + public static int ParceVersion(string stringVersionId) {
  219 + string[] versions = stringVersionId.Split (new char[] {'.'});
  220 + int intVersion = Int32.Parse(versions[0]) * 100 + Int32.Parse(versions[1]) * 10 + (versions.Length == 3 ? Int32.Parse(versions[2]) : 0);
  221 + return intVersion;
  222 + }
  223 +
  224 +
  225 +
  226 + private static int GetVersionCode(string versionFilePath) {
  227 + string stringVersionId = SA.Common.Util.Files.Read (versionFilePath);
  228 + return ParceVersion(stringVersionId);
  229 + }
  230 +
  231 +
  232 +
  233 + private static string GetStringVersionId(string versionFilePath) {
  234 + if(SA.Common.Util.Files.IsFileExists(versionFilePath)) {
  235 + return SA.Common.Util.Files.Read (versionFilePath);
  236 + } else {
  237 + return "0.0";
  238 + }
  239 + }
  240 +
  241 +
  242 + public static string InstalledPluginsList {
  243 +
  244 + get {
  245 +
  246 +
  247 + string allPluginsInstalled = "";
  248 +
  249 +
  250 +
  251 + if(SA.Common.Util.Files.IsFolderExists(SA.Common.Config.BUNDLES_PATH)) {
  252 + string[] bundles = SA.Common.Util.Files.GetFoldersAt (SA.Common.Config.BUNDLES_PATH);
  253 + foreach(string pluginPath in bundles) {
  254 + string pluginName = System.IO.Path.GetFileName (pluginPath);
  255 + allPluginsInstalled = allPluginsInstalled + " (" + pluginName + ")" + "\n";
  256 + }
  257 + }
  258 +
  259 + if(SA.Common.Util.Files.IsFolderExists(SA.Common.Config.MODULS_PATH)) {
  260 +
  261 + string[] modules = SA.Common.Util.Files.GetFoldersAt (SA.Common.Config.MODULS_PATH);
  262 + foreach(string pluginPath in modules) {
  263 + string pluginName = System.IO.Path.GetFileName (pluginPath);
  264 + allPluginsInstalled = allPluginsInstalled + " (" + pluginName + ")" + "\n";
  265 + }
  266 + }
  267 +
  268 +
  269 +
  270 +
  271 + return allPluginsInstalled;
  272 + }
  273 + }
  274 +
  275 +
  276 +
  277 + }
  278 +
  279 +}
  280 +
  281 +#endif
... ...
Assets/Plugins/StansAssets/Support/Common/Editor/Scripts/SA_VersionsManager.cs.meta 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +fileFormatVersion: 2
  2 +guid: 767314f85d4774aad89d03cd192e66ab
  3 +timeCreated: 1472657094
  4 +licenseType: Store
  5 +MonoImporter:
  6 + serializedVersion: 2
  7 + defaultReferences: []
  8 + executionOrder: 0
  9 + icon: {instanceID: 0}
  10 + userData:
  11 + assetBundleName:
  12 + assetBundleVariant:
... ...