v2.1.1 🤖

This commit is contained in:
Adam Ramberg 2020-01-23 23:42:09 +01:00
parent af6cd06fb7
commit 90a505bbd3
20 changed files with 2921 additions and 2807 deletions

View File

@ -8,6 +8,21 @@
# [Unreleased]
# 2.1.1 (January 23, 2020)
## 🐛 Bug fixes
- [#98](https://github.com/AdamRamberg/unity-atoms/pull/98) Unity v2018.4 Support. ([@fakegood](https://github.com/fakegood))
- [#102](https://github.com/AdamRamberg/unity-atoms/pull/102) Fix Remove Tag from AtomTags and Fix Remove Tag Test . ([@lucasrferreira](https://github.com/lucasrferreira))
## 📝 Documentation
- [#100](https://github.com/AdamRamberg/unity-atoms/pull/100) Added installation options and badges for OpenUPM. ([@favoyang](https://github.com/favoyang), [@AdamRamberg](https://github.com/AdamRamberg))
## 🏠 Internal
- Update example project to Unity 2019.2.17f1
# 2.1.0 (November 28, 2019)
## 🐛 Bug fixes

View File

@ -1,7 +1,7 @@
{
"name": "com.mambojambostudios.unity-atoms-core",
"displayName": "Unity Atoms Core",
"version": "2.1.0",
"version": "2.1.1",
"unity": "2019.1",
"description": "Tiny modular pieces utilizing the power of Scriptable Objects",
"keywords": [

View File

@ -1,7 +1,7 @@
{
"name": "com.mambojambostudios.unity-atoms-mobile",
"displayName": "Unity Atoms Mobile",
"version": "2.1.0",
"version": "2.1.1",
"unity": "2019.1",
"description": "Unity Atoms for your mobile project.",
"keywords": [

View File

@ -1,7 +1,7 @@
{
"name": "com.mambojambostudios.unity-atoms-mono-hooks",
"displayName": "Unity Atoms Mono Hooks",
"version": "2.1.0",
"version": "2.1.1",
"unity": "2019.1",
"description": "Hook into Unity's lifecycle methods with Atom Events.",
"keywords": [

View File

@ -1,7 +1,7 @@
{
"name": "com.mambojambostudios.unity-atoms-scene-mgmt",
"displayName": "Unity Atoms Scene Mgmt",
"version": "2.1.0",
"version": "2.1.1",
"unity": "2019.1",
"description": "Unity Atoms to manage your scenes.",
"keywords": [

View File

@ -1,7 +1,7 @@
{
"name": "com.mambojambostudios.unity-atoms-tags",
"displayName": "Unity Atoms Tags",
"version": "2.1.0",
"version": "2.1.1",
"unity": "2019.1",
"description": "A replacement to Unity´s tags based on Unity Atoms.",
"keywords": [

View File

@ -1,7 +1,7 @@
{
"name": "com.mambojambostudios.unity-atoms-ui",
"displayName": "Unity Atoms UI",
"version": "2.1.0",
"version": "2.1.1",
"unity": "2019.1",
"description": "UI system using Unity Atoms.",
"keywords": [

View File

@ -51,12 +51,12 @@ Add the following to your `manifest.json`:
],
"dependencies": {
...
"com.mambojambostudios.unity-atoms-core": "2.1.0",
"com.mambojambostudios.unity-atoms-mobile": "2.1.0",
"com.mambojambostudios.unity-atoms-mono-hooks": "2.1.0",
"com.mambojambostudios.unity-atoms-tags": "2.1.0",
"com.mambojambostudios.unity-atoms-scene-mgmt": "2.1.0",
"com.mambojambostudios.unity-atoms-ui": "2.1.0",
"com.mambojambostudios.unity-atoms-core": "2.1.1",
"com.mambojambostudios.unity-atoms-mobile": "2.1.1",
"com.mambojambostudios.unity-atoms-mono-hooks": "2.1.1",
"com.mambojambostudios.unity-atoms-tags": "2.1.1",
"com.mambojambostudios.unity-atoms-scene-mgmt": "2.1.1",
"com.mambojambostudios.unity-atoms-ui": "2.1.1",
...
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,33 +7,9 @@ sidebar_label: UnityAtoms.Mobile.Editor
# Namespace - `UnityAtoms.Mobile.Editor`
## `TouchUserInputConstantDrawer`
## `TouchUserInputVariableEditor`
Constant property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputConstant>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputEventDrawer`
Event property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputTouchUserInputEventDrawer`
Event x 2 property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputTouchUserInputEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputListDrawer`
List property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputList>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputVariableDrawer`
Variable property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputVariable>`. Only availble in `UNITY_2019_1_OR_NEWER`.
Variable Inspector of type `TouchUserInput`. Inherits from `AtomVariableEditor`
---
@ -43,8 +19,32 @@ Event property drawer of type `TouchUserInput`. Inherits from `AtomEventEditor<T
---
## `TouchUserInputVariableEditor`
## `TouchUserInputListDrawer`
Variable Inspector of type `TouchUserInput`. Inherits from `AtomVariableEditor`
List property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputList>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputConstantDrawer`
Constant property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputConstant>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputVariableDrawer`
Variable property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputVariable>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputTouchUserInputEventDrawer`
Event x 2 property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputTouchUserInputEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `TouchUserInputEventDrawer`
Event property drawer of type `TouchUserInput`. Inherits from `AtomDrawer<TouchUserInputEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---

View File

@ -7,84 +7,6 @@ sidebar_label: UnityAtoms.Mobile
# Namespace - `UnityAtoms.Mobile`
## `TouchUserInputAction`
Action of type `TouchUserInput`. Inherits from `AtomAction<TouchUserInput>`.
---
## `TouchUserInputTouchUserInputAction`
Action x 2 of type `TouchUserInput`. Inherits from `AtomAction<TouchUserInput, TouchUserInput>`.
---
## `UpdateTouchUserInput`
Updates the `TouchUserInputVariable` on every Update tick. Meant to be called every Update.
### Variables
#### `TouchUserInputVariable`
The `TouchUserInputVariable` to update.
### Methods
#### `Do`
Update the `TouchUserInputVariable`.abstract Call this on every Update tick.
---
## `SetTouchUserInputVariableValue`
Set variable value Action of type `TouchUserInput`. Inherits from `SetVariableValue<TouchUserInput, TouchUserInputVariable, TouchUserInputConstant, TouchUserInputReference, TouchUserInputEvent, TouchUserInputTouchUserInputEvent>`.
---
## `TouchUserInputConstant`
Constant of type `TouchUserInput`. Inherits from `AtomBaseVariable<TouchUserInput>`.
---
## `TouchUserInputEvent`
Event of type `TouchUserInput`. Inherits from `AtomEvent<TouchUserInput>`.
---
## `TouchUserInputTouchUserInputEvent`
Event x 2 of type `TouchUserInput`. Inherits from `AtomEvent<TouchUserInput, TouchUserInput>`.
---
## `TouchUserInputListener`
Listener of type `TouchUserInput`. Inherits from `AtomListener<TouchUserInput, TouchUserInputAction, TouchUserInputEvent, TouchUserInputUnityEvent>`.
---
## `TouchUserInputTouchUserInputListener`
Listener x 2 of type `TouchUserInput`. Inherits from `AtomListener<TouchUserInput, TouchUserInput, TouchUserInputTouchUserInputAction, TouchUserInputTouchUserInputEvent, TouchUserInputTouchUserInputUnityEvent>`.
---
## `TouchUserInputList`
List of type `TouchUserInput`. Inherits from `AtomList<TouchUserInput, TouchUserInputEvent>`.
---
## `TouchUserInputReference`
Reference of type `TouchUserInput`. Inherits from `AtomReference<TouchUserInput, TouchUserInputVariable, TouchUserInputConstant>`.
---
## `TouchUserInput`
Module class holding data for touch user input.
@ -220,9 +142,15 @@ Enum for different touch user input states.
---
## `TouchUserInputTouchUserInputUnityEvent`
## `TouchUserInputList`
None generic Unity Event x 2 of type `TouchUserInput`. Inherits from `UnityEvent<TouchUserInput, TouchUserInput>`.
List of type `TouchUserInput`. Inherits from `AtomList<TouchUserInput, TouchUserInputEvent>`.
---
## `TouchUserInputReference`
Reference of type `TouchUserInput`. Inherits from `AtomReference<TouchUserInput, TouchUserInputVariable, TouchUserInputConstant>`.
---
@ -232,8 +160,80 @@ None generic Unity Event of type `TouchUserInput`. Inherits from `UnityEvent<Tou
---
## `TouchUserInputTouchUserInputUnityEvent`
None generic Unity Event x 2 of type `TouchUserInput`. Inherits from `UnityEvent<TouchUserInput, TouchUserInput>`.
---
## `TouchUserInputConstant`
Constant of type `TouchUserInput`. Inherits from `AtomBaseVariable<TouchUserInput>`.
---
## `TouchUserInputVariable`
Variable of type `TouchUserInput`. Inherits from `EquatableAtomVariable<TouchUserInput, TouchUserInputEvent, TouchUserInputTouchUserInputEvent>`.
---
## `TouchUserInputTouchUserInputAction`
Action x 2 of type `TouchUserInput`. Inherits from `AtomAction<TouchUserInput, TouchUserInput>`.
---
## `UpdateTouchUserInput`
Updates the `TouchUserInputVariable` on every Update tick. Meant to be called every Update.
### Variables
#### `TouchUserInputVariable`
The `TouchUserInputVariable` to update.
### Methods
#### `Do`
Update the `TouchUserInputVariable`.abstract Call this on every Update tick.
---
## `TouchUserInputAction`
Action of type `TouchUserInput`. Inherits from `AtomAction<TouchUserInput>`.
---
## `TouchUserInputTouchUserInputEvent`
Event x 2 of type `TouchUserInput`. Inherits from `AtomEvent<TouchUserInput, TouchUserInput>`.
---
## `TouchUserInputEvent`
Event of type `TouchUserInput`. Inherits from `AtomEvent<TouchUserInput>`.
---
## `TouchUserInputTouchUserInputListener`
Listener x 2 of type `TouchUserInput`. Inherits from `AtomListener<TouchUserInput, TouchUserInput, TouchUserInputTouchUserInputAction, TouchUserInputTouchUserInputEvent, TouchUserInputTouchUserInputUnityEvent>`.
---
## `TouchUserInputListener`
Listener of type `TouchUserInput`. Inherits from `AtomListener<TouchUserInput, TouchUserInputAction, TouchUserInputEvent, TouchUserInputUnityEvent>`.
---
## `SetTouchUserInputVariableValue`
Set variable value Action of type `TouchUserInput`. Inherits from `SetVariableValue<TouchUserInput, TouchUserInputVariable, TouchUserInputConstant, TouchUserInputReference, TouchUserInputEvent, TouchUserInputTouchUserInputEvent>`.
---

View File

@ -7,33 +7,9 @@ sidebar_label: UnityAtoms.MonoHooks
# Namespace - `UnityAtoms.MonoHooks`
## `VoidGameObjectAction`
## `OnDestroyHook`
Action x 2 of type `Void` and `GameObject`. Inherits from `AtomAction<Void, GameObject>`.
---
## `Collider2DGameObjectEvent`
Event x 2 of type `Collider2D` and `GameObject`. Inherits from `AtomEvent<Collider2D, GameObject>`.
---
## `ColliderGameObjectEvent`
Event x 2 of type `Collider` and `GameObject`. Inherits from `AtomEvent<Collider, GameObject>`.
---
## `VoidGameObjectEvent`
Event x 2 of type `Void` and `GameObject`. Inherits from `AtomEvent<Void, GameObject>`.
---
## `Collider2DHook`
Base class for all `MonoHook`s of type `Collider2D`.
Mono Hook for [`OnDestroy`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnDestroy.html)
---
@ -43,88 +19,9 @@ Base class for all `MonoHook`s of type `Collider`.
---
## `MonoHook<E1,E2,EV,F>`
## `OnUpdateHook`
#### Type Parameters
- `E1` - Event of type `AtomEvent<EV>`
- `E2` - Event of type `AtomEvent<EV, GameObject>`
- `EV` - Event value type
- `F` - Function type `AtomFunction<GameObject, GameObject>`
Generic base class for all Mono Hooks.
### Variables
#### `Event`
The Event
---
#### `EventWithGameObjectReference`
Event including a GameObject reference.
---
#### `_selectGameObjectReference`
Selector function for the Event `EventWithGameObjectReference`. Makes it possible to for example select the parent GameObject and pass that a long to the `EventWithGameObjectReference`.
---
## `OnAwakeHook`
Mono Hook for [`Awake`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html).
### Variables
#### `_listener`
Listener
---
#### `_listenerWithGameObject`
Listener with GameObject reference
---
## `OnButtonClickHook`
Mono Hook for On Button Click
---
## `OnDestroyHook`
Mono Hook for [`OnDestroy`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnDestroy.html)
---
## `OnFixedUpdateHook`
Mono Hook for [`FixedUpdate`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html)
---
## `OnLateUpdateHook`
Mono Hook for [`LateUpdate`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.LateUpdate.html)
---
## `OnPointerDownHook`
Mono Hook for `OnPointerDown`
---
## `OnStartHook`
Mono Hook for [`Start`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html)
Mono Hook for [`Update`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Update.html)
---
@ -176,9 +73,88 @@ Set to true if Event should be triggered on `OnTriggerStay`
---
## `OnUpdateHook`
## `MonoHook<E1,E2,EV,F>`
Mono Hook for [`Update`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Update.html)
#### Type Parameters
- `E1` - Event of type `AtomEvent<EV>`
- `E2` - Event of type `AtomEvent<EV, GameObject>`
- `EV` - Event value type
- `F` - Function type `AtomFunction<GameObject, GameObject>`
Generic base class for all Mono Hooks.
### Variables
#### `Event`
The Event
---
#### `EventWithGameObjectReference`
Event including a GameObject reference.
---
#### `_selectGameObjectReference`
Selector function for the Event `EventWithGameObjectReference`. Makes it possible to for example select the parent GameObject and pass that a long to the `EventWithGameObjectReference`.
---
## `OnLateUpdateHook`
Mono Hook for [`LateUpdate`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.LateUpdate.html)
---
## `OnButtonClickHook`
Mono Hook for On Button Click
---
## `OnFixedUpdateHook`
Mono Hook for [`FixedUpdate`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html)
---
## `OnPointerDownHook`
Mono Hook for `OnPointerDown`
---
## `Collider2DHook`
Base class for all `MonoHook`s of type `Collider2D`.
---
## `OnAwakeHook`
Mono Hook for [`Awake`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Awake.html).
### Variables
#### `_listener`
Listener
---
#### `_listenerWithGameObject`
Listener with GameObject reference
---
## `OnStartHook`
Mono Hook for [`Start`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html)
---
@ -188,6 +164,30 @@ Base class for all `MonoHook`s of type `Void`.
---
## `VoidGameObjectAction`
Action x 2 of type `Void` and `GameObject`. Inherits from `AtomAction<Void, GameObject>`.
---
## `ColliderGameObjectEvent`
Event x 2 of type `Collider` and `GameObject`. Inherits from `AtomEvent<Collider, GameObject>`.
---
## `Collider2DGameObjectEvent`
Event x 2 of type `Collider2D` and `GameObject`. Inherits from `AtomEvent<Collider2D, GameObject>`.
---
## `VoidGameObjectEvent`
Event x 2 of type `Void` and `GameObject`. Inherits from `AtomEvent<Void, GameObject>`.
---
## `VoidGameObjectListener`
Listener x 2 of type `Void` and `GameObject`. Inherits from `AtomListener<Void, GameObject, VoidGameObjectAction, VoidGameObjectEvent, VoidGameObjectUnityEvent>`.

View File

@ -13,33 +13,9 @@ Customer property drawer for `SceneField`.
---
## `SceneFieldConstantDrawer`
## `SceneFieldVariableEditor`
Constant property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldConstant>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldEventDrawer`
Event property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldSceneFieldEventDrawer`
Event x 2 property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldSceneFieldEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldListDrawer`
List property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldList>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldVariableDrawer`
Variable property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldVariable>`. Only availble in `UNITY_2019_1_OR_NEWER`.
Variable Inspector of type `SceneField`. Inherits from `AtomVariableEditor`
---
@ -49,8 +25,32 @@ Event property drawer of type `SceneField`. Inherits from `AtomEventEditor<Scene
---
## `SceneFieldVariableEditor`
## `SceneFieldListDrawer`
Variable Inspector of type `SceneField`. Inherits from `AtomVariableEditor`
List property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldList>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldConstantDrawer`
Constant property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldConstant>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldVariableDrawer`
Variable property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldVariable>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldSceneFieldEventDrawer`
Event x 2 property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldSceneFieldEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---
## `SceneFieldEventDrawer`
Event property drawer of type `SceneField`. Inherits from `AtomDrawer<SceneFieldEvent>`. Only availble in `UNITY_2019_1_OR_NEWER`.
---

View File

@ -7,96 +7,6 @@ sidebar_label: UnityAtoms.SceneMgmt
# Namespace - `UnityAtoms.SceneMgmt`
## `ChangeScene`
Action to change scene.
### Variables
#### `_sceneName`
Scene to change to.
### Methods
#### `Do`
Change the scene.
---
## `QuitApplication`
Action to quit the application.
### Methods
#### `Do`
Do quit the apllication.
---
## `SceneFieldAction`
Action of type `SceneField`. Inherits from `AtomAction<SceneField>`.
---
## `SceneFieldSceneFieldAction`
Action x 2 of type `SceneField`. Inherits from `AtomAction<SceneField, SceneField>`.
---
## `SetSceneFieldVariableValue`
Set variable value Action of type `SceneField`. Inherits from `SetVariableValue<SceneField, SceneFieldVariable, SceneFieldConstant, SceneFieldReference, SceneFieldEvent, SceneFieldSceneFieldEvent>`.
---
## `SceneFieldConstant`
Constant of type `SceneField`. Inherits from `AtomBaseVariable<SceneField>`.
---
## `SceneFieldEvent`
Event of type `SceneField`. Inherits from `AtomEvent<SceneField>`.
---
## `SceneFieldSceneFieldEvent`
Event x 2 of type `SceneField`. Inherits from `AtomEvent<SceneField, SceneField>`.
---
## `SceneFieldListener`
Listener of type `SceneField`. Inherits from `AtomListener<SceneField, SceneFieldAction, SceneFieldEvent, SceneFieldUnityEvent>`.
---
## `SceneFieldSceneFieldListener`
Listener x 2 of type `SceneField`. Inherits from `AtomListener<SceneField, SceneField, SceneFieldSceneFieldAction, SceneFieldSceneFieldEvent, SceneFieldSceneFieldUnityEvent>`.
---
## `SceneFieldList`
List of type `SceneField`. Inherits from `AtomList<SceneField, SceneFieldEvent>`.
---
## `SceneFieldReference`
Reference of type `SceneField`. Inherits from `AtomReference<SceneField, SceneFieldVariable, SceneFieldConstant>`.
---
## `SceneField`
Struct to hold data about a scene.
@ -219,6 +129,18 @@ None equality operator.
---
## `SceneFieldList`
List of type `SceneField`. Inherits from `AtomList<SceneField, SceneFieldEvent>`.
---
## `SceneFieldReference`
Reference of type `SceneField`. Inherits from `AtomReference<SceneField, SceneFieldVariable, SceneFieldConstant>`.
---
## `SceneFieldSceneFieldUnityEvent`
None generic Unity Event x 2 of type `SceneField`. Inherits from `UnityEvent<SceneField, SceneField>`.
@ -231,8 +153,86 @@ None generic Unity Event of type `SceneField`. Inherits from `UnityEvent<SceneFi
---
## `SceneFieldConstant`
Constant of type `SceneField`. Inherits from `AtomBaseVariable<SceneField>`.
---
## `SceneFieldVariable`
Variable of type `SceneField`. Inherits from `EquatableAtomVariable<SceneField, SceneFieldEvent, SceneFieldSceneFieldEvent>`.
---
## `QuitApplication`
Action to quit the application.
### Methods
#### `Do`
Do quit the apllication.
---
## `SceneFieldSceneFieldAction`
Action x 2 of type `SceneField`. Inherits from `AtomAction<SceneField, SceneField>`.
---
## `ChangeScene`
Action to change scene.
### Variables
#### `_sceneName`
Scene to change to.
### Methods
#### `Do`
Change the scene.
---
## `SceneFieldAction`
Action of type `SceneField`. Inherits from `AtomAction<SceneField>`.
---
## `SceneFieldEvent`
Event of type `SceneField`. Inherits from `AtomEvent<SceneField>`.
---
## `SceneFieldSceneFieldEvent`
Event x 2 of type `SceneField`. Inherits from `AtomEvent<SceneField, SceneField>`.
---
## `SceneFieldListener`
Listener of type `SceneField`. Inherits from `AtomListener<SceneField, SceneFieldAction, SceneFieldEvent, SceneFieldUnityEvent>`.
---
## `SceneFieldSceneFieldListener`
Listener x 2 of type `SceneField`. Inherits from `AtomListener<SceneField, SceneField, SceneFieldSceneFieldAction, SceneFieldSceneFieldEvent, SceneFieldSceneFieldUnityEvent>`.
---
## `SetSceneFieldVariableValue`
Set variable value Action of type `SceneField`. Inherits from `SetVariableValue<SceneField, SceneFieldVariable, SceneFieldConstant, SceneFieldReference, SceneFieldEvent, SceneFieldSceneFieldEvent>`.
---

View File

@ -7,6 +7,180 @@ sidebar_label: UnityAtoms.Tags
# Namespace - `UnityAtoms.Tags`
## `ReadOnlyList<T>`
#### Type Parameters
- `T` - The type of the list items.
This is an `IList` without everything that could mutate the it.
### Properties
#### `Count`
Get the number of elements contained in the `ReadOnlyList<T>`.
##### Examples
```cs
var readOnlyList = new ReadOnlyList<int>(new List<int>() { 1, 2, 3 });
Debug.Log(readOnlyList.Count); // Outputs: 3
```
---
#### `IsReadOnly`
Determines if the `ReadOnlyList<T>` is read only or not.
---
#### `Item(System.Int32)`
Get the element at the specified index.
### Methods
#### `#ctor(list)`
Creates a new class of the `ReadOnlyList<T>` class.
##### Parameters
- `list` - The `IList<T>` to initialize the `ReadOnlyList<T>` with.
---
#### `GetEnumerator`
Implements `GetEnumerator()` of `IEnumerable<T>`
##### Returns
The list's `IEnumerator<T>`.
---
#### `Contains(item)`
Determines whether an element is in the `ReadOnlyList<T>`.
##### Parameters
- `item` - The item to check if it exists in the `ReadOnlyList<T>`.
##### Returns
`true` if item is found in the `ReadOnlyList<T>`; otherwise, `false`.
---
#### `IndexOf(item)`
Searches for the specified object and returns the index of its first occurrence in a one-dimensional array.
##### Parameters
- `item` - The one-dimensional array to search.
##### Returns
The index of the first occurrence of value in array, if found; otherwise, the lower bound of the array minus 1.
---
#### `CopyTo(array,arrayIndex)`
Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the specified destination array index. The index is specified as a 32-bit integer.
##### Parameters
- `array` - The one-dimensional array that is the destination of the elements copied from the current array.
- `arrayIndex` - A 32-bit integer that represents the index in array at which copying begins.
---
## `GameObjectExtensions`
`GameObject` extensions related to tags in Unity Atoms.
### Methods
#### `GetTags(UnityEngine.GameObject)`
Retrieves all tags for a given `GameObject`. A faster alternative to `gameObject.GetComponen<UATags>().Tags`.
##### Parameters
- `go` - This `GameObject`
##### Returns
A `ReadOnlyList<T>` of tags stored as `StringContant`s. Returns `null` if the `GameObject` does not have any tags or if the `GameObject` is disabled.
---
#### `HasTag(UnityEngine.GameObject,System.String)`
Check if the tag provided is associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tag` - The tag to search for.
##### Returns
`true` if the tag exists, otherwise `false`.
---
#### `HasTag(UnityEngine.GameObject,UnityAtoms.StringConstant)`
Check if the tag provided is associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tag` - The tag to search for.
##### Returns
`true` if the tag exists, otherwise `false`.
---
#### `HasAnyTag(UnityEngine.GameObject,System.Collections.Generic.List{System.String})`
Check if any of the tags provided are associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tags` - The tags to search for.
##### Returns
`true` if any of the tags exist, otherwise `false`.
---
#### `HasAnyTag(UnityEngine.GameObject,System.Collections.Generic.List{UnityAtoms.StringConstant})`
Check if any of the tags provided are associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tags` - The tags to search for.
##### Returns
`true` if any of the tags exist, otherwise `false`.
---
## `AtomTags`
A MonoBehaviour that adds tags the Unity Atoms way to a GameObject.
@ -115,177 +289,3 @@ Retrieves all tags for a given `GameObject`. A faster alternative to `gameObject
A `ReadOnlyList<T>` of tags stored as `StringContant`s. Returns `null` if the `GameObject` does not have any tags or if the `GameObject` is disabled.
---
## `GameObjectExtensions`
`GameObject` extensions related to tags in Unity Atoms.
### Methods
#### `GetTags(UnityEngine.GameObject)`
Retrieves all tags for a given `GameObject`. A faster alternative to `gameObject.GetComponen<UATags>().Tags`.
##### Parameters
- `go` - This `GameObject`
##### Returns
A `ReadOnlyList<T>` of tags stored as `StringContant`s. Returns `null` if the `GameObject` does not have any tags or if the `GameObject` is disabled.
---
#### `HasTag(UnityEngine.GameObject,System.String)`
Check if the tag provided is associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tag` - The tag to search for.
##### Returns
`true` if the tag exists, otherwise `false`.
---
#### `HasTag(UnityEngine.GameObject,UnityAtoms.StringConstant)`
Check if the tag provided is associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tag` - The tag to search for.
##### Returns
`true` if the tag exists, otherwise `false`.
---
#### `HasAnyTag(UnityEngine.GameObject,System.Collections.Generic.List{System.String})`
Check if any of the tags provided are associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tags` - The tags to search for.
##### Returns
`true` if any of the tags exist, otherwise `false`.
---
#### `HasAnyTag(UnityEngine.GameObject,System.Collections.Generic.List{UnityAtoms.StringConstant})`
Check if any of the tags provided are associated with this `GameObject`.
##### Parameters
- `go` - This `GameObject`
- `tags` - The tags to search for.
##### Returns
`true` if any of the tags exist, otherwise `false`.
---
## `ReadOnlyList<T>`
#### Type Parameters
- `T` - The type of the list items.
This is an `IList` without everything that could mutate the it.
### Properties
#### `Count`
Get the number of elements contained in the `ReadOnlyList<T>`.
##### Examples
```cs
var readOnlyList = new ReadOnlyList<int>(new List<int>() { 1, 2, 3 });
Debug.Log(readOnlyList.Count); // Outputs: 3
```
---
#### `IsReadOnly`
Determines if the `ReadOnlyList<T>` is read only or not.
---
#### `Item(System.Int32)`
Get the element at the specified index.
### Methods
#### `#ctor(list)`
Creates a new class of the `ReadOnlyList<T>` class.
##### Parameters
- `list` - The `IList<T>` to initialize the `ReadOnlyList<T>` with.
---
#### `GetEnumerator`
Implements `GetEnumerator()` of `IEnumerable<T>`
##### Returns
The list's `IEnumerator<T>`.
---
#### `Contains(item)`
Determines whether an element is in the `ReadOnlyList<T>`.
##### Parameters
- `item` - The item to check if it exists in the `ReadOnlyList<T>`.
##### Returns
`true` if item is found in the `ReadOnlyList<T>`; otherwise, `false`.
---
#### `IndexOf(item)`
Searches for the specified object and returns the index of its first occurrence in a one-dimensional array.
##### Parameters
- `item` - The one-dimensional array to search.
##### Returns
The index of the first occurrence of value in array, if found; otherwise, the lower bound of the array minus 1.
---
#### `CopyTo(array,arrayIndex)`
Copies all the elements of the current one-dimensional array to the specified one-dimensional array starting at the specified destination array index. The index is specified as a 32-bit integer.
##### Parameters
- `array` - The one-dimensional array that is the destination of the elements copied from the current array.
- `arrayIndex` - A 32-bit integer that represents the index in array at which copying begins.
---

View File

@ -33,12 +33,12 @@ Add the following to your `manifest.json`:
],
"dependencies": {
...
"com.mambojambostudios.unity-atoms-core": "2.1.0",
"com.mambojambostudios.unity-atoms-mobile": "2.1.0",
"com.mambojambostudios.unity-atoms-mono-hooks": "2.1.0",
"com.mambojambostudios.unity-atoms-tags": "2.1.0",
"com.mambojambostudios.unity-atoms-scene-mgmt": "2.1.0",
"com.mambojambostudios.unity-atoms-ui": "2.1.0",
"com.mambojambostudios.unity-atoms-core": "2.1.1",
"com.mambojambostudios.unity-atoms-mobile": "2.1.1",
"com.mambojambostudios.unity-atoms-mono-hooks": "2.1.1",
"com.mambojambostudios.unity-atoms-tags": "2.1.1",
"com.mambojambostudios.unity-atoms-scene-mgmt": "2.1.1",
"com.mambojambostudios.unity-atoms-ui": "2.1.1",
...
}
}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "com.mambojambostudios.unity-atoms",
"version": "2.1.0",
"version": "2.1.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "com.mambojambostudios.unity-atoms",
"displayName": "Unity Atoms",
"version": "2.1.0",
"version": "2.1.1",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},

View File

@ -1,31 +1,53 @@
const child_process = require('child_process');
const fs = require('fs');
const xml2js = require('xml2js');
const rimraf = require('rimraf');
const path = require('path');
const argv = require('yargs').argv
const child_process = require("child_process");
const fs = require("fs");
const xml2js = require("xml2js");
const rimraf = require("rimraf");
const path = require("path");
const argv = require("yargs").argv;
const run = async () => {
// Extract dlls
// Extract dlls from all *.csproj
let dlls = [];
const parser = new xml2js.Parser();
const assemblyFile = fs.readFileSync(path.join(process.cwd(), 'Examples', 'Assembly-CSharp.csproj'));
const assemblyXml = await parser.parseStringPromise(assemblyFile);
assemblyXml.Project.ItemGroup.forEach((itemGroup) => {
if (itemGroup.Reference) {
itemGroup.Reference.forEach((ref) => {
dlls = dlls.concat(ref.HintPath);
})
}
});
const unityProjFolder = path.join(process.cwd(), "Examples");
const csprojPaths = fs
.readdirSync(unityProjFolder)
.filter(file => file.endsWith(".csproj"))
.map(csproj => path.join(process.cwd(), "Examples", csproj));
for (let i = 0; i < csprojPaths.length; ++i) {
const csprojFile = fs.readFileSync(csprojPaths[i]);
const csprojXml = await parser.parseStringPromise(csprojFile);
csprojXml.Project.ItemGroup.forEach(itemGroup => {
if (itemGroup.Reference) {
itemGroup.Reference.forEach(ref => {
const dllPath = `"${ref.HintPath}"`;
if (!dlls.includes(dllPath)) {
dlls.push(dllPath);
}
});
}
});
}
// Compile code
const apiXmlName = `api.xml`;
const assemblyName = `Packages.dll`;
const cmd = `csc -recurse:${path.join(process.cwd(), 'Packages', '/*.cs')} /doc:${path.join(process.cwd(), apiXmlName)} -t:library -out:${path.join(process.cwd(), assemblyName)} -r:${dlls.join(',')} -define:UNITY_2019_1_OR_NEWER`;
const cmd = `csc -recurse:"${path.join(
process.cwd(),
"Packages",
"/*.cs"
)}" /doc:"${path.join(
process.cwd(),
apiXmlName
)}" -t:library -out:"${path.join(
process.cwd(),
assemblyName
)}" -r:${dlls.join(",")} -define:UNITY_2018_4_OR_NEWER,UNITY_2019_1_OR_NEWER`;
try {
const compileStdout = child_process.execSync(cmd);
} catch(e) {
} catch (e) {
console.error(e.status);
console.error(e.message);
console.error(e.stderr.toString());
@ -46,51 +68,56 @@ const run = async () => {
const docsXml = await parser.parseStringPromise(docsXmlFile);
const NAMESPACES = [
'UnityAtoms.',
'UnityAtoms.Editor.',
'UnityAtoms.Tags.',
'UnityAtoms.Tags.Editor.',
'UnityAtoms.Mobile.',
'UnityAtoms.Mobile.Editor.',
'UnityAtoms.UI.',
'UnityAtoms.UI.Editor.',
'UnityAtoms.SceneMgmt.',
'UnityAtoms.SceneMgmt.Editor.',
'UnityAtoms.MonoHooks.',
'UnityAtoms.MonoHooks.Editor.'
"UnityAtoms.",
"UnityAtoms.Editor.",
"UnityAtoms.Tags.",
"UnityAtoms.Tags.Editor.",
"UnityAtoms.Mobile.",
"UnityAtoms.Mobile.Editor.",
"UnityAtoms.UI.",
"UnityAtoms.UI.Editor.",
"UnityAtoms.SceneMgmt.",
"UnityAtoms.SceneMgmt.Editor.",
"UnityAtoms.MonoHooks.",
"UnityAtoms.MonoHooks.Editor."
];
const getNamespace = (name) => {
const matches = NAMESPACES.filter((ns) => name.includes(ns));
const namespace = matches.sort((a, b) => (b.match(/./g) || []).length - (a.match(/./g) || []).length)[0];
const getNamespace = name => {
const matches = NAMESPACES.filter(ns => name.includes(ns));
const namespace = matches.sort(
(a, b) => (b.match(/./g) || []).length - (a.match(/./g) || []).length
)[0];
return namespace.substring(0, namespace.length - 1);
}
};
const extractFromName = (name) => {
const [type, ...restOfName] = name.split(':');
const extractFromName = name => {
const [type, ...restOfName] = name.split(":");
const namespace = getNamespace(name);
const toReturn = { type, namespace };
if (type === 'T') {
if (type === "T") {
toReturn.className = restOfName[0].substring(namespace.length + 1);
} else if (type === 'M' || type === 'P' || type === 'F') {
} else if (type === "M" || type === "P" || type === "F") {
const rest = restOfName[0].substring(namespace.length + 1);
const indexOfFirstParenthesis = rest.indexOf('(');
const indexOfFirstParenthesis = rest.indexOf("(");
let className, restName;
if (indexOfFirstParenthesis !== -1) {
const indexOfMethodNameStart = rest.substring(0, indexOfFirstParenthesis).lastIndexOf('.') + 1;
const indexOfMethodNameStart =
rest.substring(0, indexOfFirstParenthesis).lastIndexOf(".") + 1;
className = rest.substring(0, indexOfMethodNameStart - 1);
restName = rest.substring(indexOfMethodNameStart, rest.length);
} else {
const splitName = restOfName[0].substring(namespace.length + 1).split('.');
const splitName = restOfName[0]
.substring(namespace.length + 1)
.split(".");
restName = splitName.pop();
className = splitName.join('.');
className = splitName.join(".");
}
toReturn.className = className;
toReturn.name = restName;
}
return toReturn;
}
};
// EXAMPLE FORMAT:
// const prettifiedAndGroupedJsonExample = [
@ -109,145 +136,217 @@ const run = async () => {
const prettifiedAndGroupedJson = [];
// Prettify
const prettifiedXml = docsXml.doc.members[0].member.map((cur) => {
const prettifiedXml = docsXml.doc.members[0].member.map(cur => {
const summary = cur.summary && cur.summary[0];
const params = cur.param && cur.param.length > 0 && cur.param.map((p) => ({ name: p['$'].name, description: p['_'] }));
const params =
cur.param &&
cur.param.length > 0 &&
cur.param.map(p => ({ name: p["$"].name, description: p["_"] }));
const returns = cur.returns && cur.returns.length > 0 && cur.returns[0];
const value = cur.value && cur.value.length > 0 && cur.value[0];
const examples = cur.example && cur.example.length > 0 && cur.example.map((ex) => ex.code[0]);
const typeparams = cur.typeparam && cur.typeparam.length > 0 && cur.typeparam.map((tp) => ({ name: tp['$'].name, description: tp['_'] }));
const extractedFromName = extractFromName(cur['$'].name);
const examples =
cur.example &&
cur.example.length > 0 &&
cur.example.map(ex => ex.code[0]);
const typeparams =
cur.typeparam &&
cur.typeparam.length > 0 &&
cur.typeparam.map(tp => ({ name: tp["$"].name, description: tp["_"] }));
const extractedFromName = extractFromName(cur["$"].name);
// Add namespace and classes
let namespaceGroup = prettifiedAndGroupedJson.find((n) => n.namespace === extractedFromName.namespace);
let namespaceGroup = prettifiedAndGroupedJson.find(
n => n.namespace === extractedFromName.namespace
);
if (!namespaceGroup) {
namespaceGroup = { namespace: extractedFromName.namespace, classes: [] };
prettifiedAndGroupedJson.push(namespaceGroup);
}
if (extractedFromName.type === 'T') {
if (extractedFromName.type === "T") {
namespaceGroup.classes.push({
id: extractedFromName.className,
name: extractedFromName.className.includes('`') && typeparams ? extractedFromName.className.replace(/`\d/, `<${typeparams.map((tp) => tp.name).join(',')}>`) : extractedFromName.className,
name:
extractedFromName.className.includes("`") && typeparams
? extractedFromName.className.replace(
/`\d/,
`<${typeparams.map(tp => tp.name).join(",")}>`
)
: extractedFromName.className,
typeparams,
summary,
methods: [],
properties: [],
variables: [],
variables: []
});
}
return { summary, params, returns, value, examples, typeparams, ...extractedFromName };
return {
summary,
params,
returns,
value,
examples,
typeparams,
...extractedFromName
};
}, []);
// Add all methods, properties and variables
prettifiedXml.filter((cur) => ['M', 'F', 'P'].includes(cur.type)).forEach((cur) => {
const classGroup = prettifiedAndGroupedJson.find((n) => n.namespace === cur.namespace).classes.find((n) => n.id === cur.className);
if (classGroup) {
if (cur.type === 'M') {
if (cur.name.includes('Do(')) {
prettifiedXml
.filter(cur => ["M", "F", "P"].includes(cur.type))
.forEach(cur => {
const classGroup = prettifiedAndGroupedJson
.find(n => n.namespace === cur.namespace)
.classes.find(n => n.id === cur.className);
if (classGroup) {
if (cur.type === "M") {
if (cur.name.includes("Do(")) {
}
let name = cur.name;
if (name.includes("``") && cur.typeparams) {
name = name.replace(
/``\d/,
`<${cur.typeparams.map(tp => tp.name).join(",")}>`
);
}
if (name.includes("`") && cur.params) {
name = name.replace(
/\(([^\)]+)\)/,
`(${cur.params.map(p => p.name).join(",")})`
);
}
classGroup.methods.push({
...cur,
name
});
} else if (cur.type === "F") {
classGroup.variables.push(cur);
} else if (cur.type === "P") {
classGroup.properties.push(cur);
}
let name = cur.name;
if (name.includes('``') && cur.typeparams) {
name = name.replace(/``\d/, `<${cur.typeparams.map((tp) => tp.name).join(',')}>`);
}
if (name.includes('`') && cur.params) {
name = name.replace(/\(([^\)]+)\)/, `(${cur.params.map((p) => p.name).join(',')})`);
}
classGroup.methods.push({
...cur,
name,
});
} else if (cur.type === 'F') {
classGroup.variables.push(cur);
} else if (cur.type === 'P') {
classGroup.properties.push(cur);
}
}
});
});
const printExamples = (examples) => {
if (!examples) return '';
const printExamples = examples => {
if (!examples) return "";
return `##### Examples\n\n${examples.map((example) => {
const exampleSplitOnNewline = example.split('\n');
const numSpacesFirstRow = exampleSplitOnNewline[1].search(/\S/);
const trimmedExample = exampleSplitOnNewline.map((line) => line.substring(numSpacesFirstRow)).join('\n');
return `\`\`\`cs${trimmedExample}\`\`\``;
}).join('\n\n')}\n\n`;
}
return `##### Examples\n\n${examples
.map(example => {
const exampleSplitOnNewline = example.split("\n");
const numSpacesFirstRow = exampleSplitOnNewline[1].search(/\S/);
const trimmedExample = exampleSplitOnNewline
.map(line => line.substring(numSpacesFirstRow))
.join("\n");
return `\`\`\`cs${trimmedExample}\`\`\``;
})
.join("\n\n")}\n\n`;
};
const printValues = (values = '') => {
const trimmedValues = values.replace(/\s+/g, ' ').trim();
if (!trimmedValues) return '';
const printValues = (values = "") => {
const trimmedValues = values.replace(/\s+/g, " ").trim();
if (!trimmedValues) return "";
return `##### Values\n\n${trimmedValues}\n\n`;
}
};
const printReturns = (returns = '') => {
const trimmedReturns = returns.replace(/\s+/g, ' ').trim();
if (!trimmedReturns) return '';
const printReturns = (returns = "") => {
const trimmedReturns = returns.replace(/\s+/g, " ").trim();
if (!trimmedReturns) return "";
return `##### Returns\n\n${trimmedReturns}\n\n`;
}
};
const printSummary = (summary = '') => {
const trimmedSummary = summary.replace(/\s+/g, ' ').trim();
if (!trimmedSummary) return '';
return(`${trimmedSummary}\n\n`);
}
const printSummary = (summary = "") => {
const trimmedSummary = summary.replace(/\s+/g, " ").trim();
if (!trimmedSummary) return "";
return `${trimmedSummary}\n\n`;
};
const printTypeParams = (typeparams) => {
if (!typeparams || typeparams.length <= 0) return '';
return(`#### Type Parameters\n\n${typeparams.map((tp) => `- \`${tp.name}\` - ${tp.description}`).join('\n')}\n\n`);
}
const printTypeParams = typeparams => {
if (!typeparams || typeparams.length <= 0) return "";
return `#### Type Parameters\n\n${typeparams
.map(tp => `- \`${tp.name}\` - ${tp.description}`)
.join("\n")}\n\n`;
};
const printParameters = (params) => {
if (!params || params.length <= 0) return '';
return (`##### Parameters\n\n${params.map((param) => `- \`${param.name}\` - ${param.description}`).join('\n')}\n\n`);
}
const printParameters = params => {
if (!params || params.length <= 0) return "";
return `##### Parameters\n\n${params
.map(param => `- \`${param.name}\` - ${param.description}`)
.join("\n")}\n\n`;
};
const printVariablesSection = (variables) => {
if (!variables || variables.length <= 0) return '';
return `### Variables\n\n${variables.map((v) => {
return `#### \`${v.name}\`\n\n${printSummary(v.summary)}`;
}).join('---\n\n')}`;
}
const printVariablesSection = variables => {
if (!variables || variables.length <= 0) return "";
return `### Variables\n\n${variables
.map(v => {
return `#### \`${v.name}\`\n\n${printSummary(v.summary)}`;
})
.join("---\n\n")}`;
};
const printPropertiesSection = (properties) => {
if (!properties || properties.length <= 0) return '';
return `### Properties\n\n${properties.map((prop) => {
return `#### \`${prop.name}\`\n\n${printSummary(prop.summary)}${printValues(prop.values)}${printExamples(prop.examples)}`
}).join('---\n\n')}`;
}
const printPropertiesSection = properties => {
if (!properties || properties.length <= 0) return "";
return `### Properties\n\n${properties
.map(prop => {
return `#### \`${prop.name}\`\n\n${printSummary(
prop.summary
)}${printValues(prop.values)}${printExamples(prop.examples)}`;
})
.join("---\n\n")}`;
};
const printMethodsSection = (methods) => {
if (!methods || methods.length <= 0) return '';
return `### Methods\n\n${methods.map((method) => {
return `#### \`${method.name}\`\n\n${printSummary(method.summary)}${printTypeParams(method.typeparams)}${printParameters(method.params)}${printReturns(method.returns)}${printExamples(method.examples)}`
}).join('---\n\n')}`;
}
const printMethodsSection = methods => {
if (!methods || methods.length <= 0) return "";
return `### Methods\n\n${methods
.map(method => {
return `#### \`${method.name}\`\n\n${printSummary(
method.summary
)}${printTypeParams(method.typeparams)}${printParameters(
method.params
)}${printReturns(method.returns)}${printExamples(method.examples)}`;
})
.join("---\n\n")}`;
};
const printClasses = (classes) => {
if (!classes || classes.length <= 0) return '';
return classes.map((c) => {
return `## \`${c.name}\`\n\n${printTypeParams(c.typeparams)}${printSummary(c.summary)}${printVariablesSection(c.variables)}${printPropertiesSection(c.properties)}${printMethodsSection(c.methods)}---\n\n`
}).join('');
}
const printClasses = classes => {
if (!classes || classes.length <= 0) return "";
return classes
.map(c => {
return `## \`${c.name}\`\n\n${printTypeParams(
c.typeparams
)}${printSummary(c.summary)}${printVariablesSection(
c.variables
)}${printPropertiesSection(c.properties)}${printMethodsSection(
c.methods
)}---\n\n`;
})
.join("");
};
const printNamespace = (namespace) => `# Namespace - \`${namespace.namespace}\`\n\n${printClasses(namespace.classes)}`;
const printNamespace = namespace =>
`# Namespace - \`${namespace.namespace}\`\n\n${printClasses(
namespace.classes
)}`;
const printPageMeta = (namespace) => `---\nid: ${namespace.toLowerCase()}\ntitle: ${namespace}\nhide_title: true\nsidebar_label: ${namespace}\n---\n\n`;
const printPageMeta = namespace =>
`---\nid: ${namespace.toLowerCase()}\ntitle: ${namespace}\nhide_title: true\nsidebar_label: ${namespace}\n---\n\n`;
// Create one MD file per namespace
prettifiedAndGroupedJson.forEach((namespace) => {
const mdPath = path.join(process.cwd(), 'docs', 'api', `${namespace.namespace.toLowerCase()}.md`);
const mdFile = `${printPageMeta(namespace.namespace)}${printNamespace(namespace)}`;
prettifiedAndGroupedJson.forEach(namespace => {
const mdPath = path.join(
process.cwd(),
"docs",
"api",
`${namespace.namespace.toLowerCase()}.md`
);
const mdFile = `${printPageMeta(namespace.namespace)}${printNamespace(
namespace
)}`;
fs.writeFileSync(mdPath, mdFile.substring(0, mdFile.length - 1)); // Trim last new line
});
// Remove generated xml
rimraf.sync(path.join(process.cwd(), apiXmlName));
}
};
run();