VRC SDK
This project aims to completely document the VRChat Unity SDK
Loading...
Searching...
No Matches
VRCSDKBase-Editor.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Diagnostics;
5using System.IO;
6using System.Linq;
7using System.Reflection;
8using System.Runtime.CompilerServices;
9using System.Runtime.InteropServices;
10using System.Runtime.Versioning;
11using JetBrains.Annotations;
12using UnityEditor;
13using UnityEditor.Build;
14using UnityEditor.Build.Reporting;
15using UnityEditor.Callbacks;
16using UnityEditor.SceneManagement;
17using UnityEngine;
18using UnityEngine.Networking;
19using UnityEngine.Rendering;
20using UnityEngine.SceneManagement;
21using UnityEngine.UIElements;
22using VRC;
23using VRC.Core;
24using VRC.SDK3.Editor;
25using VRC.SDKBase;
29
30[assembly: CompilationRelaxations(8)]
31[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
32[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
33[assembly: InternalsVisibleTo("VRC.SDK3A.Editor")]
34[assembly: InternalsVisibleTo("VRC.SDK3.Editor")]
35[assembly: InternalsVisibleTo("VRCEconomy-Editor")]
36[assembly: InternalsVisibleTo("VRCSDKBase-Editor")]
37[assembly: InternalsVisibleTo("VRCSDK3-Editor")]
38[assembly: UnityAPICompatibilityVersion("2022.3.22f1", true)]
39[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
40[assembly: AssemblyCompany("VRCSDKBase-Editor")]
41[assembly: AssemblyConfiguration("Release")]
42[assembly: AssemblyFileVersion("1.0.0.0")]
43[assembly: AssemblyInformationalVersion("1.0.0+77370df7b4055abf7cc0fb1da3c3d290108e9941")]
44[assembly: AssemblyProduct("VRCSDKBase-Editor")]
45[assembly: AssemblyTitle("VRCSDKBase-Editor")]
46[assembly: AssemblyVersion("1.0.0.0")]
48{
49 public int callbackOrder => -1024;
50
51 public bool OnPreprocessAvatar(GameObject avatarGameObject)
52 {
53 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
54 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
55 NetworkIDAssignment.ConfigureNetworkIDs(avatarGameObject.GetComponent<VRC_AvatarDescriptor>(), out var errors, NetworkIDAssignment.SetError.IncompatibleTypes, NetworkIDAssignment.SetError.InvalidObject);
56 if (errors.Count > 0)
57 {
58 throw new ApplicationException(String.Format("Failed to assign network IDs, {0} errors encountered!", (object)errors.Count));
59 }
60 return true;
61 }
62}
64{
65 public int callbackOrder => -1024;
66
67 public bool OnPreprocessScene(Scene scene)
68 {
69 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
70 VRC_SceneDescriptor vRC_SceneDescriptor = null;
71 GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects();
72 for (int i = 0; i < rootGameObjects.Length; i++)
73 {
74 vRC_SceneDescriptor = rootGameObjects[i].GetComponentInChildren<VRC_SceneDescriptor>(true);
75 if ((Object)(object)vRC_SceneDescriptor != (Object)null)
76 {
77 break;
78 }
79 }
80 if ((Object)(object)vRC_SceneDescriptor == (Object)null)
81 {
82 Logger.LogError("Unable to find scene descriptor in scene");
83 return false;
84 }
86 IEnumerable<NetworkIDPair> item = NetworkIDAssignment.ConfigureNetworkIDs(vRC_SceneDescriptor, out errors, NetworkIDAssignment.SetError.InvalidObject).Item2;
87 if (errors.Count > 0)
88 {
89 Logger.LogError(String.Format("Failed to assign network IDs, {0} errors encountered!\nTry using the Network ID Utility to resolve them.", (object)errors.Count));
90 return false;
91 }
92 if (Enumerable.Count<NetworkIDPair>(item) > 0)
93 {
94 ((Object)(object)vRC_SceneDescriptor).MarkDirty();
95 PrefabUtility.RecordPrefabInstancePropertyModifications((Object)(object)vRC_SceneDescriptor);
96 AssetDatabase.SaveAssets();
97 }
98 return true;
99 }
100}
102{
103 public int callbackOrder => -2048;
104
105 public bool OnPreprocessAvatar(GameObject avatarGameObject)
106 {
107 IEnumerator<IPreprocessCallbackBehaviour> enumerator = ((IEnumerable<IPreprocessCallbackBehaviour>)(object)Enumerable.OrderBy<IPreprocessCallbackBehaviour, int>((IEnumerable<IPreprocessCallbackBehaviour>)(object)avatarGameObject.GetComponentsInChildren<IPreprocessCallbackBehaviour>(true), (Func<IPreprocessCallbackBehaviour, int>)((IPreprocessCallbackBehaviour e) => e.PreprocessOrder))).GetEnumerator();
108 try
109 {
110 while (((IEnumerator)enumerator).MoveNext())
111 {
112 if (!enumerator.Current.OnPreprocess())
113 {
114 return false;
115 }
116 }
117 }
118 finally
119 {
120 if (enumerator != null)
121 {
122 ((IDisposable)enumerator).Dispose();
123 }
124 }
125 return true;
126 }
127}
129{
130 public int callbackOrder => -1024;
131
132 public bool OnPreprocessAvatar(GameObject avatarGameObject)
133 {
134 Transform[] componentsInChildren = avatarGameObject.GetComponentsInChildren<Transform>(true);
135 for (int num = componentsInChildren.Length - 1; num > -1; num--)
136 {
137 if (((Component)componentsInChildren[num]).CompareTag("EditorOnly"))
138 {
139 Object.DestroyImmediate((Object)(object)((Component)componentsInChildren[num]).gameObject);
140 }
141 }
142 IEditorOnly[] componentsInChildren2 = avatarGameObject.GetComponentsInChildren<IEditorOnly>(true);
143 for (int num2 = componentsInChildren2.Length - 1; num2 > -1; num2--)
144 {
145 IEditorOnly obj = componentsInChildren2[num2];
146 Object.DestroyImmediate((Object)((obj is Component) ? obj : null));
147 }
148 return true;
149 }
150}
151public interface IVRCSDKOrderedCallback : IOrderedCallback
152{
153}
154public static class GizmosUtil : Object
155{
156 public static void SetColor(Color color, float alpha)
157 {
158 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
159 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
160 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
161 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
162 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
163 Gizmos.color = new Color(color.r, color.g, color.b, color.a * alpha);
164 }
165
166 public static void DrawWireCube(Vector3 center, Vector3 size, Quaternion rotation = default(Quaternion))
167 {
168 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
169 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
170 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
171 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
172 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
173 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
174 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
175 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
176 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
177 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
178 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
179 Matrix4x4 matrix = Gizmos.matrix;
180 if (((Quaternion)(ref rotation)).Equals(default(Quaternion)))
181 {
182 rotation = Quaternion.identity;
183 }
184 Gizmos.matrix = Matrix4x4.TRS(center, rotation, size);
185 Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
186 Gizmos.matrix = matrix;
187 }
188
189 public static void DrawArrow(Vector3 from, Vector3 to, float arrowHeadLength = 0.25f, float arrowHeadAngle = 20f)
190 {
191 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
192 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
193 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
194 //IL_0008: Unknown result type (might be due to invalid IL or missing references)
195 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
196 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
197 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
198 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
199 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
200 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
201 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
202 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
203 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
204 //IL_005f: Unknown result type (might be due to invalid IL or missing references)
205 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
206 //IL_0078: Unknown result type (might be due to invalid IL or missing references)
207 //IL_007d: Unknown result type (might be due to invalid IL or missing references)
208 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
209 //IL_0083: Unknown result type (might be due to invalid IL or missing references)
210 //IL_0084: Unknown result type (might be due to invalid IL or missing references)
211 //IL_0085: Unknown result type (might be due to invalid IL or missing references)
212 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
213 //IL_008c: Unknown result type (might be due to invalid IL or missing references)
214 //IL_0096: Unknown result type (might be due to invalid IL or missing references)
215 //IL_0097: Unknown result type (might be due to invalid IL or missing references)
216 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
217 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
218 //IL_009f: Unknown result type (might be due to invalid IL or missing references)
219 Gizmos.DrawLine(from, to);
220 Vector3 val = to - from;
221 Vector3 val2 = Quaternion.LookRotation(val) * Quaternion.Euler(0f, 180f + arrowHeadAngle, 0f) * new Vector3(0f, 0f, 1f);
222 Vector3 val3 = Quaternion.LookRotation(val) * Quaternion.Euler(0f, 180f - arrowHeadAngle, 0f) * new Vector3(0f, 0f, 1f);
223 Gizmos.DrawLine(to, to + val2 * arrowHeadLength);
224 Gizmos.DrawLine(to, to + val3 * arrowHeadLength);
225 }
226
227 public static void DrawWireSphere(Vector3 center, float radius, Quaternion rotation = default(Quaternion))
228 {
229 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
230 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
231 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
232 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
233 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
234 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
235 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
236 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
237 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
238 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
239 Matrix4x4 matrix = Gizmos.matrix;
240 if (((Quaternion)(ref rotation)).Equals(default(Quaternion)))
241 {
242 rotation = Quaternion.identity;
243 }
244 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
245 Gizmos.DrawWireSphere(Vector3.zero, radius);
246 Gizmos.matrix = matrix;
247 }
248
249 public static void DrawWireCircle(Vector3 center, float radius, int segments = 20, Quaternion rotation = default(Quaternion))
250 {
251 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
252 //IL_0008: Unknown result type (might be due to invalid IL or missing references)
253 DrawWireArc(center, radius, 360f, segments, rotation);
254 }
255
256 public static void DrawWireArc(Vector3 center, float radius, float angle, int segments = 20, Quaternion rotation = default(Quaternion))
257 {
258 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
259 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
260 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
261 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
262 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
263 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
264 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
265 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
266 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
267 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
268 //IL_005d: Unknown result type (might be due to invalid IL or missing references)
269 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
270 //IL_0066: Unknown result type (might be due to invalid IL or missing references)
271 //IL_0070: Unknown result type (might be due to invalid IL or missing references)
272 Matrix4x4 matrix = Gizmos.matrix;
273 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
274 Vector3 val = Vector3.forward * radius;
275 int num = Mathf.RoundToInt(angle / (float)segments);
276 Vector3 val2 = default(Vector3);
277 for (int i = 0; (float)i <= angle; i += num)
278 {
279 ((Vector3)(ref val2))..ctor(radius * Mathf.Sin((float)i * ((float)Math.PI / 180f)), 0f, radius * Mathf.Cos((float)i * ((float)Math.PI / 180f)));
280 Gizmos.DrawLine(val, val2);
281 val = val2;
282 }
283 Gizmos.matrix = matrix;
284 }
285
286 public static void DrawWireArc(Vector3 center, float radius, float angle, int segments, Quaternion rotation, Vector3 centerOfRotation)
287 {
288 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
289 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
290 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
291 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
292 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
293 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
294 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
295 //IL_0029: Unknown result type (might be due to invalid IL or missing references)
296 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
297 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
298 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
299 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
300 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
301 //IL_003d: Unknown result type (might be due to invalid IL or missing references)
302 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
303 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
304 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
305 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
306 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
307 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
308 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
309 //IL_0088: Unknown result type (might be due to invalid IL or missing references)
310 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
311 //IL_008f: Unknown result type (might be due to invalid IL or missing references)
312 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
313 //IL_0097: Unknown result type (might be due to invalid IL or missing references)
314 //IL_0099: Unknown result type (might be due to invalid IL or missing references)
315 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
316 Matrix4x4 matrix = Gizmos.matrix;
317 if (((Quaternion)(ref rotation)).Equals(default(Quaternion)))
318 {
319 rotation = Quaternion.identity;
320 }
321 Gizmos.matrix = Matrix4x4.TRS(centerOfRotation, rotation, Vector3.one);
322 Vector3 val = centerOfRotation - center;
323 Vector3 val2 = val + Vector3.forward * radius;
324 int num = Mathf.RoundToInt(angle / (float)segments);
325 for (int i = 0; (float)i <= angle; i += num)
326 {
327 Vector3 val3 = new Vector3(radius * Mathf.Sin((float)i * ((float)Math.PI / 180f)), 0f, radius * Mathf.Cos((float)i * ((float)Math.PI / 180f))) + val;
328 Gizmos.DrawLine(val2, val3);
329 val2 = val3;
330 }
331 Gizmos.matrix = matrix;
332 }
333
334 public static void DrawWireArc(Matrix4x4 matrix, float radius, float angle, int segments)
335 {
336 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
337 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
338 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
339 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
340 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
341 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
342 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
343 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
344 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
345 //IL_005a: Unknown result type (might be due to invalid IL or missing references)
346 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
347 Matrix4x4 matrix2 = Gizmos.matrix;
348 Gizmos.matrix = matrix;
349 Vector3 val = Vector3.forward * radius;
350 int num = Mathf.RoundToInt(angle / (float)segments);
351 Vector3 val2 = default(Vector3);
352 for (int i = 0; (float)i <= angle; i += num)
353 {
354 ((Vector3)(ref val2))..ctor(radius * Mathf.Sin((float)i * ((float)Math.PI / 180f)), 0f, radius * Mathf.Cos((float)i * ((float)Math.PI / 180f)));
355 Gizmos.DrawLine(val, val2);
356 val = val2;
357 }
358 Gizmos.matrix = matrix2;
359 }
360
361 public static void DrawWireCylinder(Vector3 center, float radius, float height, Quaternion rotation = default(Quaternion))
362 {
363 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
364 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
365 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
366 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
367 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
368 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
369 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
370 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
371 //IL_003d: Unknown result type (might be due to invalid IL or missing references)
372 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
373 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
374 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
375 //IL_0052: Unknown result type (might be due to invalid IL or missing references)
376 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
377 //IL_005d: Unknown result type (might be due to invalid IL or missing references)
378 //IL_0063: Unknown result type (might be due to invalid IL or missing references)
379 //IL_0068: Unknown result type (might be due to invalid IL or missing references)
380 //IL_0072: Unknown result type (might be due to invalid IL or missing references)
381 //IL_0077: Unknown result type (might be due to invalid IL or missing references)
382 //IL_007d: Unknown result type (might be due to invalid IL or missing references)
383 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
384 //IL_0088: Unknown result type (might be due to invalid IL or missing references)
385 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
386 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
387 //IL_0097: Unknown result type (might be due to invalid IL or missing references)
388 //IL_009d: Unknown result type (might be due to invalid IL or missing references)
389 //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
390 //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
391 //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
392 //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
393 //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
394 //IL_00c2: Unknown result type (might be due to invalid IL or missing references)
395 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
396 //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
397 //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
398 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
399 //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
400 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)
401 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
402 //IL_00f2: Unknown result type (might be due to invalid IL or missing references)
403 //IL_00f7: Unknown result type (might be due to invalid IL or missing references)
404 //IL_00fd: Unknown result type (might be due to invalid IL or missing references)
405 //IL_0102: Unknown result type (might be due to invalid IL or missing references)
406 //IL_0108: Unknown result type (might be due to invalid IL or missing references)
407 //IL_010d: Unknown result type (might be due to invalid IL or missing references)
408 //IL_0112: Unknown result type (might be due to invalid IL or missing references)
409 //IL_0117: Unknown result type (might be due to invalid IL or missing references)
410 //IL_011d: Unknown result type (might be due to invalid IL or missing references)
411 //IL_0122: Unknown result type (might be due to invalid IL or missing references)
412 //IL_0128: Unknown result type (might be due to invalid IL or missing references)
413 //IL_012d: Unknown result type (might be due to invalid IL or missing references)
414 //IL_0137: Unknown result type (might be due to invalid IL or missing references)
415 //IL_0138: Unknown result type (might be due to invalid IL or missing references)
416 //IL_013e: Unknown result type (might be due to invalid IL or missing references)
417 //IL_0143: Unknown result type (might be due to invalid IL or missing references)
418 //IL_0150: Unknown result type (might be due to invalid IL or missing references)
419 //IL_0151: Unknown result type (might be due to invalid IL or missing references)
420 //IL_0157: Unknown result type (might be due to invalid IL or missing references)
421 //IL_0158: Unknown result type (might be due to invalid IL or missing references)
422 //IL_015e: Unknown result type (might be due to invalid IL or missing references)
423 //IL_0163: Unknown result type (might be due to invalid IL or missing references)
424 //IL_0170: Unknown result type (might be due to invalid IL or missing references)
425 //IL_0171: Unknown result type (might be due to invalid IL or missing references)
426 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
427 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
428 Matrix4x4 matrix = Gizmos.matrix;
429 if (((Quaternion)(ref rotation)).Equals(default(Quaternion)))
430 {
431 rotation = Quaternion.identity;
432 }
433 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
434 float num = height / 2f;
435 Gizmos.DrawLine(Vector3.right * radius - Vector3.up * num, Vector3.right * radius + Vector3.up * num);
436 Gizmos.DrawLine(-Vector3.right * radius - Vector3.up * num, -Vector3.right * radius + Vector3.up * num);
437 Gizmos.DrawLine(Vector3.forward * radius - Vector3.up * num, Vector3.forward * radius + Vector3.up * num);
438 Gizmos.DrawLine(-Vector3.forward * radius - Vector3.up * num, -Vector3.forward * radius + Vector3.up * num);
439 DrawWireArc(center + Vector3.up * num, radius, 360f, 20, rotation, center);
440 DrawWireArc(center + Vector3.down * num, radius, 360f, 20, rotation, center);
441 Gizmos.matrix = matrix;
442 }
443
444 public static void DrawWireCylinder(Vector3 center, float height, float radius1, float radius2, Quaternion rotation = default(Quaternion))
445 {
446 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
447 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
448 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
449 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
450 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
451 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
452 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
453 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
454 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
455 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
456 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
457 //IL_004e: Unknown result type (might be due to invalid IL or missing references)
458 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
459 //IL_0059: Unknown result type (might be due to invalid IL or missing references)
460 //IL_005e: Unknown result type (might be due to invalid IL or missing references)
461 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
462 //IL_0069: Unknown result type (might be due to invalid IL or missing references)
463 //IL_0073: Unknown result type (might be due to invalid IL or missing references)
464 //IL_0078: Unknown result type (might be due to invalid IL or missing references)
465 //IL_007e: Unknown result type (might be due to invalid IL or missing references)
466 //IL_0083: Unknown result type (might be due to invalid IL or missing references)
467 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
468 //IL_008e: Unknown result type (might be due to invalid IL or missing references)
469 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
470 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
471 //IL_009e: Unknown result type (might be due to invalid IL or missing references)
472 //IL_00a3: Unknown result type (might be due to invalid IL or missing references)
473 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
474 //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
475 //IL_00b8: Unknown result type (might be due to invalid IL or missing references)
476 //IL_00be: Unknown result type (might be due to invalid IL or missing references)
477 //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
478 //IL_00c9: Unknown result type (might be due to invalid IL or missing references)
479 //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
480 //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
481 //IL_00d9: Unknown result type (might be due to invalid IL or missing references)
482 //IL_00de: Unknown result type (might be due to invalid IL or missing references)
483 //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
484 //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
485 //IL_00f3: Unknown result type (might be due to invalid IL or missing references)
486 //IL_00f8: Unknown result type (might be due to invalid IL or missing references)
487 //IL_00fe: Unknown result type (might be due to invalid IL or missing references)
488 //IL_0103: Unknown result type (might be due to invalid IL or missing references)
489 //IL_0109: Unknown result type (might be due to invalid IL or missing references)
490 //IL_010e: Unknown result type (might be due to invalid IL or missing references)
491 //IL_0113: Unknown result type (might be due to invalid IL or missing references)
492 //IL_0118: Unknown result type (might be due to invalid IL or missing references)
493 //IL_011e: Unknown result type (might be due to invalid IL or missing references)
494 //IL_0123: Unknown result type (might be due to invalid IL or missing references)
495 //IL_0129: Unknown result type (might be due to invalid IL or missing references)
496 //IL_012e: Unknown result type (might be due to invalid IL or missing references)
497 //IL_0138: Unknown result type (might be due to invalid IL or missing references)
498 //IL_0139: Unknown result type (might be due to invalid IL or missing references)
499 //IL_013f: Unknown result type (might be due to invalid IL or missing references)
500 //IL_0144: Unknown result type (might be due to invalid IL or missing references)
501 //IL_0151: Unknown result type (might be due to invalid IL or missing references)
502 //IL_0153: Unknown result type (might be due to invalid IL or missing references)
503 //IL_0159: Unknown result type (might be due to invalid IL or missing references)
504 //IL_015a: Unknown result type (might be due to invalid IL or missing references)
505 //IL_0160: Unknown result type (might be due to invalid IL or missing references)
506 //IL_0165: Unknown result type (might be due to invalid IL or missing references)
507 //IL_0172: Unknown result type (might be due to invalid IL or missing references)
508 //IL_0174: Unknown result type (might be due to invalid IL or missing references)
509 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
510 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
511 Matrix4x4 matrix = Gizmos.matrix;
512 if (((Quaternion)(ref rotation)).Equals(default(Quaternion)))
513 {
514 rotation = Quaternion.identity;
515 }
516 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
517 float num = height / 2f;
518 Gizmos.DrawLine(Vector3.right * radius1 - Vector3.up * num, Vector3.right * radius2 + Vector3.up * num);
519 Gizmos.DrawLine(-Vector3.right * radius1 - Vector3.up * num, -Vector3.right * radius2 + Vector3.up * num);
520 Gizmos.DrawLine(Vector3.forward * radius1 - Vector3.up * num, Vector3.forward * radius2 + Vector3.up * num);
521 Gizmos.DrawLine(-Vector3.forward * radius1 - Vector3.up * num, -Vector3.forward * radius2 + Vector3.up * num);
522 DrawWireArc(center + Vector3.up * num, radius1, 360f, 20, rotation, center);
523 DrawWireArc(center + Vector3.down * num, radius2, 360f, 20, rotation, center);
524 Gizmos.matrix = matrix;
525 }
526
527 public static void DrawWireCapsule(Vector3 center, float radius, float height, Quaternion rotation = default(Quaternion))
528 {
529 //IL_0004: Unknown result type (might be due to invalid IL or missing references)
530 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
531 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
532 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
533 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
534 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
535 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
536 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
537 //IL_004c: Unknown result type (might be due to invalid IL or missing references)
538 //IL_0052: Unknown result type (might be due to invalid IL or missing references)
539 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
540 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
541 //IL_005d: Unknown result type (might be due to invalid IL or missing references)
542 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
543 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
544 if (((Quaternion)(ref rotation)).Equals(default(Quaternion)))
545 {
546 rotation = Quaternion.identity;
547 }
548 Matrix4x4 matrix = Gizmos.matrix;
549 Gizmos.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
550 float num = Mathf.Max(0f, height * 0.5f - radius);
551 DrawWireCylinder(center, radius, num * 2f, rotation);
552 DrawWireCapsuleEndcap(center, rotation, num, radius, isUp: true);
553 DrawWireCapsuleEndcap(center, rotation, num, radius, isUp: false);
554 Gizmos.matrix = matrix;
555 }
556
557 private static void DrawWireCapsuleEndcap(Vector3 center, Quaternion rotation, float half, float radius, bool isUp)
558 {
559 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
560 //IL_0004: Unknown result type (might be due to invalid IL or missing references)
561 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
562 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
563 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
564 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
565 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
566 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
567 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
568 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
569 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
570 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
571 //IL_003f: Unknown result type (might be due to invalid IL or missing references)
572 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
573 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
574 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
575 //IL_004c: Unknown result type (might be due to invalid IL or missing references)
576 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
577 //IL_004e: Unknown result type (might be due to invalid IL or missing references)
578 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
579 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
580 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
581 //IL_006b: Unknown result type (might be due to invalid IL or missing references)
582 //IL_0071: Unknown result type (might be due to invalid IL or missing references)
583 //IL_0072: Unknown result type (might be due to invalid IL or missing references)
584 //IL_0077: Unknown result type (might be due to invalid IL or missing references)
585 //IL_007c: Unknown result type (might be due to invalid IL or missing references)
586 //IL_007d: Unknown result type (might be due to invalid IL or missing references)
587 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
588 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
589 Vector3 val = (isUp ? Vector3.up : Vector3.down);
590 Quaternion val2 = (isUp ? Quaternion.AngleAxis(90f, Vector3.forward) : Quaternion.AngleAxis(-90f, Vector3.forward));
591 center += rotation * val * half;
592 DrawWireArc(Matrix4x4.TRS(center, rotation * val2, Vector3.one), radius, 180f, 20);
593 DrawWireArc(Matrix4x4.TRS(center, rotation * Quaternion.AngleAxis(90f, val) * val2, Vector3.one), radius, 180f, 20);
594 }
595
596 public static void DrawWireCapsule(Vector3 point1, Vector3 point2, float radius1, float radius2)
597 {
598 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
599 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
600 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
601 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
602 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
603 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
604 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
605 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
606 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
607 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
608 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
609 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
610 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
611 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
612 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
613 Vector3 center = (point1 + point2) * 0.5f;
614 float height = Vector3.Distance(point1, point2);
615 Vector3 up = Vector3.up;
616 Vector3 val = point2 - point1;
617 Quaternion rotation = Quaternion.FromToRotation(up, ((Vector3)(ref val)).normalized);
618 DrawWireCapsule(center, rotation, height, radius1, radius2);
619 }
620
621 public static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius1, float radius2)
622 {
623 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
624 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
625 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
626 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
627 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
628 //IL_001d: Unknown result type (might be due to invalid IL or missing references)
629 DrawWireCylinder(center, height, radius1, radius2, rotation);
630 DrawWireCapsuleEndcap(center, rotation, height * 0.5f, radius2, isUp: true);
631 DrawWireCapsuleEndcap(center, rotation, height * 0.5f, radius1, isUp: false);
632 }
633
634 public static void DrawWireSquare(Vector3 center, Quaternion rotation, Vector2 size)
635 {
636 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
637 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
638 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
639 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
640 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
641 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
642 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
643 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
644 //IL_001d: Unknown result type (might be due to invalid IL or missing references)
645 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
646 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
647 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
648 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
649 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
650 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
651 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
652 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
653 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
654 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
655 //IL_003d: Unknown result type (might be due to invalid IL or missing references)
656 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
657 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
658 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
659 //IL_004e: Unknown result type (might be due to invalid IL or missing references)
660 //IL_004f: Unknown result type (might be due to invalid IL or missing references)
661 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
662 //IL_0055: Unknown result type (might be due to invalid IL or missing references)
663 //IL_005a: Unknown result type (might be due to invalid IL or missing references)
664 //IL_005b: Unknown result type (might be due to invalid IL or missing references)
665 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
666 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
667 //IL_0062: Unknown result type (might be due to invalid IL or missing references)
668 //IL_006c: Unknown result type (might be due to invalid IL or missing references)
669 //IL_006d: Unknown result type (might be due to invalid IL or missing references)
670 //IL_006e: Unknown result type (might be due to invalid IL or missing references)
671 //IL_0073: Unknown result type (might be due to invalid IL or missing references)
672 //IL_0074: Unknown result type (might be due to invalid IL or missing references)
673 //IL_0079: Unknown result type (might be due to invalid IL or missing references)
674 //IL_007a: Unknown result type (might be due to invalid IL or missing references)
675 //IL_007b: Unknown result type (might be due to invalid IL or missing references)
676 //IL_0080: Unknown result type (might be due to invalid IL or missing references)
677 //IL_0081: Unknown result type (might be due to invalid IL or missing references)
678 //IL_008b: Unknown result type (might be due to invalid IL or missing references)
679 //IL_008c: Unknown result type (might be due to invalid IL or missing references)
680 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
681 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
682 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
683 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
684 //IL_0099: Unknown result type (might be due to invalid IL or missing references)
685 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
686 //IL_009f: Unknown result type (might be due to invalid IL or missing references)
687 //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
688 Vector3 val = rotation * Vector3.right * size.x;
689 Vector3 val2 = rotation * Vector3.forward * size.y;
690 Gizmos.DrawLine(center - val - val2, center + val - val2);
691 Gizmos.DrawLine(center + val - val2, center + val + val2);
692 Gizmos.DrawLine(center + val + val2, center - val + val2);
693 Gizmos.DrawLine(center - val + val2, center - val - val2);
694 }
695
696 public static void DrawWirePlane(Vector3 center, Quaternion rotation, float size)
697 {
698 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
699 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
700 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
701 //IL_0008: Unknown result type (might be due to invalid IL or missing references)
702 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
703 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
704 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
705 //IL_001d: Unknown result type (might be due to invalid IL or missing references)
706 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
707 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
708 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
709 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
710 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
711 DrawWireSquare(center, rotation, Vector2.one * size);
712 Vector3 val = rotation * Vector3.up;
713 Gizmos.DrawLine(center, center + val * size);
714 }
715
716 public static void DrawWireCone(Vector3 tip, Quaternion rotation, float height, float radius)
717 {
718 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
719 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
720 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
721 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
722 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
723 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
724 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
725 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
726 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
727 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
728 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
729 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
730 //IL_004e: Unknown result type (might be due to invalid IL or missing references)
731 //IL_005a: Unknown result type (might be due to invalid IL or missing references)
732 //IL_005f: Unknown result type (might be due to invalid IL or missing references)
733 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
734 //IL_006c: Unknown result type (might be due to invalid IL or missing references)
735 Vector3 val = default(Vector3);
736 ((Vector3)(ref val))..ctor(radius, height, 0f);
737 for (int i = 0; i < 12; i++)
738 {
739 Vector3 val2 = Quaternion.AngleAxis((float)i / 12f * 360f, Vector3.up) * val;
740 Gizmos.DrawLine(tip, tip + rotation * val2);
741 }
742 DrawWireCircle(tip + rotation * new Vector3(0f, height, 0f), radius, 20, rotation);
743 }
744
745 public static void DrawWireAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle, int segments = 12)
746 {
747 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
748 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
749 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
750 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
751 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
752 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
753 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
754 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
755 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
756 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
757 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
758 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
759 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
760 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
761 //IL_0046: Unknown result type (might be due to invalid IL or missing references)
762 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
763 //IL_005e: Unknown result type (might be due to invalid IL or missing references)
764 //IL_005f: Unknown result type (might be due to invalid IL or missing references)
765 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
766 //IL_0070: Unknown result type (might be due to invalid IL or missing references)
767 //IL_0075: Unknown result type (might be due to invalid IL or missing references)
768 //IL_007a: Unknown result type (might be due to invalid IL or missing references)
769 //IL_007f: Unknown result type (might be due to invalid IL or missing references)
770 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
771 Vector3 val = Quaternion.AngleAxis(angle, Vector3.forward) * new Vector3(0f, radius, 0f);
772 for (int i = 0; i < segments; i++)
773 {
774 Vector3 val2 = Quaternion.AngleAxis((float)i / (float)segments * 360f, Vector3.up) * val;
775 Gizmos.DrawLine(tip, tip + rotation * val2);
776 }
777 DrawWireCircle(tip + rotation * new Vector3(0f, val.y, 0f), val.x, 20, rotation);
778 }
779}
780public static class HandlesUtil : Object
781{
782 private const int LINE_GIZMOS_SIZE = 2;
783
784 private const int RADIUS_GIZMO_SIDES_OFFSET = 8;
785
786 private const int RADIUS_GIZMO_SPHERE_OFFSET = 25;
787
788 private const int RADIUS_GIZMO_CAP_OFFSET = 13;
789
790 private const int RADIUS_GIZMO_CAPS_SIZE = 50;
791
792 private const int RADIUS_GIZMO_CAPSULE_CAPS_SIZE = 52;
793
794 private const int RADIUS_GIZMO_SPHERE_SIZE = 75;
795
796 private static List<Quaternion> _capsuleGizmoRotations;
797
798 private static List<Quaternion> _sphereGizmoRotations;
799
800 private static MethodInfo _applyWireMaterialMethod;
801
802 private static List<Quaternion> CapsuleGizmoRotations
803 {
804 get
805 {
806 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
807 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
808 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
809 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
810 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
811 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
812 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
813 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
814 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
815 //IL_004a: Unknown result type (might be due to invalid IL or missing references)
816 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
817 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
818 //IL_0084: Unknown result type (might be due to invalid IL or missing references)
819 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
820 //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
821 //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
822 if (_capsuleGizmoRotations != null)
823 {
824 return _capsuleGizmoRotations;
825 }
826 Vector3[] array = (Vector3[])(object)new Vector3[6]
827 {
828 Vector3.up,
829 Vector3.up,
830 Vector3.right,
831 Vector3.right,
832 Vector3.forward,
833 Vector3.forward
834 };
835 Single[] array2 = new Single[6];
836 RuntimeHelpers.InitializeArray((Array)(object)array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
837 float[] array3 = (float[])(object)array2;
838 _capsuleGizmoRotations = new List<Quaternion>();
839 float num = 15f;
840 for (int i = 0; i < 6; i++)
841 {
842 Vector3 val = array[i];
843 float num2 = array3[i];
844 for (int j = 0; j < 13; j++)
845 {
846 _capsuleGizmoRotations.Add(Quaternion.AngleAxis(num * (float)j + num2, val));
847 }
848 }
849 return _capsuleGizmoRotations;
850 }
851 }
852
853 private static List<Quaternion> SphereGizmoRotations
854 {
855 get
856 {
857 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
858 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
859 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
860 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
861 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
862 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
863 //IL_0055: Unknown result type (might be due to invalid IL or missing references)
864 //IL_005a: Unknown result type (might be due to invalid IL or missing references)
865 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
866 //IL_006b: Unknown result type (might be due to invalid IL or missing references)
867 if (_sphereGizmoRotations != null)
868 {
869 return _sphereGizmoRotations;
870 }
871 if (_sphereGizmoRotations == null)
872 {
873 Vector3[] array = (Vector3[])(object)new Vector3[3]
874 {
875 Vector3.up,
876 Vector3.right,
877 Vector3.forward
878 };
879 _sphereGizmoRotations = new List<Quaternion>();
880 float num = 15f;
881 for (int i = 0; i < 3; i++)
882 {
883 Vector3 val = array[i];
884 for (int j = 0; j < 25; j++)
885 {
886 _sphereGizmoRotations.Add(Quaternion.AngleAxis(num * (float)j, val));
887 }
888 }
889 }
890 return _sphereGizmoRotations;
891 }
892 }
893
894 public static void SetColor(Color color, float alpha)
895 {
896 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
897 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
898 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
899 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
900 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
901 Handles.color = new Color(color.r, color.g, color.b, color.a * alpha);
902 }
903
904 public static void DrawWireSphere(Vector3 center, float radius)
905 {
906 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
907 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
908 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
909 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
910 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
911 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
912 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
913 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
914 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
915 Handles.DrawWireArc(center, Vector3.up, Vector3.forward, 360f, radius);
916 Handles.DrawWireArc(center, Vector3.forward, Vector3.up, 360f, radius);
917 Handles.DrawWireArc(center, Vector3.right, Vector3.up, 360f, radius);
918 }
919
920 public static void DrawWireSphere(Vector3 center, Quaternion rotation, float radius)
921 {
922 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
923 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
924 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
925 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
926 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
927 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
928 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
929 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
930 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
931 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
932 //IL_0029: Unknown result type (might be due to invalid IL or missing references)
933 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
934 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
935 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
936 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
937 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
938 //IL_0046: Unknown result type (might be due to invalid IL or missing references)
939 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
940 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
941 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
942 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
943 Handles.DrawWireArc(center, rotation * Vector3.up, rotation * Vector3.forward, 360f, radius);
944 Handles.DrawWireArc(center, rotation * Vector3.forward, rotation * Vector3.up, 360f, radius);
945 Handles.DrawWireArc(center, rotation * Vector3.right, rotation * Vector3.up, 360f, radius);
946 }
947
948 public static void DrawWireCylinder(Vector3 center, float height, float radius1, float radius2, Quaternion rotation = default(Quaternion), int segments = 8)
949 {
950 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
951 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
952 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
953 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
954 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
955 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
956 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
957 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
958 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
959 //IL_0040: Unknown result type (might be due to invalid IL or missing references)
960 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
961 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
962 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
963 //IL_0055: Unknown result type (might be due to invalid IL or missing references)
964 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
965 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
966 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
967 //IL_0067: Unknown result type (might be due to invalid IL or missing references)
968 //IL_006c: Unknown result type (might be due to invalid IL or missing references)
969 //IL_0071: Unknown result type (might be due to invalid IL or missing references)
970 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
971 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
972 //IL_0084: Unknown result type (might be due to invalid IL or missing references)
973 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
974 //IL_008e: Unknown result type (might be due to invalid IL or missing references)
975 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
976 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
977 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
978 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
979 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
980 //IL_009b: Unknown result type (might be due to invalid IL or missing references)
981 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
982 //IL_00b7: Unknown result type (might be due to invalid IL or missing references)
983 //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
984 //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
985 //IL_00cd: Unknown result type (might be due to invalid IL or missing references)
986 //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
987 //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
988 Matrix4x4 matrix = Handles.matrix;
989 if (((Quaternion)(ref rotation)).Equals(default(Quaternion)))
990 {
991 rotation = Quaternion.identity;
992 }
993 Handles.matrix = Matrix4x4.TRS(center, rotation, Vector3.one);
994 float num = height / 2f;
995 Vector3 val = Vector3.right * radius1 - Vector3.up * num;
996 Vector3 val2 = Vector3.right * radius2 + Vector3.up * num;
997 for (int i = 0; i < segments; i++)
998 {
999 Quaternion val3 = Quaternion.AngleAxis((float)i / (float)segments * 360f, Vector3.up);
1000 Handles.DrawLine(val3 * val, val3 * val2);
1001 }
1002 Handles.DrawWireDisc(Vector3.down * num, Vector3.up, radius1);
1003 Handles.DrawWireDisc(Vector3.up * num, Vector3.up, radius2);
1004 Handles.matrix = matrix;
1005 }
1006
1007 public static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius)
1008 {
1009 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
1010 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
1011 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
1012 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
1013 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1014 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
1015 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
1016 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
1017 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
1018 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
1019 //IL_003f: Unknown result type (might be due to invalid IL or missing references)
1020 //IL_0040: Unknown result type (might be due to invalid IL or missing references)
1021 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
1022 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
1023 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
1024 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
1025 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
1026 //IL_0059: Unknown result type (might be due to invalid IL or missing references)
1027 //IL_005a: Unknown result type (might be due to invalid IL or missing references)
1028 //IL_005b: Unknown result type (might be due to invalid IL or missing references)
1029 //IL_0060: Unknown result type (might be due to invalid IL or missing references)
1030 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
1031 //IL_0062: Unknown result type (might be due to invalid IL or missing references)
1032 //IL_0067: Unknown result type (might be due to invalid IL or missing references)
1033 //IL_0069: Unknown result type (might be due to invalid IL or missing references)
1034 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
1035 //IL_006b: Unknown result type (might be due to invalid IL or missing references)
1036 //IL_0070: Unknown result type (might be due to invalid IL or missing references)
1037 //IL_0072: Unknown result type (might be due to invalid IL or missing references)
1038 //IL_0073: Unknown result type (might be due to invalid IL or missing references)
1039 //IL_007d: Unknown result type (might be due to invalid IL or missing references)
1040 //IL_007e: Unknown result type (might be due to invalid IL or missing references)
1041 //IL_007f: Unknown result type (might be due to invalid IL or missing references)
1042 //IL_0084: Unknown result type (might be due to invalid IL or missing references)
1043 //IL_0086: Unknown result type (might be due to invalid IL or missing references)
1044 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
1045 //IL_0091: Unknown result type (might be due to invalid IL or missing references)
1046 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
1047 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
1048 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
1049 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
1050 //IL_009b: Unknown result type (might be due to invalid IL or missing references)
1051 //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
1052 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
1053 //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
1054 //IL_00ac: Unknown result type (might be due to invalid IL or missing references)
1055 //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
1056 //IL_00af: Unknown result type (might be due to invalid IL or missing references)
1057 //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
1058 //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
1059 //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
1060 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
1061 //IL_00c9: Unknown result type (might be due to invalid IL or missing references)
1062 //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
1063 //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
1064 //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
1065 //IL_00d7: Unknown result type (might be due to invalid IL or missing references)
1066 //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
1067 //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
1068 //IL_00e5: Unknown result type (might be due to invalid IL or missing references)
1069 //IL_00e6: Unknown result type (might be due to invalid IL or missing references)
1070 //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
1071 //IL_00f8: Unknown result type (might be due to invalid IL or missing references)
1072 //IL_00ff: Unknown result type (might be due to invalid IL or missing references)
1073 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
1074 //IL_0102: Unknown result type (might be due to invalid IL or missing references)
1075 //IL_0103: Unknown result type (might be due to invalid IL or missing references)
1076 //IL_0113: Unknown result type (might be due to invalid IL or missing references)
1077 //IL_0115: Unknown result type (might be due to invalid IL or missing references)
1078 //IL_0116: Unknown result type (might be due to invalid IL or missing references)
1079 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
1080 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
1081 if (height <= radius * 2f)
1082 {
1083 DrawWireSphere(center, rotation, radius);
1084 return;
1085 }
1086 Vector3 val = rotation * Vector3.up * (height * 0.5f - radius);
1087 Vector3 val2 = rotation * Vector3.right * radius;
1088 Vector3 val3 = rotation * Vector3.forward * radius;
1089 Vector3 normalized = ((Vector3)(ref val)).normalized;
1090 Vector3 val4 = center - val;
1091 Vector3 val5 = center + val;
1092 Handles.DrawLine(val4 + val2, val5 + val2);
1093 Handles.DrawLine(val4 - val2, val5 - val2);
1094 Handles.DrawLine(val4 + val3, val5 + val3);
1095 Handles.DrawLine(val4 - val3, val5 - val3);
1096 val2 = ((Vector3)(ref val2)).normalized;
1097 val3 = ((Vector3)(ref val3)).normalized;
1098 Handles.DrawWireDisc(val4, -normalized, radius);
1099 Handles.DrawWireArc(val4, val2, val3, 180f, radius);
1100 Handles.DrawWireArc(val4, val3, -val2, 180f, radius);
1101 Handles.DrawWireDisc(val5, normalized, radius);
1102 Handles.DrawWireArc(val5, val2, -val3, 180f, radius);
1103 Handles.DrawWireArc(val5, val3, val2, 180f, radius);
1104 }
1105
1106 public static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius1, float radius2)
1107 {
1108 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1109 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
1110 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
1111 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
1112 //IL_001d: Unknown result type (might be due to invalid IL or missing references)
1113 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
1114 DrawWireCylinder(center, height, radius1, radius2, rotation, 4);
1115 DrawWireCapsuleEndcap(center, rotation, height * 0.5f, radius2, isUp: true);
1116 DrawWireCapsuleEndcap(center, rotation, height * 0.5f, radius1, isUp: false);
1117 }
1118
1119 private static void DrawWireCapsuleEndcap(Vector3 center, Quaternion rotation, float half, float radius, bool isUp)
1120 {
1121 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
1122 //IL_0004: Unknown result type (might be due to invalid IL or missing references)
1123 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
1124 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
1125 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
1126 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
1127 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
1128 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
1129 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
1130 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
1131 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
1132 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
1133 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
1134 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
1135 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
1136 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
1137 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
1138 //IL_0055: Unknown result type (might be due to invalid IL or missing references)
1139 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
1140 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
1141 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
1142 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
1143 //IL_0062: Unknown result type (might be due to invalid IL or missing references)
1144 //IL_0067: Unknown result type (might be due to invalid IL or missing references)
1145 Vector3 val = (isUp ? Vector3.up : Vector3.down);
1146 float num = (isUp ? 180f : (-180f));
1147 center += rotation * val * half;
1148 Handles.DrawWireArc(center, rotation * Vector3.forward, rotation * Vector3.right, num, radius);
1149 Handles.DrawWireArc(center, rotation * Vector3.left, rotation * Vector3.forward, num, radius);
1150 }
1151
1152 public static void DrawWireAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle, int segments = 12)
1153 {
1154 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
1155 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
1156 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
1157 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
1158 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
1159 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
1160 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
1161 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
1162 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
1163 //IL_0041: Unknown result type (might be due to invalid IL or missing references)
1164 //IL_0042: Unknown result type (might be due to invalid IL or missing references)
1165 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
1166 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
1167 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
1168 //IL_0046: Unknown result type (might be due to invalid IL or missing references)
1169 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
1170 //IL_005e: Unknown result type (might be due to invalid IL or missing references)
1171 //IL_005f: Unknown result type (might be due to invalid IL or missing references)
1172 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
1173 //IL_0070: Unknown result type (might be due to invalid IL or missing references)
1174 //IL_0075: Unknown result type (might be due to invalid IL or missing references)
1175 //IL_007a: Unknown result type (might be due to invalid IL or missing references)
1176 //IL_007f: Unknown result type (might be due to invalid IL or missing references)
1177 //IL_0080: Unknown result type (might be due to invalid IL or missing references)
1178 //IL_0085: Unknown result type (might be due to invalid IL or missing references)
1179 //IL_008a: Unknown result type (might be due to invalid IL or missing references)
1180 Vector3 val = Quaternion.AngleAxis(angle, Vector3.forward) * new Vector3(0f, radius, 0f);
1181 for (int i = 0; i < segments; i++)
1182 {
1183 Vector3 val2 = Quaternion.AngleAxis((float)i / (float)segments * 360f, Vector3.up) * val;
1184 Handles.DrawLine(tip, tip + rotation * val2);
1185 }
1186 Handles.DrawWireDisc(tip + rotation * new Vector3(0f, val.y, 0f), rotation * Vector3.up, val.x);
1187 }
1188
1189 public static void DrawSolidAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle)
1190 {
1191 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1192 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
1193 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
1194 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
1195 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
1196 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
1197 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
1198 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
1199 //IL_001d: Unknown result type (might be due to invalid IL or missing references)
1200 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
1201 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
1202 //IL_0028: Unknown result type (might be due to invalid IL or missing references)
1203 //IL_0029: Unknown result type (might be due to invalid IL or missing references)
1204 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
1205 Vector3 val = rotation * Vector3.up;
1206 Vector3 val2 = rotation * Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.up;
1207 Handles.DrawSolidArc(tip, val, val2, 360f, radius);
1208 }
1209
1210 public static void DrawWireSquare(Vector3 center, Quaternion rotation, float size)
1211 {
1212 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1213 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
1214 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
1215 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
1216 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1217 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
1218 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
1219 //IL_0018: Unknown result type (might be due to invalid IL or missing references)
1220 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
1221 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
1222 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
1223 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
1224 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
1225 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
1226 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1227 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
1228 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
1229 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
1230 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
1231 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
1232 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
1233 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
1234 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
1235 //IL_004a: Unknown result type (might be due to invalid IL or missing references)
1236 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
1237 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
1238 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
1239 //IL_0052: Unknown result type (might be due to invalid IL or missing references)
1240 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
1241 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
1242 //IL_0062: Unknown result type (might be due to invalid IL or missing references)
1243 //IL_0063: Unknown result type (might be due to invalid IL or missing references)
1244 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
1245 //IL_0069: Unknown result type (might be due to invalid IL or missing references)
1246 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
1247 //IL_006f: Unknown result type (might be due to invalid IL or missing references)
1248 //IL_0070: Unknown result type (might be due to invalid IL or missing references)
1249 //IL_0071: Unknown result type (might be due to invalid IL or missing references)
1250 //IL_0076: Unknown result type (might be due to invalid IL or missing references)
1251 //IL_0077: Unknown result type (might be due to invalid IL or missing references)
1252 //IL_0081: Unknown result type (might be due to invalid IL or missing references)
1253 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
1254 //IL_0083: Unknown result type (might be due to invalid IL or missing references)
1255 //IL_0088: Unknown result type (might be due to invalid IL or missing references)
1256 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
1257 //IL_008e: Unknown result type (might be due to invalid IL or missing references)
1258 //IL_008f: Unknown result type (might be due to invalid IL or missing references)
1259 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
1260 //IL_0095: Unknown result type (might be due to invalid IL or missing references)
1261 //IL_0096: Unknown result type (might be due to invalid IL or missing references)
1262 Vector3 val = rotation * Vector3.right * size;
1263 Vector3 val2 = rotation * Vector3.forward * size;
1264 Handles.DrawLine(center - val - val2, center + val - val2);
1265 Handles.DrawLine(center + val - val2, center + val + val2);
1266 Handles.DrawLine(center + val + val2, center - val + val2);
1267 Handles.DrawLine(center - val + val2, center - val - val2);
1268 }
1269
1270 public static void DrawWireSquare(Vector3 center, Vector3 normal, float size)
1271 {
1272 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1273 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
1274 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
1275 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
1276 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
1277 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
1278 //IL_0025: Unknown result type (might be due to invalid IL or missing references)
1279 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
1280 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
1281 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1282 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
1283 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
1284 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
1285 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
1286 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
1287 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
1288 //IL_003f: Unknown result type (might be due to invalid IL or missing references)
1289 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
1290 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
1291 //IL_0047: Unknown result type (might be due to invalid IL or missing references)
1292 //IL_004c: Unknown result type (might be due to invalid IL or missing references)
1293 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
1294 //IL_004f: Unknown result type (might be due to invalid IL or missing references)
1295 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
1296 //IL_0055: Unknown result type (might be due to invalid IL or missing references)
1297 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
1298 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
1299 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
1300 //IL_005d: Unknown result type (might be due to invalid IL or missing references)
1301 //IL_0062: Unknown result type (might be due to invalid IL or missing references)
1302 //IL_0063: Unknown result type (might be due to invalid IL or missing references)
1303 //IL_0064: Unknown result type (might be due to invalid IL or missing references)
1304 //IL_0069: Unknown result type (might be due to invalid IL or missing references)
1305 //IL_006a: Unknown result type (might be due to invalid IL or missing references)
1306 //IL_0074: Unknown result type (might be due to invalid IL or missing references)
1307 //IL_0075: Unknown result type (might be due to invalid IL or missing references)
1308 //IL_0076: Unknown result type (might be due to invalid IL or missing references)
1309 //IL_007b: Unknown result type (might be due to invalid IL or missing references)
1310 //IL_007c: Unknown result type (might be due to invalid IL or missing references)
1311 //IL_0081: Unknown result type (might be due to invalid IL or missing references)
1312 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
1313 //IL_0083: Unknown result type (might be due to invalid IL or missing references)
1314 //IL_0088: Unknown result type (might be due to invalid IL or missing references)
1315 //IL_0089: Unknown result type (might be due to invalid IL or missing references)
1316 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
1317 //IL_0094: Unknown result type (might be due to invalid IL or missing references)
1318 //IL_0095: Unknown result type (might be due to invalid IL or missing references)
1319 //IL_009a: Unknown result type (might be due to invalid IL or missing references)
1320 //IL_009b: Unknown result type (might be due to invalid IL or missing references)
1321 //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
1322 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
1323 //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
1324 //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
1325 //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
1326 //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
1327 //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
1328 //IL_00b4: Unknown result type (might be due to invalid IL or missing references)
1329 //IL_00b9: Unknown result type (might be due to invalid IL or missing references)
1330 //IL_00ba: Unknown result type (might be due to invalid IL or missing references)
1331 //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
1332 //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
1333 //IL_00c1: Unknown result type (might be due to invalid IL or missing references)
1334 //IL_00c6: Unknown result type (might be due to invalid IL or missing references)
1335 //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
1336 Vector3 val = Vector3.Cross(normal, Mathf.Approximately(normal.y, 1f) ? Vector3.forward : Vector3.up);
1337 Vector3 val2 = Vector3.Cross(normal, val);
1338 Vector3 normalized = ((Vector3)(ref val2)).normalized;
1339 val2 = Vector3.Cross(normal, normalized);
1340 Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
1341 normalized *= size;
1342 normalized2 *= size;
1343 Handles.DrawLine(center - normalized - normalized2, center + normalized - normalized2);
1344 Handles.DrawLine(center + normalized - normalized2, center + normalized + normalized2);
1345 Handles.DrawLine(center + normalized + normalized2, center - normalized + normalized2);
1346 Handles.DrawLine(center - normalized + normalized2, center - normalized - normalized2);
1347 }
1348
1349 public static void DrawWirePlane(Vector3 center, Vector3 normal, float size)
1350 {
1351 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1352 //IL_0001: Unknown result type (might be due to invalid IL or missing references)
1353 //IL_0008: Unknown result type (might be due to invalid IL or missing references)
1354 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
1355 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
1356 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
1357 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1358 DrawWireSquare(center, normal, size);
1359 Handles.DrawLine(center, center + normal * size);
1360 }
1361
1362 public static int AddLineToBatch(ref List<Vector3> buffer, Vector3 start, Vector3 end)
1363 {
1364 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
1365 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
1366 buffer.Add(start);
1367 buffer.Add(end);
1368 return 2;
1369 }
1370
1371 public static int AddCapsuleToBatch(ref List<Vector3> buffer, float beginRadius, float endRadius, float half)
1372 {
1373 return 0 + AddCylinderSidePoints(ref buffer, beginRadius, endRadius, half) + AddCylinderCapPoints(ref buffer, beginRadius, endRadius, half) + AddCapsuleCapPoints(ref buffer, beginRadius, endRadius, half);
1374 }
1375
1376 private static int AddCylinderSidePoints(ref List<Vector3> buffer, float beginRadius, float endRadius, float half)
1377 {
1378 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
1379 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
1380 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
1381 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1382 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
1383 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
1384 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
1385 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
1386 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
1387 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
1388 //IL_0032: Unknown result type (might be due to invalid IL or missing references)
1389 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
1390 //IL_004a: Unknown result type (might be due to invalid IL or missing references)
1391 //IL_004f: Unknown result type (might be due to invalid IL or missing references)
1392 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
1393 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
1394 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
1395 //IL_0059: Unknown result type (might be due to invalid IL or missing references)
1396 //IL_0065: Unknown result type (might be due to invalid IL or missing references)
1397 //IL_0066: Unknown result type (might be due to invalid IL or missing references)
1398 //IL_0067: Unknown result type (might be due to invalid IL or missing references)
1399 Vector3 val = Vector3.right * beginRadius - Vector3.up * half;
1400 Vector3 val2 = Vector3.right * endRadius + Vector3.up * half;
1401 for (int i = 0; i < 4; i++)
1402 {
1403 Quaternion val3 = Quaternion.AngleAxis((float)i / 4f * 360f, Vector3.up);
1404 buffer.Add(val3 * val);
1405 buffer.Add(val3 * val2);
1406 }
1407 return 8;
1408 }
1409
1410 private static int AddCylinderCapPoints(ref List<Vector3> buffer, float beginRadius, float endRadius, float half)
1411 {
1412 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
1413 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1414 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
1415 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
1416 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
1417 //IL_0027: Unknown result type (might be due to invalid IL or missing references)
1418 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1419 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
1420 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
1421 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
1422 //IL_005b: Unknown result type (might be due to invalid IL or missing references)
1423 //IL_0060: Unknown result type (might be due to invalid IL or missing references)
1424 //IL_0066: Unknown result type (might be due to invalid IL or missing references)
1425 //IL_006b: Unknown result type (might be due to invalid IL or missing references)
1426 for (int i = 0; i < 25; i++)
1427 {
1428 buffer.Add(SphereGizmoRotations[i] * (Vector3.forward * beginRadius) - Vector3.up * half);
1429 }
1430 for (int j = 0; j < 25; j++)
1431 {
1432 buffer.Add(SphereGizmoRotations[j] * (Vector3.forward * endRadius) + Vector3.up * half);
1433 }
1434 return 50;
1435 }
1436
1437 private static int AddCapsuleCapPoints(ref List<Vector3> buffer, float beginRadius, float endRadius, float half)
1438 {
1439 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
1440 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
1441 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
1442 //IL_001f: Unknown result type (might be due to invalid IL or missing references)
1443 //IL_0024: Unknown result type (might be due to invalid IL or missing references)
1444 //IL_002a: Unknown result type (might be due to invalid IL or missing references)
1445 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
1446 //IL_0051: Unknown result type (might be due to invalid IL or missing references)
1447 //IL_0056: Unknown result type (might be due to invalid IL or missing references)
1448 //IL_005c: Unknown result type (might be due to invalid IL or missing references)
1449 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
1450 //IL_0066: Unknown result type (might be due to invalid IL or missing references)
1451 //IL_006c: Unknown result type (might be due to invalid IL or missing references)
1452 //IL_0071: Unknown result type (might be due to invalid IL or missing references)
1453 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
1454 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
1455 //IL_009e: Unknown result type (might be due to invalid IL or missing references)
1456 //IL_00a3: Unknown result type (might be due to invalid IL or missing references)
1457 //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
1458 //IL_00ae: Unknown result type (might be due to invalid IL or missing references)
1459 //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
1460 //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
1461 //IL_00da: Unknown result type (might be due to invalid IL or missing references)
1462 //IL_00e0: Unknown result type (might be due to invalid IL or missing references)
1463 //IL_00e5: Unknown result type (might be due to invalid IL or missing references)
1464 //IL_00ea: Unknown result type (might be due to invalid IL or missing references)
1465 //IL_00f0: Unknown result type (might be due to invalid IL or missing references)
1466 //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
1467 for (int i = 0; i < 13; i++)
1468 {
1469 buffer.Add(CapsuleGizmoRotations[i + 26] * (Vector3.forward * beginRadius) - Vector3.up * half);
1470 }
1471 for (int j = 0; j < 13; j++)
1472 {
1473 buffer.Add(CapsuleGizmoRotations[j + 39] * (Vector3.forward * endRadius) + Vector3.up * half);
1474 }
1475 for (int k = 0; k < 13; k++)
1476 {
1477 buffer.Add(CapsuleGizmoRotations[k + 52] * (Vector3.up * beginRadius) - Vector3.up * half);
1478 }
1479 for (int l = 0; l < 13; l++)
1480 {
1481 buffer.Add(CapsuleGizmoRotations[l + 65] * (Vector3.up * endRadius) + Vector3.up * half);
1482 }
1483 return 52;
1484 }
1485
1486 public static int AddSphereToBatch(ref List<Vector3> buffer, float radius)
1487 {
1488 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
1489 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1490 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
1491 //IL_001c: Unknown result type (might be due to invalid IL or missing references)
1492 //IL_003e: Unknown result type (might be due to invalid IL or missing references)
1493 //IL_0043: Unknown result type (might be due to invalid IL or missing references)
1494 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
1495 //IL_004e: Unknown result type (might be due to invalid IL or missing references)
1496 //IL_0070: Unknown result type (might be due to invalid IL or missing references)
1497 //IL_0075: Unknown result type (might be due to invalid IL or missing references)
1498 //IL_007b: Unknown result type (might be due to invalid IL or missing references)
1499 //IL_0080: Unknown result type (might be due to invalid IL or missing references)
1500 for (int i = 0; i < 25; i++)
1501 {
1502 buffer.Add(SphereGizmoRotations[i] * (Vector3.forward * radius));
1503 }
1504 for (int j = 0; j < 25; j++)
1505 {
1506 buffer.Add(SphereGizmoRotations[j + 25] * (Vector3.forward * radius));
1507 }
1508 for (int k = 0; k < 25; k++)
1509 {
1510 buffer.Add(SphereGizmoRotations[k + 50] * (Vector3.up * radius));
1511 }
1512 return 75;
1513 }
1514
1515 public static int DrawLineBatched(ref List<Vector3> buffer, int offset, Color color)
1516 {
1517 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
1518 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
1519 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
1520 //IL_002d: Unknown result type (might be due to invalid IL or missing references)
1521 GL.PushMatrix();
1522 GL.MultMatrix(Matrix4x4.identity);
1523 GL.Begin(1);
1524 GL.Color(color);
1525 GL.Vertex(buffer[offset]);
1526 GL.Vertex(buffer[offset + 1]);
1527 GL.End();
1528 GL.PopMatrix();
1529 return 2;
1530 }
1531
1532 public static int DrawSphereBatched(ref List<Vector3> buffer, int offset, Color color, Matrix4x4 matrix)
1533 {
1534 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
1535 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1536 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
1537 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
1538 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
1539 //IL_0077: Unknown result type (might be due to invalid IL or missing references)
1540 //IL_0086: Unknown result type (might be due to invalid IL or missing references)
1541 GL.PushMatrix();
1542 GL.MultMatrix(matrix);
1543 GL.Begin(2);
1544 GL.Color(color);
1545 for (int i = 0; i < 25; i++)
1546 {
1547 GL.Vertex(buffer[offset + i]);
1548 }
1549 GL.End();
1550 offset += 25;
1551 GL.Begin(2);
1552 GL.Color(color);
1553 for (int j = 0; j < 25; j++)
1554 {
1555 GL.Vertex(buffer[offset + j]);
1556 }
1557 GL.End();
1558 offset += 25;
1559 GL.Begin(2);
1560 GL.Color(color);
1561 for (int k = 0; k < 25; k++)
1562 {
1563 GL.Vertex(buffer[offset + k]);
1564 }
1565 GL.End();
1566 offset += 25;
1567 GL.PopMatrix();
1568 return offset;
1569 }
1570
1571 public static int DrawCapsuleBatched(ref List<Vector3> buffer, int offset, Color color, Matrix4x4 matrix)
1572 {
1573 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
1574 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
1575 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
1576 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
1577 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
1578 //IL_0062: Unknown result type (might be due to invalid IL or missing references)
1579 //IL_0086: Unknown result type (might be due to invalid IL or missing references)
1580 //IL_0095: Unknown result type (might be due to invalid IL or missing references)
1581 //IL_00b9: Unknown result type (might be due to invalid IL or missing references)
1582 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
1583 //IL_00ec: Unknown result type (might be due to invalid IL or missing references)
1584 //IL_00fd: Unknown result type (might be due to invalid IL or missing references)
1585 //IL_0124: Unknown result type (might be due to invalid IL or missing references)
1586 //IL_0135: Unknown result type (might be due to invalid IL or missing references)
1587 //IL_015c: Unknown result type (might be due to invalid IL or missing references)
1588 //IL_016d: Unknown result type (might be due to invalid IL or missing references)
1589 GL.PushMatrix();
1590 GL.MultMatrix(matrix);
1591 for (int i = 0; i < 8; i += 2)
1592 {
1593 GL.Begin(1);
1594 GL.Color(color);
1595 GL.Vertex(buffer[offset + i]);
1596 GL.Vertex(buffer[offset + i + 1]);
1597 GL.End();
1598 }
1599 offset += 8;
1600 GL.Begin(2);
1601 GL.Color(color);
1602 for (int j = 0; j < 25; j++)
1603 {
1604 GL.Vertex(buffer[offset + j]);
1605 }
1606 GL.End();
1607 offset += 25;
1608 GL.Begin(2);
1609 GL.Color(color);
1610 for (int k = 0; k < 25; k++)
1611 {
1612 GL.Vertex(buffer[offset + k]);
1613 }
1614 GL.End();
1615 offset += 25;
1616 GL.Begin(2);
1617 GL.Color(color);
1618 for (int l = 0; l < 13; l++)
1619 {
1620 GL.Vertex(buffer[offset + l]);
1621 }
1622 GL.End();
1623 offset += 13;
1624 GL.Begin(2);
1625 GL.Color(color);
1626 for (int m = 0; m < 13; m++)
1627 {
1628 GL.Vertex(buffer[offset + m]);
1629 }
1630 GL.End();
1631 offset += 13;
1632 GL.Begin(2);
1633 GL.Color(color);
1634 for (int n = 0; n < 13; n++)
1635 {
1636 GL.Vertex(buffer[offset + n]);
1637 }
1638 GL.End();
1639 offset += 13;
1640 GL.Begin(2);
1641 GL.Color(color);
1642 for (int num = 0; num < 13; num++)
1643 {
1644 GL.Vertex(buffer[offset + num]);
1645 }
1646 GL.End();
1647 offset += 13;
1648 GL.PopMatrix();
1649 return offset;
1650 }
1651
1652 public static void ApplyWireMaterial()
1653 {
1654 //IL_0050: Unknown result type (might be due to invalid IL or missing references)
1655 if (_applyWireMaterialMethod == (MethodInfo)null)
1656 {
1657 _applyWireMaterialMethod = typeof(HandleUtility).GetMethod("ApplyWireMaterial", (BindingFlags)40, (Binder)null, (Type[])(object)new Type[1] { typeof(CompareFunction) }, (ParameterModifier[])null);
1658 }
1659 MethodInfo applyWireMaterialMethod = _applyWireMaterialMethod;
1660 if (applyWireMaterialMethod != null)
1661 {
1662 ((MethodBase)applyWireMaterialMethod).Invoke((object)null, (object[])(object)new Object[1] { (object)Handles.zTest });
1663 }
1664 }
1665}
1666public static class InspectorUtil : Object
1667{
1668 public struct EditableArray : ValueType
1669 {
1670 public SerializedProperty array;
1671
1672 public int maxElements;
1673
1674 public Action<SerializedProperty, int> onDrawElement;
1675
1676 public Action<SerializedProperty, int> onNewElement;
1677
1678 public Action<SerializedProperty, int> onSelect;
1679 }
1680
1681 private static GUIStyle Style_BoxNormal;
1682
1683 private static GUIStyle Style_BoxSelected;
1684
1685 public static void QuaternionAsEulerField(SerializedProperty property)
1686 {
1687 //IL_000b: Unknown result type (might be due to invalid IL or missing references)
1688 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
1689 //IL_0013: Unknown result type (might be due to invalid IL or missing references)
1690 //IL_001d: Unknown result type (might be due to invalid IL or missing references)
1691 //IL_0022: Unknown result type (might be due to invalid IL or missing references)
1692 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
1693 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1694 EditorGUI.BeginChangeCheck();
1695 Quaternion quaternionValue = property.quaternionValue;
1696 Vector3 val = EditorGUILayout.Vector3Field("Rotation", ((Quaternion)(ref quaternionValue)).eulerAngles, Array.Empty<GUILayoutOption>());
1697 if (EditorGUI.EndChangeCheck())
1698 {
1699 property.quaternionValue = Quaternion.Euler(val);
1700 }
1701 }
1702
1703 private static void InitStyles()
1704 {
1705 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1706 //IL_001b: Expected O, but got Unknown
1707 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
1708 //IL_0036: Expected O, but got Unknown
1709 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
1710 if (Style_BoxNormal == null)
1711 {
1712 Style_BoxNormal = new GUIStyle(GUI.skin.box);
1713 }
1714 if (Style_BoxSelected == null)
1715 {
1716 Style_BoxSelected = new GUIStyle(GUI.skin.box);
1717 Style_BoxSelected.normal.background = MakeStyleBackground(new Color(0f, 0.5f, 1f, 0.5f));
1718 }
1719 }
1720
1721 private static Texture2D MakeStyleBackground(Color color)
1722 {
1723 //IL_0002: Unknown result type (might be due to invalid IL or missing references)
1724 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
1725 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
1726 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
1727 //IL_0017: Expected O, but got Unknown
1728 Texture2D val = new Texture2D(1, 1);
1729 val.SetPixel(0, 0, color);
1730 val.Apply();
1731 return val;
1732 }
1733
1734 public static void DrawEditableArray(Editor editor, EditableArray data, ref int selected)
1735 {
1736 //IL_000a: Unknown result type (might be due to invalid IL or missing references)
1737 //IL_0164: Unknown result type (might be due to invalid IL or missing references)
1738 //IL_0169: Unknown result type (might be due to invalid IL or missing references)
1739 //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
1740 //IL_01b7: Unknown result type (might be due to invalid IL or missing references)
1741 InitStyles();
1742 EditorGUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
1743 EditorGUI.BeginDisabledGroup(data.array.arraySize >= data.maxElements);
1744 if (GUILayout.Button("Add", Array.Empty<GUILayoutOption>()))
1745 {
1746 data.array.InsertArrayElementAtIndex(data.array.arraySize);
1747 data.onNewElement?.Invoke(data.array, data.array.arraySize - 1);
1748 }
1749 EditorGUI.EndDisabledGroup();
1750 EditorGUI.BeginDisabledGroup(selected < 0);
1751 if (GUILayout.Button("Up", Array.Empty<GUILayoutOption>()) && selected > 0)
1752 {
1753 data.array.MoveArrayElement(selected, selected - 1);
1754 selected--;
1755 editor.Repaint();
1756 }
1757 if (GUILayout.Button("Down", Array.Empty<GUILayoutOption>()) && selected < data.array.arraySize - 1)
1758 {
1759 data.array.MoveArrayElement(selected, selected + 1);
1760 selected++;
1761 editor.Repaint();
1762 }
1763 if (GUILayout.Button("Delete", Array.Empty<GUILayoutOption>()))
1764 {
1765 data.array.DeleteArrayElementAtIndex(selected);
1766 selected--;
1767 data.onSelect?.Invoke(data.array, selected);
1768 }
1769 EditorGUI.EndDisabledGroup();
1770 EditorGUILayout.EndHorizontal();
1771 for (int i = 0; i < data.array.arraySize; i++)
1772 {
1773 bool num = i == selected;
1774 EditorGUI.BeginChangeCheck();
1775 Rect val = EditorGUILayout.BeginVertical(num ? Style_BoxSelected : Style_BoxNormal, Array.Empty<GUILayoutOption>());
1776 data.onDrawElement.Invoke(data.array, i);
1777 EditorGUILayout.EndVertical();
1778 if (EditorGUI.EndChangeCheck())
1779 {
1780 selected = i;
1781 data.onSelect?.Invoke(data.array, selected);
1782 }
1783 if ((int)Event.current.type == 0 && ((Rect)(ref val)).Contains(Event.current.mousePosition))
1784 {
1785 if (selected == i)
1786 {
1787 selected = -1;
1788 }
1789 else
1790 {
1791 selected = i;
1792 }
1793 data.onSelect?.Invoke(data.array, selected);
1794 Event.current.Use();
1795 }
1796 }
1797 }
1798}
1799namespace VRC.SDK3.Editor
1800{
1801 public class SerializableFunction : Object
1802 {
1803 public string className;
1804
1805 public string methodName;
1806
1807 public SerializableFunction(string _className, string _methodName)
1808 {
1809 className = _className;
1810 methodName = _methodName;
1811 }
1812 }
1813 public class EditorAssemblies : Object
1814 {
1815 public delegate void OnDeserialized();
1816
1817 [CompilerGenerated]
1818 private sealed class <>c__DisplayClass10_0 : Object
1819 {
1820 public string staticFunctionName;
1821
1822 public string className;
1823
1824 internal bool <AddOnAssemblyReloadCallback>b__0(SerializableFunction sf)
1825 {
1826 if (sf.methodName == staticFunctionName)
1827 {
1828 return sf.className == className;
1829 }
1830 return false;
1831 }
1832 }
1833
1834 public static string SERIALIZATION_PATH = String.Concat(Application.dataPath, "/../vrcAssemblyCallbacks");
1835
1836 public static string TMP_FILE_PATH = String.Concat(Application.dataPath, "/VRCSDK/_tmp.cs");
1837
1838 private static List<SerializableFunction> OnAssemblyReloadCallbacks;
1839
1841
1842 [DidReloadScripts]
1843 public static void OnCompileScripts()
1844 {
1845 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
1846 //IL_0023: Expected O, but got Unknown
1847 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
1848 //IL_002d: Expected O, but got Unknown
1849 Logger.Log("Reloading Assemblies", DebugLevel.All);
1850 EditorApplication.delayCall = (CallbackFunction)Delegate.Combine((Delegate)(object)EditorApplication.delayCall, (Delegate)new CallbackFunction(DoIt));
1851 }
1852
1853 public static void ReloadAssemblies()
1854 {
1855 if (!File.Exists(TMP_FILE_PATH))
1856 {
1857 ((Stream)File.Create(TMP_FILE_PATH)).Close();
1858 }
1859 else
1860 {
1861 File.Delete(TMP_FILE_PATH);
1862 }
1863 AssetDatabase.Refresh();
1864 }
1865
1866 public static void DoIt()
1867 {
1869 if (File.Exists(SERIALIZATION_PATH))
1870 {
1871 File.Delete(SERIALIZATION_PATH);
1872 }
1874 }
1875
1876 private static void DeserializeCallbacks()
1877 {
1878 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
1879 //IL_0017: Expected O, but got Unknown
1880 if (File.Exists(SERIALIZATION_PATH))
1881 {
1882 StreamReader val = new StreamReader(SERIALIZATION_PATH);
1883 string text;
1884 while ((text = ((TextReader)val).ReadLine()) != null)
1885 {
1886 string[] array = text.Split((char[])(object)new Char[1] { (Char)44 });
1887 AddOnAssemblyReloadCallback(array[0], array[1], autoSerialize: false);
1888 }
1889 ((TextReader)val).Close();
1890 }
1891 }
1892
1893 private static void SerializeCallbacks()
1894 {
1895 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
1896 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
1897 if (File.Exists(SERIALIZATION_PATH))
1898 {
1899 File.Delete(SERIALIZATION_PATH);
1900 }
1901 TextWriter val = (TextWriter)(object)File.CreateText(SERIALIZATION_PATH);
1902 try
1903 {
1904 Enumerator<SerializableFunction> enumerator = OnAssemblyReloadCallbacks.GetEnumerator();
1905 try
1906 {
1907 while (enumerator.MoveNext())
1908 {
1909 SerializableFunction current = enumerator.Current;
1910 val.WriteLine(String.Concat(current.className, ",", current.methodName));
1911 }
1912 }
1913 finally
1914 {
1915 ((IDisposable)enumerator).Dispose();
1916 }
1917 val.Close();
1918 }
1919 finally
1920 {
1921 if (val != null)
1922 {
1923 ((IDisposable)val).Dispose();
1924 }
1925 }
1926 }
1927
1928 public static void AddOnAssemblyReloadCallback(string className, string staticFunctionName, bool autoSerialize = true)
1929 {
1930 <>c__DisplayClass10_0 CS$<>8__locals0 = new <>c__DisplayClass10_0();
1931 CS$<>8__locals0.staticFunctionName = staticFunctionName;
1932 CS$<>8__locals0.className = className;
1933 if (OnAssemblyReloadCallbacks == null)
1934 {
1935 OnAssemblyReloadCallbacks = new List<SerializableFunction>();
1936 }
1937 if (!Enumerable.Any<SerializableFunction>((IEnumerable<SerializableFunction>)(object)OnAssemblyReloadCallbacks, (Func<SerializableFunction, bool>)((SerializableFunction sf) => sf.methodName == CS$<>8__locals0.staticFunctionName && sf.className == CS$<>8__locals0.className)))
1938 {
1939 SerializableFunction serializableFunction = new SerializableFunction(CS$<>8__locals0.className, CS$<>8__locals0.staticFunctionName);
1940 OnAssemblyReloadCallbacks.Add(serializableFunction);
1941 if (autoSerialize)
1942 {
1944 }
1945 }
1946 }
1947
1948 public static void ClearAssemblyReloadCallbacks()
1949 {
1950 if (OnAssemblyReloadCallbacks != null)
1951 {
1953 }
1954 }
1955
1957 {
1958 //IL_004a: Expected O, but got Unknown
1959 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
1960 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
1961 List<SerializableFunction> onAssemblyReloadCallbacks = OnAssemblyReloadCallbacks;
1963 if (onAssemblyReloadCallbacks == null)
1964 {
1965 return;
1966 }
1967 Enumerator<SerializableFunction> enumerator = onAssemblyReloadCallbacks.GetEnumerator();
1968 try
1969 {
1970 while (enumerator.MoveNext())
1971 {
1972 SerializableFunction current = enumerator.Current;
1973 try
1974 {
1975 ((MethodBase)Assembly.GetExecutingAssembly().GetType(current.className).GetMethod(current.methodName, (BindingFlags)24)).Invoke((object)null, (object[])null);
1976 }
1977 catch (Exception val)
1978 {
1979 Exception val2 = val;
1980 Debug.Log((object)String.Concat((string[])(object)new String[6] { "Error calling ", current.className, ".", current.methodName, " - ", val2.Message }));
1981 }
1982 }
1983 }
1984 finally
1985 {
1986 ((IDisposable)enumerator).Dispose();
1987 }
1988 }
1989
1990 public static List<string> GetLoadedAssemblies()
1991 {
1992 List<string> val = new List<string>();
1993 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
1994 for (int i = 0; i < assemblies.Length; i++)
1995 {
1996 string name = assemblies[i].GetName().Name;
1997 val.Add(name);
1998 }
1999 return val;
2000 }
2001
2002 public static List<string> GetCustomLoadedAssembles()
2003 {
2004 return Enumerable.ToList<string>(Enumerable.Where<string>((IEnumerable<string>)(object)GetLoadedAssemblies(), (Func<string, bool>)((string a) => a.StartsWith("vrc"))));
2005 }
2006 }
2007}
2009{
2010 public class AssetExporter : MonoBehaviour
2011 {
2013 {
2014 if (File.Exists(GetActiveSceneUnityPackageExportPath()) && String.Compare(EditorPrefs.GetString("VRC_exportedUnityPackagePath", ""), GetActiveSceneUnityPackageExportPath(), true) == 0)
2015 {
2016 Logger.Log(String.Concat("Exported package already up to date: ", GetActiveSceneUnityPackageExportPath()), DebugLevel.All);
2017 }
2018 else
2019 {
2021 }
2022 }
2023
2025 {
2026 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
2027 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
2028 Scene activeScene = SceneManager.GetActiveScene();
2029 string path = ((Scene)(ref activeScene)).path;
2030 List<string> obj = new List<string>();
2031 obj.Add(path);
2033 }
2034
2035 public static void ExportCurrentAssetAsUnityPackage(List<string> assetPaths, string dstPath)
2036 {
2037 Logger.Log(String.Concat("Exporting package to: ", dstPath), DebugLevel.All);
2038 EditorUtility.DisplayProgressBar("Exporting unity package", "Future proofing your content!", 1f);
2039 Logger.Log(String.Concat("Exporting to ", dstPath), DebugLevel.All);
2040 if (!assetPaths.Contains("Assets/VRCSDK"))
2041 {
2042 assetPaths.Add("Assets/VRCSDK");
2043 }
2044 EditorPrefs.SetString("VRC_exportedUnityPackagePath", dstPath);
2045 AssetDatabase.ExportPackage(assetPaths.ToArray(), dstPath, (ExportPackageOptions)14);
2046 EditorUtility.ClearProgressBar();
2047 }
2048
2049 public static void CleanupUnityPackageExport()
2050 {
2051 EditorPrefs.DeleteKey("VRC_exportedUnityPackagePath");
2052 }
2053
2055 {
2056 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
2057 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
2058 Scene activeScene = SceneManager.GetActiveScene();
2059 string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(((Scene)(ref activeScene)).path);
2060 return String.Concat(Path.GetDirectoryName(Application.dataPath), ((Char)(ref Path.DirectorySeparatorChar)).ToString(), fileNameWithoutExtension, ".unitypackage");
2061 }
2062
2063 public static void FindDynamicContent(ref List<GameObject> prefabs, ref List<Material> materials)
2064 {
2065 FindMaterialsAndPrefabsInScene(ref prefabs, ref materials);
2066 FindMaterialsOnObjects((IEnumerable<GameObject>)(object)prefabs, ref prefabs, ref materials);
2067 List<GameObject> prefabs2 = new List<GameObject>();
2069 FindMaterialsOnObjects((IEnumerable<GameObject>)(object)prefabs2, ref prefabs, ref materials);
2070 while (FindPrefabReferencesOnPrefabs(ref prefabs))
2071 {
2072 }
2073 }
2074
2075 public static void DoPreExportShaderReplacement()
2076 {
2077 Renderer[] array = Object.FindObjectsOfType<Renderer>();
2078 Shader val = Shader.Find("VRChat/Sprites/Default");
2079 Shader val2 = Shader.Find("VRChat/Sprites/Diffuse");
2080 if (!Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)val2))
2081 {
2082 return;
2083 }
2084 Renderer[] array2 = array;
2085 for (int i = 0; i < array2.Length; i++)
2086 {
2087 Material[] sharedMaterials = array2[i].sharedMaterials;
2088 foreach (Material val3 in sharedMaterials)
2089 {
2090 if ((Object)(object)val3 == (Object)null)
2091 {
2092 continue;
2093 }
2094 Shader shader = val3.shader;
2095 if (Object.op_Implicit((Object)(object)val) && ((Object)shader).name == "Sprites/Default")
2096 {
2097 shader = val;
2098 }
2099 else
2100 {
2101 if (!Object.op_Implicit((Object)(object)val2) || !(((Object)shader).name == "Sprites/Diffuse"))
2102 {
2103 continue;
2104 }
2105 shader = val2;
2106 }
2107 val3.shader = shader;
2108 }
2109 }
2110 }
2111
2112 private static void AddAlwaysIncludedShaders(IEnumerable<Shader> shaders)
2113 {
2114 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
2115 //IL_0012: Expected O, but got Unknown
2116 SerializedObject val = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/GraphicsSettings.asset")[0]);
2117 bool flag = false;
2118 SerializedProperty val2 = val.FindProperty("m_AlwaysIncludedShaders");
2119 List<Shader> val3 = Enumerable.ToList<Shader>(Enumerable.Where<Shader>(shaders, (Func<Shader, bool>)((Shader s) => (Object)(object)s != (Object)null && !((Object)s).name.Contains("Standard"))));
2120 for (int i = 0; i < val2.arraySize; i++)
2121 {
2122 Object objectReferenceValue = val2.GetArrayElementAtIndex(i).objectReferenceValue;
2123 Shader val4 = (Shader)(object)((objectReferenceValue is Shader) ? objectReferenceValue : null);
2124 if ((Object)(object)val4 != (Object)null && val3.Contains(val4))
2125 {
2126 val3.Remove(val4);
2127 }
2128 }
2129 int arraySize = val2.arraySize;
2130 if (val3.Count > 0)
2131 {
2132 val2.arraySize += val3.Count;
2133 flag = true;
2134 }
2135 for (int j = arraySize; j < val2.arraySize; j++)
2136 {
2137 Debug.LogFormat("Adding {0} to Always Included Shaders", (object[])(object)new Object[1] { (Object)((Object)val3[j - arraySize]).name });
2138 val2.GetArrayElementAtIndex(j).objectReferenceValue = (Object)(object)val3[j - arraySize];
2139 }
2140 if (flag)
2141 {
2142 val.ApplyModifiedProperties();
2143 }
2144 }
2145
2146 private static void FindMaterialsAndPrefabsInScene(ref List<GameObject> prefabs, ref List<Material> materials)
2147 {
2148 FindMaterialsOnObjects((IEnumerable<GameObject>)(object)Object.FindObjectsOfType<GameObject>(), ref prefabs, ref materials);
2149 }
2150
2151 private static void FindMaterialsOnObjects(IEnumerable<GameObject> objs, ref List<GameObject> prefabs, ref List<Material> materials)
2152 {
2153 IEnumerator<GameObject> enumerator = objs.GetEnumerator();
2154 try
2155 {
2156 while (((IEnumerator)enumerator).MoveNext())
2157 {
2158 GameObject current = enumerator.Current;
2159 if ((Object)(object)current == (Object)null)
2160 {
2161 continue;
2162 }
2163 Renderer[] componentsInChildren = current.GetComponentsInChildren<Renderer>();
2164 for (int i = 0; i < componentsInChildren.Length; i++)
2165 {
2166 Material[] sharedMaterials = componentsInChildren[i].sharedMaterials;
2167 foreach (Material val in sharedMaterials)
2168 {
2169 if ((Object)(object)val != (Object)null && !((Object)val).name.Contains("(Instance)") && !materials.Contains(val))
2170 {
2171 materials.Add(val);
2172 }
2173 }
2174 }
2175 Terrain[] componentsInChildren2 = current.GetComponentsInChildren<Terrain>();
2176 foreach (Terrain val2 in componentsInChildren2)
2177 {
2178 if ((Object)(object)val2.materialTemplate != (Object)null && !((Object)val2.materialTemplate).name.Contains("(Instance)") && !materials.Contains(val2.materialTemplate))
2179 {
2180 materials.Add(val2.materialTemplate);
2181 }
2182 if (!((Object)(object)val2.terrainData != (Object)null))
2183 {
2184 continue;
2185 }
2186 if (val2.terrainData.treePrototypes != null)
2187 {
2188 IEnumerable<GameObject> val3 = Enumerable.Where<GameObject>(Enumerable.Select<TreePrototype, GameObject>((IEnumerable<TreePrototype>)(object)val2.terrainData.treePrototypes, (Func<TreePrototype, GameObject>)((TreePrototype p) => p.prefab)), (Func<GameObject, bool>)((GameObject o) => (Object)(object)o != (Object)null));
2189 prefabs.AddRange(val3);
2190 }
2191 if (val2.terrainData.detailPrototypes != null)
2192 {
2193 IEnumerable<GameObject> val4 = Enumerable.Where<GameObject>(Enumerable.Select<DetailPrototype, GameObject>((IEnumerable<DetailPrototype>)(object)val2.terrainData.detailPrototypes, (Func<DetailPrototype, GameObject>)((DetailPrototype p) => p.prototype)), (Func<GameObject, bool>)((GameObject o) => (Object)(object)o != (Object)null));
2194 prefabs.AddRange(val4);
2195 }
2196 }
2197 }
2198 }
2199 finally
2200 {
2201 if (enumerator != null)
2202 {
2203 ((IDisposable)enumerator).Dispose();
2204 }
2205 }
2206 }
2207
2208 private static void FindPrefabsThatCanBeToggledActiveInScene(ref List<GameObject> prefabs, GameObject rootObj = null)
2209 {
2210 if ((Object)(object)rootObj != (Object)null)
2211 {
2212 for (int i = 0; i < rootObj.transform.childCount; i++)
2213 {
2214 FindPrefabsThatCanBeToggledActiveInScene(ref prefabs, ((Component)rootObj.transform.GetChild(i)).gameObject);
2215 }
2216 }
2217 }
2218
2219 private static void FindDynamicContentInProject(ref List<GameObject> prefabs, ref List<Material> materials, string rootPath)
2220 {
2221 if (!Directory.Exists(rootPath))
2222 {
2223 return;
2224 }
2225 string[] files = Directory.GetFiles(rootPath);
2226 foreach (string text in files)
2227 {
2228 string text2 = String.Concat("Assets", ((Char)(ref Path.DirectorySeparatorChar)).ToString(), text.Substring(String.Concat(Application.dataPath, ((Char)(ref Path.DirectorySeparatorChar)).ToString()).Length));
2229 if (!text2.Contains("Assets/Resources") || !text2.Contains("Assets/StreamingAssets"))
2230 {
2231 continue;
2232 }
2233 string text3 = text.ToLower();
2234 if (text3.EndsWith(".prefab"))
2235 {
2236 Object obj = AssetDatabase.LoadMainAssetAtPath(text2);
2237 GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null);
2238 if ((Object)(object)val != (Object)null)
2239 {
2240 prefabs.Add(val);
2241 }
2242 else
2243 {
2244 Debug.LogError((object)String.Concat("Could not load ", text2));
2245 }
2246 }
2247 else if (text3.EndsWith(".mat"))
2248 {
2249 Object obj2 = AssetDatabase.LoadMainAssetAtPath(text2);
2250 Material val2 = (Material)(object)((obj2 is Material) ? obj2 : null);
2251 if ((Object)(object)val2 != (Object)null)
2252 {
2253 materials.Add(val2);
2254 }
2255 else
2256 {
2257 Debug.LogError((object)String.Concat("Could not load ", text2));
2258 }
2259 }
2260 }
2261 files = Directory.GetDirectories(rootPath);
2262 foreach (string rootPath2 in files)
2263 {
2264 FindDynamicContentInProject(ref prefabs, ref materials, rootPath2);
2265 }
2266 }
2267
2268 private static bool FindPrefabReferencesOnPrefabs(ref List<GameObject> prefabs)
2269 {
2270 List<GameObject> val = new List<GameObject>();
2271 IEnumerator<GameObject> enumerator = Enumerable.Where<GameObject>((IEnumerable<GameObject>)(object)prefabs, (Func<GameObject, bool>)((GameObject p) => (Object)(object)p != (Object)null)).GetEnumerator();
2272 try
2273 {
2274 while (((IEnumerator)enumerator).MoveNext())
2275 {
2276 _ = enumerator.Current;
2277 }
2278 }
2279 finally
2280 {
2281 if (enumerator != null)
2282 {
2283 ((IDisposable)enumerator).Dispose();
2284 }
2285 }
2286 if (val.Count > 0)
2287 {
2288 prefabs.AddRange((IEnumerable<GameObject>)(object)val);
2289 return true;
2290 }
2291 return false;
2292 }
2293
2294 public static void CleanupTmpFiles()
2295 {
2296 if (File.Exists(EditorAssemblies.SERIALIZATION_PATH))
2297 {
2299 }
2300 if (File.Exists(EditorAssemblies.TMP_FILE_PATH))
2301 {
2302 File.Delete(EditorAssemblies.TMP_FILE_PATH);
2303 }
2304 }
2305 }
2306 public class VRC_SdkBuilder : MonoBehaviour
2307 {
2308 public enum BuildType : Enum
2309 {
2310 None,
2311 Test,
2312 Publish
2313 }
2314
2315 public static bool shouldBuildUnityPackage;
2316
2317 [Obsolete("Uploads from SDK Builder are no longer supported")]
2318 public static Func<GameObject, bool> RunExportAndUploadAvatarBlueprint;
2319
2320 public static Func<GameObject, bool> RunExportAndTestAvatarBlueprint;
2321
2322 public static Func<GameObject, bool> RunExportAvatarBlueprint;
2323
2325
2326 [Obsolete("Uploads from SDK Builder are no longer supported")]
2328
2329 [Obsolete("Uploads from SDK Builder are no longer supported")]
2331
2332 public static Action RunExportSceneResourceAndRun;
2333
2334 public static Func<bool> RunExportSceneResource;
2335
2336 public static Action RunExportSceneToV3;
2337
2338 public static Action<GameObject> RunExportAvatarToV3;
2339
2340 private static readonly HashSet<Type> _builderTypes;
2341
2342 private static readonly Dictionary<string, ISDKBuilder> _buildersByName;
2343
2344 private static ISDKBuilder _currentBuilder;
2345
2346 private const string SESSION_BUILD_TYPE_KEY = "Session.ActiveBuildType";
2347
2348 private static string RandomRoomDigits;
2349
2350 public static readonly Guid LocalLowGUID;
2351
2352 [field: CompilerGenerated]
2353 public static string VRCPath
2354 {
2355 [CompilerGenerated]
2356 get;
2357 [CompilerGenerated]
2358 set;
2359 }
2360
2362 {
2363 get
2364 {
2365 return (BuildType)SessionState.GetInt("Session.ActiveBuildType", 0);
2366 }
2367 set
2368 {
2369 SessionState.SetInt("Session.ActiveBuildType", (int)value);
2370 }
2371 }
2372
2374 {
2375 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
2376 //IL_0030: Expected O, but got Unknown
2377 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
2378 //IL_0045: Expected O, but got Unknown
2379 //IL_005e: Unknown result type (might be due to invalid IL or missing references)
2380 //IL_0063: Unknown result type (might be due to invalid IL or missing references)
2381 //IL_006d: Unknown result type (might be due to invalid IL or missing references)
2382 //IL_0072: Unknown result type (might be due to invalid IL or missing references)
2384 RunExportAndUploadAvatarBlueprint = (GameObject target) => false;
2385 RunUploadLastExportedSceneBlueprint = (Action)delegate
2386 {
2387 };
2388 RunExportAndUploadSceneBlueprint = (Action)delegate
2389 {
2390 };
2391 _builderTypes = new HashSet<Type>();
2392 _buildersByName = new Dictionary<string, ISDKBuilder>();
2393 LocalLowGUID = new Guid("A520A1A4-1780-4FF6-BD18-167343C5AF16");
2394 Enumerator<Type> enumerator = GetBuilderTypesFromAttribute().GetEnumerator();
2395 try
2396 {
2397 while (enumerator.MoveNext())
2398 {
2399 RegisterBuilder(enumerator.Current);
2400 }
2401 }
2402 finally
2403 {
2404 ((IDisposable)enumerator).Dispose();
2405 }
2406 }
2407
2408 private static void RegisterBuilder([NotNull] Type builderType)
2409 {
2410 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
2411 //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
2412 //IL_00b1: Expected O, but got Unknown
2413 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
2414 //IL_00bb: Expected O, but got Unknown
2415 //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
2416 //IL_00d2: Expected O, but got Unknown
2417 //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
2418 //IL_00dc: Expected O, but got Unknown
2419 //IL_010a: Unknown result type (might be due to invalid IL or missing references)
2420 //IL_0114: Expected O, but got Unknown
2421 //IL_0114: Unknown result type (might be due to invalid IL or missing references)
2422 //IL_011e: Expected O, but got Unknown
2423 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
2424 if (builderType == (Type)null)
2425 {
2426 throw new ArgumentNullException("builderType");
2427 }
2428 if (!_builderTypes.Contains(builderType))
2429 {
2430 _builderTypes.Add(builderType);
2431 ISDKBuilder iSDKBuilder = CreateBuilder(builderType);
2432 string name = iSDKBuilder.Name;
2433 if (!_buildersByName.ContainsKey(name))
2434 {
2435 _buildersByName.Add(name, iSDKBuilder);
2436 RunExportAndTestAvatarBlueprint = (Func<GameObject, bool>)(object)Delegate.Combine((Delegate)(object)RunExportAndTestAvatarBlueprint, (Delegate)(object)new Func<GameObject, bool>(iSDKBuilder.ExportAndTestAvatarBlueprint));
2437 RunExportAvatarBlueprint = (Func<GameObject, bool>)(object)Delegate.Combine((Delegate)(object)RunExportAvatarBlueprint, (Delegate)(object)new Func<GameObject, bool>(iSDKBuilder.ExportAvatarBlueprint));
2438 RunLastExportedSceneResourceAction = (Action)Delegate.Combine((Delegate)(object)RunLastExportedSceneResourceAction, (Delegate)new Action(iSDKBuilder.RunLastExportedSceneResource));
2439 RunExportSceneResourceAndRun = (Action)Delegate.Combine((Delegate)(object)RunExportSceneResourceAndRun, (Delegate)new Action(iSDKBuilder.ExportSceneResourceAndRun));
2440 RunExportSceneResource = (Func<bool>)(object)Delegate.Combine((Delegate)(object)RunExportSceneResource, (Delegate)(object)new Func<bool>(iSDKBuilder.ExportSceneResource));
2441 RunExportSceneToV3 = (Action)Delegate.Combine((Delegate)(object)RunExportSceneToV3, (Delegate)new Action(iSDKBuilder.ExportSceneToV3));
2442 RunExportAvatarToV3 = (Action<GameObject>)(object)Delegate.Combine((Delegate)(object)RunExportAvatarToV3, (Delegate)(object)new Action<GameObject>(iSDKBuilder.ExportAvatarToV3));
2443 _currentBuilder = iSDKBuilder;
2444 }
2445 else if (((Object)_buildersByName[name]).GetType() != ((Object)iSDKBuilder).GetType())
2446 {
2447 throw new ArgumentException(String.Concat("A different SDK builder type with the same name '", name, "' has already been Registered."));
2448 }
2449 }
2450 }
2451
2452 internal static void RegisterBuildStartedCallback(EventHandler eventHandler)
2453 {
2454 if (_currentBuilder != null)
2455 {
2456 _currentBuilder.OnBuildStarted += eventHandler;
2457 }
2458 }
2459
2460 internal static void RegisterBuildProgressCallback(EventHandler<string> eventHandler)
2461 {
2462 if (_currentBuilder != null)
2463 {
2464 _currentBuilder.OnBuildProgress += eventHandler;
2465 }
2466 }
2467
2468 internal static void RegisterBuildContentProcessedCallback(EventHandler<object> eventHandler)
2469 {
2470 if (_currentBuilder != null)
2471 {
2472 _currentBuilder.OnBuildContentProcessed += eventHandler;
2473 }
2474 }
2475
2476 internal static void RegisterBuildSuccessCallback(EventHandler<string> eventHandler)
2477 {
2478 if (_currentBuilder != null)
2479 {
2480 _currentBuilder.OnBuildSuccess += eventHandler;
2481 }
2482 }
2483
2484 internal static void RegisterBuildSuccessCallback(EventHandler<ValueTuple<string, string>> eventHandler)
2485 {
2486 if (_currentBuilder != null)
2487 {
2488 _currentBuilder.OnBuildSuccessWithSignature += eventHandler;
2489 }
2490 }
2491
2492 internal static void RegisterBuildErrorCallback(EventHandler<string> eventHandler)
2493 {
2494 if (_currentBuilder != null)
2495 {
2496 _currentBuilder.OnBuildError += eventHandler;
2497 }
2498 }
2499
2500 internal static void ClearCallbacks()
2501 {
2502 _currentBuilder?.ClearEventHandlers();
2503 }
2504
2505 [PublicAPI]
2506 public static void RegisterContentPreUploadCallback(EventHandler<object> eventHandler)
2507 {
2508 if (_currentBuilder != null)
2509 {
2510 _currentBuilder.OnContentPreUpload += eventHandler;
2511 }
2512 }
2513
2514 public static void ClearUploadEventHandlers()
2515 {
2516 _currentBuilder?.ClearUploadEventHandlers();
2517 }
2518
2519 private static ISDKBuilder CreateBuilder(Type builderType)
2520 {
2521 return (ISDKBuilder)Activator.CreateInstance(builderType);
2522 }
2523
2524 private static List<Type> GetBuilderTypesFromAttribute()
2525 {
2526 Type typeFromHandle = typeof(ISDKBuilder);
2527 Type typeFromHandle2 = typeof(VRCSdkBuilderAttribute);
2528 List<Type> val = new List<Type>();
2529 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
2530 foreach (Assembly val2 in assemblies)
2531 {
2532 VRCSdkBuilderAttribute[] array;
2533 try
2534 {
2535 array = (VRCSdkBuilderAttribute[])val2.GetCustomAttributes(typeFromHandle2, false);
2536 }
2537 catch (Object)
2538 {
2539 array = new VRCSdkBuilderAttribute[0];
2540 }
2541 VRCSdkBuilderAttribute[] array2 = array;
2542 foreach (VRCSdkBuilderAttribute vRCSdkBuilderAttribute in array2)
2543 {
2544 if (vRCSdkBuilderAttribute != null && typeFromHandle.IsAssignableFrom(vRCSdkBuilderAttribute.Type))
2545 {
2546 val.Add(vRCSdkBuilderAttribute.Type);
2547 }
2548 }
2549 }
2550 return val;
2551 }
2552
2553 public static bool VerifyCredentials()
2554 {
2555 if (!ConfigManager.RemoteConfig.IsInitialized())
2556 {
2557 API.SetOnlineMode(online: true);
2558 ConfigManager.RemoteConfig.Init();
2559 }
2560 if (!APIUser.IsLoggedIn && ApiCredentials.Load())
2561 {
2562 APIUser.InitialFetchCurrentUser(delegate(ApiModelContainer<APIUser> c)
2563 {
2564 AnalyticsSDK.LoggedInUserChanged(c.Model as APIUser);
2565 }, null);
2566 }
2567 if (!APIUser.IsLoggedIn)
2568 {
2569 GUILayout.Label("Please use the \"VRChat SDK/Settings\" window to log in.", EditorStyles.boldLabel, Array.Empty<GUILayoutOption>());
2570 return false;
2571 }
2572 return true;
2573 }
2574
2575 [PublicAPI]
2576 public static void ExportSceneResourceAndRun()
2577 {
2578 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
2579 if (VerifyCredentials())
2580 {
2581 if (RunExportSceneResourceAndRun == null)
2582 {
2583 throw new Exception("Can't find Worlds SDK, make sure you have it installed!");
2584 }
2586 }
2587 }
2588
2589 [PublicAPI]
2590 public static void ExportSceneResource()
2591 {
2592 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
2593 if (VerifyCredentials())
2594 {
2595 if (RunExportSceneResource == null)
2596 {
2597 throw new Exception("Can't find Worlds SDK, make sure you have it installed!");
2598 }
2599 RunExportSceneResource.Invoke();
2600 }
2601 }
2602
2603 [Obsolete("Use Upload methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads")]
2605 {
2606 Debug.LogError((object)"Uploads via the SDK Builder are no longer supported");
2607 }
2608
2609 [Obsolete("Use Upload methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads")]
2611 {
2612 Debug.LogError((object)"Uploads via the SDK Builder are no longer supported");
2613 }
2614
2615 [PublicAPI]
2616 public static bool ExportAvatarBlueprint(GameObject externalReference = null)
2617 {
2618 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
2619 if (!VerifyCredentials())
2620 {
2621 return false;
2622 }
2623 if (RunExportAvatarBlueprint == null)
2624 {
2625 throw new Exception("Can't find Avatars SDK, make sure you have it installed!");
2626 }
2627 return RunExportAvatarBlueprint.Invoke(externalReference);
2628 }
2629
2630 [Obsolete("Use Upload methods from VRC.SDKBase.Editor.Api.VRCApi class for uploads")]
2631 public static bool ExportAndUploadAvatarBlueprint(GameObject externalReference = null)
2632 {
2633 Debug.LogError((object)"Uploads via the SDK Builder are no longer supported");
2634 return false;
2635 }
2636
2637 [PublicAPI]
2638 public static bool ExportAndTestAvatarBlueprint(GameObject externalReference = null)
2639 {
2640 //IL_0015: Unknown result type (might be due to invalid IL or missing references)
2641 if (!VerifyCredentials())
2642 {
2643 return false;
2644 }
2646 {
2647 throw new Exception("Can't find Avatars SDK, make sure you have it installed!");
2648 }
2649 return RunExportAndTestAvatarBlueprint.Invoke(externalReference);
2650 }
2651
2652 [PublicAPI]
2653 public static void RunLastExportedSceneResource()
2654 {
2655 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
2656 if (VerifyCredentials())
2657 {
2659 {
2660 throw new Exception("Can't find Worlds SDK, make sure you have it installed!");
2661 }
2663 }
2664 }
2665
2666 [PublicAPI]
2667 public static void ExportSceneToV3()
2668 {
2669 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
2670 if (VerifyCredentials())
2671 {
2672 if (RunExportSceneToV3 == null)
2673 {
2674 throw new Exception("Can't find Worlds SDK, make sure you have it installed!");
2675 }
2676 RunExportSceneToV3.Invoke();
2677 }
2678 }
2679
2680 [PublicAPI]
2681 public static void ExportAvatarToV3(GameObject externalReference = null)
2682 {
2683 //IL_0014: Unknown result type (might be due to invalid IL or missing references)
2684 if (VerifyCredentials())
2685 {
2686 if (RunExportAvatarToV3 == null)
2687 {
2688 throw new Exception("Can't find Avatars SDK, make sure you have it installed!");
2689 }
2690 RunExportAvatarToV3.Invoke(externalReference);
2691 }
2692 }
2693
2694 public static string GetLastUrl()
2695 {
2696 if (String.IsNullOrEmpty(EditorPrefs.GetString("lastVRCPath")))
2697 {
2698 return null;
2699 }
2700 string text = UnityWebRequest.EscapeURL(EditorPrefs.GetString("lastVRCPath")).Replace("+", "%20");
2701 if (String.IsNullOrEmpty(RandomRoomDigits))
2702 {
2703 RandomRoomDigits = Tools.GetRandomDigits(10);
2704 }
2705 string randomRoomDigits = RandomRoomDigits;
2706 return String.Concat(String.Concat("vrchat://create?roomId=", randomRoomDigits), "&url=file:///", text);
2707 }
2708
2709 [PublicAPI]
2710 public static void PreBuildBehaviourPackaging()
2711 {
2712 EditorSceneManager.SaveOpenScenes();
2713 }
2714
2715 public static void DoDestroyImmediate(GameObject gameObject)
2716 {
2717 Object.DestroyImmediate((Object)(object)gameObject);
2718 }
2719
2720 public static string GetLocalLowPath()
2721 {
2722 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
2723 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
2724 //IL_000c: Unknown result type (might be due to invalid IL or missing references)
2725 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
2726 //IL_0053: Unknown result type (might be due to invalid IL or missing references)
2727 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2728 {
2730 }
2731 if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
2732 {
2733 return Path.Combine(Environment.GetFolderPath((SpecialFolder)40), "Library", "Application Support");
2734 }
2735 if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
2736 {
2737 return Environment.GetFolderPath((SpecialFolder)28);
2738 }
2739 throw new SystemException("This platform is not currently supported");
2740 }
2741
2742 public static string GetKnownFolderPath(Guid knownFolderId)
2743 {
2744 //IL_0006: Unknown result type (might be due to invalid IL or missing references)
2745 System.IntPtr pszPath = IntPtr.Zero;
2746 try
2747 {
2748 int num = SHGetKnownFolderPath(knownFolderId, 0u, IntPtr.Zero, out pszPath);
2749 if (num >= 0)
2750 {
2751 return Marshal.PtrToStringAuto(pszPath);
2752 }
2753 throw Marshal.GetExceptionForHR(num);
2754 }
2755 catch (Object)
2756 {
2757 return null;
2758 }
2759 finally
2760 {
2761 if (pszPath != IntPtr.Zero)
2762 {
2763 Marshal.FreeCoTaskMem(pszPath);
2764 }
2765 }
2766 }
2767
2768 [DllImport("shell32.dll")]
2769 private static extern int SHGetKnownFolderPath([MarshalAs(43)] Guid rfid, uint dwFlags, System.IntPtr hToken, out System.IntPtr pszPath);
2770 }
2771 public interface IAssetExporter
2772 {
2773 [PublicAPI]
2774 string Name { get; }
2775
2777 }
2778 public interface ISDKBuilder
2779 {
2780 [PublicAPI]
2781 string Name { get; }
2782
2783 [PublicAPI]
2784 event EventHandler OnBuildStarted;
2785
2786 [PublicAPI]
2787 event EventHandler<string> OnBuildProgress;
2788
2789 [PublicAPI]
2790 event EventHandler<object> OnBuildContentProcessed;
2791
2792 [PublicAPI]
2793 event EventHandler<string> OnBuildSuccess;
2794
2795 [PublicAPI]
2796 event EventHandler<ValueTuple<string, string>> OnBuildSuccessWithSignature;
2797
2798 [PublicAPI]
2799 event EventHandler<string> OnBuildError;
2800
2801 [PublicAPI]
2802 event EventHandler<object> OnContentPreUpload;
2803
2804 [PublicAPI]
2805 bool ExportAvatarBlueprint(GameObject externalReference = null);
2806
2807 [PublicAPI]
2808 bool ExportAndUploadAvatarBlueprint(GameObject externalReference = null);
2809
2810 [PublicAPI]
2811 bool ExportAndTestAvatarBlueprint(GameObject externalReference = null);
2812
2813 [PublicAPI]
2815
2816 [PublicAPI]
2818
2819 [PublicAPI]
2821
2822 [PublicAPI]
2824
2825 [PublicAPI]
2827
2828 [PublicAPI]
2830
2831 [PublicAPI]
2833
2834 void ExportAvatarToV3(GameObject externalReference = null);
2835
2836 [PublicAPI]
2838 }
2839 public static class VRCSettings : Object
2840 {
2841 public const string editorPrefActiveWindowPanel = "activeWindowPanel";
2842
2843 public const string editorPrefDisplayAdvancedSettings = "displayAdvancedSettings";
2844
2845 public const string editorPrefDisplayHelpBoxes = "displayHelpBoxes";
2846
2847 public const string editorPrefForceNoVR = "forceNoVR";
2848
2849 public const string editorPrefNumClients = "numClients";
2850
2851 public const string editorPrefWatchWorlds = "watchWorlds";
2852
2853 public const string editorPrefVrcConstraintsInEditMode = "vrcConstraintsInEditMode";
2854
2855 public const string editorPrefAndroidPackageName = "androidPackageName";
2856
2857 public const string editorPrefQuestPackageName = "questPackageName";
2858
2859 public static int ActiveWindowPanel
2860 {
2861 get
2862 {
2863 return EditorPrefs.GetInt("activeWindowPanel", 0);
2864 }
2865 set
2866 {
2867 EditorPrefs.SetInt("activeWindowPanel", value);
2868 }
2869 }
2870
2871 public static bool DisplayAdvancedSettings
2872 {
2873 get
2874 {
2875 return EditorPrefs.GetBool("displayAdvancedSettings", false);
2876 }
2877 set
2878 {
2879 EditorPrefs.SetBool("displayAdvancedSettings", value);
2880 }
2881 }
2882
2883 public static bool DisplayHelpBoxes
2884 {
2885 get
2886 {
2887 return EditorPrefs.GetBool("displayHelpBoxes", true);
2888 }
2889 set
2890 {
2891 EditorPrefs.SetBool("displayHelpBoxes", value);
2892 }
2893 }
2894
2895 public static bool ForceNoVR
2896 {
2897 get
2898 {
2899 return EditorPrefs.GetBool("forceNoVR", true);
2900 }
2901 set
2902 {
2903 EditorPrefs.SetBool("forceNoVR", value);
2904 }
2905 }
2906
2907 public static int NumClients
2908 {
2909 get
2910 {
2911 return EditorPrefs.GetInt("numClients", 1);
2912 }
2913 set
2914 {
2915 EditorPrefs.SetInt("numClients", value);
2916 }
2917 }
2918
2919 public static bool WatchWorlds
2920 {
2921 get
2922 {
2923 return EditorPrefs.GetBool("watchWorlds", true);
2924 }
2925 set
2926 {
2927 EditorPrefs.SetBool("watchWorlds", value);
2928 }
2929 }
2930
2931 public static bool VrcConstraintsInEditMode
2932 {
2933 get
2934 {
2935 return EditorPrefs.GetBool("vrcConstraintsInEditMode", true);
2936 }
2937 set
2938 {
2939 EditorPrefs.SetBool("vrcConstraintsInEditMode", value);
2940 }
2941 }
2942
2943 public static string AndroidPackageName
2944 {
2945 get
2946 {
2947 return EditorPrefs.GetString("androidPackageName", "com.vrchat.mobile.playstore");
2948 }
2949 set
2950 {
2951 EditorPrefs.SetString("androidPackageName", value);
2952 }
2953 }
2954
2955 public static string QuestPackageName
2956 {
2957 get
2958 {
2959 return EditorPrefs.GetString("questPackageName", "com.vrchat.oculus.quest");
2960 }
2961 set
2962 {
2963 EditorPrefs.SetString("questPackageName", value);
2964 }
2965 }
2966 }
2967}
2969{
2970 public static class ValidationEditorHelpers : Object
2971 {
2972 private static ValueTuple<DateTime, int> _lastBuildReportFileSize;
2973
2974 public static bool IsMobilePlatform()
2975 {
2976 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
2977 //IL_0006: Invalid comparison between Unknown and I4
2978 return (int)EditorUserBuildSettings.selectedBuildTargetGroup != 1;
2979 }
2980
2981 public static bool CheckIfAssetBundleFileTooLarge(ContentType contentType, string vrcFilePath, out int fileSize, bool mobilePlatform)
2982 {
2983 //IL_0058: Expected O, but got Unknown
2984 //IL_0029: Unknown result type (might be due to invalid IL or missing references)
2985 //IL_002f: Expected O, but got Unknown
2986 fileSize = 0;
2987 try
2988 {
2989 int assetBundleSizeLimit = ValidationHelpers.GetAssetBundleSizeLimit(contentType, mobilePlatform);
2990 if (assetBundleSizeLimit < 0)
2991 {
2992 return false;
2993 }
2994 if (String.IsNullOrEmpty(vrcFilePath) || !File.Exists(vrcFilePath))
2995 {
2996 return false;
2997 }
2998 FileInfo val = new FileInfo(vrcFilePath);
2999 fileSize = (int)val.Length;
3000 if (fileSize > assetBundleSizeLimit)
3001 {
3002 return true;
3003 }
3004 }
3005 catch (Exception val2)
3006 {
3007 Debug.LogError((object)String.Concat("Couldn't open file: ", vrcFilePath));
3008 Debug.LogException(val2);
3009 }
3010 return false;
3011 }
3012
3013 public static bool CheckIfUncompressedAssetBundleFileTooLarge(ContentType contentType, out int fileSize, bool mobilePlatform)
3014 {
3015 //IL_00d1: Expected O, but got Unknown
3016 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
3017 //IL_0036: Unknown result type (might be due to invalid IL or missing references)
3018 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
3019 //IL_003d: Unknown result type (might be due to invalid IL or missing references)
3020 //IL_0098: Unknown result type (might be due to invalid IL or missing references)
3021 //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
3022 //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
3023 //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
3024 fileSize = 0;
3025 try
3026 {
3027 int assetBundleSizeLimit = ValidationHelpers.GetAssetBundleSizeLimit(contentType, mobilePlatform, compressed: false);
3028 if (assetBundleSizeLimit < 0)
3029 {
3030 return false;
3031 }
3032 string text = "Assets/Build AssetBundles.buildreport";
3033 if (File.Exists("Library/LastBuild.buildreport"))
3034 {
3035 DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc("Library/LastBuild.buildreport");
3036 if (lastWriteTimeUtc == _lastBuildReportFileSize.Item1)
3037 {
3038 fileSize = _lastBuildReportFileSize.Item2;
3039 }
3040 else
3041 {
3042 File.Copy("Library/LastBuild.buildreport", text, true);
3043 AssetDatabase.ImportAsset(text);
3044 BuildReport val = AssetDatabase.LoadAssetAtPath<BuildReport>(text);
3045 fileSize = (int)Enumerable.Sum<PackedAssets>((IEnumerable<PackedAssets>)(object)val.packedAssets, (Func<PackedAssets, Decimal>)((PackedAssets f) => Enumerable.Sum<PackedAssetInfo>((IEnumerable<PackedAssetInfo>)(object)f.contents, (Func<PackedAssetInfo, Decimal>)((PackedAssetInfo a) => Decimal.op_Implicit(((PackedAssetInfo)(ref a)).packedSize))) + Decimal.op_Implicit(f.overhead)));
3046 AssetDatabase.DeleteAsset(text);
3047 _lastBuildReportFileSize = new ValueTuple<DateTime, int>(lastWriteTimeUtc, fileSize);
3048 }
3049 }
3050 if (fileSize > assetBundleSizeLimit)
3051 {
3052 return true;
3053 }
3054 }
3055 catch (Exception val2)
3056 {
3057 Debug.LogError((object)"Couldn't get info from last build report");
3058 Debug.LogException(val2);
3059 }
3060 return false;
3061 }
3062 }
3063}
3065{
3066 public static class V3SdkUI : Object
3067 {
3068 public static bool V3Enabled()
3069 {
3070 return false;
3071 }
3072
3073 [PublicAPI]
3074 public static void SetupV3UI(Func<bool> validationFunc, Action onPublishAction, VisualElement _v3Block)
3075 {
3076 GUI.enabled = true;
3077 }
3078 }
3079}
3081{
3082 [CustomPropertyDrawer(/*Could not decode attribute arguments.*/)]
3083 public class CurveDrawer : PropertyDrawer
3084 {
3085 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
3086 {
3087 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
3088 //IL_0014: Invalid comparison between Unknown and I4
3089 //IL_0019: Unknown result type (might be due to invalid IL or missing references)
3090 //IL_001a: Unknown result type (might be due to invalid IL or missing references)
3091 //IL_002e: Unknown result type (might be due to invalid IL or missing references)
3092 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
3093 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
3094 //IL_0057: Unknown result type (might be due to invalid IL or missing references)
3095 //IL_0058: Unknown result type (might be due to invalid IL or missing references)
3096 //IL_0080: Unknown result type (might be due to invalid IL or missing references)
3097 //IL_008d: Unknown result type (might be due to invalid IL or missing references)
3098 //IL_0093: Expected O, but got Unknown
3099 CurveAttribute curveAttribute = ((PropertyDrawer)this).attribute as CurveAttribute;
3100 if ((int)property.propertyType == 14)
3101 {
3102 Rect val = position;
3103 ((Rect)(ref val)).width = ((Rect)(ref val)).width - 32f;
3104 EditorGUI.CurveField(val, property, Color.cyan, new Rect(curveAttribute.PosX, curveAttribute.PosY, curveAttribute.RangeX, curveAttribute.RangeY));
3105 val = position;
3106 ((Rect)(ref val)).x = ((Rect)(ref val)).x + (((Rect)(ref val)).width - 32f);
3107 ((Rect)(ref val)).width = 32f;
3108 if (GUI.Button(val, "X"))
3109 {
3110 AnimationCurve animationCurveValue = new AnimationCurve();
3111 property.animationCurveValue = animationCurveValue;
3112 }
3113 }
3114 }
3115 }
3116 [CustomPropertyDrawer(/*Could not decode attribute arguments.*/)]
3117 public class HelpBoxDrawer : DecoratorDrawer
3118 {
3119 public override float GetHeight()
3120 {
3121 //IL_004c: Unknown result type (might be due to invalid IL or missing references)
3122 //IL_005b: Expected O, but got Unknown
3123 if (!(((DecoratorDrawer)this).attribute is HelpBoxAttribute helpBoxAttribute))
3124 {
3125 return ((DecoratorDrawer)this).GetHeight();
3126 }
3127 GUIStyle val = (((Object)(object)GUI.skin != (Object)null) ? GUI.skin.GetStyle("helpbox") : null);
3128 if (val == null)
3129 {
3130 return ((DecoratorDrawer)this).GetHeight();
3131 }
3132 return Mathf.Max(40f, val.CalcHeight(new GUIContent(helpBoxAttribute.text), EditorGUIUtility.currentViewWidth) + 4f);
3133 }
3134
3135 public override void OnGUI(Rect position)
3136 {
3137 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
3138 //IL_001e: Unknown result type (might be due to invalid IL or missing references)
3139 if (((DecoratorDrawer)this).attribute is HelpBoxAttribute helpBoxAttribute)
3140 {
3141 EditorGUI.HelpBox(position, helpBoxAttribute.text, GetMessageType(helpBoxAttribute.messageType));
3142 }
3143 }
3144
3145 private MessageType GetMessageType(HelpBoxAttribute.MessageType helpBoxMessageType)
3146 {
3147 return (MessageType)(helpBoxMessageType switch
3148 {
3149 HelpBoxAttribute.MessageType.Info => 1,
3150 HelpBoxAttribute.MessageType.Warning => 2,
3151 HelpBoxAttribute.MessageType.Error => 3,
3152 _ => 0,
3153 });
3154 }
3155 }
3156}
3158{
3159 [CustomPropertyDrawer(/*Could not decode attribute arguments.*/)]
3160 public class VRCUrlEditor : PropertyDrawer
3161 {
3162 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
3163 {
3164 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
3165 //IL_0009: Unknown result type (might be due to invalid IL or missing references)
3166 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
3167 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
3168 //IL_003f: Unknown result type (might be due to invalid IL or missing references)
3169 EditorGUI.BeginProperty(position, label, property);
3170 position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID((FocusType)2), label);
3171 int indentLevel = EditorGUI.indentLevel;
3172 EditorGUI.indentLevel = 0;
3173 EditorGUI.PropertyField(new Rect(((Rect)(ref position)).x, ((Rect)(ref position)).y, ((Rect)(ref position)).width, ((Rect)(ref position)).height), property.FindPropertyRelative("url"), GUIContent.none);
3174 EditorGUI.indentLevel = indentLevel;
3175 EditorGUI.EndProperty();
3176 }
3177 }
3178}
3180{
3181 public class ReloadUtil : Object
3182 {
3183 private const string worldsPackageRuntimePluginsFolder = "Packages/com.vrchat.worlds/Runtime/VRCSDK/Plugins";
3184
3185 private const string avatarsPackageRuntimePluginsFolder = "Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins";
3186
3187 private const string legacyRuntimePluginsFolder = "Assets/VRCSDK/Plugins/";
3188
3189 private static MethodInfo _clearConsoleMethod;
3190
3191 private static MethodInfo clearConsoleMethod
3192 {
3193 get
3194 {
3195 if (_clearConsoleMethod == (MethodInfo)null)
3196 {
3197 _clearConsoleMethod = Assembly.GetAssembly(typeof(SceneView)).GetType("UnityEditor.LogEntries").GetMethod("Clear");
3198 }
3199 return _clearConsoleMethod;
3200 }
3201 }
3202
3203 [MenuItem("VRChat SDK/Reload SDK")]
3204 public static void ReloadSDK()
3205 {
3206 ReloadSDK(clearConsole: true);
3207 }
3208
3209 public static void ReloadSDK(bool clearConsole)
3210 {
3211 if (Directory.Exists("Packages/com.vrchat.worlds/Runtime/VRCSDK/Plugins"))
3212 {
3213 AssetDatabase.ImportAsset("Packages/com.vrchat.worlds/Runtime/VRCSDK/Plugins/VRCSDK3.dll", (ImportAssetOptions)8);
3214 AssetDatabase.ImportAsset("Packages/com.vrchat.worlds/Runtime/VRCSDK/Plugins/VRCSDK3-Editor.dll", (ImportAssetOptions)8);
3215 }
3216 if (Directory.Exists("Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins"))
3217 {
3218 AssetDatabase.ImportAsset("Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins/VRCSDK3A.dll", (ImportAssetOptions)8);
3219 AssetDatabase.ImportAsset("Packages/com.vrchat.avatars/Runtime/VRCSDK/Plugins/VRCSDK3A-Editor.dll", (ImportAssetOptions)8);
3220 }
3221 if (Directory.Exists("Assets/VRCSDK/Plugins/"))
3222 {
3223 AssetDatabase.ImportAsset("Assets/VRCSDK/Plugins//VRCSDK3.dll", (ImportAssetOptions)8);
3224 AssetDatabase.ImportAsset("Assets/VRCSDK/Plugins//VRCSDK3-Editor.dll", (ImportAssetOptions)8);
3225 AssetDatabase.ImportAsset("Assets/VRCSDK/Plugins//VRCSDK3A.dll", (ImportAssetOptions)8);
3226 AssetDatabase.ImportAsset("Assets/VRCSDK/Plugins//VRCSDK3A-Editor.dll", (ImportAssetOptions)8);
3227 }
3228 if (clearConsole)
3229 {
3231 }
3232 }
3233
3234 public static void ReloadCurrentScene()
3235 {
3236 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
3237 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
3238 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
3239 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
3240 if (EditorUtility.DisplayDialog("Would you like to reload the current scene?", "After Reloading the SDK, it can help to reload the open scene to restore missing components", "Yes, Reload the Scene", "No, Don't Reload."))
3241 {
3242 Scene activeScene = SceneManager.GetActiveScene();
3243 string path = ((Scene)(ref activeScene)).path;
3244 if (!String.IsNullOrWhiteSpace(path) && EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
3245 {
3246 EditorSceneManager.CloseScene(SceneManager.GetActiveScene(), true);
3247 EditorSceneManager.OpenScene(path);
3248 }
3249 }
3250 }
3251
3252 public static void ClearLogConsole()
3253 {
3254 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
3255 //IL_0010: Expected O, but got Unknown
3256 ((MethodBase)clearConsoleMethod).Invoke((object)new Object(), (object[])null);
3257 }
3258 }
3259}
3261{
3262 public enum VRCSDKRequestedBuildType : Enum
3263 {
3264 Avatar,
3265 Scene
3266 }
3267 public interface IVRCSDKBuildRequestedCallback : IVRCSDKOrderedCallback, IOrderedCallback
3268 {
3270 }
3272 {
3274 }
3275 internal interface IVRCSDKPostprocessSceneCallback : IVRCSDKOrderedCallback, IOrderedCallback
3276 {
3277 void OnPostprocessScene(Scene scene);
3278 }
3279 public interface IVRCSDKPreprocessAvatarCallback : IVRCSDKOrderedCallback, IOrderedCallback
3280 {
3281 bool OnPreprocessAvatar(GameObject avatarGameObject);
3282 }
3283 internal interface IVRCSDKPreprocessSceneCallback : IVRCSDKOrderedCallback, IOrderedCallback
3284 {
3285 bool OnPreprocessScene(Scene scene);
3286 }
3287 public static class VRCBuildPipelineCallbacks : Object
3288 {
3289 private static readonly Type _buildRequestedCallbackInterfaceType = typeof(IVRCSDKBuildRequestedCallback);
3290
3291 private static readonly List<IVRCSDKBuildRequestedCallback> _buildRequestedCallbacks = new List<IVRCSDKBuildRequestedCallback>();
3292
3293 private static readonly Type _preprocessAvatarCallbackInterfaceType = typeof(IVRCSDKPreprocessAvatarCallback);
3294
3295 private static readonly List<IVRCSDKPreprocessAvatarCallback> _preprocessAvatarCallbacks = new List<IVRCSDKPreprocessAvatarCallback>();
3296
3297 private static readonly Type _postprocessAvatarCallbackInterfaceType = typeof(IVRCSDKPostprocessAvatarCallback);
3298
3299 private static readonly List<IVRCSDKPostprocessAvatarCallback> _postprocessAvatarCallbacks = new List<IVRCSDKPostprocessAvatarCallback>();
3300
3301 private static readonly Type _preprocessSceneCallbackInterfaceType = typeof(IVRCSDKPreprocessSceneCallback);
3302
3303 private static readonly List<IVRCSDKPreprocessSceneCallback> _preprocessSceneCallbacks = new List<IVRCSDKPreprocessSceneCallback>();
3304
3305 private static readonly Type _postprocessSceneCallbackInterfaceType = typeof(IVRCSDKPostprocessSceneCallback);
3306
3307 private static readonly List<IVRCSDKPostprocessSceneCallback> _postprocessSceneCallbacks = new List<IVRCSDKPostprocessSceneCallback>();
3308
3309 [InitializeOnLoadMethod]
3310 private static void Initialize()
3311 {
3312 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
3313 foreach (Assembly val in assemblies)
3314 {
3315 try
3316 {
3317 Type[] types = val.GetTypes();
3318 foreach (Type val2 in types)
3319 {
3320 if (!val2.IsAbstract && !val2.IsInterface)
3321 {
3322 if (_buildRequestedCallbackInterfaceType.IsAssignableFrom(val2))
3323 {
3324 _buildRequestedCallbacks.Add((IVRCSDKBuildRequestedCallback)Activator.CreateInstance(val2));
3325 }
3326 if (_preprocessAvatarCallbackInterfaceType.IsAssignableFrom(val2))
3327 {
3328 _preprocessAvatarCallbacks.Add((IVRCSDKPreprocessAvatarCallback)Activator.CreateInstance(val2));
3329 }
3330 if (_postprocessAvatarCallbackInterfaceType.IsAssignableFrom(val2))
3331 {
3332 _postprocessAvatarCallbacks.Add((IVRCSDKPostprocessAvatarCallback)Activator.CreateInstance(val2));
3333 }
3334 if (_preprocessSceneCallbackInterfaceType.IsAssignableFrom(val2))
3335 {
3336 _preprocessSceneCallbacks.Add((IVRCSDKPreprocessSceneCallback)Activator.CreateInstance(val2));
3337 }
3338 if (_postprocessSceneCallbackInterfaceType.IsAssignableFrom(val2))
3339 {
3340 _postprocessSceneCallbacks.Add((IVRCSDKPostprocessSceneCallback)Activator.CreateInstance(val2));
3341 }
3342 }
3343 }
3344 }
3345 catch (ReflectionTypeLoadException)
3346 {
3347 Debug.LogWarning((object)String.Concat("VRCBuildPipelineCallbacks failed to load a type in assembly '", val.FullName, "'. If this is Assembly-CSharp it's just Unity being in the middle of loading."));
3348 SessionState.SetInt("ReloadPlugins", 3);
3349 }
3350 }
3351 }
3352
3353 [PublicAPI]
3354 public static bool OnVRCSDKBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
3355 {
3356 //IL_00a4: Expected O, but got Unknown
3357 IEnumerator<IVRCSDKBuildRequestedCallback> enumerator = ((IEnumerable<IVRCSDKBuildRequestedCallback>)(object)Enumerable.OrderBy<IVRCSDKBuildRequestedCallback, int>((IEnumerable<IVRCSDKBuildRequestedCallback>)(object)_buildRequestedCallbacks, (Func<IVRCSDKBuildRequestedCallback, int>)((IVRCSDKBuildRequestedCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3358 try
3359 {
3360 while (((IEnumerator)enumerator).MoveNext())
3361 {
3362 IVRCSDKBuildRequestedCallback current = enumerator.Current;
3363 try
3364 {
3365 if (current.OnBuildRequested(requestedBuildType))
3366 {
3367 continue;
3368 }
3369 string text = String.Concat("The the VRCSDK build was aborted at the request of the '", ((MemberInfo)((Object)current).GetType()).Name, "' VRCSDKBuildRequestedCallback");
3370 Debug.LogError((object)text);
3371 EditorUtility.DisplayDialog("Build Aborted", text, "Ok");
3372 return false;
3373 }
3374 catch (Exception val)
3375 {
3376 string text2 = String.Concat("The VRCSDK build was aborted due to an exception in the '", ((MemberInfo)((Object)current).GetType()).Name, "' VRCSDKBuildRequestedCallback.\nCheck the log for details.");
3377 Debug.LogError((object)text2);
3378 Debug.LogException(val);
3379 EditorUtility.DisplayDialog("Exception in OnBuildRequested Callback", text2, "Ok");
3380 }
3381 }
3382 }
3383 finally
3384 {
3385 if (enumerator != null)
3386 {
3387 ((IDisposable)enumerator).Dispose();
3388 }
3389 }
3390 return true;
3391 }
3392
3393 [PublicAPI]
3394 public static bool OnPreprocessAvatar(GameObject avatarGameObject)
3395 {
3396 //IL_00a4: Expected O, but got Unknown
3397 IEnumerator<IVRCSDKPreprocessAvatarCallback> enumerator = ((IEnumerable<IVRCSDKPreprocessAvatarCallback>)(object)Enumerable.OrderBy<IVRCSDKPreprocessAvatarCallback, int>((IEnumerable<IVRCSDKPreprocessAvatarCallback>)(object)_preprocessAvatarCallbacks, (Func<IVRCSDKPreprocessAvatarCallback, int>)((IVRCSDKPreprocessAvatarCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3398 try
3399 {
3400 while (((IEnumerator)enumerator).MoveNext())
3401 {
3402 IVRCSDKPreprocessAvatarCallback current = enumerator.Current;
3403 try
3404 {
3405 if (current.OnPreprocessAvatar(avatarGameObject))
3406 {
3407 continue;
3408 }
3409 string text = String.Concat("The VRCSDK build was aborted because the VRCSDKPreprocessAvatarCallback '", ((MemberInfo)((Object)current).GetType()).Name, "' reported a failure.");
3410 Debug.LogError((object)text);
3411 EditorUtility.DisplayDialog("Preprocess Callback Failed", text, "Ok");
3412 return false;
3413 }
3414 catch (Exception val)
3415 {
3416 string text2 = String.Concat("The VRCSDK build was aborted because the VRCSDKPreprocessAvatarCallback '", ((MemberInfo)((Object)current).GetType()).Name, "' threw an exception.\nCheck the log for details.");
3417 Debug.LogError((object)text2);
3418 Debug.LogException(val);
3419 EditorUtility.DisplayDialog("Exception in VRCSDKPreprocessAvatarCallback Callback", text2, "Ok");
3420 return false;
3421 }
3422 }
3423 }
3424 finally
3425 {
3426 if (enumerator != null)
3427 {
3428 ((IDisposable)enumerator).Dispose();
3429 }
3430 }
3431 return true;
3432 }
3433
3434 [PublicAPI]
3435 public static void OnPostprocessAvatar()
3436 {
3437 //IL_0066: Expected O, but got Unknown
3438 IEnumerator<IVRCSDKPostprocessAvatarCallback> enumerator = ((IEnumerable<IVRCSDKPostprocessAvatarCallback>)(object)Enumerable.OrderBy<IVRCSDKPostprocessAvatarCallback, int>((IEnumerable<IVRCSDKPostprocessAvatarCallback>)(object)_postprocessAvatarCallbacks, (Func<IVRCSDKPostprocessAvatarCallback, int>)((IVRCSDKPostprocessAvatarCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3439 try
3440 {
3441 while (((IEnumerator)enumerator).MoveNext())
3442 {
3443 IVRCSDKPostprocessAvatarCallback current = enumerator.Current;
3444 try
3445 {
3446 current.OnPostprocessAvatar();
3447 }
3448 catch (Exception val)
3449 {
3450 string text = String.Concat("VRCSDKPostprocessAvatarCallback Callback '", ((MemberInfo)((Object)current).GetType()).Name, "' threw an exception.\nCheck the log for details.");
3451 Debug.LogError((object)text);
3452 Debug.LogException(val);
3453 EditorUtility.DisplayDialog("Exception in VRCSDKPostprocessAvatarCallback Callback", text, "Ok");
3454 }
3455 }
3456 }
3457 finally
3458 {
3459 if (enumerator != null)
3460 {
3461 ((IDisposable)enumerator).Dispose();
3462 }
3463 }
3464 }
3465
3466 [PublicAPI]
3467 public static bool OnPreprocessScene(Scene scene)
3468 {
3469 //IL_00a4: Expected O, but got Unknown
3470 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
3471 IEnumerator<IVRCSDKPreprocessSceneCallback> enumerator = ((IEnumerable<IVRCSDKPreprocessSceneCallback>)(object)Enumerable.OrderBy<IVRCSDKPreprocessSceneCallback, int>((IEnumerable<IVRCSDKPreprocessSceneCallback>)(object)_preprocessSceneCallbacks, (Func<IVRCSDKPreprocessSceneCallback, int>)((IVRCSDKPreprocessSceneCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3472 try
3473 {
3474 while (((IEnumerator)enumerator).MoveNext())
3475 {
3476 IVRCSDKPreprocessSceneCallback current = enumerator.Current;
3477 try
3478 {
3479 if (current.OnPreprocessScene(scene))
3480 {
3481 continue;
3482 }
3483 string text = String.Concat("The VRCSDK build was aborted because the IVRCSDKPreprocessSceneCallback '", ((MemberInfo)((Object)current).GetType()).Name, "' reported a failure.");
3484 Debug.LogError((object)text);
3485 EditorUtility.DisplayDialog("Preprocess Callback Failed", text, "Ok");
3486 return false;
3487 }
3488 catch (Exception val)
3489 {
3490 string text2 = String.Concat("The VRCSDK build was aborted because the IVRCSDKPreprocessSceneCallback '", ((MemberInfo)((Object)current).GetType()).Name, "' threw an exception.\nCheck the log for details.");
3491 Debug.LogError((object)text2);
3492 Debug.LogException(val);
3493 EditorUtility.DisplayDialog("Exception in IVRCSDKPreprocessSceneCallback Callback", text2, "Ok");
3494 }
3495 }
3496 }
3497 finally
3498 {
3499 if (enumerator != null)
3500 {
3501 ((IDisposable)enumerator).Dispose();
3502 }
3503 }
3504 return true;
3505 }
3506
3507 [PublicAPI]
3508 public static void OnPostprocessScene(Scene scene)
3509 {
3510 //IL_0067: Expected O, but got Unknown
3511 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
3512 IEnumerator<IVRCSDKPostprocessSceneCallback> enumerator = ((IEnumerable<IVRCSDKPostprocessSceneCallback>)(object)Enumerable.OrderBy<IVRCSDKPostprocessSceneCallback, int>((IEnumerable<IVRCSDKPostprocessSceneCallback>)(object)_postprocessSceneCallbacks, (Func<IVRCSDKPostprocessSceneCallback, int>)((IVRCSDKPostprocessSceneCallback callback) => ((IOrderedCallback)callback).callbackOrder))).GetEnumerator();
3513 try
3514 {
3515 while (((IEnumerator)enumerator).MoveNext())
3516 {
3517 IVRCSDKPostprocessSceneCallback current = enumerator.Current;
3518 try
3519 {
3520 current.OnPostprocessScene(scene);
3521 }
3522 catch (Exception val)
3523 {
3524 string text = String.Concat("IVRCSDKPostprocessSceneCallback Callback '", ((MemberInfo)((Object)current).GetType()).Name, "' threw an exception.\nCheck the log for details.");
3525 Debug.LogError((object)text);
3526 Debug.LogException(val);
3527 EditorUtility.DisplayDialog("Exception in IVRCSDKPostprocessSceneCallback Callback", text, "Ok");
3528 }
3529 }
3530 }
3531 finally
3532 {
3533 if (enumerator != null)
3534 {
3535 ((IDisposable)enumerator).Dispose();
3536 }
3537 }
3538 }
3539 }
3540}
3542{
3543 [AttributeUsage(/*Could not decode attribute arguments.*/)]
3544 [MeansImplicitUse]
3545 public class VRCAssetExporterAttribute : Attribute
3546 {
3547 [field: CompilerGenerated]
3548 public Type Type
3549 {
3550 [CompilerGenerated]
3551 get;
3552 }
3553
3555 {
3556 Type = type;
3557 }
3558 }
3559 [AttributeUsage(/*Could not decode attribute arguments.*/)]
3560 [MeansImplicitUse]
3561 public class VRCSdkBuilderAttribute : Attribute
3562 {
3563 [field: CompilerGenerated]
3564 public Type Type
3565 {
3566 [CompilerGenerated]
3567 get;
3568 }
3569
3571 {
3572 Type = type;
3573 }
3574 }
3575}
bool OnPreprocessAvatar(GameObject avatarGameObject)
bool OnPreprocessScene(Scene scene)
static void DrawWirePlane(Vector3 center, Quaternion rotation, float size)
static void DrawWireCylinder(Vector3 center, float radius, float height, Quaternion rotation=default(Quaternion))
static void DrawWireCube(Vector3 center, Vector3 size, Quaternion rotation=default(Quaternion))
static void DrawWireAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle, int segments=12)
static void DrawWireCylinder(Vector3 center, float height, float radius1, float radius2, Quaternion rotation=default(Quaternion))
static void DrawWireCone(Vector3 tip, Quaternion rotation, float height, float radius)
static void SetColor(Color color, float alpha)
static void DrawWireSquare(Vector3 center, Quaternion rotation, Vector2 size)
static void DrawWireCapsule(Vector3 center, float radius, float height, Quaternion rotation=default(Quaternion))
static void DrawWireSphere(Vector3 center, float radius, Quaternion rotation=default(Quaternion))
static void DrawWireArc(Vector3 center, float radius, float angle, int segments, Quaternion rotation, Vector3 centerOfRotation)
static void DrawWireArc(Matrix4x4 matrix, float radius, float angle, int segments)
static void DrawWireCapsule(Vector3 point1, Vector3 point2, float radius1, float radius2)
static void DrawWireCircle(Vector3 center, float radius, int segments=20, Quaternion rotation=default(Quaternion))
static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius1, float radius2)
static void DrawArrow(Vector3 from, Vector3 to, float arrowHeadLength=0.25f, float arrowHeadAngle=20f)
static void DrawWireArc(Vector3 center, float radius, float angle, int segments=20, Quaternion rotation=default(Quaternion))
static void DrawWireCapsuleEndcap(Vector3 center, Quaternion rotation, float half, float radius, bool isUp)
static int AddCylinderSidePoints(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius1, float radius2)
static int AddCylinderCapPoints(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
static void DrawWireCylinder(Vector3 center, float height, float radius1, float radius2, Quaternion rotation=default(Quaternion), int segments=8)
static List< Quaternion > SphereGizmoRotations
const int RADIUS_GIZMO_SIDES_OFFSET
const int RADIUS_GIZMO_CAP_OFFSET
static void DrawWireCapsule(Vector3 center, Quaternion rotation, float height, float radius)
static int DrawCapsuleBatched(ref List< Vector3 > buffer, int offset, Color color, Matrix4x4 matrix)
static int AddLineToBatch(ref List< Vector3 > buffer, Vector3 start, Vector3 end)
static void DrawWireSphere(Vector3 center, Quaternion rotation, float radius)
static void DrawWireSphere(Vector3 center, float radius)
static int AddCapsuleCapPoints(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
const int RADIUS_GIZMO_CAPS_SIZE
static void DrawWirePlane(Vector3 center, Vector3 normal, float size)
static void DrawWireSquare(Vector3 center, Quaternion rotation, float size)
static void DrawWireSquare(Vector3 center, Vector3 normal, float size)
const int RADIUS_GIZMO_SPHERE_SIZE
static void DrawSolidAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle)
static void ApplyWireMaterial()
const int RADIUS_GIZMO_CAPSULE_CAPS_SIZE
static void DrawWireAngleCone(Vector3 tip, Quaternion rotation, float radius, float angle, int segments=12)
static void DrawWireCapsuleEndcap(Vector3 center, Quaternion rotation, float half, float radius, bool isUp)
static int DrawSphereBatched(ref List< Vector3 > buffer, int offset, Color color, Matrix4x4 matrix)
static int AddCapsuleToBatch(ref List< Vector3 > buffer, float beginRadius, float endRadius, float half)
static List< Quaternion > CapsuleGizmoRotations
static int AddSphereToBatch(ref List< Vector3 > buffer, float radius)
static int DrawLineBatched(ref List< Vector3 > buffer, int offset, Color color)
const int RADIUS_GIZMO_SPHERE_OFFSET
const int LINE_GIZMOS_SIZE
static void SetColor(Color color, float alpha)
static void DrawEditableArray(Editor editor, EditableArray data, ref int selected)
static void QuaternionAsEulerField(SerializedProperty property)
static GUIStyle Style_BoxNormal
static GUIStyle Style_BoxSelected
static Texture2D MakeStyleBackground(Color color)
static void InitStyles()
bool OnPreprocessAvatar(GameObject avatarGameObject)
bool OnPreprocessAvatar(GameObject avatarGameObject)
bool< AddOnAssemblyReloadCallback > b__0(SerializableFunction sf)
static List< string > GetLoadedAssemblies()
static List< SerializableFunction > OnAssemblyReloadCallbacks
static void AddOnAssemblyReloadCallback(string className, string staticFunctionName, bool autoSerialize=true)
static List< string > GetCustomLoadedAssembles()
SerializableFunction(string _className, string _methodName)
static void FindPrefabsThatCanBeToggledActiveInScene(ref List< GameObject > prefabs, GameObject rootObj=null)
static void FindDynamicContent(ref List< GameObject > prefabs, ref List< Material > materials)
static string GetActiveSceneUnityPackageExportPath()
static void FindMaterialsOnObjects(IEnumerable< GameObject > objs, ref List< GameObject > prefabs, ref List< Material > materials)
static void FindDynamicContentInProject(ref List< GameObject > prefabs, ref List< Material > materials, string rootPath)
static void ExportCurrentAssetAsUnityPackage(List< string > assetPaths, string dstPath)
static void ExportCurrentSceneAsUnityPackageIfNotExist()
static void AddAlwaysIncludedShaders(IEnumerable< Shader > shaders)
static void FindMaterialsAndPrefabsInScene(ref List< GameObject > prefabs, ref List< Material > materials)
static bool FindPrefabReferencesOnPrefabs(ref List< GameObject > prefabs)
static bool OnVRCSDKBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
static bool OnPreprocessAvatar(GameObject avatarGameObject)
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
MessageType GetMessageType(HelpBoxAttribute.MessageType helpBoxMessageType)
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
static void SetupV3UI(Func< bool > validationFunc, Action onPublishAction, VisualElement _v3Block)
static void DoDestroyImmediate(GameObject gameObject)
static Func< GameObject, bool > RunExportAvatarBlueprint
static bool ExportAndTestAvatarBlueprint(GameObject externalReference=null)
static string GetKnownFolderPath(Guid knownFolderId)
static bool ExportAvatarBlueprint(GameObject externalReference=null)
static void RegisterBuildProgressCallback(EventHandler< string > eventHandler)
static void RegisterBuildSuccessCallback(EventHandler< string > eventHandler)
static List< Type > GetBuilderTypesFromAttribute()
static void RegisterBuildStartedCallback(EventHandler eventHandler)
static bool ExportAndUploadAvatarBlueprint(GameObject externalReference=null)
static ISDKBuilder CreateBuilder(Type builderType)
static void RegisterBuilder([NotNull] Type builderType)
static void RegisterContentPreUploadCallback(EventHandler< object > eventHandler)
static void ExportAvatarToV3(GameObject externalReference=null)
static int SHGetKnownFolderPath([MarshalAs(43)] Guid rfid, uint dwFlags, System.IntPtr hToken, out System.IntPtr pszPath)
static Action< GameObject > RunExportAvatarToV3
static Func< bool > RunExportSceneResource
static void RegisterBuildSuccessCallback(EventHandler< ValueTuple< string, string > > eventHandler)
static void RegisterBuildErrorCallback(EventHandler< string > eventHandler)
static Func< GameObject, bool > RunExportAndUploadAvatarBlueprint
static Func< GameObject, bool > RunExportAndTestAvatarBlueprint
static void RegisterBuildContentProcessedCallback(EventHandler< object > eventHandler)
static bool CheckIfUncompressedAssetBundleFileTooLarge(ContentType contentType, out int fileSize, bool mobilePlatform)
static bool CheckIfAssetBundleFileTooLarge(ContentType contentType, string vrcFilePath, out int fileSize, bool mobilePlatform)
static ValueTuple< IEnumerable< NetworkIDPair >, IEnumerable< NetworkIDPair > > ConfigureNetworkIDs(INetworkIDContainer container, out List< SetErrorLocation > errors, params SetError[] errorsToIgnore)
static int GetAssetBundleSizeLimit(ContentType contentType, bool mobilePlatform, bool compressed=true)
Definition: VRCSDKBase.cs:607
bool OnBuildRequested(VRCSDKRequestedBuildType requestedBuildType)
EventHandler< ValueTuple< string, string > > OnBuildSuccessWithSignature
EventHandler< object > OnContentPreUpload
bool ExportAndUploadAvatarBlueprint(GameObject externalReference=null)
EventHandler< string > OnBuildProgress
EventHandler< string > OnBuildError
EventHandler< object > OnBuildContentProcessed
void ExportAvatarToV3(GameObject externalReference=null)
bool ExportAvatarBlueprint(GameObject externalReference=null)
EventHandler< string > OnBuildSuccess
bool ExportAndTestAvatarBlueprint(GameObject externalReference=null)
ContentType
Definition: VRCSDKBase.cs:582
Action< SerializedProperty, int > onNewElement
Action< SerializedProperty, int > onDrawElement
Action< SerializedProperty, int > onSelect