diff --git a/.dockerignore b/.dockerignore new file mode 100755 index 00000000..27d2dae2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +*/node_modules +*.log diff --git a/.gitignore b/.gitignore index ddadb081..c3f4093f 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,10 @@ sysinfo.txt *.unitypackage # VS Code Settings -.vscode \ No newline at end of file +.vscode + +# Node +node_modules + +# Website build folder +/website/build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 00000000..d369844d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:8.11.4 + +WORKDIR /app/website + +EXPOSE 3000 35729 +COPY ./docs /app/docs +COPY ./website /app/website +RUN yarn install + +CMD ["yarn", "start"] diff --git a/Packages/Tags/package.json b/Packages/Tags/package.json index e24d0e4b..3dd8b76d 100644 --- a/Packages/Tags/package.json +++ b/Packages/Tags/package.json @@ -3,7 +3,7 @@ "displayName": "Unity Atoms Tags", "version": "2.0.0-beta.0", "unity": "2019.1", - "description": "A tags system based Unity Atoms.", + "description": "A replacement to Unity´s tags based on Unity Atoms.", "keywords": [ "scriptable objects", "unity" diff --git a/Packages/UI/package.json b/Packages/UI/package.json index 79e46f4d..32923924 100644 --- a/Packages/UI/package.json +++ b/Packages/UI/package.json @@ -3,7 +3,7 @@ "displayName": "Unity Atoms UI", "version": "2.0.0-beta.0", "unity": "2019.1", - "description": "An UI system using Unity Atoms.", + "description": "UI system using Unity Atoms.", "keywords": [ "scriptable objects", "unity" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100755 index 00000000..e2148cc9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3" + +services: + docusaurus: + build: . + ports: + - 3000:3000 + - 35729:35729 + volumes: + - ./docs:/app/docs + - ./website/blog:/app/website/blog + - ./website/core:/app/website/core + - ./website/i18n:/app/website/i18n + - ./website/pages:/app/website/pages + - ./website/static:/app/website/static + - ./website/sidebars.json:/app/website/sidebars.json + - ./website/siteConfig.js:/app/website/siteConfig.js + working_dir: /app/website diff --git a/docs/api/actions.md b/docs/api/actions.md index 4ad69a1b..55e71afb 100644 --- a/docs/api/actions.md +++ b/docs/api/actions.md @@ -1,3 +1,10 @@ +--- +id: actions +title: Actions +hide_title: true +sidebar_label: Actions +--- + # Actions [**TODO**] diff --git a/docs/api/constants.md b/docs/api/constants.md index e45d34d9..e8b07cf8 100644 --- a/docs/api/constants.md +++ b/docs/api/constants.md @@ -1,3 +1,10 @@ +--- +id: constants +title: Constants +hide_title: true +sidebar_label: Constants +--- + # Constants [**TODO**] diff --git a/docs/api/events.md b/docs/api/events.md index 107bff93..42b8f6d5 100644 --- a/docs/api/events.md +++ b/docs/api/events.md @@ -1,3 +1,10 @@ +--- +id: events +title: Events +hide_title: true +sidebar_label: Events +--- + # Events [**TODO**] diff --git a/docs/api/functions.md b/docs/api/functions.md index 1b202682..5459025b 100644 --- a/docs/api/functions.md +++ b/docs/api/functions.md @@ -1,3 +1,10 @@ +--- +id: functions +title: Functions +hide_title: true +sidebar_label: Functions +--- + # Functions [**TODO**] diff --git a/docs/api/listeners.md b/docs/api/listeners.md index 241abad0..69f2543d 100644 --- a/docs/api/listeners.md +++ b/docs/api/listeners.md @@ -1,3 +1,10 @@ +--- +id: listeners +title: Listeners +hide_title: true +sidebar_label: Listeners +--- + # Listeners [**TODO**] diff --git a/docs/api/lists.md b/docs/api/lists.md index 99c4d064..45cb1b14 100644 --- a/docs/api/lists.md +++ b/docs/api/lists.md @@ -1,3 +1,10 @@ +--- +id: lists +title: Lists +hide_title: true +sidebar_label: Lists +--- + # Lists [**TODO**] diff --git a/docs/api/references.md b/docs/api/references.md index 417b9c0d..40ea8bf4 100644 --- a/docs/api/references.md +++ b/docs/api/references.md @@ -1,3 +1,10 @@ +--- +id: references +title: References +hide_title: true +sidebar_label: References +--- + # References [**TODO**] diff --git a/docs/api/unity-events.md b/docs/api/unity-events.md index ce04a5eb..dd659ed7 100644 --- a/docs/api/unity-events.md +++ b/docs/api/unity-events.md @@ -1,3 +1,10 @@ +--- +id: unity-events +title: Unity Events +hide_title: true +sidebar_label: Unity Events +--- + # Unity Events [**TODO**] diff --git a/docs/api/variables.md b/docs/api/variables.md index 45e40ec0..5a672778 100644 --- a/docs/api/variables.md +++ b/docs/api/variables.md @@ -1,3 +1,10 @@ +--- +id: variables +title: Variables +hide_title: true +sidebar_label: Variables +--- + # Variables [**TODO**] diff --git a/docs/introduction/basic-tutorial.md b/docs/introduction/basic-tutorial.md index b02c58be..04339b21 100644 --- a/docs/introduction/basic-tutorial.md +++ b/docs/introduction/basic-tutorial.md @@ -1,3 +1,10 @@ +--- +id: basic-tutorial +title: Basic tutorial +hide_title: true +sidebar_label: Basic tutorial +--- + # Basic tutorial [**TODO**] diff --git a/docs/introduction/generator.md b/docs/introduction/generator.md index 258e4508..11528589 100644 --- a/docs/introduction/generator.md +++ b/docs/introduction/generator.md @@ -1,3 +1,10 @@ +--- +id: generator +title: Generator +hide_title: true +sidebar_label: Generator +--- + # Generator [**TODO**] diff --git a/docs/introduction/overview.md b/docs/introduction/overview.md index 87507d9d..a1ee9c78 100644 --- a/docs/introduction/overview.md +++ b/docs/introduction/overview.md @@ -1,3 +1,10 @@ +--- +id: overview +title: Overview and philosopy +hide_title: true +sidebar_label: Overview and philosopy +--- + # Overview and philosopy Unity Atoms is an event based system that encourages the game to be as data-driven as possible. The four most fundamental parts of Unity Atoms are: @@ -25,7 +32,7 @@ Exactly the same as Variables, but can not be changed via script and therefore d References can be toggled between `use as constant` or `use variable` via the Unity Inspector. When a reference is `used as constant` then it functions exactly like a regular serialized variable in a MonoBehaviour script. However, when it is set to `use variable` it functions exactly like a Variable. -#### Lists +### Lists A List is an array of values that is stored as a Scriptable Object. There is the possibility to add Events for when the following happens to the list: @@ -33,22 +40,22 @@ A List is an array of values that is stored as a Scriptable Object. There is the - An item is removed from the List. - The List is cleared. -### Events +## Events An event is a thing that happens in the game that others can listen / subscribe to. Events in Unity Atoms are also Scriptable Objects that lives outside of a specific scene. It is possible to raise an Event from the Unity Inspector for debug purposes. -### Listeners +## Listeners A Listener listens / observes / subscribes to an event and raises / invokes zero to many responses to that event. Listeners are MonoBehaviours and lives in a scene. See below for more information on the type of responses there are. -### Responses +## Responses A responses is raised by a listener in response to an event. Responses can live both in the scene as [UnityEvents](https://docs.unity3d.com/ScriptReference/Events.UnityEvent.html) or outside the scene as a Scriptable Object in the shape of an Action. -#### Actions +### Actions An Action in Unity Atoms is a C# function as a Scriptable Object. An Action can be used as a response in a Listener. -#### Game Functions +### Game Functions A Function in Unity Atoms is basically the same as an Action, but while an Actions does not return something a Function does. diff --git a/docs/introduction/quick-start.md b/docs/introduction/quick-start.md index 71a11802..f58f4906 100644 --- a/docs/introduction/quick-start.md +++ b/docs/introduction/quick-start.md @@ -1,3 +1,10 @@ +--- +id: quick-start +title: Quick start +hide_title: true +sidebar_label: Quick start +--- + # Quick start ## Installation diff --git a/docs/introduction/unirx.md b/docs/introduction/unirx.md index 227f9831..562e6ab0 100644 --- a/docs/introduction/unirx.md +++ b/docs/introduction/unirx.md @@ -1,3 +1,10 @@ +--- +id: unirx +title: Usage with UniRX +hide_title: true +sidebar_label: Usage with UniRX +--- + # Usage with UniRX [**TODO**] diff --git a/docs/subpackages/mobile.md b/docs/subpackages/mobile.md index 5f291f98..01fa3313 100644 --- a/docs/subpackages/mobile.md +++ b/docs/subpackages/mobile.md @@ -1,7 +1,14 @@ +--- +id: mobile +title: Mobile +hide_title: true +sidebar_label: Mobile +--- + # Unity Atoms / Mobile -[**TODO**] - -## What does it do? +Unity Atoms for your mobile project. ## API + +[**TODO**] diff --git a/docs/subpackages/scene-mgmt.md b/docs/subpackages/scene-mgmt.md index 9ce696c2..05ba2497 100644 --- a/docs/subpackages/scene-mgmt.md +++ b/docs/subpackages/scene-mgmt.md @@ -1,7 +1,14 @@ +--- +id: scene-mgmt +title: Scene Mgmt +hide_title: true +sidebar_label: Scene Mgmt +--- + # Unity Atoms / Scene Mgmt -[**TODO**] - -## What does it do? +Unity Atoms to manage your scenes. ## API + +[**TODO**] diff --git a/docs/subpackages/tags.md b/docs/subpackages/tags.md index 248d5c63..ec8158b8 100644 --- a/docs/subpackages/tags.md +++ b/docs/subpackages/tags.md @@ -1,7 +1,14 @@ +--- +id: tags +title: Tags +hide_title: true +sidebar_label: Tags +--- + # Unity Atoms / Tags -[**TODO**] - -## What does it do? +A replacement to Unity´s tags based on Unity Atoms. ## API + +[**TODO**] diff --git a/docs/subpackages/ui.md b/docs/subpackages/ui.md index 8c370312..9a8e19c0 100644 --- a/docs/subpackages/ui.md +++ b/docs/subpackages/ui.md @@ -1,7 +1,14 @@ +--- +id: ui +title: UI +hide_title: true +sidebar_label: UI +--- + # Unity Atoms / UI -[**TODO**] - -## What does it do? +UI system using Unity Atoms. ## API + +[**TODO**] diff --git a/website/README.md b/website/README.md new file mode 100755 index 00000000..f3da77ff --- /dev/null +++ b/website/README.md @@ -0,0 +1,193 @@ +This website was created with [Docusaurus](https://docusaurus.io/). + +# What's In This Document + +* [Get Started in 5 Minutes](#get-started-in-5-minutes) +* [Directory Structure](#directory-structure) +* [Editing Content](#editing-content) +* [Adding Content](#adding-content) +* [Full Documentation](#full-documentation) + +# Get Started in 5 Minutes + +1. Make sure all the dependencies for the website are installed: + +```sh +# Install dependencies +$ yarn +``` +2. Run your dev server: + +```sh +# Start the site +$ yarn start +``` + +## Directory Structure + +Your project file structure should look something like this + +``` +my-docusaurus/ + docs/ + doc-1.md + doc-2.md + doc-3.md + website/ + blog/ + 2016-3-11-oldest-post.md + 2017-10-24-newest-post.md + core/ + node_modules/ + pages/ + static/ + css/ + img/ + package.json + sidebar.json + siteConfig.js +``` + +# Editing Content + +## Editing an existing docs page + +Edit docs by navigating to `docs/` and editing the corresponding document: + +`docs/doc-to-be-edited.md` + +```markdown +--- +id: page-needs-edit +title: This Doc Needs To Be Edited +--- + +Edit me... +``` + +For more information about docs, click [here](https://docusaurus.io/docs/en/navigation) + +## Editing an existing blog post + +Edit blog posts by navigating to `website/blog` and editing the corresponding post: + +`website/blog/post-to-be-edited.md` +```markdown +--- +id: post-needs-edit +title: This Blog Post Needs To Be Edited +--- + +Edit me... +``` + +For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog) + +# Adding Content + +## Adding a new docs page to an existing sidebar + +1. Create the doc as a new markdown file in `/docs`, example `docs/newly-created-doc.md`: + +```md +--- +id: newly-created-doc +title: This Doc Needs To Be Edited +--- + +My new content here.. +``` + +1. Refer to that doc's ID in an existing sidebar in `website/sidebar.json`: + +```javascript +// Add newly-created-doc to the Getting Started category of docs +{ + "docs": { + "Getting Started": [ + "quick-start", + "newly-created-doc" // new doc here + ], + ... + }, + ... +} +``` + +For more information about adding new docs, click [here](https://docusaurus.io/docs/en/navigation) + +## Adding a new blog post + +1. Make sure there is a header link to your blog in `website/siteConfig.js`: + +`website/siteConfig.js` +```javascript +headerLinks: [ + ... + { blog: true, label: 'Blog' }, + ... +] +``` + +2. Create the blog post with the format `YYYY-MM-DD-My-Blog-Post-Title.md` in `website/blog`: + +`website/blog/2018-05-21-New-Blog-Post.md` + +```markdown +--- +author: Frank Li +authorURL: https://twitter.com/foobarbaz +authorFBID: 503283835 +title: New Blog Post +--- + +Lorem Ipsum... +``` + +For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog) + +## Adding items to your site's top navigation bar + +1. Add links to docs, custom pages or external links by editing the headerLinks field of `website/siteConfig.js`: + +`website/siteConfig.js` +```javascript +{ + headerLinks: [ + ... + /* you can add docs */ + { doc: 'my-examples', label: 'Examples' }, + /* you can add custom pages */ + { page: 'help', label: 'Help' }, + /* you can add external links */ + { href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' }, + ... + ], + ... +} +``` + +For more information about the navigation bar, click [here](https://docusaurus.io/docs/en/navigation) + +## Adding custom pages + +1. Docusaurus uses React components to build pages. The components are saved as .js files in `website/pages/en`: +1. If you want your page to show up in your navigation header, you will need to update `website/siteConfig.js` to add to the `headerLinks` element: + +`website/siteConfig.js` +```javascript +{ + headerLinks: [ + ... + { page: 'my-new-custom-page', label: 'My New Custom Page' }, + ... + ], + ... +} +``` + +For more information about custom pages, click [here](https://docusaurus.io/docs/en/custom-pages). + +# Full Documentation + +Full documentation can be found on the [website](https://docusaurus.io/). diff --git a/website/core/Footer.js b/website/core/Footer.js new file mode 100755 index 00000000..4e1ac30a --- /dev/null +++ b/website/core/Footer.js @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +const React = require('react'); + +class Footer extends React.Component { + docUrl(doc, language) { + const baseUrl = this.props.config.baseUrl; + const docsUrl = this.props.config.docsUrl; + const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`; + const langPart = `${language ? `${language}/` : ''}`; + return `${baseUrl}${docsPart}${langPart}${doc}`; + } + + pageUrl(doc, language) { + const baseUrl = this.props.config.baseUrl; + return baseUrl + (language ? `${language}/` : '') + doc; + } + + render() { + return ( + + ); + } +} + +module.exports = Footer; diff --git a/website/i18n/en.json b/website/i18n/en.json new file mode 100644 index 00000000..ff2a9f2c --- /dev/null +++ b/website/i18n/en.json @@ -0,0 +1,100 @@ +{ + "_comment": "This file is auto-generated by write-translations.js", + "localized-strings": { + "next": "Next", + "previous": "Previous", + "tagline": "Tiny modular pieces utilizing the power of Scriptable Objects", + "docs": { + "api/actions": { + "title": "Actions", + "sidebar_label": "Actions" + }, + "api/constants": { + "title": "Constants", + "sidebar_label": "Constants" + }, + "api/events": { + "title": "Events", + "sidebar_label": "Events" + }, + "api/functions": { + "title": "Functions", + "sidebar_label": "Functions" + }, + "api/listeners": { + "title": "Listeners", + "sidebar_label": "Listeners" + }, + "api/lists": { + "title": "Lists", + "sidebar_label": "Lists" + }, + "api/references": { + "title": "References", + "sidebar_label": "References" + }, + "api/unity-events": { + "title": "Unity Events", + "sidebar_label": "Unity Events" + }, + "api/variables": { + "title": "Variables", + "sidebar_label": "Variables" + }, + "introduction/basic-tutorial": { + "title": "Basic tutorial", + "sidebar_label": "Basic tutorial" + }, + "introduction/generator": { + "title": "Generator", + "sidebar_label": "Generator" + }, + "introduction/overview": { + "title": "Overview and philosopy", + "sidebar_label": "Overview and philosopy" + }, + "introduction/quick-start": { + "title": "Quick start", + "sidebar_label": "Quick start" + }, + "introduction/unirx": { + "title": "Usage with UniRX", + "sidebar_label": "Usage with UniRX" + }, + "README": { + "title": "README" + }, + "subpackages/mobile": { + "title": "Mobile", + "sidebar_label": "Mobile" + }, + "subpackages/scene-mgmt": { + "title": "Scene Mgmt", + "sidebar_label": "Scene Mgmt" + }, + "subpackages/tags": { + "title": "Tags", + "sidebar_label": "Tags" + }, + "subpackages/ui": { + "title": "UI", + "sidebar_label": "UI" + } + }, + "links": { + "Quick Start": "Quick Start", + "API": "API", + "Github": "Github" + }, + "categories": { + "Introduction": "Introduction", + "API Reference": "API Reference", + "Subpackages": "Subpackages" + } + }, + "pages-strings": { + "Help Translate|recruit community translators for your project": "Help Translate", + "Edit this Doc|recruitment message asking to edit the doc source": "Edit", + "Translate this Doc|recruitment message asking to translate the docs": "Translate" + } +} diff --git a/website/package.json b/website/package.json new file mode 100644 index 00000000..09ef87f2 --- /dev/null +++ b/website/package.json @@ -0,0 +1,14 @@ +{ + "scripts": { + "examples": "docusaurus-examples", + "start": "docusaurus-start", + "build": "docusaurus-build", + "publish-gh-pages": "docusaurus-publish", + "write-translations": "docusaurus-write-translations", + "version": "docusaurus-version", + "rename-version": "docusaurus-rename-version" + }, + "devDependencies": { + "docusaurus": "^1.13.0" + } +} diff --git a/website/pages/en/index.js b/website/pages/en/index.js new file mode 100755 index 00000000..85efc479 --- /dev/null +++ b/website/pages/en/index.js @@ -0,0 +1,140 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +const React = require("react"); + +const CompLibrary = require("../../core/CompLibrary.js"); + +const {MarkdownBlock, GridBlock, Container} = CompLibrary; /* Used to read markdown */ + +const siteConfig = require(`${process.cwd()}/siteConfig.js`); + +function docUrl(doc, language) { + return `${siteConfig.baseUrl}${language ? `${language}/` : ""}${doc}`; +} + +function imgUrl(img) { + return `${siteConfig.baseUrl}img/${img}`; +} + +class Button extends React.Component { + render() { + return ( +
+ + {this.props.children} + +
+ ); + } +} + +Button.defaultProps = { + target: "_self" +}; + +const SplashContainer = props => ( +
+
+
{props.children}
+
+
+); + +const ProjectTitle = () => ( + +
+ Unity Atoms logo +

{siteConfig.title}

+
+ +

+ Tiny modular pieces utilizing the power of Scriptable Objects +

+
+); + +const PromoSection = props => ( +
+
+
{props.children}
+
+
+); + +class HomeSplash extends React.Component { + render() { + const language = this.props.language || ""; + return ( + +
+ + + + +
+
+ ); + } +} + +const Block = props => ( + + + +); + +const FeaturesTop = props => ( + + {[ + { + content: "Avoid scripts and systems directly dependent on each other.", + image : imgUrl("box.svg"), + imageAlign: 'top', + title: "Modular" + }, + { + content: "Scriptable Objects makes it possible to make changes to your game at runtime.", + image : imgUrl("pen.svg"), + imageAlign: 'top', + title: "Editable" + }, + { + content: "Modular code is easier to debug than tightly coupled code.", + image : imgUrl("bug.svg"), + imageAlign: 'top', + title: "Debuggable" + }, + ]} + +); + + +class Index extends React.Component { + render() { + const language = this.props.language || ""; + + return ( +
+ + +
+ +
+
+
+ ); + } +} + +module.exports = Index; diff --git a/website/sidebars.json b/website/sidebars.json new file mode 100755 index 00000000..afa97316 --- /dev/null +++ b/website/sidebars.json @@ -0,0 +1,28 @@ +{ + "docs": { + "Introduction": [ + "introduction/quick-start", + "introduction/overview", + "introduction/basic-tutorial", + "introduction/generator", + "introduction/unirx" + ], + "API Reference": [ + "api/actions", + "api/constants", + "api/events", + "api/functions", + "api/listeners", + "api/lists", + "api/references", + "api/unity-events", + "api/variables" + ], + "Subpackages": [ + "subpackages/mobile", + "subpackages/scene-mgmt", + "subpackages/tags", + "subpackages/ui" + ] + } +} diff --git a/website/siteConfig.js b/website/siteConfig.js new file mode 100644 index 00000000..28e257a5 --- /dev/null +++ b/website/siteConfig.js @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2017-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +// See https://docusaurus.io/docs/site-config for all the possible +// site configuration options. + +const siteConfig = { + title: 'Unity Atoms', // Title for your website. + tagline: 'Tiny modular pieces utilizing the power of Scriptable Objects', + url: 'https://adamramberg.github.io/unity-atoms', // Your website URL + baseUrl: '/', + docsUrl: '', + + // Used for publishing and more + projectName: 'unity-atoms', + organizationName: 'Mambo Jambo Studios', + // For top-level user or org sites, the organization is still the same. + // e.g., for the https://JoelMarcey.github.io site, it would be set like... + // organizationName: 'JoelMarcey' + + // For no header links in the top nav bar -> headerLinks: [], + headerLinks: [ + { doc: 'introduction/quick-start', label: 'Quick Start' }, + { doc: 'api/actions', label: 'API' }, + { href: 'https://www.github.com/AdamRamberg/unity-atoms', label: 'Github' } + ], + + /* path to images for header/footer */ + headerIcon: 'img/atoms-icon-white.png', + footerIcon: 'img/atoms-icon-white.png', + favicon: 'img/favicon.ico', + + /* Colors for website */ + colors: { + primaryColor: '#5b389b', + secondaryColor: '#8555dc', + }, + + /* Custom fonts for website */ + /* + fonts: { + myFont: [ + "Times New Roman", + "Serif" + ], + myOtherFont: [ + "-apple-system", + "system-ui" + ] + }, + */ + + // This copyright info is used in /core/Footer.js and blog RSS/Atom feeds. + copyright: `Copyright © ${new Date().getFullYear()} Adam Ramberg`, + + highlight: { + // Highlight.js theme to use for syntax highlighting in code blocks. + theme: 'default', + }, + + // Add custom scripts here that would be placed in