gg.easy.airship 0.1.2159 → 0.1.2160

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.
@@ -132,6 +132,7 @@ public class AccessoryCollectionTools {
132
132
  // }
133
133
 
134
134
 
135
+ #if AIRSHIP_INTERNAL
135
136
  [MenuItem("Airship/Avatar/Create Outfit Accessories from Mesh %f8", true)]
136
137
  [MenuItem("Assets/Create/Airship/Accessories/Create Outfit Accessories from Mesh", true)]
137
138
  private static bool ValidateCreateAccFromMesh(){
@@ -159,14 +160,16 @@ public class AccessoryCollectionTools {
159
160
  return Selection.GetFiltered<GameObject>(AssetModeMask).Length == 1;
160
161
  }
161
162
 
162
- [MenuItem("Airship/Avatar/Create Accessory from Mesh %f8")]
163
- [MenuItem("Assets/Create/Airship/Accessories/Create Accessory from Mesh")]
163
+ [MenuItem("Airship/Avatar/Create Accessory from Mesh %f8", false, 100)]
164
+ [MenuItem("Assets/Create/Airship/Accessories/Create Accessory from Mesh", false, 100)]
164
165
  static void CreateSingleAccFromMesh() {
165
166
  processedPaths.Clear();
166
167
  // defaultMat = AssetDatabase.LoadAssetAtPath<Material>("Assets/AirshipPackages/@Easy/CoreMaterials//MaterialLibrary/Organic/Clay.mat");
167
168
  UnpackSingleObject(Selection.GetFiltered<GameObject>(AssetModeMask)[0]);
168
169
  }
169
170
 
171
+ #endif
172
+
170
173
  private static void UnpackSingleObject(GameObject rootGo){
171
174
  string rootPath = AssetDatabase.GetAssetPath(rootGo.GetInstanceID());
172
175
  string fileName = Path.GetFileNameWithoutExtension(rootPath);
@@ -67,6 +67,8 @@ namespace Editor {
67
67
 
68
68
  FileUtil.DeleteFileOrDirectory("build/StandaloneLinux64");
69
69
 
70
+ // This should probably be NamedBuildTarget.Server (rather than Standalone), but that does cause some issues.
71
+ // We will want to review this again in the future as a possible optimization.
70
72
  PlayerSettings.SetScriptingBackend(NamedBuildTarget.Standalone, ScriptingImplementation.IL2CPP);
71
73
  PlayerSettings.dedicatedServerOptimizations = true;
72
74
  PlayerSettings.insecureHttpOption = InsecureHttpOption.AlwaysAllowed;
@@ -194,7 +196,7 @@ namespace Editor {
194
196
 
195
197
  UserBuildSettings.architecture = OSArchitecture.x64ARM64;
196
198
  PlayerSettings.SplashScreen.show = false;
197
- PlayerSettings.SetScriptingBackend(NamedBuildTarget.Standalone, ScriptingImplementation.IL2CPP);
199
+ PlayerSettings.SetScriptingBackend(NamedBuildTarget.iOS, ScriptingImplementation.IL2CPP);
198
200
  var options = new BuildPlayerOptions();
199
201
  options.scenes = scenes;
200
202
  options.locationPathName = "build/client_ios";
@@ -238,7 +238,7 @@ namespace Editor.Packages {
238
238
  var style = new GUIStyle(EditorStyles.textField);
239
239
 
240
240
  this.addPackageId = EditorGUILayout.TextField("Package ID", this.addPackageId);
241
- EditorGUILayout.LabelField("Example: @Easy/Survival");
241
+ EditorGUILayout.LabelField("Example: @Easy/VoxelWorld");
242
242
  EditorGUILayout.Space(4);
243
243
 
244
244
  var addPackagePressed = GUILayout.Button("Add Package", GUILayout.Width(150));
@@ -288,7 +288,7 @@ namespace Editor.Packages {
288
288
  EditorGUILayout.Space(12);
289
289
  EditorGUILayout.BeginVertical();
290
290
  this.createPackageId = EditorGUILayout.TextField("Package ID", this.createPackageId);
291
- EditorGUILayout.LabelField("Example: @Easy/Survival");
291
+ EditorGUILayout.LabelField("Example: @Easy/VoxelWorld");
292
292
  EditorGUILayout.Space(4);
293
293
  if (GUILayout.Button("Create Package", GUILayout.Width(150))) {
294
294
  EditorCoroutineUtility.StartCoroutineOwnerless(CreateNewLocalSourcePackage(this.createPackageId));
@@ -18,7 +18,7 @@ public class AirshipCharacterEditor : MonoBehaviour {
18
18
  }
19
19
  }
20
20
 
21
- [MenuItem("Assets/Create/Airship/Viewmodel Variant", false, 1)]
21
+ [MenuItem("Assets/Create/Airship/Viewmodel Variant", false, -104)]
22
22
  static void CreateViewmodelVariant() {
23
23
  GameObject source =
24
24
  AssetDatabase.LoadAssetAtPath<GameObject>(
@@ -29,7 +29,7 @@ public class AirshipCharacterEditor : MonoBehaviour {
29
29
  Selection.activeObject = prefab;
30
30
  }
31
31
 
32
- [MenuItem("Assets/Create/Airship/Character Variant", false, 1)]
32
+ [MenuItem("Assets/Create/Airship/Character Variant", false, -105)]
33
33
  static void CreateCharacterVariant() {
34
34
  GameObject source =
35
35
  AssetDatabase.LoadAssetAtPath<GameObject>(
@@ -11,7 +11,7 @@ namespace Airship.Editor {
11
11
  internal static string AirshipComponentTemplate => PosixPath.Join(TemplatePath, "AirshipComponent.ts.txt");
12
12
  internal static string AirshipModuleTemplate => PosixPath.Join(TemplatePath, "AirshipModule.ts.txt");
13
13
 
14
- [MenuItem("Assets/Create/Airship/TypeScript File", false, 2)]
14
+ [MenuItem("Assets/Create/Airship/TypeScript File", false, 50)]
15
15
  private static void CreateNewComponentFile()
16
16
  {
17
17
  ProjectWindowUtil.CreateScriptAssetFromTemplateFile(AirshipComponentTemplate, "AirshipComponent.ts");
@@ -20,6 +20,8 @@ namespace Code.Authentication {
20
20
  public string editorUserId;
21
21
  public string editorUsername;
22
22
  public string editorProfileImageId;
23
+
24
+ public string passkey;
23
25
  }
24
26
  public struct LoginResponseMessage : NetworkMessage
25
27
  {
@@ -33,10 +35,19 @@ namespace Code.Authentication {
33
35
  }
34
36
 
35
37
  public class EasyAuthenticator : NetworkAuthenticator {
38
+ private string passkey = "empty";
39
+
36
40
  readonly HashSet<NetworkConnection> connectionsPendingDisconnect = new HashSet<NetworkConnection>();
37
41
 
38
42
  public int connectionCounter = 0;
39
43
 
44
+ private void Awake() {
45
+ TextAsset passkeyTextFile = Resources.Load<TextAsset>("ConnectPassKey");
46
+ if (passkeyTextFile) {
47
+ this.passkey = passkeyTextFile.text;
48
+ }
49
+ }
50
+
40
51
  public override void OnStartServer() {
41
52
  this.connectionCounter = 0;
42
53
 
@@ -72,6 +83,7 @@ namespace Code.Authentication {
72
83
  editorUserId = EditorAuthManager.localUser.uid,
73
84
  editorUsername = EditorAuthManager.localUser.username,
74
85
  editorProfileImageId = EditorAuthManager.localUser.profileImageId,
86
+ passkey = this.passkey,
75
87
  });
76
88
  return;
77
89
  }
@@ -91,6 +103,7 @@ namespace Code.Authentication {
91
103
  NetworkClient.Send(new LoginMessage {
92
104
  authToken = authToken,
93
105
  playerVersion = AirshipConst.playerVersion,
106
+ passkey = this.passkey,
94
107
  });
95
108
  return;
96
109
  }
@@ -100,6 +113,7 @@ namespace Code.Authentication {
100
113
  NetworkClient.Send(new LoginMessage {
101
114
  authToken = authToken,
102
115
  playerVersion = AirshipConst.playerVersion,
116
+ passkey = this.passkey,
103
117
  });
104
118
  }
105
119
 
@@ -115,6 +129,11 @@ namespace Code.Authentication {
115
129
  private async void Server_OnLoginMessage(NetworkConnectionToClient conn, LoginMessage loginData) {
116
130
  if (connectionsPendingDisconnect.Contains(conn)) return;
117
131
 
132
+ if (loginData.passkey != this.passkey) {
133
+ this.RejectConnection(conn, "Invalid passkey.", true);
134
+ return;
135
+ }
136
+
118
137
  #if UNITY_SERVER
119
138
  Debug.Log("Authenticating " + conn);
120
139
  #endif
@@ -171,10 +190,11 @@ namespace Code.Authentication {
171
190
  if (Application.isEditor && CrossSceneState.IsLocalServer()) {
172
191
  this.connectionCounter++;
173
192
  if (this.connectionCounter == 1 && loginMessage.editorUserId != null) {
193
+ string userId = InternalHttpManager.editorUserId ?? (this.connectionCounter + "");
174
194
  tcs.SetResult(new UserData() {
175
- uid = InternalHttpManager.editorUserId,
195
+ uid = userId,
176
196
  username = loginMessage.editorUsername,
177
- orgRoleName = "Dev",
197
+ orgRoleName = "Owner",
178
198
  profileImageId = loginMessage.editorProfileImageId,
179
199
  });
180
200
  return await tcs.Task;
@@ -182,7 +202,7 @@ namespace Code.Authentication {
182
202
  tcs.SetResult(new UserData() {
183
203
  uid = this.connectionCounter + "",
184
204
  username = "Player" + this.connectionCounter,
185
- orgRoleName = "Dev",
205
+ orgRoleName = "Owner",
186
206
  profileImageId = string.Empty,
187
207
  fullTransferPacket = "{}"
188
208
  });
@@ -286,6 +286,7 @@ public class ServerBootstrap : MonoBehaviour
286
286
  }
287
287
  this.airshipJWT = annotations["JWT"];
288
288
  UnityWebRequestProxyHelper.ProxyAuthCredentials = this.airshipJWT;
289
+ InternalHttpManager.authTokenSetTaskCompletionSource.SetResult(true);
289
290
  // Debug.Log("Airship JWT:");
290
291
  // Debug.Log(airshipJWT);
291
292
 
@@ -13,10 +13,13 @@ namespace Code.Http.Internal {
13
13
  public static string editorUserId;
14
14
  public static string editorAuthToken = "";
15
15
  public static string authToken = "";
16
- private static TaskCompletionSource<bool> authTokenSetTaskCompletionSource = new();
16
+ public static TaskCompletionSource<bool> authTokenSetTaskCompletionSource = new();
17
17
 
18
- static InternalHttpManager() {
19
- if (RunCore.IsServer()) {
18
+ // This handles the case when we are a server in editor dedicated mode.
19
+ // In this case, we immediately resolve the task because we will not have any auth token.
20
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
21
+ public static void OnLoad() {
22
+ if (RunCore.IsServer() && !RunCore.IsClient() && RunCore.IsEditor()) {
20
23
  authTokenSetTaskCompletionSource.TrySetResult(true);
21
24
  }
22
25
  }
@@ -27,7 +30,7 @@ namespace Code.Http.Internal {
27
30
  return HttpManager.GetAsync(url, GetHeaders());
28
31
  }
29
32
  #endif
30
-
33
+
31
34
  return authTokenSetTaskCompletionSource.Task.ContinueWith(_ => {
32
35
  return HttpManager.GetAsync(url, GetHeaders());
33
36
  }, TaskScheduler.FromCurrentSynchronizationContext()).Unwrap();
@@ -11,6 +11,7 @@ public class PlayerInfoDto {
11
11
  public string username;
12
12
  public string profileImageId;
13
13
  public string orgRoleName;
14
+ public string transferPacket;
14
15
  public GameObject gameObject;
15
16
  }
16
17
 
@@ -21,6 +22,7 @@ public class PlayerInfo : NetworkBehaviour {
21
22
  [SyncVar] public int connectionId;
22
23
  [SyncVar] public string profileImageId;
23
24
  [SyncVar] public string orgRoleName;
25
+ public string transferPacket;
24
26
  public AudioSource voiceChatAudioSource;
25
27
 
26
28
  private void Start() {
@@ -28,13 +30,14 @@ public class PlayerInfo : NetworkBehaviour {
28
30
  PlayerManagerBridge.Instance.AddPlayer(this);
29
31
  }
30
32
 
31
- public void Init(int connectionId, string userId, string username, string profileImageId, string orgRoleName) {
33
+ public void Init(int connectionId, string userId, string username, string profileImageId, string orgRoleName, string transferPacket) {
32
34
  this.gameObject.name = "Player_" + username;
33
35
  this.connectionId = connectionId;
34
36
  this.userId = userId;
35
37
  this.username = username;
36
38
  this.profileImageId = profileImageId;
37
39
  this.orgRoleName = orgRoleName;
40
+ this.transferPacket = transferPacket;
38
41
 
39
42
  this.InitVoiceChat();
40
43
  }
@@ -82,6 +85,7 @@ public class PlayerInfo : NetworkBehaviour {
82
85
  username = this.username,
83
86
  profileImageId = this.profileImageId,
84
87
  orgRoleName = this.orgRoleName,
88
+ transferPacket = this.transferPacket,
85
89
  gameObject = this.gameObject,
86
90
  };
87
91
  }
@@ -176,7 +176,7 @@ namespace Code.Player {
176
176
  var go = Instantiate(this.playerPrefab, Instance.transform.parent);
177
177
 
178
178
  var playerInfo = go.GetComponent<PlayerInfo>();
179
- playerInfo.Init(connectionId, userId, username, profilePictureId, string.Empty);
179
+ playerInfo.Init(connectionId, userId, username, profilePictureId, string.Empty, string.Empty);
180
180
 
181
181
  // var identity = go.GetComponent<NetworkIdentity>();
182
182
  NetworkServer.Spawn(go);
@@ -217,7 +217,7 @@ namespace Code.Player {
217
217
  // #if UNITY_SERVER || true
218
218
  // Debug.Log($"Initializing Player as {userData.username} owned by " + conn);
219
219
  // #endif
220
- playerInfo.Init(conn.connectionId, userData.uid, userData.username, userData.profileImageId, userData.orgRoleName);
220
+ playerInfo.Init(conn.connectionId, userData.uid, userData.username, userData.profileImageId, userData.orgRoleName, userData.fullTransferPacket);
221
221
  } else {
222
222
  #if UNITY_SERVER || true
223
223
  Debug.Log("Missing UserData for " + conn);
@@ -34,8 +34,7 @@ public abstract class Singleton<T> : MonoBehaviour where T : MonoBehaviour
34
34
  go.name = typeof(T).ToString();
35
35
 
36
36
  var coreScene = SceneManager.GetSceneByName("CoreScene");
37
- // if (!coreScene.isLoaded) return null;
38
- if (coreScene.IsValid()) {
37
+ if (coreScene.IsValid() && coreScene.isLoaded) {
39
38
  SceneManager.MoveGameObjectToScene(go, coreScene);
40
39
  }
41
40
 
@@ -131,7 +131,6 @@ namespace Code.Airship.Resources.VoxelRenderer.Editor {
131
131
  //Select this
132
132
  selection.gameObject.SetActive(true);
133
133
  Selection.activeGameObject = selection.gameObject;
134
- Debug.Log("select.1");
135
134
  }
136
135
 
137
136
  if (VoxelWorldEditorToolBase.buttonActive) {
@@ -141,7 +140,6 @@ namespace Code.Airship.Resources.VoxelRenderer.Editor {
141
140
  if (selection) {
142
141
  //Select the world
143
142
  Selection.activeGameObject = world.gameObject;
144
- Debug.Log("select.2");
145
143
  //disable it
146
144
  selection.gameObject.SetActive(false);
147
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gg.easy.airship",
3
- "version": "0.1.2159",
3
+ "version": "0.1.2160",
4
4
  "displayName": "Airship",
5
5
  "unity": "2021.3",
6
6
  "unityRelease": "12f1",