@@ -18,84 +18,65 @@ @implementation RNUnity
18
18
RCT_EXPORT_MODULE (RNUnity)
19
19
20
20
static int _RNUnity_argc;
21
- static char ** _RNUnity_argv;
21
+ static char **_RNUnity_argv;
22
22
static id <RNUnityFramework> _RNUnity_ufw;
23
23
static RNUnity *_RNUnity_sharedInstance;
24
24
25
25
+ (char **)argv {
26
- @synchronized (self) {
27
- return _RNUnity_argv;
28
- }
26
+ return _RNUnity_argv;
29
27
}
30
28
31
29
+ (void )setArgv : (char **)argv {
32
- @synchronized (self) {
33
- _RNUnity_argv = argv;
34
- }
30
+ _RNUnity_argv = argv;
35
31
}
36
32
37
33
+ (int )argc {
38
- @synchronized (self) {
39
- return _RNUnity_argc;
40
- }
34
+ return _RNUnity_argc;
41
35
}
42
36
43
37
+ (void )setArgc : (int )argc {
44
- @synchronized (self) {
45
- _RNUnity_argc = argc;
46
- }
38
+ _RNUnity_argc = argc;
47
39
}
48
40
49
41
+ (id <RNUnityFramework>)ufw {
50
- @synchronized (self) {
51
- return _RNUnity_ufw;
52
- }
42
+ return _RNUnity_ufw;
53
43
}
54
44
55
45
+ (void )setUfw : (id <RNUnityFramework>)ufw {
56
- @synchronized (self) {
57
- _RNUnity_ufw = ufw;
58
- }
46
+ _RNUnity_ufw = ufw;
59
47
}
60
48
61
49
+ (void )initFromSwift {
62
- NSLog (@" RNUnity.initFromSwift()" );
63
50
_RNUnity_argc = *_NSGetArgc ();
64
51
_RNUnity_argv = *_NSGetArgv ();
65
52
}
66
53
67
- + (void )applicationWillResignActive : (UIApplication*)application {
68
- NSLog (@" RNUnity.applicationWillResignActive()" );
54
+ + (void )applicationWillResignActive : (UIApplication *)application {
69
55
[[[self ufw ] appController ] applicationWillResignActive: application];
70
56
}
71
57
72
- + (void )applicationDidEnterBackground : (UIApplication*)application {
73
- NSLog (@" RNUnity.applicationDidEnterBackground()" );
58
+ + (void )applicationDidEnterBackground : (UIApplication *)application {
74
59
[[[self ufw ] appController ] applicationDidEnterBackground: application];
75
60
}
76
61
77
- + (void )applicationWillEnterForeground : (UIApplication*)application {
78
- NSLog (@" RNUnity.applicationWillEnterForeground()" );
62
+ + (void )applicationWillEnterForeground : (UIApplication *)application {
79
63
[[[self ufw ] appController ] applicationWillEnterForeground: application];
80
64
}
81
65
82
- + (void )applicationDidBecomeActive : (UIApplication*)application {
83
- NSLog (@" RNUnity.applicationDidBecomeActive()" );
66
+ + (void )applicationDidBecomeActive : (UIApplication *)application {
84
67
[[[self ufw ] appController ] applicationDidBecomeActive: application];
85
68
}
86
69
87
- + (void )applicationWillTerminate : (UIApplication*)application {
88
- NSLog (@" RNUnity.applicationWillTerminate()" );
70
+ + (void )applicationWillTerminate : (UIApplication *)application {
89
71
[[[self ufw ] appController ] applicationWillTerminate: application];
90
72
}
91
73
92
- + (id <RNUnityFramework>)launchWithOptions : (NSDictionary *)applaunchOptions {
93
-
94
- NSString * bundlePath = nil ;
74
+ + (id <RNUnityFramework>)launchWithOptions : (NSDictionary *)applaunchOptions {
75
+ NSString *bundlePath = nil ;
95
76
bundlePath = [[NSBundle mainBundle ] bundlePath ];
96
77
bundlePath = [bundlePath stringByAppendingString: @" /Frameworks/UnityFramework.framework" ];
97
78
98
- NSBundle * bundle = [NSBundle bundleWithPath: bundlePath];
79
+ NSBundle * bundle = [NSBundle bundleWithPath: bundlePath];
99
80
if ([bundle isLoaded ] == false ) [bundle load ];
100
81
101
82
id <RNUnityFramework> framework = [bundle.principalClass getInstance ];
@@ -155,13 +136,12 @@ - (dispatch_queue_t)methodQueue {
155
136
RCT_EXPORT_METHOD (sendMessage:(NSString *)gameObject
156
137
functionName:(NSString *)functionName
157
138
message:(NSString *)message) {
158
-
159
139
if (_RNUnity_sharedInstance) {
160
140
[[RNUnity ufw ] sendMessageToGOWithName: [gameObject UTF8String ] functionName: [functionName UTF8String ] message: [message UTF8String ]];
161
141
}
162
142
}
163
143
164
- + (void )emitEvent : (const char *)name data : (const char *)data {
144
+ + (void )emitEvent : (const char *)name data : (const char *)data {
165
145
[_RNUnity_sharedInstance emitEvent: [NSString stringWithUTF8String: name] data: [NSString stringWithUTF8String: data]];
166
146
}
167
147
0 commit comments