forked from hunterzonewu/unity-decompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTile.cs
More file actions
433 lines (381 loc) · 17.2 KB
/
Tile.cs
File metadata and controls
433 lines (381 loc) · 17.2 KB
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
425
426
427
428
429
430
431
432
433
// Decompiled with JetBrains decompiler
// Type: UnityEngine.WSA.Tile
// Assembly: UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: A8FF7A2C-E4EE-4232-AB17-3FCABEC16496
// Assembly location: C:\Users\Blake\sandbox\unity\test-project\Library\UnityAssemblies\UnityEngine.dll
using System.Runtime.CompilerServices;
namespace UnityEngine.WSA
{
/// <summary>
/// <para>Represents tile on Windows start screen
/// </para>
/// </summary>
public sealed class Tile
{
private string m_TileId;
private static Tile s_MainTile;
/// <summary>
/// <para>Returns applications main tile
/// </para>
/// </summary>
public static Tile main
{
get
{
if (Tile.s_MainTile == null)
Tile.s_MainTile = new Tile(string.Empty);
return Tile.s_MainTile;
}
}
/// <summary>
/// <para>A unique string, identifying secondary tile</para>
/// </summary>
public string id
{
get
{
return this.m_TileId;
}
}
/// <summary>
/// <para>Whether secondary tile was approved (pinned to start screen) or rejected by user.
/// </para>
/// </summary>
public bool hasUserConsent
{
get
{
return Tile.HasUserConsent(this.m_TileId);
}
}
/// <summary>
/// <para>Whether secondary tile is pinned to start screen.
/// </para>
/// </summary>
public bool exists
{
get
{
return Tile.Exists(this.m_TileId);
}
}
private Tile(string tileId)
{
this.m_TileId = tileId;
}
/// <summary>
/// <para>Get template XML for tile notification.</para>
/// </summary>
/// <param name="templ">A template identifier.</param>
/// <returns>
/// <para>String, which is an empty XML document to be filled and used for tile notification.</para>
/// </returns>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern string GetTemplate(TileTemplate templ);
/// <summary>
/// <para>Send a notification for tile (update tiles look).</para>
/// </summary>
/// <param name="xml">A string containing XML document for new tile look.</param>
/// <param name="medium">An uri to 150x150 image, shown on medium tile.</param>
/// <param name="wide">An uri to a 310x150 image to be shown on a wide tile (if such issupported).</param>
/// <param name="large">An uri to a 310x310 image to be shown on a large tile (if such is supported).</param>
/// <param name="text">A text to shown on a tile.</param>
public void Update(string xml)
{
Tile.Update(this.m_TileId, xml);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void Update(string tileId, string xml);
/// <summary>
/// <para>Send a notification for tile (update tiles look).</para>
/// </summary>
/// <param name="xml">A string containing XML document for new tile look.</param>
/// <param name="medium">An uri to 150x150 image, shown on medium tile.</param>
/// <param name="wide">An uri to a 310x150 image to be shown on a wide tile (if such issupported).</param>
/// <param name="large">An uri to a 310x310 image to be shown on a large tile (if such is supported).</param>
/// <param name="text">A text to shown on a tile.</param>
public void Update(string medium, string wide, string large, string text)
{
Tile.UpdateImageAndText(this.m_TileId, medium, wide, large, text);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void UpdateImageAndText(string tileId, string medium, string wide, string large, string text);
/// <summary>
/// <para>Starts periodic update of a tile.
/// </para>
/// </summary>
/// <param name="uri">a remote location fromwhere to retrieve tile update</param>
/// <param name="interval">a time interval in minutes, will be rounded to a value, supported by the system</param>
public void PeriodicUpdate(string uri, float interval)
{
Tile.PeriodicUpdate(this.m_TileId, uri, interval);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void PeriodicUpdate(string tileId, string uri, float interval);
/// <summary>
/// <para>Stops previously started periodic update of a tile.</para>
/// </summary>
public void StopPeriodicUpdate()
{
Tile.StopPeriodicUpdate(this.m_TileId);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void StopPeriodicUpdate(string tileId);
/// <summary>
/// <para>Sets or updates badge on a tile to an image.</para>
/// </summary>
/// <param name="image">Image identifier.</param>
public void UpdateBadgeImage(string image)
{
Tile.UpdateBadgeImage(this.m_TileId, image);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void UpdateBadgeImage(string tileId, string image);
/// <summary>
/// <para>Set or update a badge on a tile to a number.</para>
/// </summary>
/// <param name="number">Number to be shown on a badge.</param>
public void UpdateBadgeNumber(float number)
{
Tile.UpdateBadgeNumber(this.m_TileId, number);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void UpdateBadgeNumber(string tileId, float number);
/// <summary>
/// <para>Remove badge from tile.</para>
/// </summary>
public void RemoveBadge()
{
Tile.RemoveBadge(this.m_TileId);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void RemoveBadge(string tileId);
/// <summary>
/// <para>Starts periodic update of a badge on a tile.
/// </para>
/// </summary>
/// <param name="uri">A remote location from where to retrieve tile update</param>
/// <param name="interval">A time interval in minutes, will be rounded to a value, supported by the system</param>
public void PeriodicBadgeUpdate(string uri, float interval)
{
Tile.PeriodicBadgeUpdate(this.m_TileId, uri, interval);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void PeriodicBadgeUpdate(string tileId, string uri, float interval);
/// <summary>
/// <para>Stops previously started periodic update of a tile.</para>
/// </summary>
public void StopPeriodicBadgeUpdate()
{
Tile.StopPeriodicBadgeUpdate(this.m_TileId);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void StopPeriodicBadgeUpdate(string tileId);
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern bool HasUserConsent(string tileId);
/// <summary>
/// <para>Whether secondary tile is pinned to start screen.</para>
/// </summary>
/// <param name="tileId">An identifier for secondary tile.</param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool Exists(string tileId);
private static string[] MakeSecondaryTileSargs(SecondaryTileData data)
{
return new string[10]{ data.arguments, data.displayName, data.lockScreenBadgeLogo, data.phoneticName, data.square150x150Logo, data.square30x30Logo, data.square310x310Logo, data.square70x70Logo, data.tileId, data.wide310x150Logo };
}
private static bool[] MakeSecondaryTileBargs(SecondaryTileData data)
{
return new bool[6]{ data.backgroundColorSet, data.lockScreenDisplayBadgeAndTileText, data.roamingEnabled, data.showNameOnSquare150x150Logo, data.showNameOnSquare310x310Logo, data.showNameOnWide310x150Logo };
}
/// <summary>
/// <para>Creates new or updates existing secondary tile.</para>
/// </summary>
/// <param name="data">The data used to create or update secondary tile.</param>
/// <param name="pos">The coordinates for a request to create new tile.</param>
/// <param name="area">The area on the screen above which the request to create new tile will be displayed.</param>
/// <returns>
/// <para>New Tile object, that can be used for further work with the tile.</para>
/// </returns>
public static Tile CreateOrUpdateSecondary(SecondaryTileData data)
{
string[] sargs = Tile.MakeSecondaryTileSargs(data);
bool[] bargs = Tile.MakeSecondaryTileBargs(data);
Color32 backgroundColor = data.backgroundColor;
string updateSecondaryTile = Tile.CreateOrUpdateSecondaryTile(sargs, bargs, ref backgroundColor, (int) data.foregroundText);
if (string.IsNullOrEmpty(updateSecondaryTile))
return (Tile) null;
return new Tile(updateSecondaryTile);
}
private static string CreateOrUpdateSecondaryTile(string[] sargs, bool[] bargs, ref Color32 backgroundColor, int foregroundText)
{
return Tile.INTERNAL_CALL_CreateOrUpdateSecondaryTile(sargs, bargs, ref backgroundColor, foregroundText);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string INTERNAL_CALL_CreateOrUpdateSecondaryTile(string[] sargs, bool[] bargs, ref Color32 backgroundColor, int foregroundText);
/// <summary>
/// <para>Creates new or updates existing secondary tile.</para>
/// </summary>
/// <param name="data">The data used to create or update secondary tile.</param>
/// <param name="pos">The coordinates for a request to create new tile.</param>
/// <param name="area">The area on the screen above which the request to create new tile will be displayed.</param>
/// <returns>
/// <para>New Tile object, that can be used for further work with the tile.</para>
/// </returns>
public static Tile CreateOrUpdateSecondary(SecondaryTileData data, Vector2 pos)
{
string[] sargs = Tile.MakeSecondaryTileSargs(data);
bool[] bargs = Tile.MakeSecondaryTileBargs(data);
Color32 backgroundColor = data.backgroundColor;
string secondaryTilePoint = Tile.CreateOrUpdateSecondaryTilePoint(sargs, bargs, ref backgroundColor, (int) data.foregroundText, pos);
if (string.IsNullOrEmpty(secondaryTilePoint))
return (Tile) null;
return new Tile(secondaryTilePoint);
}
private static string CreateOrUpdateSecondaryTilePoint(string[] sargs, bool[] bargs, ref Color32 backgroundColor, int foregroundText, Vector2 pos)
{
return Tile.INTERNAL_CALL_CreateOrUpdateSecondaryTilePoint(sargs, bargs, ref backgroundColor, foregroundText, ref pos);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string INTERNAL_CALL_CreateOrUpdateSecondaryTilePoint(string[] sargs, bool[] bargs, ref Color32 backgroundColor, int foregroundText, ref Vector2 pos);
/// <summary>
/// <para>Creates new or updates existing secondary tile.</para>
/// </summary>
/// <param name="data">The data used to create or update secondary tile.</param>
/// <param name="pos">The coordinates for a request to create new tile.</param>
/// <param name="area">The area on the screen above which the request to create new tile will be displayed.</param>
/// <returns>
/// <para>New Tile object, that can be used for further work with the tile.</para>
/// </returns>
public static Tile CreateOrUpdateSecondary(SecondaryTileData data, Rect area)
{
string[] sargs = Tile.MakeSecondaryTileSargs(data);
bool[] bargs = Tile.MakeSecondaryTileBargs(data);
Color32 backgroundColor = data.backgroundColor;
string secondaryTileArea = Tile.CreateOrUpdateSecondaryTileArea(sargs, bargs, ref backgroundColor, (int) data.foregroundText, area);
if (string.IsNullOrEmpty(secondaryTileArea))
return (Tile) null;
return new Tile(secondaryTileArea);
}
private static string CreateOrUpdateSecondaryTileArea(string[] sargs, bool[] bargs, ref Color32 backgroundColor, int foregroundText, Rect area)
{
return Tile.INTERNAL_CALL_CreateOrUpdateSecondaryTileArea(sargs, bargs, ref backgroundColor, foregroundText, ref area);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string INTERNAL_CALL_CreateOrUpdateSecondaryTileArea(string[] sargs, bool[] bargs, ref Color32 backgroundColor, int foregroundText, ref Rect area);
/// <summary>
/// <para>Returns the secondary tile, identified by tile id.</para>
/// </summary>
/// <param name="tileId">A tile identifier.</param>
/// <returns>
/// <para>A Tile object or null if secondary tile does not exist (not pinned to start screen and user request is complete).</para>
/// </returns>
public static Tile GetSecondary(string tileId)
{
if (Tile.Exists(tileId))
return new Tile(tileId);
return (Tile) null;
}
/// <summary>
/// <para>Gets all secondary tiles.</para>
/// </summary>
/// <returns>
/// <para>An array of Tile objects.</para>
/// </returns>
public static Tile[] GetSecondaries()
{
string[] allSecondaryTiles = Tile.GetAllSecondaryTiles();
Tile[] tileArray = new Tile[allSecondaryTiles.Length];
for (int index = 0; index < allSecondaryTiles.Length; ++index)
tileArray[index] = new Tile(allSecondaryTiles[index]);
return tileArray;
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern string[] GetAllSecondaryTiles();
/// <summary>
/// <para>Show a request to unpin secondary tile from start screen.</para>
/// </summary>
/// <param name="pos">The coordinates for a request to unpin tile.</param>
/// <param name="area">The area on the screen above which the request to unpin tile will be displayed.</param>
public void Delete()
{
Tile.DeleteSecondary(this.m_TileId);
}
/// <summary>
/// <para>Show a request to unpin secondary tile from start screen.</para>
/// </summary>
/// <param name="tileId">An identifier for secondary tile.</param>
/// <param name="pos">The coordinates for a request to unpin tile.</param>
/// <param name="area">The area on the screen above which the request to unpin tile will be displayed.</param>
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void DeleteSecondary(string tileId);
/// <summary>
/// <para>Show a request to unpin secondary tile from start screen.</para>
/// </summary>
/// <param name="pos">The coordinates for a request to unpin tile.</param>
/// <param name="area">The area on the screen above which the request to unpin tile will be displayed.</param>
public void Delete(Vector2 pos)
{
Tile.DeleteSecondaryPos(this.m_TileId, pos);
}
/// <summary>
/// <para>Show a request to unpin secondary tile from start screen.</para>
/// </summary>
/// <param name="tileId">An identifier for secondary tile.</param>
/// <param name="pos">The coordinates for a request to unpin tile.</param>
/// <param name="area">The area on the screen above which the request to unpin tile will be displayed.</param>
public static void DeleteSecondary(string tileId, Vector2 pos)
{
Tile.DeleteSecondaryPos(tileId, pos);
}
private static void DeleteSecondaryPos(string tileId, Vector2 pos)
{
Tile.INTERNAL_CALL_DeleteSecondaryPos(tileId, ref pos);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_DeleteSecondaryPos(string tileId, ref Vector2 pos);
/// <summary>
/// <para>Show a request to unpin secondary tile from start screen.</para>
/// </summary>
/// <param name="pos">The coordinates for a request to unpin tile.</param>
/// <param name="area">The area on the screen above which the request to unpin tile will be displayed.</param>
public void Delete(Rect area)
{
Tile.DeleteSecondaryArea(this.m_TileId, area);
}
/// <summary>
/// <para>Show a request to unpin secondary tile from start screen.</para>
/// </summary>
/// <param name="tileId">An identifier for secondary tile.</param>
/// <param name="pos">The coordinates for a request to unpin tile.</param>
/// <param name="area">The area on the screen above which the request to unpin tile will be displayed.</param>
public static void DeleteSecondary(string tileId, Rect area)
{
Tile.DeleteSecondary(tileId, area);
}
private static void DeleteSecondaryArea(string tileId, Rect area)
{
Tile.INTERNAL_CALL_DeleteSecondaryArea(tileId, ref area);
}
[WrapperlessIcall]
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern void INTERNAL_CALL_DeleteSecondaryArea(string tileId, ref Rect area);
}
}