Skip to content

Commit

Permalink
feat: add samples
Browse files Browse the repository at this point in the history
  • Loading branch information
jonisavo committed May 12, 2022
1 parent 14a813d commit f4c0ccf
Show file tree
Hide file tree
Showing 66 changed files with 99 additions and 109 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/upm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
git config --global user.email '[email protected]'
- name: Copy meta files to package folder
run: cp CHANGELOG.md CHANGELOG.md.meta LICENSE.md LICENSE.md.meta README.md README.md.meta "$UICOMPONENTS_PATH"
- name: Copy samples to package folder
run: |
cp -r Assets/Samples/ "$UICOMPONENTS_PATH"/Samples~
rm "$UICOMPONENTS_PATH"/Samples~/*.meta
- name: Create commit for the meta files
run: |
git add -A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ MonoBehaviour:
m_Address: Assets/UIComponents.Tests/Addressables/Assets/Component.uxml
m_ReadOnly: 0
m_SerializedLabels: []
- m_GUID: 3f5abc4da50c49b8b1d34cf4fa50850a
m_Address: Assets/Examples/Addressables/Data/AddressablesExampleComponent.uss
- m_GUID: e9bbd2fb164840019750b795061e4bf2
m_Address: Assets/Samples/Addressables/Data/AddressablesExampleComponent.uxml
m_ReadOnly: 0
m_SerializedLabels: []
- m_GUID: e9bbd2fb164840019750b795061e4bf2
m_Address: Assets/Examples/Addressables/Data/AddressablesExampleComponent.uxml
- m_GUID: 3f5abc4da50c49b8b1d34cf4fa50850a
m_Address: Assets/Samples/Addressables/Data/AddressablesExampleComponent.uss
m_ReadOnly: 0
m_SerializedLabels: []
m_ReadOnly: 0
Expand Down
3 changes: 0 additions & 3 deletions Assets/Examples/Editor.meta

This file was deleted.

23 changes: 0 additions & 23 deletions Assets/Examples/Editor/AssetDatabaseExampleComponentWindow.cs

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions Assets/Examples/Editor/LoadFromAssetDatabase.meta

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions Assets/Examples/UIComponentsExamples.asmdef.meta

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using UIComponents;
using UIComponents.Addressables;
using UIComponents.Addressables;

namespace UIComponentsExamples.Addressables
namespace UIComponents.Samples.Addressables
{
[AssetPath("Assets/Examples/Addressables/Data")]
[AssetPath("Assets/Samples/Addressables/Data")]
[Layout("AddressablesExampleComponent.uxml")]
[Stylesheet("AddressablesExampleComponent.uss")]
[Dependency(typeof(IAssetResolver), provide: typeof(AddressableAssetResolver))]
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;

namespace UIComponentsExamples.Addressables.Editor
namespace UIComponents.Samples.Addressables.Editor
{
public class AddressablesExampleComponentWindow : EditorWindow
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "UIComponentsExamples.Addressables.Editor",
"rootNamespace": "UIComponentsExamples",
"name": "UIComponents.Samples.Addressables.Editor",
"rootNamespace": "UIComponents.Samples",
"references": [
"GUID:d593635333b4cae48bac5b5f0b596e90",
"GUID:12a73a47a9014699b2fba61bc5f9a0dc",
"GUID:3784f1f14a0a4923ae912fdf829426a8",
"GUID:9e24947de15b9834991c9d8411ea37cf",
"GUID:84651a3751eca9349aac36a66bba901b"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "UIComponentsExamples.Addressables",
"rootNamespace": "UIComponentsExamples",
"name": "UIComponents.Samples.Addressables",
"rootNamespace": "UIComponents.Samples",
"references": [
"GUID:d593635333b4cae48bac5b5f0b596e90",
"GUID:12a73a47a9014699b2fba61bc5f9a0dc",
"GUID:9e24947de15b9834991c9d8411ea37cf",
"GUID:34063fb90481ae5469861eb4a68e5445",
"GUID:84651a3751eca9349aac36a66bba901b"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using UIComponents;
using UnityEngine.UIElements;
using UnityEngine.UIElements;

namespace UIComponentsExamples
namespace UIComponents.Samples.Counter
{
[Dependency(typeof(ICounterService), provide: typeof(CounterService))]
public class CounterComponent : UIComponent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UIComponentsExamples
namespace UIComponents.Samples.Counter
{
public class CounterService : ICounterService
{
Expand Down
3 changes: 3 additions & 0 deletions Assets/Samples/Counter/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;

namespace UIComponentsExamples.Editor
namespace UIComponents.Samples.Counter.Editor
{
public class CounterComponentWindow : EditorWindow
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "UIComponentsExamples.Editor",
"rootNamespace": "UIComponentsExamples.Editor",
"name": "UIComponents.Samples.Counter.Editor",
"rootNamespace": "UIComponents.Samples",
"references": [
"GUID:d593635333b4cae48bac5b5f0b596e90",
"GUID:7282a494dd2226f45a32fcf2256d7c89",
"GUID:12a73a47a9014699b2fba61bc5f9a0dc"
"GUID:85e613970e1a4b2da36dc72b51d4b4d0"
],
"includePlatforms": [
"Editor"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace UIComponentsExamples
namespace UIComponents.Samples.Counter
{
public interface ICounterService
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "UIComponentsExamples",
"rootNamespace": "UIComponentsExamples",
"name": "UIComponents.Samples.Counter",
"rootNamespace": "UIComponents.Samples",
"references": [
"GUID:d593635333b4cae48bac5b5f0b596e90"
],
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions Assets/Samples/Resources/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using UnityEditor;
using UnityEngine;

namespace UIComponentsExamples.Editor
namespace UIComponents.Samples.Resources.Editor
{
public class ResourcesExampleComponentWindow : EditorWindow
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "UIComponents.Samples.Resources.Editor",
"rootNamespace": "UIComponents.Samples",
"references": [
"GUID:d593635333b4cae48bac5b5f0b596e90",
"GUID:af36ccbbcbfb40b09be04c65626bd552"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using UIComponents;

namespace UIComponentsExamples
namespace UIComponents.Samples.Resources
{
/// <summary>
/// Assets are loaded from Resources by default.
Expand Down
16 changes: 16 additions & 0 deletions Assets/Samples/Resources/UIComponents.Samples.Resources.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "UIComponents.Samples.Resources",
"rootNamespace": "UIComponents.Samples",
"references": [
"GUID:d593635333b4cae48bac5b5f0b596e90"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Assets/UIComponents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@
"uielements",
"library"
],
"samples": [
{
"displayName": "CounterComponent (Dependency injection)",
"description": "Contains an example of simple dependency injection.",
"path": "Samples~/Counter"
},
{
"displayName": "Asset Loading from Resources",
"description": "Contains an example of asset loading from Resources.",
"path": "Samples~/Resources"
},
{
"displayName": "Asset Loading from Addressables",
"description": "Contains an example of asset loading from Addressables.",
"path": "Samples~/Addressables"
}
],
"license": "MIT",
"changelogUrl": "https://github.com/jonisavo/uicomponents/blob/main/CHANGELOG.md",
"documentationUrl": "https://github.com/jonisavo/uicomponents/blob/main/README.md",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ This creates a component which can be used to increment a number.
**Each instance of CounterComponent receives the same instance of
CounterService.**

![CounterComponent in action](https://github.com/jonisavo/uicomponents/blob/main/Assets/Examples/Counter/counter.gif?raw=true)
![CounterComponent in action](https://github.com/jonisavo/uicomponents/blob/main/Assets/Samples/Counter/counter.gif?raw=true)

### Get dependency safely

Expand Down

0 comments on commit f4c0ccf

Please sign in to comment.