gg.easy.airship 0.1.2153 → 0.1.2154
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.
- package/Editor/TypescriptServices/Editor/TypescriptLogService.cs +2 -2
- package/Editor/TypescriptServices/TypescriptServices.cs +38 -15
- package/Runtime/Code/Player/Character/Animation/CharacterAnimationHelper.cs +10 -4
- package/Runtime/Code/Player/Character/MovementSystems/Character/CharacterMovement.cs +5 -1
- package/package.json +1 -1
|
@@ -140,12 +140,12 @@ namespace Airship.Editor {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
internal static void StartLogging() {
|
|
143
|
+
if (started) return;
|
|
144
|
+
|
|
143
145
|
if (!Directory.Exists(LogFolder)) {
|
|
144
146
|
Directory.CreateDirectory(LogFolder);
|
|
145
147
|
}
|
|
146
148
|
|
|
147
|
-
if (started) return;
|
|
148
|
-
|
|
149
149
|
string logDir = Path.GetDirectoryName(Application.consoleLogPath);
|
|
150
150
|
logPath = LogFilePath;
|
|
151
151
|
prevLogPath = LogFilePrevPath; // lol
|
|
@@ -48,7 +48,7 @@ namespace Airship.Editor {
|
|
|
48
48
|
/// <summary>
|
|
49
49
|
/// Main static class for handling the TypeScript services
|
|
50
50
|
/// </summary>
|
|
51
|
-
public
|
|
51
|
+
public class TypescriptServices : AssetPostprocessor {
|
|
52
52
|
internal static event CompilerCrashEvent CompilerCrash;
|
|
53
53
|
|
|
54
54
|
/// <summary>
|
|
@@ -87,10 +87,18 @@ namespace Airship.Editor {
|
|
|
87
87
|
Debug.LogWarning("[TypescriptServices] Skipped, in Airship Player mode");
|
|
88
88
|
return;
|
|
89
89
|
#endif
|
|
90
|
+
TypescriptLogService.StartLogging();
|
|
91
|
+
|
|
90
92
|
// On project load we'll force a full compile to try and get all the refs up to date
|
|
91
93
|
if (!SessionState.GetBool("TypescriptInitialBoot", false) && IsValidEditorContext) {
|
|
92
94
|
SessionState.SetBool("TypescriptInitialBoot", true);
|
|
93
|
-
|
|
95
|
+
|
|
96
|
+
if (HasAllPackagesDownloaded()) {
|
|
97
|
+
TypescriptCompilationService.BuildTypescript(TypeScriptCompileFlags.FullClean | TypeScriptCompileFlags.Setup | TypeScriptCompileFlags.DisplayProgressBar);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
TypescriptLogService.LogWarning("Skipped precompile due to not having packages downloaded yet");
|
|
101
|
+
}
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
// If a server or clone - ignore
|
|
@@ -145,20 +153,31 @@ namespace Airship.Editor {
|
|
|
145
153
|
}
|
|
146
154
|
}
|
|
147
155
|
|
|
156
|
+
#if !AIRSHIP_PLAYER
|
|
157
|
+
private static bool assetDbReady = false;
|
|
158
|
+
// ReSharper disable once Unity.IncorrectMethodSignature
|
|
159
|
+
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
|
|
160
|
+
string[] movedFromAssetPaths, bool didDomainReload) {
|
|
161
|
+
if (!IsValidEditorContext || !didDomainReload) return;
|
|
162
|
+
if (!assetDbReady) assetDbReady = true;
|
|
163
|
+
}
|
|
164
|
+
#endif
|
|
165
|
+
|
|
148
166
|
private static bool HasAllPackagesDownloaded() {
|
|
167
|
+
if (!assetDbReady) return false;
|
|
168
|
+
|
|
149
169
|
var gameConfig = GameConfig.Load();
|
|
150
|
-
|
|
151
|
-
if (!project.localSource && !project.IsDownloaded()) return false;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return true;
|
|
170
|
+
return gameConfig != null && gameConfig.packages.All(project => project.localSource || project.IsDownloaded());
|
|
155
171
|
}
|
|
156
172
|
|
|
157
173
|
private static IEnumerator InitializeProject() {
|
|
158
174
|
TypescriptProjectsService.ReloadProjects();
|
|
159
175
|
TypescriptCompilationService.ClearIncrementalCache(); // clear incremental cache
|
|
176
|
+
TypescriptLogService.LogInfo("Checking and waiting for packages to download...");
|
|
160
177
|
yield return new WaitUntil(HasAllPackagesDownloaded);
|
|
178
|
+
TypescriptLogService.LogInfo("Packages are OK, will now initialize TypeScript");
|
|
161
179
|
yield return InitializeTypeScript();
|
|
180
|
+
TypescriptLogService.LogInfo("TypeScript initialized, now starting the TypeScript runtime");
|
|
162
181
|
yield return StartTypescriptRuntime();
|
|
163
182
|
}
|
|
164
183
|
|
|
@@ -193,12 +212,13 @@ namespace Airship.Editor {
|
|
|
193
212
|
|
|
194
213
|
private static IEnumerator StartTypescriptRuntime() {
|
|
195
214
|
TypescriptProjectsService.ReloadProject();
|
|
215
|
+
|
|
196
216
|
|
|
197
217
|
// Wait for updates
|
|
198
|
-
if (AirshipUpdateService.IsUpdatingAirship || AirshipPackagesWindow.IsModifyingPackages) {
|
|
218
|
+
if (AirshipUpdateService.IsUpdatingAirship || AirshipPackagesWindow.IsModifyingPackages || !HasAllPackagesDownloaded()) {
|
|
199
219
|
IsAwaitingRestart = true;
|
|
200
220
|
yield return new WaitUntil(() =>
|
|
201
|
-
!AirshipPackagesWindow.IsModifyingPackages && !AirshipUpdateService.IsUpdatingAirship);
|
|
221
|
+
!AirshipPackagesWindow.IsModifyingPackages && !AirshipUpdateService.IsUpdatingAirship && HasAllPackagesDownloaded());
|
|
202
222
|
IsAwaitingRestart = false;
|
|
203
223
|
}
|
|
204
224
|
|
|
@@ -228,6 +248,7 @@ namespace Airship.Editor {
|
|
|
228
248
|
return;
|
|
229
249
|
}
|
|
230
250
|
|
|
251
|
+
TypescriptLogService.LogInfo("Enforcing default config settings");
|
|
231
252
|
project.EnforceDefaultConfigurationSettings();
|
|
232
253
|
CompilerCrash += OnCrash;
|
|
233
254
|
|
|
@@ -243,6 +264,7 @@ namespace Airship.Editor {
|
|
|
243
264
|
}
|
|
244
265
|
|
|
245
266
|
if (!SessionState.GetBool("InitializedTypescriptServices", false)) {
|
|
267
|
+
TypescriptLogService.LogInfo("Running initial setup for TypeScript services");
|
|
246
268
|
SessionState.SetBool("InitializedTypescriptServices", true);
|
|
247
269
|
TypescriptCompilationService.StopCompilerServices();
|
|
248
270
|
|
|
@@ -259,6 +281,7 @@ namespace Airship.Editor {
|
|
|
259
281
|
}
|
|
260
282
|
}
|
|
261
283
|
else {
|
|
284
|
+
TypescriptLogService.LogInfo("Attempting to resume TypeScript compilation services...");
|
|
262
285
|
TypescriptCompilationService.StopCompilerServices(shouldRestart: TypescriptCompilationService.IsWatchModeRunning);
|
|
263
286
|
}
|
|
264
287
|
|
|
@@ -324,12 +347,12 @@ namespace Airship.Editor {
|
|
|
324
347
|
invokedCrashEvent = false;
|
|
325
348
|
}
|
|
326
349
|
|
|
327
|
-
var shouldAutostart = !IsCompilerActive && !TypescriptCompilationService.Crashed &&
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (!shouldAutostart) return;
|
|
331
|
-
TypescriptLogService.LogWarning("Found compiler inactive, doing an automatic restart");
|
|
332
|
-
EditorCoroutines.Execute(StartTypescriptRuntime());
|
|
350
|
+
// var shouldAutostart = !IsCompilerActive && !TypescriptCompilationService.Crashed &&
|
|
351
|
+
// ShouldCompilerBeRunning && !IsAwaitingRestart && !IsCompilerStoppedByUser && HasAllPackagesDownloaded();
|
|
352
|
+
//
|
|
353
|
+
// if (!shouldAutostart) return;
|
|
354
|
+
// TypescriptLogService.LogWarning("Found compiler inactive, doing an automatic restart");
|
|
355
|
+
// EditorCoroutines.Execute(StartTypescriptRuntime());
|
|
333
356
|
}
|
|
334
357
|
}
|
|
335
358
|
}
|
|
@@ -204,18 +204,26 @@ namespace Code.Player.Character.NetworkedMovement
|
|
|
204
204
|
|
|
205
205
|
public void SetVelocity(Vector3 localVel)
|
|
206
206
|
{
|
|
207
|
+
currentSpeed = new Vector2(localVel.x, localVel.z).magnitude;
|
|
207
208
|
//The target speed is the movement speed the animations were built for
|
|
208
209
|
var targetSpeed = animWalkSpeed;
|
|
209
210
|
if (currentState == CharacterState.Sprinting)
|
|
210
211
|
{
|
|
211
|
-
|
|
212
|
+
if (currentSpeed < animWalkSpeed) {
|
|
213
|
+
//We will walk instead of run even though we are trying to run
|
|
214
|
+
} else {
|
|
215
|
+
targetSpeed = animRunSpeed;
|
|
216
|
+
}
|
|
212
217
|
}
|
|
213
218
|
else if (currentState == CharacterState.Crouching)
|
|
214
219
|
{
|
|
215
220
|
targetSpeed = animCrouchSpeed;
|
|
216
221
|
}
|
|
222
|
+
|
|
223
|
+
//Have to update sprinting state dynamically because low speeds can disable it
|
|
224
|
+
animator.SetBool("Sprinting",
|
|
225
|
+
currentState == CharacterState.Sprinting && currentSpeed >= animWalkSpeed);
|
|
217
226
|
|
|
218
|
-
currentSpeed = new Vector2(localVel.x, localVel.z).magnitude;
|
|
219
227
|
this.targetPlaybackSpeed = currentSpeed / targetSpeed;
|
|
220
228
|
targetVelNormalized = new Vector2(localVel.x, localVel.z).normalized;
|
|
221
229
|
verticalVel = Mathf.Clamp(localVel.y, -10, 10);
|
|
@@ -233,8 +241,6 @@ namespace Code.Player.Character.NetworkedMovement
|
|
|
233
241
|
this.grounded = syncedState.grounded;
|
|
234
242
|
animator.SetBool("Grounded", grounded);
|
|
235
243
|
animator.SetBool("Crouching", syncedState.crouching || syncedState.state == CharacterState.Crouching);
|
|
236
|
-
animator.SetBool("Sprinting",
|
|
237
|
-
!syncedState.crouching && (syncedState.sprinting || syncedState.state == CharacterState.Sprinting));
|
|
238
244
|
|
|
239
245
|
if (syncedState.jumping) {
|
|
240
246
|
SetTrigger("Jump");
|
|
@@ -553,7 +553,7 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
553
553
|
*/
|
|
554
554
|
var isMoving = currentVelocity.sqrMagnitude > .1f;
|
|
555
555
|
var inAir = didJump || (!detectedGround && !currentMoveSnapshot.prevStepUp);
|
|
556
|
-
var tryingToSprint =
|
|
556
|
+
var tryingToSprint = movementSettings.onlySprintForward
|
|
557
557
|
? command.sprint && graphicTransform.InverseTransformVector(command.moveDir).z > 0.1f
|
|
558
558
|
: //Only sprint if you are moving forward
|
|
559
559
|
command.sprint && command.moveDir.magnitude > 0.1f; //Only sprint if you are moving
|
|
@@ -579,6 +579,10 @@ namespace Code.Player.Character.MovementSystems.Character {
|
|
|
579
579
|
groundedState = CharacterState.Idle;
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
+
if (groundedState == CharacterState.Crouching) {
|
|
583
|
+
tryingToSprint = false;
|
|
584
|
+
}
|
|
585
|
+
|
|
582
586
|
//If you are in the air override the state
|
|
583
587
|
if (inAir) {
|
|
584
588
|
currentMoveSnapshot.state = CharacterState.Airborne;
|