Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.2.1: Extended reference items and lists to be able to store persistent references to assets. #9

Merged
merged 3 commits into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,32 @@ If you can't see the latest version of Scriptable Framework in the package manag

## Roadmap

> Roadmap is subject to change. Last reviewed 14th of August 2019.
> Roadmap is subject to change. Last reviewed 19th of August 2019.

| Version | Defining Feature |
| ------- | ----------------------------------------------------------------------- |
| 1.3 | Automatic script and dependancy generation wizard |
| Version | Defining Feature |
| ------- | --------------------------------------------------------------------------- |
| 2.0 | Decouple RuntimeObjects from Resources folder using a RuntimeObjectDatabase |
| 2.1 | Automatic script and dependancy generation wizard |

---

## History

| Version | Defining Feature |
| ------- | ----------------------------------------------------------------------- |
| 1.2 | Added AppVersion API and string types for ValueList and ValueItem |
| 1.1 | Create a menu item to toggle event logging within the editor |
| 1.0 | Deploy on an internal npm registry |
| 0.10 | Add StateMachineController to control many StateMachines at once |
| 0.9 | Create scripting API documentation via DocFX and host on gitlab pages |
| 0.8 | Extracted styling API into its own package |
| 0.7 | Provide full unit test coverage for the core Scriptable Framework APIs |
| 0.6 | Complete Styling API |
| 0.5 | Provide icons for the various data and component types |
| 0.4 | Extend RuntimeItems and Lists with Reference and Value typing |
| 0.3 | RuntimeItems added |
| 0.2 | Upgrade to Unity 2018.3 for nested and variant prefabs |
| 0.1 | RuntimeLists, Event API and Statemachines |
| Version | Defining Feature |
| ------- | --------------------------------------------------------------------------- |
| 1.2 | Added AppVersion API and string types for ValueList and ValueItem |
| 1.1 | Create a menu item to toggle event logging within the editor |
| 1.0 | Deploy on an internal npm registry |
| 0.10 | Add StateMachineController to control many StateMachines at once |
| 0.9 | Create scripting API documentation via DocFX and host on gitlab pages |
| 0.8 | Extracted styling API into its own package |
| 0.7 | Provide full unit test coverage for the core Scriptable Framework APIs |
| 0.6 | Complete Styling API |
| 0.5 | Provide icons for the various data and component types |
| 0.4 | Extend RuntimeItems and Lists with Reference and Value typing |
| 0.3 | RuntimeItems added |
| 0.2 | Upgrade to Unity 2018.3 for nested and variant prefabs |
| 0.1 | RuntimeLists, Event API and Statemachines |

---

Expand Down
32 changes: 32 additions & 0 deletions Scriptable Framework/Assets/GameObject (2).prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3632367930637629523
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9157207383982155598}
m_Layer: 0
m_Name: GameObject (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &9157207383982155598
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3632367930637629523}
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_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
7 changes: 7 additions & 0 deletions Scriptable Framework/Assets/GameObject (2).prefab.meta

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

69 changes: 69 additions & 0 deletions Scriptable Framework/Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,72 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &8951008420740006091
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3632367930637629523, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_Name
value: GameObject (2)
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9157207383982155598, guid: ceb367ae6d7713344a5b72607240af0b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ceb367ae6d7713344a5b72607240af0b, type: 3}
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,28 @@ public class AppVersion : ScriptableObject
/// The major version number. For versions that should replace a prior major version.
/// </summary>
[Header ("Semantic Version")]
[Min (0)] [SerializeField] private int major;
[Min (0)] [SerializeField] private int major = 0;

/// <summary>
/// The minor version number. For versions that offer smaller improvements and additions.
/// </summary>
[Min (0)] [SerializeField] private int minor;
[Min (0)] [SerializeField] private int minor = 0;

/// <summary>
/// The patch version number. For versions that offer some kind of bug fix or incremental improvements.
/// </summary>
[Min (0)] [SerializeField] private int patch;
[Min (0)] [SerializeField] private int patch = 0;

/// <summary>
/// The type of release the software is intended for.
/// </summary>
[Header ("Release Suffix")]
[SearchableEnum] [SerializeField] private ReleaseType release;
[SearchableEnum] [SerializeField] private ReleaseType release = ReleaseType.Development;

/// <summary>
/// If an alpha or beta version, append this number to the end.
/// </summary>
[Min (0)] [SerializeField] private int releaseUpdate;
[Min (0)] [SerializeField] private int releaseUpdate = 0;

/// <summary>
/// Creates a string in the semver format according to the set values in the inspector.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class AppEvent : AppEventBase
/// <summary>
/// Returns the count of all listeners on this event.
/// </summary>
public int ListenerCount { get { return listeners.Count; } }
public new int ListenerCount => listeners.Count;

/// <summary>
/// Invoke every function callback that is delegated to every event listener that is listenning
Expand Down Expand Up @@ -98,18 +98,12 @@ public bool UnregisterListener (AppEventListener listener)
/// <summary>
/// Clear this event of all it's listeners
/// </summary>
public override void Clear ()
{
listeners.Clear ();
}
public override void Clear () => listeners.Clear ();

/// <summary>
/// Calls Clear ()
/// </summary>
public override void Reset ()
{
Clear ();
}
public override void Reset () => Clear ();
}

/// <summary>
Expand Down Expand Up @@ -143,7 +137,7 @@ public abstract class AppEvent<T> : AppEventBase
/// <summary>
/// Returns the count of all listeners on this event.
/// </summary>
public int ListenerCount { get { return listeners.Count; } }
public new int ListenerCount => listeners.Count;

/// <summary>
/// Invoke every function callback that is delegated to every event listener that is listenning
Expand Down Expand Up @@ -259,17 +253,21 @@ public override void Clear ()
/// <summary>
/// Calls Clear ()
/// </summary>
public override void Reset ()
{
Clear ();
}
public override void Reset () => Clear ();
}

/// <summary>
/// Base class for generic and non generic AppEvents
/// </summary>
public abstract class AppEventBase : RuntimeObject
{
public int ListenerCount { get; }

/*private void Awake ()
{
Resources.LoadAll<RuntimeObjectDatabase> ("/")[0].RegisterEvent (this);
}*/

/// <summary>
/// Invoke every function callback that is delegated to every event listener that is listenning
/// to this event.
Expand Down

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

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

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
Expand Up @@ -19,13 +19,22 @@ public abstract class ReferenceItem<T> : RuntimeItem<T> where T : class
[Space]
public T reference;

/// <summary>
/// If true, the <c>items</c> property will not be cleared on application start.
/// This is useful when wanting a persistent reference to another asset rather than a runtime
/// reference to an object in a scene.
/// </summary>
[Space]
[Header ("Editor Properties")]
public bool forAssetReferencingOnly;

/// <summary>
/// Set value to null rather can create a new instance to avoid issues like
/// instantiating new GameObjects.
/// instantiating new objects. If marked for asset referencing only, the data will not be cleared.
/// </summary>
public override void Clear ()
{
reference = null;
}
{
if (!forAssetReferencingOnly) reference = null;
}
}
}

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

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

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
Expand Up @@ -11,6 +11,21 @@ namespace ScriptableFramework
/// <typeparam name="T">Must be at least a class NOT a struct.</typeparam>
public abstract class ReferenceList<T> : RuntimeList<T> where T : class
{
/// <summary>
/// If true, the <c>items</c> property will not be cleared on application start.
/// This is useful when wanting a persistent reference to another asset rather than a runtime
/// reference to an object in a scene.
/// </summary>
[Space]
[Header ("Editor Properties")]
public bool forAssetReferencingOnly;

}
/// <summary>
/// Empties the current internal list. If marked for asset referencing only, the data will not be cleared.
/// </summary>
public override void Clear ()
{
if (!forAssetReferencingOnly) items.Clear ();
}
}
}
Loading