Skip to content

Commit

Permalink
Icosa Gallery added in
Browse files Browse the repository at this point in the history
  • Loading branch information
TimAidley committed Mar 20, 2023
1 parent 28c179d commit 41b39df
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 5 deletions.
77 changes: 77 additions & 0 deletions Assets/Prefabs/Utility/ResourceCollectionFactory.prefab
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1186575691
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1186575692}
m_Layer: 0
m_Name: PolySketchSet
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1186575692
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1186575691}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1197480599120525051}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &181213052578665738
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -89,6 +120,8 @@ Transform:
m_Children:
- {fileID: 7352678666177677243}
- {fileID: 5817307013886715331}
- {fileID: 1186575692}
- {fileID: 8866470003074788290}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand All @@ -104,6 +137,50 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 730833d9ce6a4ef69dbcb1aefa319085, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &620338092573772038
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8866470003074788290}
- component: {fileID: 1706921022958993577}
m_Layer: 0
m_Name: IcosaCollectionFactory
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8866470003074788290
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 620338092573772038}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1197480599120525051}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1706921022958993577
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 620338092573772038}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b0bb2e4292a84736a61a785ac4d1e60d, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &7586609730876914498
GameObject:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/GUI/SketchbookPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected override void OnStart()
{
$"file:///{App.UserSketchPath()}",
"feed:https://timaidley.github.io/open-brush-feed/sketches.rss",
"poly:",
IcosaCollection.AllAssetsUri.OriginalString,
"googledrive:"
}.Select(uri => new Stack<ISketchSet>(new[] { SketchCatalog.m_Instance.GetSketchSet(uri) })).ToArray();

Expand Down
8 changes: 4 additions & 4 deletions Assets/Scripts/ResourceSystem/IcosaCollectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ public class IcosaCollectionFactory : MonoBehaviour, IResourceCollectionFactory
public IResourceCollection Create(Uri uri)
{
Assert.AreEqual(uri.Scheme, Scheme);
return new FeedCollection(App.HttpClient, uri);
return new IcosaCollection(App.HttpClient, new Uri(uri.AbsoluteUri));
}
}

public class IcosaCollection : IResourceCollection
{
private string m_User;
private HttpClient m_httpClient;
public static Uri AllAssetsUri => new Uri("https://api.icosa.gallery/assets");
public static Uri AllAssetsUri => new Uri("icosa:https://api.icosa.gallery/assets");

public static Uri CreateUserUri(string user)
{
return new Uri($"https://api.icosa.gallery/users/{user}/assets");
return new Uri($"icosa:https://api.icosa.gallery/users/{user}/assets");
}

public IcosaCollection(HttpClient httpClient, Uri uri)
{
if (uri.Segments.Length > 1)
if (uri.Segments.Contains("users"))
{
m_User = uri.Segments[uri.Segments.Length - 2];
Name = $"Icosa : {m_User}";
Expand Down

0 comments on commit 41b39df

Please sign in to comment.