Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "AppDelegateListener.h"
- @interface AppDelegateListenerTest : NSObject <AppDelegateListener>
- @property NSString *_goName;
- @property NSString *_methodName;
- @end
- @implementation AppDelegateListenerTest
- static AppDelegateListenerTest *_instance = nil;
- + (void)load {
- if(!_instance) {
- _instance = [[AppDelegateListenerTest alloc] init];
- }
- }
- - (id)init {
- self = [super init];
- if(!self)
- return nil;
- _instance = self;
- // register to unity
- UnityRegisterAppDelegateListener(self);
- return self;
- }
- - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSNotification*)notification {
- NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken was called!");
- }
- - (void)didFailToRegisterForRemoteNotificationsWithError:(NSNotification*)notification {
- NSLog(@"didFailToRegisterForRemoteNotificationsWithError was called!");
- }
- - (void)didReceiveRemoteNotification:(NSNotification*)notification {
- NSLog(@"didReceiveRemoteNotification was called!");
- }
- - (void)didReceiveLocalNotification:(NSNotification*)notification {
- NSLog(@"didReceiveLocalNotification was called!");
- }
- - (void)onOpenURL:(NSNotification*)notification {
- NSLog(@"onOpenURL was called!");
- NSURL *url = notification.userInfo[@"url"];
- NSString *urlStr =[url absoluteString];
- const char *mess = [urlStr cStringUsingEncoding:NSASCIIStringEncoding];
- UnitySendMessage("ScriptObject", "OnDeepLinkURLOpened", mess);
- }
- - (void)applicationDidReceiveMemoryWarning:(NSNotification*)notification {
- NSLog(@"applicationDidReceiveMemoryWarning was called!");
- }
- - (void)applicationSignificantTimeChange:(NSNotification*)notification {
- NSLog(@"applicationSignificantTimeChange was called!");
- }
- - (void)applicationWillChangeStatusBarFrame:(NSNotification*)notification {
- NSLog(@"applicationWillChangeStatusBarFrame was called!");
- }
- - (void)applicationWillChangeStatusBarOrientation:(NSNotification*)notification {
- NSLog(@"applicationWillChangeStatusBarOrientation was called!");
- }
- @end
- extern "C"{
- void SetupInstance(const char *goName){
- AppDelegateListenerTest *test = [AppDelegateListenerTest shared];
- test._goName = [NSString stringWithUTF8String:goName];
- test._methodName = [NSString stringWithUTF8String:goName];
- }
- const char *GetGameObjectName(){
- AppDelegateListenerTest *test = [AppDelegateListenerTest shared];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement