From ee6adabf4ef79ddcbc1637d694ca25b2d5e5186e Mon Sep 17 00:00:00 2001 From: Yan Jin Date: Thu, 9 Jan 2025 15:41:57 -0800 Subject: [PATCH] INTG-2300 Add API for fetching workspaces from proj --- Runtime/Scripts/Data/Entities/InworldProjectData.cs | 6 ++++++ .../Scripts/Data/ScriptableObjects/InworldUserSetting.cs | 1 + 2 files changed, 7 insertions(+) diff --git a/Runtime/Scripts/Data/Entities/InworldProjectData.cs b/Runtime/Scripts/Data/Entities/InworldProjectData.cs index ade3e30..eccd5e1 100644 --- a/Runtime/Scripts/Data/Entities/InworldProjectData.cs +++ b/Runtime/Scripts/Data/Entities/InworldProjectData.cs @@ -45,6 +45,12 @@ public class InworldProjectData public List workspaceInfo; public List ownerInfo; public List collaboratorInfo; + + [JsonIgnore] public string DisplayName => name.Substring(name.LastIndexOf('/') + 1); + + [JsonIgnore] + public List WorkspaceList => workspaceInfo.Select(ws => ws.displayName).ToList(); + } [Serializable] public class ListProjectResponse diff --git a/Runtime/Scripts/Data/ScriptableObjects/InworldUserSetting.cs b/Runtime/Scripts/Data/ScriptableObjects/InworldUserSetting.cs index 7cd0e61..66f63eb 100644 --- a/Runtime/Scripts/Data/ScriptableObjects/InworldUserSetting.cs +++ b/Runtime/Scripts/Data/ScriptableObjects/InworldUserSetting.cs @@ -100,6 +100,7 @@ public string ID /// Get the workspace list by workspace full name. /// public List WorkspaceList => m_Workspaces.Select(ws => ws.displayName).ToList(); + public InworldProjectData GetProjectByDisplayName(string displayName) => m_Projects.FirstOrDefault(proj => proj.name.Contains(displayName)); /// /// Get the workspace full name by its display name ///