|
1 | | -using System; |
| 1 | +using System; |
2 | 2 | using System.Collections; |
3 | 3 | using System.Collections.Generic; |
4 | 4 | using System.Runtime.InteropServices; |
5 | 5 | using UnityEngine; |
6 | | -namespace PM.iOS |
| 6 | +public class iOSNative |
7 | 7 | { |
8 | | - |
9 | | - public class iOSNative |
10 | | - { |
11 | 8 | #if UNITY_IOS && !UNITY_EDITOR |
12 | 9 | [DllImport("__Internal")] |
13 | 10 | private static extern void _initialize(); |
@@ -64,156 +61,157 @@ public class iOSNative |
64 | 61 | [DllImport("__Internal")] |
65 | 62 | private static extern bool _iCloudSaveBool(string key, bool value); |
66 | 63 | #endif |
67 | | - public static void Initialize(){ |
| 64 | + public static void Initialize() |
| 65 | + { |
68 | 66 | #if UNITY_IOS && !UNITY_EDITOR |
69 | 67 | _initialize(); |
70 | 68 | #endif |
71 | | - } |
| 69 | + } |
72 | 70 |
|
73 | | - public static void _ShowTempAlert(string alertString, int duration = 5) |
74 | | - { |
| 71 | + public static void ShowTempAlert(string alertString, int duration = 5) |
| 72 | + { |
75 | 73 | #if UNITY_IOS && !UNITY_EDITOR |
76 | 74 | _ShowTempAlert(alertString, duration); |
77 | 75 | #endif |
78 | | - } |
| 76 | + } |
79 | 77 |
|
80 | | - public static bool Synchronize() |
81 | | - { |
| 78 | + public static bool Synchronize() |
| 79 | + { |
82 | 80 | #if UNITY_IOS && !UNITY_EDITOR |
83 | 81 | return _Synchronize(); |
84 | 82 | #else |
85 | | - return default(bool); |
| 83 | + return default(bool); |
86 | 84 | #endif |
87 | | - } |
88 | | - public static bool IsICloudAvailable() |
89 | | - { |
| 85 | + } |
| 86 | + public static bool IsICloudAvailable() |
| 87 | + { |
90 | 88 | #if UNITY_IOS && !UNITY_EDITOR |
91 | 89 | return _IsICloudAvailable(); |
92 | 90 | #else |
93 | | - return default(bool); |
| 91 | + return default(bool); |
94 | 92 | #endif |
95 | | - } |
96 | | - /// <summary> |
97 | | - /// PlayHaptics |
98 | | - /// </summary> |
99 | | - /// <param name="style">0 = Light, 1=Medium, 2=Heavy</param> |
100 | | - /// <param name="intensity">Intensity 0.0 - 1.0</param> |
101 | | - public static void PlayHaptics(int style, float intensity)//0 = Light, 1=Medium, 2=Heavy; Intensity 0.0 - 1.0 |
102 | | - { |
| 93 | + } |
| 94 | + /// <summary> |
| 95 | + /// PlayHaptics |
| 96 | + /// </summary> |
| 97 | + /// <param name="style">0 = Light, 1=Medium, 2=Heavy</param> |
| 98 | + /// <param name="intensity">Intensity 0.0 - 1.0</param> |
| 99 | + public static void PlayHaptics(int style, float intensity)//0 = Light, 1=Medium, 2=Heavy; Intensity 0.0 - 1.0 |
| 100 | + { |
103 | 101 | #if UNITY_IOS && !UNITY_EDITOR |
104 | 102 | _PlayHaptics(style, intensity); |
105 | 103 | #endif |
106 | | - } |
| 104 | + } |
107 | 105 |
|
108 | 106 |
|
109 | | - public static void Share(string message, string url = "", string imagePath = "", Action closeCallback = null) |
110 | | - { |
| 107 | + public static void Share(string message, string url = "", string imagePath = "", Action closeCallback = null) |
| 108 | + { |
111 | 109 | #if UNITY_IOS && !UNITY_EDITOR |
112 | 110 | _Share(message, url, imagePath); |
113 | 111 | #endif |
114 | | - iOSCallbackHelper.INSTANCE.SetShareCloseCallback(closeCallback); |
115 | | - } |
116 | | - public static void PushNotification(string msg, string title, string identifier, int delay){ |
| 112 | + iOSCallbackHelper.INSTANCE.SetShareCloseCallback(closeCallback); |
| 113 | + } |
| 114 | + public static void PushNotification(string msg, string title, string identifier, int delay) |
| 115 | + { |
117 | 116 | #if UNITY_IOS && !UNITY_EDITOR |
118 | 117 | _PushNotification(msg, title, identifier, delay); |
119 | 118 | #endif |
120 | | - } |
121 | | - public static void RemovePendingNotifications(string identifier){ |
| 119 | + } |
| 120 | + public static void RemovePendingNotifications(string identifier) |
| 121 | + { |
122 | 122 | #if UNITY_IOS && !UNITY_EDITOR |
123 | 123 | _RemovePendingNotifications(identifier); |
124 | 124 | #endif |
125 | | - } |
126 | | - public static void RemoveAllPendingNotifications(){ |
| 125 | + } |
| 126 | + public static void RemoveAllPendingNotifications() |
| 127 | + { |
127 | 128 | #if UNITY_IOS && !UNITY_EDITOR |
128 | 129 | _RemoveAllPendingNotifications(); |
129 | 130 | #endif |
130 | | - } |
| 131 | + } |
131 | 132 |
|
132 | 133 |
|
133 | 134 |
|
134 | 135 |
|
135 | 136 |
|
136 | | - public static bool ClearICloudSave() |
137 | | - { |
| 137 | + public static bool ClearICloudSave() |
| 138 | + { |
138 | 139 | #if UNITY_IOS && !UNITY_EDITOR |
139 | 140 | return _ClearICloudSave(); |
140 | 141 | #else |
141 | | - return default(bool); |
| 142 | + return default(bool); |
142 | 143 | #endif |
143 | | - } |
| 144 | + } |
144 | 145 |
|
145 | | - public static string iCloudGetStringValue(string key, string defaultValue) |
146 | | - { |
| 146 | + public static string iCloudGetStringValue(string key, string defaultValue) |
| 147 | + { |
147 | 148 | #if UNITY_IOS && !UNITY_EDITOR |
148 | 149 | return _iCloudGetString(key, defaultValue); |
149 | 150 | #else |
150 | | - return default(string); |
| 151 | + return default(string); |
151 | 152 | #endif |
152 | | - } |
| 153 | + } |
153 | 154 |
|
154 | | - public static bool iCloudSaveStringValue(string key, string value) |
155 | | - { |
| 155 | + public static bool iCloudSaveStringValue(string key, string value) |
| 156 | + { |
156 | 157 | #if UNITY_IOS && !UNITY_EDITOR |
157 | 158 | return _iCloudSaveString(key, value); |
158 | 159 | #else |
159 | | - return default(bool); |
| 160 | + return default(bool); |
160 | 161 | #endif |
161 | | - } |
| 162 | + } |
162 | 163 |
|
163 | | - public static int iCloudGetIntValue(string key, int defaultValue) |
164 | | - { |
| 164 | + public static int iCloudGetIntValue(string key, int defaultValue) |
| 165 | + { |
165 | 166 | #if UNITY_IOS && !UNITY_EDITOR |
166 | 167 | return _iCloudGetInt(key, defaultValue); |
167 | 168 | #else |
168 | | - return default(int); |
| 169 | + return default(int); |
169 | 170 | #endif |
170 | | - } |
| 171 | + } |
171 | 172 |
|
172 | | - public static bool iCloudSaveIntValue(string key, int value) |
173 | | - { |
| 173 | + public static bool iCloudSaveIntValue(string key, int value) |
| 174 | + { |
174 | 175 | #if UNITY_IOS && !UNITY_EDITOR |
175 | 176 | return _iCloudSaveInt(key, value); |
176 | 177 | #else |
177 | | - return default(bool); |
| 178 | + return default(bool); |
178 | 179 | #endif |
179 | | - } |
| 180 | + } |
180 | 181 |
|
181 | | - public static float iCloudGetFloatValue(string key, float defaultValue) |
182 | | - { |
| 182 | + public static float iCloudGetFloatValue(string key, float defaultValue) |
| 183 | + { |
183 | 184 | #if UNITY_IOS && !UNITY_EDITOR |
184 | 185 | return _iCloudGetFloat(key, defaultValue); |
185 | 186 | #else |
186 | | - return default(float); |
| 187 | + return default(float); |
187 | 188 | #endif |
188 | | - } |
| 189 | + } |
189 | 190 |
|
190 | | - public static bool iCloudSaveFloatValue(string key, float value) |
191 | | - { |
| 191 | + public static bool iCloudSaveFloatValue(string key, float value) |
| 192 | + { |
192 | 193 | #if UNITY_IOS && !UNITY_EDITOR |
193 | 194 | return _iCloudSaveFloat(key, value); |
194 | 195 | #else |
195 | | - return default(bool); |
| 196 | + return default(bool); |
196 | 197 | #endif |
197 | | - } |
| 198 | + } |
198 | 199 |
|
199 | | - public static bool iCloudGetBoolValue(string key, bool defaultValue) |
200 | | - { |
| 200 | + public static bool iCloudGetBoolValue(string key, bool defaultValue) |
| 201 | + { |
201 | 202 | #if UNITY_IOS && !UNITY_EDITOR |
202 | 203 | return _iCloudGetBool(key, defaultValue); |
203 | 204 | #else |
204 | | - return default(bool); |
| 205 | + return default(bool); |
205 | 206 | #endif |
206 | | - } |
| 207 | + } |
207 | 208 |
|
208 | | - public static bool iCloudSaveBoolValue(string key, bool value) |
209 | | - { |
| 209 | + public static bool iCloudSaveBoolValue(string key, bool value) |
| 210 | + { |
210 | 211 | #if UNITY_IOS && !UNITY_EDITOR |
211 | 212 | return _iCloudSaveBool(key, value); |
212 | 213 | #else |
213 | | - return default(bool); |
| 214 | + return default(bool); |
214 | 215 | #endif |
215 | | - } |
216 | 216 | } |
217 | | - |
218 | 217 | } |
219 | | - |
0 commit comments