gg.easy.airship 0.1.2108 → 0.1.2110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,9 @@
1
1
  #if UNITY_EDITOR
2
2
  using System;
3
+ using System.Collections.Generic;
3
4
  using UnityEditor;
4
5
  using UnityEditor.Build;
6
+ using UnityEditor.Build.Profile;
5
7
  using UnityEditor.Build.Reporting;
6
8
  using UnityEngine;
7
9
  #if UNITY_EDITOR_OSX
@@ -226,11 +228,24 @@ namespace Editor {
226
228
 
227
229
  PlayerSettings.SplashScreen.show = false;
228
230
  PlayerSettings.SetScriptingBackend(NamedBuildTarget.Android, ScriptingImplementation.IL2CPP);
229
- var options = new BuildPlayerOptions();
230
- options.scenes = scenes;
231
- options.locationPathName = $"build/client_android/{ClientExecutableName}.apk";
232
- options.target = BuildTarget.Android;
233
- if (development == true) {
231
+ PlayerSettings.Android.splitApplicationBinary = !development;
232
+
233
+ BuildProfile buildProfile;
234
+ if (development) {
235
+ buildProfile = AssetDatabase.LoadAssetAtPath<BuildProfile>("Assets/Settings/Build Profiles/Android Debug.asset");
236
+ } else {
237
+ buildProfile = AssetDatabase.LoadAssetAtPath<BuildProfile>("Assets/Settings/Build Profiles/Android Google Play.asset");
238
+ }
239
+ var options = new BuildPlayerWithProfileOptions();
240
+ var editorBuildScenes = new List<EditorBuildSettingsScene>();
241
+ foreach (var sceneName in scenes) {
242
+ editorBuildScenes.Add(new EditorBuildSettingsScene(sceneName, true));
243
+ }
244
+ buildProfile.overrideGlobalScenes = true;
245
+ buildProfile.scenes = editorBuildScenes.ToArray();
246
+ options.buildProfile = buildProfile;
247
+ options.locationPathName = $"build/client_android/{ClientExecutableName}.{(development ? "apk" : "aab")}";
248
+ if (development) {
234
249
  options.options = BuildOptions.Development;
235
250
  }
236
251
 
@@ -122,8 +122,7 @@ public class Deploy {
122
122
  }
123
123
 
124
124
  // Rebuild Typescript
125
- var skipRecompileOnCodeDeploy = skipBuild && TypescriptServicesLocalConfig.instance.skipCompileOnCodeDeploy;
126
- var shouldRecompile = !skipBuild || !skipRecompileOnCodeDeploy;
125
+ var shouldRecompile = !skipBuild;
127
126
  var shouldResumeTypescriptWatch = shouldRecompile && TypescriptCompilationService.IsWatchModeRunning;
128
127
 
129
128
  // We want to do a full publish
@@ -303,15 +302,17 @@ public class Deploy {
303
302
  // UploadSingleGameFile(urls.Windows_client_scenes, $"{AirshipPlatform.Windows}/client/scenes", AirshipPlatform.Windows),
304
303
  UploadSingleGameFile(urls.Windows_shared_resources, $"{AirshipPlatform.Windows}/shared/resources", AirshipPlatform.Windows),
305
304
  UploadSingleGameFile(urls.Windows_shared_scenes, $"{AirshipPlatform.Windows}/shared/scenes", AirshipPlatform.Windows),
305
+ });
306
306
 
307
- // UploadSingleGameFile(urls.iOS_client_resources, $"{AirshipPlatform.iOS}/client/resources", AirshipPlatform.iOS),
308
- // UploadSingleGameFile(urls.iOS_client_scenes, $"{AirshipPlatform.iOS}/client/scenes", AirshipPlatform.iOS),
309
- UploadSingleGameFile(urls.iOS_shared_resources, $"{AirshipPlatform.iOS}/shared/resources", AirshipPlatform.iOS),
310
- UploadSingleGameFile(urls.iOS_shared_scenes, $"{AirshipPlatform.iOS}/shared/scenes", AirshipPlatform.iOS),
307
+ if (gameConfig.supportsMobile) {
308
+ uploadList.AddRange(new List<IEnumerator>() {
309
+ UploadSingleGameFile(urls.iOS_shared_resources, $"{AirshipPlatform.iOS}/shared/resources", AirshipPlatform.iOS),
310
+ UploadSingleGameFile(urls.iOS_shared_scenes, $"{AirshipPlatform.iOS}/shared/scenes", AirshipPlatform.iOS),
311
311
 
312
- UploadSingleGameFile(urls.Android_shared_resources, $"{AirshipPlatform.Android}/shared/resources", AirshipPlatform.Android),
313
- UploadSingleGameFile(urls.Android_shared_scenes, $"{AirshipPlatform.Android}/shared/scenes", AirshipPlatform.Android),
314
- });
312
+ UploadSingleGameFile(urls.Android_shared_resources, $"{AirshipPlatform.Android}/shared/resources", AirshipPlatform.Android),
313
+ UploadSingleGameFile(urls.Android_shared_scenes, $"{AirshipPlatform.Android}/shared/scenes", AirshipPlatform.Android),
314
+ });
315
+ }
315
316
  }
316
317
 
317
318
  // wait for all
@@ -143,13 +143,6 @@ namespace Airship.Editor {
143
143
  EditorGUILayout.ToggleLeft(new GUIContent("Automatically Run on Editor Startup", "Compilation of TypeScript files will be handled by the editor"), projectSettings.typescriptAutostartCompiler);
144
144
  projectSettings.typescriptPreventPlayOnError =
145
145
  EditorGUILayout.ToggleLeft(new GUIContent("Prevent Play Mode With Errors", "Stop being able to go into play mode if there are active compiler errors"), projectSettings.typescriptPreventPlayOnError);
146
-
147
- localSettings.skipCompileOnCodeDeploy =
148
- EditorGUILayout.ToggleLeft(new GUIContent("Skip Compile on Code Publish *", "This will skip compilation on code publish"), localSettings.skipCompileOnCodeDeploy);
149
-
150
- if (localSettings.skipCompileOnCodeDeploy) {
151
- EditorGUILayout.HelpBox("Skipping compilation on code deploy may speed up the deploy, but it has a very small chance of publishing broken code if the watch state is incorrect.", MessageType.Warning);
152
- }
153
146
  }
154
147
  AirshipEditorGUI.EndSettingGroup();
155
148
 
@@ -169,8 +162,6 @@ namespace Airship.Editor {
169
162
 
170
163
 
171
164
  projectSettings.typescriptVerbose = EditorGUILayout.ToggleLeft(new GUIContent("Verbose Output", "Will display much more verbose information when compiling a TypeScript project"), projectSettings.typescriptVerbose );
172
-
173
-
174
165
 
175
166
  #if AIRSHIP_INTERNAL
176
167
  projectSettings.typescriptWriteOnlyChanged = EditorGUILayout.ToggleLeft(new GUIContent("Write Only Changed", "Will write only changed files (this shouldn't be enabled unless there's a good reason for it)"), projectSettings.typescriptWriteOnlyChanged);
@@ -178,8 +169,8 @@ namespace Airship.Editor {
178
169
  }
179
170
  AirshipEditorGUI.EndSettingGroup();
180
171
 
181
- EditorGUILayout.Space(10);
182
- EditorGUILayout.LabelField("* This property only applies to your instance of the project");
172
+ // EditorGUILayout.Space(10);
173
+ // EditorGUILayout.LabelField("* This property only applies to your instance of the project");
183
174
 
184
175
  if (GUI.changed) {
185
176
  projectSettings.Modify();
@@ -266,13 +257,17 @@ namespace Airship.Editor {
266
257
  }
267
258
  }
268
259
 
260
+ private static GUIContent projectSettingsIcon;
261
+ private static GUIContent userSettingsIcon;
262
+
269
263
  private static TypescriptOptionsTab selectedTab;
270
264
  internal static void RenderSettings() {
271
-
265
+ projectSettingsIcon ??= EditorGUIUtility.IconContent("Project");
266
+ userSettingsIcon ??= EditorGUIUtility.IconContent("BuildSettings.Standalone.Small");
272
267
 
273
268
  selectedTab = (TypescriptOptionsTab) AirshipEditorGUI.BeginTabs((int) selectedTab, new[] {
274
- "Project Settings",
275
- "Local Settings"
269
+ new GUIContent(" Project Settings", projectSettingsIcon.image),
270
+ new GUIContent(" User Settings", userSettingsIcon.image)
276
271
  });
277
272
  {
278
273
  if (selectedTab == TypescriptOptionsTab.ProjectSettings) {
@@ -16,7 +16,6 @@ namespace Airship.Editor {
16
16
  internal class TypescriptServicesLocalConfig : ScriptableSingleton<TypescriptServicesLocalConfig> {
17
17
  [SerializeField]
18
18
  internal bool hasInitialized = false;
19
- [SerializeField] internal bool skipCompileOnCodeDeploy = false;
20
19
 
21
20
  public void Modify() {
22
21
  Save(true);
@@ -1,4 +1,6 @@
1
1
  using System;
2
+ using System.Collections.Generic;
3
+ using System.Linq;
2
4
  using Editor.EditorInternal;
3
5
  using UnityEditor;
4
6
  using UnityEngine;
@@ -66,8 +68,8 @@ public class AirshipEditorGUI {
66
68
  int right = Mathf.RoundToInt((tabIndex + 1) * tabWidth);
67
69
  return new Rect(rect.x + left, rect.y, right - left, /* kTabButtonHeight */ TabButtonHeight);
68
70
  }
69
-
70
- internal static int BeginTabs(int selectedIndex, string[] tabs) {
71
+
72
+ internal static int BeginTabs(int selectedIndex, GUIContent[] tabs) {
71
73
  var rect = EditorGUILayout.BeginVertical(new GUIStyle("FrameBox"));
72
74
  GUILayoutUtility.GetRect(10, TabButtonHeight);
73
75
 
@@ -8,6 +8,16 @@ using UnityEngine.Networking;
8
8
  using UnityEngine.Serialization;
9
9
 
10
10
  namespace Code.Accessories.Clothing {
11
+ public class PlatformGearBundleInfo {
12
+ public AssetBundle assetBundle;
13
+ public PlatformGearBundleManifest manifest;
14
+
15
+ public PlatformGearBundleInfo(AssetBundle assetBundle, PlatformGearBundleManifest manifest) {
16
+ this.assetBundle = assetBundle;
17
+ this.manifest = manifest;
18
+ }
19
+ }
20
+
11
21
  /**
12
22
  * Clothing exists on the backend and consists of one or many accessories.
13
23
  * Usually it's just one accessory (ie: a hat)
@@ -21,10 +31,15 @@ namespace Code.Accessories.Clothing {
21
31
  public AccessoryFace face;
22
32
 
23
33
  public static Dictionary<string, Task<bool>> inProgressDownloads = new();
34
+ /// <summary>
35
+ /// AirId to asset bundle
36
+ /// </summary>
37
+ public static Dictionary<string, PlatformGearBundleInfo> loadedPlatformGearBundles = new();
24
38
 
25
39
  [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
26
40
  public static void OnReload() {
27
41
  inProgressDownloads.Clear();
42
+ loadedPlatformGearBundles.Clear();
28
43
  }
29
44
 
30
45
  public static async Task<PlatformGear> DownloadYielding(string classId, string airId) {
@@ -38,7 +53,7 @@ namespace Code.Accessories.Clothing {
38
53
  }
39
54
 
40
55
  // Check if we already loaded an asset bundle that contains this clothing piece.
41
- if (PlatformGearManager.Instance.loadedPlatformGearBundles.TryGetValue(airId, out var loadedBundleInfo)) {
56
+ if (loadedPlatformGearBundles.TryGetValue(airId, out var loadedBundleInfo)) {
42
57
  foreach (var clothing in loadedBundleInfo.manifest.gearList) {
43
58
  if (clothing.classId == classId) {
44
59
  return clothing;
@@ -83,7 +98,7 @@ namespace Code.Accessories.Clothing {
83
98
 
84
99
  await manifestReq;
85
100
  var manifest = (PlatformGearBundleManifest) manifestReq.asset;
86
- PlatformGearManager.Instance.loadedPlatformGearBundles[airId] = new PlatformGearBundleInfo(bundle, manifest);
101
+ loadedPlatformGearBundles[airId] = new PlatformGearBundleInfo(bundle, manifest);
87
102
  foreach (var clothing in manifest.gearList) {
88
103
  if (clothing.classId == classId) {
89
104
  inProgressTask.SetResult(true);
@@ -15,71 +15,71 @@ using UnityEngine.Networking;
15
15
  public class AuthManager {
16
16
  public static Action authed;
17
17
 
18
- private static string GetAccountJSONPath() {
18
+ private static string GetAccountJSONPath() {
19
19
  var stagingExtension = "";
20
20
  #if AIRSHIP_STAGING
21
21
  stagingExtension = "_staging";
22
22
  #endif
23
23
  #if DEVELOPMENT_BUILD
24
- return Path.Combine(Application.persistentDataPath, $"account_devbuild{stagingExtension}.json");
24
+ return Path.Combine(Application.persistentDataPath, $"account_devbuild{stagingExtension}.json");
25
25
  #endif
26
26
  #if UNITY_EDITOR
27
- return Path.Combine(Application.persistentDataPath, $"account_editor{stagingExtension}.json");
27
+ return Path.Combine(Application.persistentDataPath, $"account_editor{stagingExtension}.json");
28
28
  #endif
29
- return Path.Combine(Application.persistentDataPath, $"account{stagingExtension}.json");
30
- }
29
+ return Path.Combine(Application.persistentDataPath, $"account{stagingExtension}.json");
30
+ }
31
31
 
32
- [CanBeNull]
33
- public static AuthSave GetSavedAccount() {
34
- var path = GetAccountJSONPath();
35
- if (!File.Exists(path)) {
36
- return null;
37
- }
32
+ [CanBeNull]
33
+ public static AuthSave GetSavedAccount() {
34
+ var path = GetAccountJSONPath();
35
+ if (!File.Exists(path)) {
36
+ return null;
37
+ }
38
38
 
39
- try {
40
- var authSave = JsonUtility.FromJson<AuthSave>(File.ReadAllText(path));
41
- return authSave;
42
- } catch (Exception e) {
43
- Debug.LogError(e);
44
- }
45
- return null;
46
- }
39
+ try {
40
+ var authSave = JsonUtility.FromJson<AuthSave>(File.ReadAllText(path));
41
+ return authSave;
42
+ } catch (Exception e) {
43
+ Debug.LogError(e);
44
+ }
45
+ return null;
46
+ }
47
47
 
48
- public static void SaveAuthAccount(string refreshToken) {
49
- var authSave = new AuthSave {
50
- refreshToken = refreshToken,
51
- time = DateTimeOffset.Now.ToUnixTimeSeconds()
52
- };
53
- var path = GetAccountJSONPath();
54
- File.WriteAllText(path, JsonUtility.ToJson(authSave));
55
- }
48
+ public static void SaveAuthAccount(string refreshToken) {
49
+ var authSave = new AuthSave {
50
+ refreshToken = refreshToken,
51
+ time = DateTimeOffset.Now.ToUnixTimeSeconds()
52
+ };
53
+ var path = GetAccountJSONPath();
54
+ File.WriteAllText(path, JsonUtility.ToJson(authSave));
55
+ }
56
56
 
57
- public static async Task<FirebaseTokenResponse> LoginWithRefreshToken(string refreshToken) {
58
- var body = $"grantType=refresh_token&refresh_token={refreshToken}";
59
- var req = UnityWebRequest.PostWwwForm("https://securetoken.googleapis.com/v1/token?key=" + AirshipApp.firebaseApiKey + "&" + body, "");
60
- req.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded");
61
- await req.SendWebRequest();
62
- if (req.result == UnityWebRequest.Result.ProtocolError) {
63
- Debug.LogError(req.error);
64
- return null;
65
- }
66
- return JsonUtility.FromJson<FirebaseTokenResponse>(req.downloadHandler.text);
67
- }
57
+ public static async Task<FirebaseTokenResponse> LoginWithRefreshToken(string refreshToken) {
58
+ var body = $"grantType=refresh_token&refresh_token={refreshToken}";
59
+ var req = UnityWebRequest.PostWwwForm("https://securetoken.googleapis.com/v1/token?key=" + AirshipApp.firebaseApiKey + "&" + body, "");
60
+ req.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded");
61
+ await req.SendWebRequest();
62
+ if (req.result == UnityWebRequest.Result.ProtocolError) {
63
+ Debug.LogError(req.error);
64
+ return null;
65
+ }
66
+ return JsonUtility.FromJson<FirebaseTokenResponse>(req.downloadHandler.text);
67
+ }
68
68
 
69
- public static void ClearSavedAccount() {
69
+ public static void ClearSavedAccount() {
70
70
  #if UNITY_EDITOR
71
- InternalHttpManager.editorAuthToken = "";
72
- InternalHttpManager.editorUserId = "";
71
+ InternalHttpManager.editorAuthToken = "";
72
+ InternalHttpManager.editorUserId = "";
73
73
  #else
74
- InternalHttpManager.authToken = "";
74
+ InternalHttpManager.authToken = "";
75
75
  #endif
76
- var path = GetAccountJSONPath();
77
- if (File.Exists(path)) {
78
- File.Delete(path);
79
- }
80
- }
76
+ var path = GetAccountJSONPath();
77
+ if (File.Exists(path)) {
78
+ File.Delete(path);
79
+ }
80
+ }
81
81
 
82
- public static async Task<(bool success, string error)> AuthWithGoogle() {
82
+ public static async Task<(bool success, string error)> AuthWithGoogle() {
83
83
  #if AIRSHIP_STAGING
84
84
  string clientId = "987279961241-0mjidme48us0fis0vtqk4jqrsmk7ar0n.apps.googleusercontent.com";
85
85
  string clientSecret = "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";
@@ -99,6 +99,16 @@ public class AuthManager {
99
99
  clientSecret = null;
100
100
  redirectUri = "gg.easy.airship:/oauth2";
101
101
  #endif
102
+ #endif
103
+
104
+ #if UNITY_ANDROID && !UNITY_EDITOR
105
+ #if AIRSHIP_STAGING
106
+ // TODO
107
+ #else
108
+ clientId = "457451560440-htottasd1788to2boc7lg08jrkduotg1.apps.googleusercontent.com";
109
+ clientSecret = null;
110
+ redirectUri = "https://airship.gg/oauth2";
111
+ #endif
102
112
  #endif
103
113
 
104
114
  var auth = new GoogleAuth(new AuthorizationCodeFlow.Configuration() {
@@ -110,6 +120,8 @@ public class AuthManager {
110
120
  redirectUri = redirectUri,
111
121
  scope = "openid email profile",
112
122
  });
123
+
124
+ Debug.Log($"Redirect URI: {redirectUri}");
113
125
 
114
126
  var crossPlatformBrowser = new CrossPlatformBrowser();
115
127
  var standaloneBrowser = new StandaloneBrowser();
@@ -121,8 +133,8 @@ public class AuthManager {
121
133
  crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.OSXEditor, standaloneBrowser);
122
134
  crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.OSXPlayer, standaloneBrowser);
123
135
  crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.IPhonePlayer, new ASWebAuthenticationSessionBrowser());
124
- // crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.Android, new DeepLinkBrowser());
125
- crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.Android, new AndroidBrowser("http://*:8080"));
136
+ crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.Android, new DeepLinkBrowser());
137
+ // crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.Android, new AndroidBrowser("http://*:8080"));
126
138
 
127
139
  using var authenticationSession = new AuthenticationSession(auth, crossPlatformBrowser);
128
140
 
@@ -166,4 +178,4 @@ public class AuthManager {
166
178
  return (false, ""); // Don't return a display error
167
179
  }
168
180
  }
169
- }
181
+ }
@@ -10,26 +10,25 @@ public class ManageFullscreenSwitch : MonoBehaviour
10
10
 
11
11
  private bool _fullscreen = false;
12
12
 
13
- private void Start()
14
- {
13
+ private void Start() {
14
+ #if !UNITY_IOS && !UNITY_ANDROID
15
15
  _fullscreen = Screen.fullScreen;
16
16
  SetFullScreenValues();
17
+ #endif
17
18
  }
18
- private void Update()
19
- {
20
- if (_fullscreen != Screen.fullScreen)
21
- {
22
- if (Screen.fullScreen)
23
- {
19
+ private void Update() {
20
+ #if !UNITY_IOS && !UNITY_ANDROID
21
+ if (_fullscreen != Screen.fullScreen) {
22
+ if (Screen.fullScreen) {
24
23
  RestoreFullscreenResolution();
25
24
  }
26
25
 
27
26
  _fullscreen = Screen.fullScreen;
28
27
  }
28
+ #endif
29
29
  }
30
30
 
31
- private void RestoreFullscreenResolution()
32
- {
31
+ private void RestoreFullscreenResolution() {
33
32
  SetFullScreenValues();
34
33
  Screen.SetResolution(_fullscreenWidth, _fullscreenHeight, true, _fullscreenAspectRatio);
35
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg.easy.airship",
3
- "version": "0.1.2108",
3
+ "version": "0.1.2110",
4
4
  "displayName": "Airship",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "12f1",
@@ -1,22 +0,0 @@
1
- using System.Collections.Generic;
2
- using UnityEngine;
3
- using UnityEngine.Serialization;
4
-
5
- namespace Code.Accessories.Clothing {
6
- public class PlatformGearBundleInfo {
7
- public AssetBundle assetBundle;
8
- public PlatformGearBundleManifest manifest;
9
-
10
- public PlatformGearBundleInfo(AssetBundle assetBundle, PlatformGearBundleManifest manifest) {
11
- this.assetBundle = assetBundle;
12
- this.manifest = manifest;
13
- }
14
- }
15
-
16
- public class PlatformGearManager : Singleton<PlatformGearManager> {
17
- /// <summary>
18
- /// AirId to asset bundle
19
- /// </summary>
20
- public Dictionary<string, PlatformGearBundleInfo> loadedPlatformGearBundles = new();
21
- }
22
- }
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 9136398281fe4ea6b7e827eb658af255
3
- timeCreated: 1739814504