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
|
C++RAW
#include "UnityPrefix.h"
#include "Runtime/Mono/MonoManager.h"
#include "Runtime/Scripting/ScriptingUtility.h"
#include "Runtime/Scripting/ScriptingExportUtility.h"
#if UNITY_METRO
#include "PlatformDependent/MetroPlayer/AppCallbacks.h"
#endif
using namespace Unity;
using namespace std;
CSRAW
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngineInternal;
namespace UnityEngine.WSA
{
CONDITIONAL UNITY_METRO_API
public delegate void AppCallbackItem();
CONDITIONAL UNITY_METRO_API
public delegate void WindowSizeChanged(int width, int height);
CONDITIONAL UNITY_METRO_API
ENUM WindowActivationState
CodeActivated = 0,
Deactivated = 1,
PointerActivated = 2
END
CONDITIONAL UNITY_METRO_API
public delegate void WindowActivated(WindowActivationState state);
CONDITIONAL UNITY_METRO_API
CLASS Application
public static event WindowSizeChanged windowSizeChanged;
public static event WindowActivated windowActivated;
CSRAW public static string arguments
{
get {
return GetAppArguments();
}
}
CUSTOM private static string GetAppArguments()
{
#if UNITY_METRO
std::string args = ConvertStringToUtf8(UnityPlayer::AppCallbacks::Instance->GetAppArguments());
return scripting_string_new(args);
#else
return scripting_string_new("");
#endif
}
CSRAW internal static void InvokeWindowSizeChangedEvent(int width, int height)
{
if (windowSizeChanged != null)
windowSizeChanged.Invoke(width, height);
}
CSRAW internal static void InvokeWindowActivatedEvent(WindowActivationState state)
{
if (windowActivated != null) windowActivated.Invoke(state);
}
CSRAW public static void InvokeOnAppThread(AppCallbackItem item, bool waitUntilDone)
{
#if UNITY_EDITOR
item();
#else
InternalInvokeOnAppThread(item, waitUntilDone);
#endif
}
CSRAW public static void InvokeOnUIThread(AppCallbackItem item, bool waitUntilDone)
{
#if UNITY_EDITOR
item();
#else
InternalInvokeOnUIThread(item, waitUntilDone);
#endif
}
CUSTOM internal static void InternalInvokeOnAppThread(AppCallbackItem item, bool waitUntilDone)
{
#if UNITY_METRO
UnityPlayer::AppCallbacks::Instance->InvokeOnAppThread(ref new UnityPlayer::AppCallbackItem(
GetWinRTTypeInformation()->CastScriptingObjectToAppCallbackItemStub(item)), waitUntilDone);
#endif
}
CUSTOM internal static void InternalInvokeOnUIThread(AppCallbackItem item, bool waitUntilDone)
{
#if UNITY_METRO
UnityPlayer::AppCallbacks::Instance->InvokeOnUIThread(ref new UnityPlayer::AppCallbackItem(
GetWinRTTypeInformation()->CastScriptingObjectToAppCallbackItemStub(item)), waitUntilDone);
#endif
}
CUSTOM public static bool RunningOnAppThread()
{
#if UNITY_METRO
return UnityPlayer::AppCallbacks::Instance->RunningOnAppThread();
#else
return true;
#endif
}
CUSTOM public static bool RunningOnUIThread()
{
#if UNITY_METRO
return UnityPlayer::AppCallbacks::Instance->RunningOnUIThread();
#else
return true;
#endif
}
CSRAW
END
CSRAW
}
|