forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnityGeneratedCreator.cs
More file actions
92 lines (83 loc) · 3.27 KB
/
UnityGeneratedCreator.cs
File metadata and controls
92 lines (83 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using UnityEditor;
internal abstract class UnityGeneratedCreator
{
private readonly IDictionary<UIOrientation, string> unityOrientationToMs = new Dictionary<UIOrientation, string>();
protected UnityGeneratedCreator()
{
}
internal abstract string[] Create(string directory);
protected virtual string GetDefaultFullScreenCode()
{
if (EditorUserBuildSettings.wsaSDK == WSASDK.UWP)
{
if (PlayerSettings.defaultIsFullScreen)
{
return "ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;";
}
return "ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;";
}
return "";
}
protected string GetDisplaySetupCode()
{
string initialOrientationsCode = this.GetInitialOrientationsCode();
string defaultFullScreenCode = this.GetDefaultFullScreenCode();
if (defaultFullScreenCode != "")
{
initialOrientationsCode = initialOrientationsCode + "\r\n" + this.IndentCodeLine() + defaultFullScreenCode;
}
return initialOrientationsCode;
}
protected virtual string GetInitialOrientationsCode()
{
string str;
if (this.unityOrientationToMs.Count == 0)
{
this.unityOrientationToMs[UIOrientation.Portrait] = "DisplayOrientations.Portrait";
this.unityOrientationToMs[UIOrientation.PortraitUpsideDown] = "DisplayOrientations.PortraitFlipped";
this.unityOrientationToMs[UIOrientation.LandscapeRight] = "DisplayOrientations.LandscapeFlipped";
this.unityOrientationToMs[UIOrientation.LandscapeLeft] = "DisplayOrientations.Landscape";
}
if (PlayerSettings.defaultInterfaceOrientation == UIOrientation.AutoRotation)
{
List<string> list = new List<string>();
if (PlayerSettings.allowedAutorotateToLandscapeLeft)
{
list.Add(this.unityOrientationToMs[UIOrientation.LandscapeLeft]);
}
if (PlayerSettings.allowedAutorotateToLandscapeRight)
{
list.Add(this.unityOrientationToMs[UIOrientation.LandscapeRight]);
}
if (PlayerSettings.allowedAutorotateToPortrait)
{
list.Add(this.unityOrientationToMs[UIOrientation.Portrait]);
}
if (PlayerSettings.allowedAutorotateToPortraitUpsideDown)
{
list.Add(this.unityOrientationToMs[UIOrientation.PortraitUpsideDown]);
}
if (list.Count == 0)
{
return "";
}
str = list[0];
for (int i = 1; i < list.Count; i++)
{
str = str + "|" + list[i];
}
}
else
{
str = this.unityOrientationToMs[PlayerSettings.defaultInterfaceOrientation];
}
return $"DisplayInformation.AutoRotationPreferences = {str};";
}
protected abstract string IndentCodeLine();
internal static UnityGeneratedCreator Cpp =>
new UnityGeneratedCreatorCpp();
internal static UnityGeneratedCreator CSharp =>
new UnityGeneratedCreatorCSharp();
}