gg.easy.airship 0.1.2112 → 0.1.2113

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,4 +1,5 @@
1
1
  using System;
2
+ using Code.State;
2
3
  using Editor.Packages;
3
4
  using UnityEditor;
4
5
  using UnityEditor.SceneManagement;
@@ -63,7 +64,6 @@ public class AutoSceneRedirect {
63
64
  Debug.Log("An Airship Core update is available. Not updating may result in unexpected behaviour.");
64
65
  }
65
66
  }
66
-
67
67
  if (state != PlayModeStateChange.ExitingEditMode) return;
68
68
 
69
69
  var sceneName = SceneManager.GetActiveScene().name;
@@ -71,9 +71,9 @@ public class AutoSceneRedirect {
71
71
  if (gameConfig == null) return;
72
72
 
73
73
  if (Array.Find(gameConfig.gameScenes, obj => ((SceneAsset)obj).name == sceneName) != null) {
74
- ServerBootstrap.editorStartingSceneIntent = sceneName;
74
+ EditorSessionState.SetString("AirshipEditorStartingSceneName", sceneName);
75
75
  } else {
76
- ServerBootstrap.editorStartingSceneIntent = "";
76
+ EditorSessionState.SetString("AirshipEditorStartingSceneName", "");
77
77
  }
78
78
  }
79
79
  }
@@ -315,10 +315,10 @@ public static class CreateAssetBundles {
315
315
  .Select((s) => AssetDatabase.GetAssetPath((SceneAsset)s))
316
316
  .Where((path) => !(path.EndsWith(".lua") || path.EndsWith(".json~")))
317
317
  .ToArray();
318
- Debug.Log("Including scenes: ");
319
- foreach (var p in assetPaths) {
320
- Debug.Log(" - " + p);
321
- }
318
+ // Debug.Log("Including scenes: ");
319
+ // foreach (var p in assetPaths) {
320
+ // Debug.Log(" - " + p);
321
+ // }
322
322
  var addressableNames = assetPaths.Select((p) => p.ToLower())
323
323
  .ToArray();
324
324
  var build = new AssetBundleBuild() {
@@ -343,10 +343,10 @@ public static class CreateAssetBundles {
343
343
  .Where((path) => !path.ToLower().Contains("editor/"))
344
344
  .Where((p) => !AssetDatabase.IsValidFolder(p))
345
345
  .ToArray();
346
- Debug.Log("Resources:");
347
- foreach (var path in assetPaths) {
348
- Debug.Log(" - " + path);
349
- }
346
+ // Debug.Log("Resources:");
347
+ // foreach (var path in assetPaths) {
348
+ // Debug.Log(" - " + path);
349
+ // }
350
350
  var addressableNames = assetPaths
351
351
  .Select((p) => p.ToLower())
352
352
  .ToArray();
@@ -367,6 +367,8 @@ public static class CreateAssetBundles {
367
367
  {
368
368
  GraphicsDeviceType.OpenGLES3
369
369
  });
370
+ } else {
371
+ PlayerSettings.SetUseDefaultGraphicsAPIs(buildTarget, true);
370
372
  }
371
373
 
372
374
  var buildTargetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget);
@@ -384,13 +386,13 @@ public static class CreateAssetBundles {
384
386
  buildParams.BundleCompression = BuildCompression.LZ4;
385
387
  var buildContent = new BundleBuildContent(builds);
386
388
 
387
- Debug.Log("Additional files:");
388
- foreach (var pair in buildContent.AdditionalFiles) {
389
- Debug.Log(pair.Key + ":");
390
- foreach (var p in pair.Value) {
391
- Debug.Log(" - " + p.fileAlias);
392
- }
393
- }
389
+ // Debug.Log("Additional files:");
390
+ // foreach (var pair in buildContent.AdditionalFiles) {
391
+ // Debug.Log(pair.Key + ":");
392
+ // foreach (var p in pair.Value) {
393
+ // Debug.Log(" - " + p.fileAlias);
394
+ // }
395
+ // }
394
396
 
395
397
  ContentPipeline.BuildCallbacks.PostPackingCallback = (parameters, data, arg3) => {
396
398
  return ReturnCode.Success;
@@ -407,9 +409,9 @@ public static class CreateAssetBundles {
407
409
  return false;
408
410
  }
409
411
 
410
- Debug.Log("----------------------");
411
- Debug.Log("Airship Build Report");
412
- Debug.Log("----------------------");
412
+ // Debug.Log("----------------------");
413
+ // Debug.Log("Airship Build Report");
414
+ // Debug.Log("----------------------");
413
415
  // {
414
416
  // Debug.Log("Serialized Files:");
415
417
  // foreach (var pair in result.WriteResults) {
@@ -449,6 +451,7 @@ public static class CreateAssetBundles {
449
451
  // }
450
452
 
451
453
  Debug.Log($"[Editor]: Finished building {platform} asset bundles in {sw.Elapsed.TotalSeconds} seconds.");
454
+
452
455
  return true;
453
456
  }
454
457
 
@@ -382,10 +382,17 @@ namespace Editor.Packages {
382
382
 
383
383
  List<AirshipPlatform> platforms = new() {
384
384
  AirshipPlatform.iOS,
385
- AirshipPlatform.Mac,
386
- AirshipPlatform.Windows,
387
385
  AirshipPlatform.Android,
388
386
  };
387
+ // We want to end up on our editor machine's platform
388
+ #if UNITY_EDITOR_OSX
389
+ platforms.Add(AirshipPlatform.Windows);
390
+ platforms.Add(AirshipPlatform.Mac);
391
+ #else
392
+ platforms.Add(AirshipPlatform.Mac);
393
+ platforms.Add(AirshipPlatform.Windows);
394
+ #endif
395
+
389
396
  // Uncomment to just build iOS
390
397
  if (isCoreMaterials) {
391
398
  platforms.Clear();
@@ -733,7 +740,7 @@ namespace Editor.Packages {
733
740
  }
734
741
 
735
742
  var android = ModuleUtil.IsModuleInstalled(BuildTarget.Android);
736
- if (!iOS) {
743
+ if (!android) {
737
744
  Debug.LogError("Android Build Support module not found.");
738
745
  }
739
746
  return mac && windows && iOS && android;
@@ -42,20 +42,21 @@ public class Deploy {
42
42
  // NetworkPrefabManager.WriteAllCollections();
43
43
  // Sort the current platform first to speed up build time
44
44
  List<AirshipPlatform> platforms = new();
45
- var gameConfig = GameConfig.Load();
46
- if (gameConfig.supportsMobile) {
47
- platforms.Add(AirshipPlatform.iOS);
48
- platforms.Add(AirshipPlatform.Android);
49
- }
50
45
 
51
- // We want to end up on our editor machine's platform
52
46
  #if UNITY_EDITOR_OSX
53
47
  platforms.Add(AirshipPlatform.Windows);
54
48
  platforms.Add(AirshipPlatform.Mac);
55
49
  #else
56
- platforms.Add(AirshipPlatform.Mac);
57
50
  platforms.Add(AirshipPlatform.Windows);
51
+ platforms.Add(AirshipPlatform.Mac);
58
52
  #endif
53
+
54
+ var gameConfig = GameConfig.Load();
55
+ if (gameConfig.supportsMobile) {
56
+ platforms.Add(AirshipPlatform.iOS);
57
+ platforms.Add(AirshipPlatform.Android);
58
+ }
59
+
59
60
  EditorCoroutines.Execute((BuildAndDeploy(platforms.ToArray(), false)));
60
61
  }
61
62
 
@@ -262,6 +263,8 @@ public class Deploy {
262
263
  Debug.Log("Cancelled publish.");
263
264
  yield break;
264
265
  }
266
+
267
+ yield return null;
265
268
  }
266
269
 
267
270
  if (EditorIntegrationsConfig.instance.buildWithoutUpload) {
@@ -445,6 +448,9 @@ public class Deploy {
445
448
  }
446
449
  }
447
450
 
451
+ // Switch back to starting build target
452
+ EditorUserBuildSettings.SwitchActiveBuildTarget(startingBuildGroup, startingBuildTarget);
453
+
448
454
  var slug = activeDeployTarget.slug;
449
455
  if (slug == null) {
450
456
  slug = activeDeployTarget.id;
@@ -463,8 +469,6 @@ public class Deploy {
463
469
  }
464
470
 
465
471
  if (shouldResumeTypescriptWatch) TypescriptCompilationService.StartCompilerServices();
466
- // Switch back to starting build target
467
- // EditorUserBuildSettings.SwitchActiveBuildTarget(startingBuildGroup, startingBuildTarget);
468
472
  }
469
473
 
470
474
  private static IEnumerator UploadSingleGameFile(string url, string filePath, AirshipPlatform? platform, bool absolutePath = false) {
@@ -79,9 +79,9 @@ namespace Code.AirAssetBundle {
79
79
 
80
80
  AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(req);
81
81
  // Uncomment to list all assets inside the bundle.
82
- foreach (var asset in bundle.GetAllAssetNames()) {
83
- Debug.Log(" - " + asset);
84
- }
82
+ // foreach (var asset in bundle.GetAllAssetNames()) {
83
+ // Debug.Log(" - " + asset);
84
+ // }
85
85
  var loadReq = bundle.LoadAssetAsync<AirAssetBundle>("_AirAssetBundle");
86
86
  await loadReq;
87
87
  var airAssetBundle = (AirAssetBundle) loadReq.asset;
@@ -1,9 +1,9 @@
1
1
  using System.Collections.Generic;
2
2
  using System.Linq;
3
3
  using Code.Bundles;
4
- using Code.Platform.Shared;
5
4
  using Code.Platform.Server;
6
5
  using Code.Platform.Client;
6
+ using Code.Platform.Shared;
7
7
  using UnityEngine;
8
8
 
9
9
  namespace Code.Analytics {
@@ -32,7 +32,7 @@ namespace Code.Analytics {
32
32
  AnalyticsServiceServerBackend.SendServerAnalytics(message).ContinueWith((t) => {
33
33
  isAlreadySending = false;
34
34
  if (!t.Result.success) {
35
- Debug.LogError("airship-analytics-forwarder - Failed to send error analytics: " + t.Result.error);
35
+ Debug.LogWarning("airship-analytics-forwarder - Failed to send error analytics: " + t.Result.error);
36
36
  }
37
37
  });
38
38
  #endif
@@ -53,7 +53,7 @@ namespace Code.Analytics {
53
53
  AnalyticsServiceClient.SendClientAnalytics(message).ContinueWith((t) => {
54
54
  isAlreadySending = false;
55
55
  if (!t.Result.success) {
56
- Debug.LogError("airship-analytics-forwarder - Failed to send error analytics: " + t.Result.error);
56
+ Debug.LogWarning("airship-analytics-forwarder - Failed to send error analytics: " + t.Result.error);
57
57
  }
58
58
  });
59
59
  #endif
@@ -67,6 +67,8 @@ namespace Code.Bootstrap {
67
67
  private List<LuauScriptsDto> scriptsDtos = new();
68
68
  private string scriptsHash;
69
69
 
70
+ private int setupClientSessionCounter = 0;
71
+
70
72
  /// <summary>
71
73
  /// Client downloads and combines all LuauScriptDto objects into this single dto.
72
74
  /// This is then serialized to disk as a cache.
@@ -154,6 +156,8 @@ namespace Code.Bootstrap {
154
156
  /// 5. Receive SceneMessage
155
157
  /// 6. NetworkClient.Ready()
156
158
  public async void SetupClient() {
159
+ this.setupClientSessionCounter++;
160
+ var session = this.setupClientSessionCounter;
157
161
  this.scriptsReady = false;
158
162
  this.packagesReady = false;
159
163
  this.isFinishedPreparing = false;
@@ -196,7 +200,7 @@ namespace Code.Bootstrap {
196
200
  }
197
201
 
198
202
  if (data.final) {
199
- print("scripts hash: " + data.hash);
203
+ // print("scripts hash: " + data.hash);
200
204
  try {
201
205
  var writer = new NetworkWriter();
202
206
  writer.WriteLuauScriptsDto(data.scriptsDto);
@@ -218,6 +222,9 @@ namespace Code.Bootstrap {
218
222
  while (!NetworkClient.isConnected) {
219
223
  await Awaitable.NextFrameAsync();
220
224
  }
225
+
226
+ if (this.setupClientSessionCounter != session) return;
227
+
221
228
  NetworkClient.Send(new GreetingMessage());
222
229
  }
223
230
 
@@ -11,6 +11,7 @@ using Code.Bootstrap;
11
11
  using Code.GameBundle;
12
12
  using Code.Http.Internal;
13
13
  using Code.Platform.Shared;
14
+ using Code.State;
14
15
  using JetBrains.Annotations;
15
16
  using kcp2k;
16
17
  using Mirror;
@@ -62,11 +63,6 @@ public class ServerBootstrap : MonoBehaviour
62
63
 
63
64
  private GameServer gameServer;
64
65
 
65
- /// <summary>
66
- /// When set, this will be used as the starting scene.
67
- /// </summary>
68
- public static string editorStartingSceneIntent;
69
-
70
66
  [NonSerialized] public bool isServerReady = false;
71
67
  public event Action OnStartLoadingGame;
72
68
  public event Action OnServerReady;
@@ -85,7 +81,7 @@ public class ServerBootstrap : MonoBehaviour
85
81
  #endif
86
82
  }
87
83
 
88
- private void Start() {
84
+ private async void Start() {
89
85
  if (!RunCore.IsServer()) {
90
86
  return;
91
87
  }
@@ -128,6 +124,11 @@ public class ServerBootstrap : MonoBehaviour
128
124
  // print("Listening on port " + transport.port);
129
125
  AirshipNetworkManager.singleton.StartHost();
130
126
  } else {
127
+
128
+ // print("waiting 2 seconds...");
129
+ // await Awaitable.WaitForSecondsAsync(2);
130
+ // print("starting server.");
131
+
131
132
  AirshipNetworkManager.singleton.StartServer();
132
133
  Application.logMessageReceived += AnalyticsRecorder.RecordLogMessageToAnalytics;
133
134
  }
@@ -192,6 +193,7 @@ public class ServerBootstrap : MonoBehaviour
192
193
 
193
194
  #if UNITY_EDITOR
194
195
  var gameConfig = GameConfig.Load();
196
+ var editorStartingSceneIntent = EditorSessionState.GetString("AirshipEditorStartingSceneName");
195
197
  if (!string.IsNullOrEmpty(editorStartingSceneIntent)) {
196
198
  startupConfig.StartingSceneName = editorStartingSceneIntent;
197
199
  } else {
@@ -326,14 +326,16 @@ public class SystemRoot : Singleton<SystemRoot> {
326
326
 
327
327
  // Shader Variant Collections
328
328
  if (!preWarmedCoreShaders && RunCore.IsClient()) {
329
- // #if !UNITY_IOS && !UNITY_ANDROID
329
+ #if !UNITY_IOS && !UNITY_ANDROID && !UNITY_EDITOR
330
330
  preWarmedCoreShaders = true;
331
331
  string[] collections = new[] {
332
332
  "MainMenu",
333
333
  // "RacingGame",
334
- "BWShaderVariants 1 (Raven)",
334
+ // "BWShaderVariants 1 (Raven)",
335
335
  };
336
+ int totalCounter = 0;
336
337
  foreach (var collectionName in collections) {
338
+ onLoadingScreenStep?.Invoke($"Prewarming shaders (1)");
337
339
  var path = $"Assets/AirshipPackages/@Easy/CoreMaterials/ShaderVariantCollections/{collectionName}.shadervariants".ToLower();
338
340
  Debug.Log("Loading shader variant: " + collectionName);
339
341
  if (this.coreMaterialsAssetBundle == null) {
@@ -354,13 +356,15 @@ public class SystemRoot : Singleton<SystemRoot> {
354
356
  int step = 1;
355
357
  while (!col.WarmUpProgressively(step)) {
356
358
  variantCounter += step;
359
+ totalCounter += step;
360
+ onLoadingScreenStep?.Invoke($"Prewarming shaders ({totalCounter + 1})");
357
361
  Debug.Log($"Prewarm in progress ({collectionName}): {variantCounter}");
358
362
  yield return null;
359
363
  }
360
364
  Debug.Log("Prewarmed " + collectionName + " in " + st.ElapsedMilliseconds + "ms");
361
365
  }
362
366
  }
363
- // #endif
367
+ #endif
364
368
  }
365
369
  } else {
366
370
  if (NetworkClient.isConnected) {
@@ -105,6 +105,15 @@ public class AirshipComponent : MonoBehaviour {
105
105
  }
106
106
 
107
107
  #if !UNITY_EDITOR || AIRSHIP_PLAYER
108
+ if (LuauScript.AssetBridge == null) {
109
+ Debug.LogError("Cannot start script: AssetBridge not yet initialized", gameObject);
110
+ return;
111
+ }
112
+ if (ReferenceEquals(script, null)) {
113
+ Debug.LogError($"Cannot start script: 'script' property is null (GameObject: {gameObject.name})", gameObject);
114
+ return;
115
+ }
116
+
108
117
  // Grab the script from code.zip at runtime
109
118
  var runtimeScript = LuauScript.AssetBridge.GetBinaryFileFromLuaPath<AirshipScript>(script.m_path.ToLower());
110
119
  if (runtimeScript) {
@@ -116,8 +116,14 @@ public class AirshipNetworkManager : NetworkManager {
116
116
  await ao;
117
117
 
118
118
  var scene = SceneManager.GetSceneByName(sceneName);
119
+ if (!scene.IsValid()) {
120
+ scene = SceneManager.GetSceneByPath(sceneName);
121
+ }
122
+
119
123
  if (scene.IsValid() && scene.isLoaded) {
120
124
  SceneManager.SetActiveScene(scene);
125
+ } else {
126
+ Debug.LogWarning($"SetSceneActiveOnceLoaded \"{sceneName}\" failed to be set as active scene");
121
127
  }
122
128
  }
123
129
 
@@ -173,6 +173,7 @@ public class AccessoryBuilder : MonoBehaviour {
173
173
  }
174
174
 
175
175
  if (Application.isPlaying) {
176
+ lod.rootTransform.gameObject.SetActive(false);
176
177
  Destroy(lod.rootTransform.gameObject);
177
178
  } else {
178
179
  DestroyImmediate(lod.rootTransform.gameObject);
@@ -184,6 +185,7 @@ public class AccessoryBuilder : MonoBehaviour {
184
185
  }
185
186
 
186
187
  if (Application.isPlaying) {
188
+ activeAccessory.rootTransform.gameObject.SetActive(false);
187
189
  Destroy(activeAccessory.rootTransform.gameObject);
188
190
  } else {
189
191
  DestroyImmediate(activeAccessory.rootTransform.gameObject);
@@ -203,7 +203,7 @@ public class CharacterMovement : NetworkBehaviour {
203
203
  //Only the owner can control
204
204
  hasMovementAuth = isOwned || (isServer && (netIdentity.connectionToClient == null || isServerAuth));
205
205
 
206
- //Have to manualy control the flow of data
206
+ //Have to manually control the flow of data
207
207
  if (networkTransform) {
208
208
  if (isServerOnly) {
209
209
  networkTransform.syncDirection
@@ -73,11 +73,18 @@ namespace Code.Player {
73
73
  this.serverBootstrap = FindFirstObjectByType<ServerBootstrap>();
74
74
  }
75
75
 
76
- private void Start() {
76
+ private async void Start() {
77
+ // print("PlayerManagerBridge.start");
78
+
79
+ // print("PlayerManagerBridge: server is ready.");
77
80
  if (RunCore.IsServer()) {
81
+ while (!serverBootstrap.isServerReady) {
82
+ await Awaitable.NextFrameAsync();
83
+ }
78
84
  foreach (var connection in NetworkServer.connections.Values) {
79
85
  NetworkServer_OnConnected(connection);
80
86
  }
87
+
81
88
  NetworkServer.OnConnectedEvent += NetworkServer_OnConnected;
82
89
 
83
90
  if (this.serverBootstrap && this.serverBootstrap.IsAgonesEnvironment())
@@ -189,6 +196,7 @@ namespace Code.Player {
189
196
  }
190
197
 
191
198
  while (!conn.isAuthenticated || !conn.isReady) {
199
+ // print($"Waiting for {conn.connectionId} to be ready.");
192
200
  await Awaitable.NextFrameAsync();
193
201
  }
194
202
 
@@ -207,7 +215,7 @@ namespace Code.Player {
207
215
  Debug.Log("Missing UserData for " + conn);
208
216
  #endif
209
217
  }
210
- NetworkServer.Spawn(go, conn);
218
+ // NetworkServer.Spawn(go, conn);
211
219
  NetworkServer.AddPlayerForConnection(conn, go);
212
220
 
213
221
  var playerInfoDto = playerInfo.BuildDto();
@@ -216,6 +224,10 @@ namespace Code.Player {
216
224
  OnPlayerAdded?.Invoke(playerInfoDto);
217
225
  playerChanged?.Invoke(playerInfoDto, (object)true);
218
226
 
227
+ if (RunCore.IsServer() && !RunCore.IsClient()) {
228
+ Debug.Log(playerInfo.username + " joined the server.");
229
+ }
230
+
219
231
  if (this.agones) {
220
232
  await this.agones.AppendListValue(AGONES_PLAYERS_LIST_NAME, $"{playerInfo.userId}");
221
233
  }
@@ -87,7 +87,7 @@ namespace Code.RemoteConsole {
87
87
  stackTrace = stackTrace,
88
88
  time = time,
89
89
  };
90
- NetworkServer.SendToAll(packet);
90
+ NetworkServer.SendToAll(packet, Channels.Reliable, true);
91
91
  }
92
92
  }
93
93
  }
@@ -11,7 +11,7 @@ public class MirrorPlacementMod : VoxelPlacementModifier {
11
11
  }
12
12
 
13
13
  public override string GetName() {
14
- return "Mirror";
14
+ return "Flip";
15
15
  }
16
16
 
17
17
  public override void OnPlaceVoxels(VoxelWorld world, HashSet<Vector3Int> positions) {
@@ -397,7 +397,6 @@ public class SelectionZoneEditor : UnityEditor.Editor
397
397
  {
398
398
  return;
399
399
  }
400
- VoxelEditManager voxelEditManager = VoxelEditManager.Instance;
401
400
 
402
401
  //Add Copy Button
403
402
  if (GUILayout.Button("Fill"))
@@ -428,7 +427,7 @@ public class SelectionZoneEditor : UnityEditor.Editor
428
427
  }
429
428
  }
430
429
  }
431
- voxelEditManager.AddEdits(cube.voxelWorld, edits, "Fill Voxels");
430
+ VoxelEditManager.AddEdits(cube.voxelWorld, edits, "Fill Voxels");
432
431
  }
433
432
  }
434
433
 
@@ -463,7 +462,7 @@ public class SelectionZoneEditor : UnityEditor.Editor
463
462
  }
464
463
  }
465
464
  }
466
- voxelEditManager.AddEdits(cube.voxelWorld, edits, "Replace Voxels");
465
+ VoxelEditManager.AddEdits(cube.voxelWorld, edits, "Replace Voxels");
467
466
  }
468
467
  }
469
468
 
@@ -504,7 +503,7 @@ public class SelectionZoneEditor : UnityEditor.Editor
504
503
  {
505
504
  List<VoxelEditAction.EditInfo> edits = new();
506
505
  edits.Add(new VoxelEditAction.EditInfo(new Vector3Int(x, y, z), data, 0));
507
- voxelEditManager.AddEdits(cube.voxelWorld, edits, "Cut Voxels");
506
+ VoxelEditManager.AddEdits(cube.voxelWorld, edits, "Cut Voxels");
508
507
  }
509
508
  }
510
509
  }
@@ -585,7 +584,7 @@ public class SelectionZoneEditor : UnityEditor.Editor
585
584
  }
586
585
  }
587
586
  }
588
- voxelEditManager.AddEdits(cube.voxelWorld, edits, "Paste Voxels");
587
+ VoxelEditManager.AddEdits(cube.voxelWorld, edits, "Paste Voxels");
589
588
  }
590
589
 
591
590
  //resize the box to whatever we pasted
@@ -41,14 +41,14 @@ public class VoxelEditAction {
41
41
  public class VoxelEditMarker : ScriptableObject {
42
42
  public VoxelEditAction lastAction;
43
43
  }
44
- public class VoxelEditManager : Singleton<VoxelEditManager> {
45
- public Dictionary<string, VoxelPlacementModifier> placementModifiers = new();
46
- public bool buildModsEnabled = false;
47
- VoxelEditMarker undoObject;
48
- public List<VoxelEditAction> edits = new List<VoxelEditAction>();
49
- public List<VoxelEditAction> redos = new List<VoxelEditAction>();
50
-
51
- private HashSet<Vector3Int> WriteVoxel(VoxelWorld world, Vector3Int position, ushort num) {
44
+ public class VoxelEditManager {
45
+ public static Dictionary<string, VoxelPlacementModifier> placementModifiers = new();
46
+ public static bool buildModsEnabled = false;
47
+ static VoxelEditMarker undoObject;
48
+ public static List<VoxelEditAction> edits = new List<VoxelEditAction>();
49
+ public static List<VoxelEditAction> redos = new List<VoxelEditAction>();
50
+
51
+ private static HashSet<Vector3Int> WriteVoxel(VoxelWorld world, Vector3Int position, ushort num) {
52
52
  var positionSet = new HashSet<Vector3Int>() { position };
53
53
  if (buildModsEnabled) {
54
54
  foreach (var (id, modifier) in placementModifiers) {
@@ -62,7 +62,7 @@ public class VoxelEditManager : Singleton<VoxelEditManager> {
62
62
  return positionSet;
63
63
  }
64
64
 
65
- public HashSet<Vector3Int> ColorVoxel(VoxelWorld world, Vector3Int position, Color col) {
65
+ public static HashSet<Vector3Int> ColorVoxel(VoxelWorld world, Vector3Int position, Color col) {
66
66
  var positionSet = new HashSet<Vector3Int>() { position };
67
67
  if (buildModsEnabled) {
68
68
  foreach (var (id, modifier) in placementModifiers) {
@@ -76,7 +76,7 @@ public class VoxelEditManager : Singleton<VoxelEditManager> {
76
76
  return positionSet;
77
77
  }
78
78
 
79
- public void AddEdit(VoxelWorld world, Vector3Int position, ushort oldValue, ushort newValue, string name) {
79
+ public static void AddEdit(VoxelWorld world, Vector3Int position, ushort oldValue, ushort newValue, string name) {
80
80
  VoxelEditAction edit = new VoxelEditAction();
81
81
  edit.CreateSingleEdit(world, position, oldValue, newValue);
82
82
  edits.Add(edit);
@@ -99,7 +99,7 @@ public class VoxelEditManager : Singleton<VoxelEditManager> {
99
99
  world.hasUnsavedChanges = true;
100
100
  }
101
101
 
102
- public void AddEdits(VoxelWorld world, List<EditInfo> editInfos, string name) {
102
+ public static void AddEdits(VoxelWorld world, List<EditInfo> editInfos, string name) {
103
103
  VoxelEditAction edit = new VoxelEditAction();
104
104
  edit.CreateMultiEdit(world, editInfos);
105
105
  edits.Add(edit);
@@ -129,11 +129,9 @@ public class VoxelEditManager : Singleton<VoxelEditManager> {
129
129
  //Constructor
130
130
  public VoxelEditManager() {
131
131
  Undo.undoRedoEvent += UndoRedoEvent;
132
-
133
132
  }
134
133
 
135
- public void UndoRedoEvent(in UndoRedoInfo info) {
136
-
134
+ public static void UndoRedoEvent(in UndoRedoInfo info) {
137
135
  if (info.isRedo == false) {
138
136
  if (edits.Count > 0) {
139
137
  VoxelEditAction edit = edits[edits.Count - 1];
@@ -152,8 +150,7 @@ public class VoxelEditManager : Singleton<VoxelEditManager> {
152
150
 
153
151
  redos.Add(edit);
154
152
  }
155
- }
156
- else {
153
+ } else {
157
154
  if (redos.Count > 0) {
158
155
  VoxelEditAction edit = redos[redos.Count - 1];
159
156
  redos.RemoveAt(redos.Count - 1);
@@ -167,16 +164,12 @@ public class VoxelEditManager : Singleton<VoxelEditManager> {
167
164
  }
168
165
  currentWorld.hasUnsavedChanges = true;
169
166
  }
170
-
171
167
  edits.Add(edit);
172
168
  }
173
169
  }
174
-
175
170
  }
176
171
  }
177
172
 
178
-
179
-
180
173
  [CustomEditor(typeof(VoxelWorld))]
181
174
  public class VoxelWorldEditor : UnityEditor.Editor {
182
175
  private static readonly string DefaultBlockDefinesPath = "Assets/Bundles/@Easy/Survival/Shared/Resources/VoxelWorld/SurvivalBlockDefines.xml";
@@ -416,13 +409,13 @@ public class VoxelWorldEditor : UnityEditor.Editor {
416
409
  }
417
410
 
418
411
  EditorGUILayout.LabelField("Build Mods", EditorStyles.boldLabel);
419
- VoxelEditManager.Instance.buildModsEnabled =
420
- GUILayout.Toggle(VoxelEditManager.Instance.buildModsEnabled, "Enabled");
412
+ VoxelEditManager.buildModsEnabled =
413
+ GUILayout.Toggle(VoxelEditManager.buildModsEnabled, "Enabled");
421
414
  // placementModsOpen = EditorGUILayout.Foldout(placementModsOpen, "Build Mods");
422
415
  // if (placementModsOpen) {
423
- GUI.enabled = VoxelEditManager.Instance.buildModsEnabled;
416
+ GUI.enabled = VoxelEditManager.buildModsEnabled;
424
417
  EditorGUI.indentLevel++;
425
- var enabledMods = VoxelEditManager.Instance.placementModifiers;
418
+ var enabledMods = VoxelEditManager.placementModifiers;
426
419
  foreach (var placementMod in allPlacementModifiers) {
427
420
  var modName = placementMod.GetName();
428
421
  var modEnabledOld = enabledMods.ContainsKey(modName);
@@ -437,7 +430,7 @@ public class VoxelWorldEditor : UnityEditor.Editor {
437
430
  EditorGUI.indentLevel++;
438
431
  placementMod.OnInspectorGUI();
439
432
  EditorGUI.indentLevel--;
440
- GUI.enabled = VoxelEditManager.Instance.buildModsEnabled;
433
+ GUI.enabled = VoxelEditManager.buildModsEnabled;
441
434
  }
442
435
  EditorGUI.indentLevel--;
443
436
  GUI.enabled = true;
@@ -704,10 +697,8 @@ public class VoxelWorldEditor : UnityEditor.Editor {
704
697
  Vector3Int voxelPos = lastPos;
705
698
  ushort oldValue =
706
699
  world.GetVoxelAt(voxelPos); // Assuming you have a method to get the voxel value
707
-
708
- VoxelEditManager voxelEditManager = VoxelEditManager.Instance;
709
700
 
710
- voxelEditManager.AddEdit(world, voxelPos, oldValue, 0, "Delete Voxel");
701
+ VoxelEditManager.AddEdit(world, voxelPos, oldValue, 0, "Delete Voxel");
711
702
 
712
703
  if (leftControlDown == false) {
713
704
  //Refresh the gizmo like we just moved the mouse here
@@ -728,15 +719,13 @@ public class VoxelWorldEditor : UnityEditor.Editor {
728
719
  world.GetVoxelAt(voxelPos); // Assuming you have a method to get the voxel value
729
720
  ushort newValue = (ushort)world.selectedBlockIndex;
730
721
 
731
- VoxelEditManager voxelEditManager = VoxelEditManager.Instance;
732
-
733
722
  var def = world.voxelBlocks.GetBlock(newValue);
734
723
 
735
724
  if (def.definition.rotatedPlacement) {
736
725
  newValue = (ushort)VoxelWorld.SetVoxelFlippedBits(newValue, (int)placementFlip);
737
726
  }
738
727
 
739
- voxelEditManager.AddEdit(world, voxelPos, oldValue, newValue,
728
+ VoxelEditManager.AddEdit(world, voxelPos, oldValue, newValue,
740
729
  "Add Voxel " + def.definition.name);
741
730
 
742
731
 
@@ -772,7 +761,7 @@ public class VoxelWorldEditor : UnityEditor.Editor {
772
761
  if (oldColor.r == 0) colIncr = 1; // If just being lightly painted to mark as receiving color
773
762
  newCol = new Color32((byte) (Math.Min(oldColor.r + colIncr, 255)), oldColor.g, oldColor.b, oldColor.a);
774
763
  }
775
- VoxelEditManager.Instance.ColorVoxel(world, voxelPos, newCol);
764
+ VoxelEditManager.ColorVoxel(world, voxelPos, newCol);
776
765
  }
777
766
  }
778
767
  }
@@ -789,7 +778,7 @@ public class VoxelWorldEditor : UnityEditor.Editor {
789
778
  if (oldBlockId > 0) {
790
779
  var edits = new List<EditInfo>();
791
780
  PaintBucket(world, edits, lastPos, oldValue, (ushort) world.selectedBlockIndex, new HashSet<Vector3>());
792
- VoxelEditManager.Instance.AddEdits(world, edits, "Paint Bucket");
781
+ VoxelEditManager.AddEdits(world, edits, "Paint Bucket");
793
782
  }
794
783
  }
795
784
  }
@@ -816,12 +805,10 @@ public class VoxelWorldEditor : UnityEditor.Editor {
816
805
  flipBits %= 8;
817
806
  newValue = (ushort)VoxelWorld.SetVoxelFlippedBits(newValue, flipBits);
818
807
 
819
- VoxelEditManager voxelEditManager = VoxelEditManager.Instance;
820
-
821
808
  var def = world.voxelBlocks.GetBlock(newValue);
822
809
 
823
810
  //newValue = (ushort)VoxelWorld.SetVoxelFlippedBits(newValue, 0x04 );
824
- voxelEditManager.AddEdit(world, lastPos, oldValue, newValue, "Flip Voxel " + def.definition.name);
811
+ VoxelEditManager.AddEdit(world, lastPos, oldValue, newValue, "Flip Voxel " + def.definition.name);
825
812
  }
826
813
  //Refresh the view
827
814
  UpdateHandlePosition(world);
@@ -6,7 +6,7 @@ TextureImporter:
6
6
  serializedVersion: 13
7
7
  mipmaps:
8
8
  mipMapMode: 0
9
- enableMipMap: 1
9
+ enableMipMap: 0
10
10
  sRGBTexture: 1
11
11
  linearTexture: 0
12
12
  fadeOut: 0
@@ -666,8 +666,8 @@ namespace Mirror
666
666
 
667
667
  if (prefabs.ContainsKey(prefab.assetId))
668
668
  {
669
- GameObject existingPrefab = prefabs[prefab.assetId];
670
- Debug.LogWarning($"Replacing existing prefab with assetId '{prefab.assetId}'. Old prefab '{existingPrefab.name}', New prefab '{prefab.name}'");
669
+ // GameObject existingPrefab = prefabs[prefab.assetId];
670
+ // Debug.LogWarning($"Replacing existing prefab with assetId '{prefab.assetId}'. Old prefab '{existingPrefab.name}', New prefab '{prefab.name}'");
671
671
  }
672
672
 
673
673
  if (spawnHandlers.ContainsKey(prefab.assetId) || unspawnHandlers.ContainsKey(prefab.assetId))
@@ -90,6 +90,7 @@ namespace Mirror
90
90
  public static void Pack<T>(T message, NetworkWriter writer)
91
91
  where T : struct, NetworkMessage
92
92
  {
93
+ // Debug.Log($"Packing msgId={NetworkMessageId<T>.Id}");
93
94
  writer.WriteUShort(NetworkMessageId<T>.Id);
94
95
  writer.Write(message);
95
96
  }
@@ -924,6 +924,8 @@ namespace Mirror
924
924
  NetworkMessages.Lookup[msgType] = typeof(T);
925
925
 
926
926
  handlers[msgType] = NetworkMessages.WrapHandler(handler, requireAuthentication, exceptionsDisconnect);
927
+
928
+ // Debug.Log($"Registered handler id={msgType}");
927
929
  }
928
930
 
929
931
  /// <summary>Register a handler for message type T. Most should require authentication.</summary>
@@ -941,6 +943,7 @@ namespace Mirror
941
943
  NetworkMessages.Lookup[msgType] = typeof(T);
942
944
 
943
945
  handlers[msgType] = NetworkMessages.WrapHandler(handler, requireAuthentication, exceptionsDisconnect);
946
+ // Debug.Log($"Registered handler id={msgType}");
944
947
  }
945
948
 
946
949
  /// <summary>Replace a handler for message type T. Most should require authentication.</summary>
@@ -67,7 +67,7 @@ namespace Nobi.UiRoundedCorners {
67
67
  if (shader == null) return;
68
68
 
69
69
  material = new Material(shader) {
70
- hideFlags = HideFlags.DontSave
70
+ // hideFlags = HideFlags.DontSave
71
71
  };
72
72
  }
73
73
 
@@ -151,7 +151,7 @@ namespace Adrenak.UniVoice {
151
151
 
152
152
  void Log(string tag, string msg) {
153
153
  if (!Application.isEditor) {
154
- Debug.Log($"[{tag}] {msg}");
154
+ // Debug.Log($"[{tag}] {msg}");
155
155
  }
156
156
  }
157
157
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg.easy.airship",
3
- "version": "0.1.2112",
3
+ "version": "0.1.2113",
4
4
  "displayName": "Airship",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "12f1",