summaryrefslogtreecommitdiff
path: root/Runtime/Export/Handheld.txt
blob: b1268a8c5e368acdacb4e121470da92c27fa0c6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
C++RAW

#include "UnityPrefix.h"
#include "Runtime/Video/MoviePlayback.h"
#include "Runtime/Graphics/RenderTexture.h"
#include "Runtime/Input/GetInput.h"
#include "Runtime/Input/OnScreenKeyboard.h"
#include "Runtime/Mono/MonoBehaviour.h"
#include "Runtime/Misc/PlayerSettings.h"
#include "Runtime/Misc/BuildSettings.h"
#include "Runtime/Math/Vector2.h"
#include "Runtime/Shaders/Material.h"
#include "PlatformDependent/iPhonePlayer/iPhoneSettings.h"
#include "PlatformDependent/iPhonePlayer/iPhoneMisc.h"
#include "PlatformDependent/AndroidPlayer/AndroidSystemInfo.h"
#include "Runtime/Scripting/ScriptingObjectWithIntPtrField.h"


#if UNITY_ANDROID
#include "PlatformDependent/AndroidPlayer/EntryPoint.h"
#elif UNITY_IPHONE
	void StartActivityIndicator();
	void StopActivityIndicator();
	const char* GetVendorIdentifier();
	const char* GetAdvertisingIdentifier();
	bool		IsAdvertisingTrackingEnabled();
#endif

using namespace Unity;

CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections;

namespace UnityEngine
{

// Simple struct that contains all the arguments needed by
CONDITIONAL UNITY_IPHONE_API || UNITY_ANDROID_API || UNITY_BB10_API || UNITY_WP8 || UNITY_TIZEN_API
STRUCT internal TouchScreenKeyboard_InternalConstructorHelperArguments
	CSRAW public uint keyboardType;
	CSRAW public uint autocorrection;
	CSRAW public uint multiline;
	CSRAW public uint secure;
	CSRAW public uint alert;
END

C++RAW
struct MonoTouchScreenKeyboard_InternalConstructorHelperArguments {
	unsigned int keyboardType;
	unsigned int autocorrection;
	unsigned int multiline;
	unsigned int secure;
	unsigned int alert;
};

// Describes options for displaying movie playback controls.
CONDITIONAL UNITY_IPHONE_API || UNITY_ANDROID_API || UNITY_BB10_API || UNITY_WP8 || UNITY_TIZEN_API
ENUM FullScreenMovieControlMode
	// Display the standard controls for controlling movie playback. This
	Full = 0,
	// Display minimal set of controls controlling movie playback. Set of
	Minimal = 1,
	// Do not display any controls, but cancel movie playback if input occurs.
	CancelOnInput = 2,
	// Do not display any controls. This mode prevents the user from
	Hidden = 3,
END

// Describes scaling modes for displaying movies.
CONDITIONAL UNITY_IPHONE_API || UNITY_ANDROID_API || UNITY_BB10_API || UNITY_WP8 || UNITY_TIZEN_API
ENUM FullScreenMovieScalingMode
	// Do not scale the movie.
	None = 0,
	// Scale the movie until one dimension fits on the screen exactly. In
	AspectFit = 1,
	// Scale the movie until the movie fills the entire screen. Content at
	AspectFill = 2,
	// Scale the movie until both dimensions fit the screen exactly. The
	Fill = 3
END

CONDITIONAL UNITY_IPHONE_API
/// iOS-specific ActivityIndicator styles.
ENUM iOSActivityIndicatorStyle
	/// Do not show ActivityIndicator
	DontShow = -1,
	/// The large white style of indicator (UIActivityIndicatorViewStyleWhiteLarge).
	WhiteLarge = 0,
	/// The standard white style of indicator (UIActivityIndicatorViewStyleWhite).
	White = 1,
	/// The standard gray style of indicator (UIActivityIndicatorViewStyleGray).
	Gray = 2,
END

CONDITIONAL UNITY_ANDROID_API
ENUM AndroidActivityIndicatorStyle
	/// Do not show ActivityIndicator
	DontShow = -1,
	/// Large (android.R.attr.progressBarStyleLarge).
	Large = 0,
	/// Large Inversed (android.R.attr.progressBarStyleLargeInverse).
	InversedLarge = 1,
	/// Small (android.R.attr.progressBarStyleSmall).
	Small = 2,
	/// Small Inversed (android.R.attr.progressBarStyleSmallInverse).
	InversedSmall = 3,
END


// Interface into functionality unique to handheld devices.
CONDITIONAL UNITY_IPHONE_API || UNITY_ANDROID_API || UNITY_BB10_API || UNITY_WP8 || UNITY_TIZEN_API
CLASS Handheld
	// Plays a full-screen movie.
	CUSTOM static bool PlayFullScreenMovie (string path, Color bgColor = Color.black, FullScreenMovieControlMode controlMode = FullScreenMovieControlMode.Full, FullScreenMovieScalingMode scalingMode = FullScreenMovieScalingMode.AspectFit)
	{
		return PlayFullScreenMovie (path, bgColor, controlMode, scalingMode);
	}

	// Triggers device vibration.
	CUSTOM static void Vibrate ()
	{
		Vibrate ();
	}

	CUSTOM_PROP static bool use32BitDisplayBuffer
	{
		return GetPlayerSettings().GetUse32BitDisplayBuffer();
	}
	{
		GetPlayerSettings().SetUse32BitDisplayBuffer(value);
	}

	CUSTOM internal static void SetActivityIndicatorStyleImpl(int style)
	{
	#if UNITY_IPHONE
		GetPlayerSettings().SetIOSShowActivityIndicatorOnLoading(style);
	#elif UNITY_ANDROID
		GetPlayerSettings().SetAndroidShowActivityIndicatorOnLoading(style);
	#endif
	}

	CONDITIONAL UNITY_IPHONE_API
	/// Sets ActivityIndicator style. See iOSActivityIndicatorStyle enumeration for possible values.
	/// Be warned that it will take effect on next call to StartActivityIndicator.
	CSRAW public static void SetActivityIndicatorStyle(iOSActivityIndicatorStyle style)
	{
		SetActivityIndicatorStyleImpl((int)style);
	}

	CONDITIONAL UNITY_ANDROID_API
	/// Sets ActivityIndicator style. See AndroidActivityIndicatorStyle enumeration for possible values.
	/// Be warned that it will take effect on next call to StartActivityIndicator.
	CSRAW public static void SetActivityIndicatorStyle(AndroidActivityIndicatorStyle style)
	{
		SetActivityIndicatorStyleImpl((int)style);
	}

	/// Gets current ActivityIndicator style.
	CUSTOM static int GetActivityIndicatorStyle()
	{
	#if UNITY_IPHONE
		return GetPlayerSettings().GetIOSShowActivityIndicatorOnLoading();
	#elif UNITY_ANDROID
		return GetPlayerSettings().GetAndroidShowActivityIndicatorOnLoading();
	#else
		return -1;
	#endif
	}

	// Starts os activity indicator
	CUSTOM static void StartActivityIndicator()
	{
	#if UNITY_IPHONE || UNITY_ANDROID
		StartActivityIndicator();
	#endif
	}

	// Stops os activity indicator
	CUSTOM static void StopActivityIndicator()
	{
	#if UNITY_IPHONE || UNITY_ANDROID
		StopActivityIndicator();
	#endif
	}

	//*undocumented*
	CUSTOM static void ClearShaderCache()
	{
	#if UNITY_ANDROID
		extern void Internal_ClearShaderCache();
		Internal_ClearShaderCache();
	#endif
	}
END

// Describes the type of keyboard.
CONDITIONAL UNITY_IPHONE_API || UNITY_ANDROID_API || UNITY_BB10_API || UNITY_WP8 || UNITY_TIZEN_API
ENUM TouchScreenKeyboardType
	// Default keyboard for the current input method.
	Default = 0,
	// Keyboard displays standard ASCII characters.
	ASCIICapable = 1,
	// Keyboard with numbers and punctuation.
	NumbersAndPunctuation = 2,
	// Keyboard optimized for URL entry, features ".", "/", and ".com"
	URL = 3,
	// Numeric keypad designed for PIN entry, features the numbers 0 through 9
	NumberPad = 4,
	// Keypad designed for entering telephone numbers, features the numbers 0
	PhonePad = 5,
	// Keypad designed for entering a person's name or phone number.
	NamePhonePad = 6,
	// Keyboard optimized for specifying email addresses, features the "@",
	EmailAddress = 7
END

// Interface into the native iPhone and Android on-screen keyboards - it is not available on other platforms.
CONDITIONAL UNITY_IPHONE_API || UNITY_ANDROID_API || UNITY_BB10_API || UNITY_WP8 || UNITY_TIZEN_API
CLASS TouchScreenKeyboard
	// We are matching the KeyboardOnScreen class here so we can directly
	// access it.
	CSRAW
	[System.NonSerialized] [NotRenamed]
	internal IntPtr m_Ptr;

	THREAD_SAFE
	CUSTOM private void Destroy()
	{
		KeyboardOnScreen* keyboard = self.GetPtr();
		if (keyboard)
		{
			delete keyboard;
			self.SetPtr(NULL);
		}
	}

	//*undocumented*
	CSRAW ~TouchScreenKeyboard()
	{
		Destroy();
	}

	//*undocumented*
	CSRAW public TouchScreenKeyboard(string text, TouchScreenKeyboardType keyboardType, bool autocorrection, bool multiline, bool secure, bool alert, string textPlaceholder)
	{
		TouchScreenKeyboard_InternalConstructorHelperArguments arguments = new TouchScreenKeyboard_InternalConstructorHelperArguments ();
		arguments.keyboardType = Convert.ToUInt32(keyboardType);
		arguments.autocorrection = Convert.ToUInt32(autocorrection);
		arguments.multiline = Convert.ToUInt32(multiline);
		arguments.secure = Convert.ToUInt32(secure);
		arguments.alert = Convert.ToUInt32(alert);
		TouchScreenKeyboard_InternalConstructorHelper (ref arguments, text, textPlaceholder);
	}

	CUSTOM private void TouchScreenKeyboard_InternalConstructorHelper (ref TouchScreenKeyboard_InternalConstructorHelperArguments arguments, string text, string textPlaceholder)
	{
		KeyboardOnScreen* keyboard = new KeyboardOnScreen(text, arguments.keyboardType, arguments.autocorrection, arguments.multiline, arguments.secure, arguments.alert, textPlaceholder);
		self.SetPtr(keyboard);
	}

	// Opens the native keyboard provided by OS on the screen.
	CSRAW public static TouchScreenKeyboard Open(string text, TouchScreenKeyboardType keyboardType = TouchScreenKeyboardType.Default, bool autocorrection = true, bool multiline = false, bool secure = false, bool alert = false, string textPlaceholder = "")
	{
		return new TouchScreenKeyboard(text, keyboardType, autocorrection, multiline, secure, alert, textPlaceholder);
	}

	// Returns the text displayed by the input field of the keyboard. This
	CUSTOM_PROP public string text {
		KeyboardOnScreen* keyboard = self.GetPtr();
		if (keyboard) return scripting_string_new(keyboard->getText());
		else return scripting_string_new("");
	}
	{
		KeyboardOnScreen* keyboard = self.GetPtr();
		if (keyboard) keyboard->setText(value);
	}

	// Specifies if text input field above the keyboard will be hidden when
	CUSTOM_PROP public static bool hideInput {
		return KeyboardOnScreen::isInputHidden();
	} {
		KeyboardOnScreen::setInputHidden(value);
	}

	// Specifies if the keyboard is visible or is sliding into the position on
	CUSTOM_PROP public bool active {
		KeyboardOnScreen* keyboard = self.GetPtr();
		if (keyboard) return (short)keyboard->isActive();
		else return false;
	} {
		KeyboardOnScreen* keyboard = self.GetPtr();
		if (keyboard) keyboard->setActive(value);
	}

	// Specifies if input process was finished (RO)
	CUSTOM_PROP public bool done {
		KeyboardOnScreen* keyboard = self.GetPtr();
		if (keyboard) return (short)keyboard->isDone();
		else return false;
	}

	// Specifies if input process was canceled (RO)
	CUSTOM_PROP public bool wasCanceled {
		KeyboardOnScreen* keyboard = self.GetPtr();
		if (keyboard) return (short)keyboard->wasCanceled();
		else return false;
	}

	// Returns portion of the screen which is covered by the keyboard. Returns
	CUSTOM_PROP static Rect area { return KeyboardOnScreen::GetRect(); }

	// Returns true whenever any keyboard is completely visible on the screen.
	CUSTOM_PROP static bool visible { return KeyboardOnScreen::IsVisible(); }
END

// iPhone device generation
CONDITIONAL UNITY_IPHONE_API || UNITY_ANDROID_API
ENUM iPhoneGeneration
	//*undocumented*
	Unknown = 0,
	// First generation device
	iPhone = 1,
	// Second generation
	iPhone3G = 2,
	// Third generation
	iPhone3GS = 3,
	// iPod Touch, first generation
	iPodTouch1Gen = 4,
	// iPod Touch, second generation
	iPodTouch2Gen = 5,
	// iPod Touch, third generation
	iPodTouch3Gen = 6,
	// iPad, first generation
	iPad1Gen = 7,
	// Fourth generation
	iPhone4 = 8,
	// iPod Touch, fourth generation
	iPodTouch4Gen = 9,
	// iPad, second generation
	iPad2Gen = 10,
	// Fifth generation
	iPhone4S = 11,
	// iPad, third generation
	iPad3Gen = 12,
	// iPhone5
	iPhone5 = 13,
	// iPod Touch, fifth generation
	iPodTouch5Gen = 14,
	// iPadMini, first generation
	iPadMini1Gen = 15,
	// iPad, fourth generation
	iPad4Gen = 16,
	// iPhone5C
	iPhone5C = 17,
	// iPhone5S
	iPhone5S = 18,

	// Yet unknown iPhone
	iPhoneUnknown = 10001,
	// Yet unknown iPad
	iPadUnknown = 10002,
	// Yet unknown iPodTouch
	iPodTouchUnknown = 10003,
END

// Interface into iPhone specific functionality.
CONDITIONAL UNITY_IPHONE_API
CLASS iPhone
	// The generation of the device (RO)
	CUSTOM_PROP static iPhoneGeneration generation {
		return iphone::GetDeviceGeneration ();
	}

	// Set file flag to be excluded from iCloud/iTunes backup.
	CUSTOM static void SetNoBackupFlag(string path)
	{
	#if UNITY_IPHONE
		iphone::SetNoBackupFlag(path.AsUTF8().c_str());
	#else
		(void)path;
	#endif
	}

	// Reset "no backup" file flag: file will be synced with iCloud/iTunes backup and can be deleted by OS in low storage situations.
	CUSTOM static void ResetNoBackupFlag(string path)
	{
	#if UNITY_IPHONE
		iphone::ResetNoBackupFlag(path.AsUTF8().c_str());
	#else
		(void)path;
	#endif
	}

	CUSTOM_PROP static string vendorIdentifier
	{
	#if UNITY_IPHONE
		return scripting_string_new(GetVendorIdentifier());
	#else
		return 0;
	#endif
	}
	CUSTOM_PROP static string advertisingIdentifier
	{
	#if UNITY_IPHONE
		return scripting_string_new(GetAdvertisingIdentifier());
	#else
		return 0;
	#endif
	}
	CUSTOM_PROP static bool advertisingTrackingEnabled
	{
	#if UNITY_IPHONE
		return IsAdvertisingTrackingEnabled();
	#else
		return false;
	#endif
	}
END

CSRAW
}