├── assets
├── Source
│ ├── _assembly.asmdef
│ ├── _assembly.asmdef.meta
│ ├── Common.meta
│ ├── Collections.meta
│ ├── Collections
│ │ ├── EditableEntry.cs.meta
│ │ ├── OrderedDictionary.cs.meta
│ │ ├── EditableEntryAttribute.cs.meta
│ │ ├── EditableEntry{TKey,TValue}.cs.meta
│ │ ├── OrderedDictionary{TKey,TValue}.cs.meta
│ │ ├── OrderedDictionary{TKey,TValue}.Enumerator.cs.meta
│ │ ├── OrderedDictionary{TKey,TValue}.KeyCollection.cs.meta
│ │ ├── OrderedDictionary{TKey,TValue}.ValueCollection.cs.meta
│ │ ├── EditableEntryAttribute.cs
│ │ ├── EditableEntry.cs
│ │ ├── EditableEntry{TKey,TValue}.cs
│ │ ├── OrderedDictionary{TKey,TValue}.Enumerator.cs
│ │ ├── OrderedDictionary.cs
│ │ ├── OrderedDictionary{TKey,TValue}.KeyCollection.cs
│ │ ├── OrderedDictionary{TKey,TValue}.ValueCollection.cs
│ │ └── OrderedDictionary{TKey,TValue}.cs
│ └── Common
│ │ ├── EditableOrderedDictionary_string_Sprite.cs.meta
│ │ ├── EditableOrderedDictionary_string_Texture.cs.meta
│ │ ├── EditableOrderedDictionary_string_string.cs.meta
│ │ ├── EditableOrderedDictionary_string_Texture2D.cs.meta
│ │ ├── EditableOrderedDictionary_string_string.cs
│ │ ├── EditableOrderedDictionary_string_Sprite.cs
│ │ ├── EditableOrderedDictionary_string_Texture.cs
│ │ └── EditableOrderedDictionary_string_Texture2D.cs
├── Editor
│ ├── _assembly.asmdef.meta
│ ├── Collections.meta
│ ├── Collections
│ │ ├── IOrderedDictionaryListAdaptor.cs.meta
│ │ ├── OrderedDictionaryListAdaptor.cs.meta
│ │ ├── OrderedDictionaryPropertyDrawer.cs.meta
│ │ ├── IEditableOrderedDictionaryContext.cs.meta
│ │ ├── OrderedDictionaryNewEntryManager.cs.meta
│ │ ├── IOrderedDictionaryListAdaptor.cs
│ │ ├── IEditableOrderedDictionaryContext.cs
│ │ ├── OrderedDictionaryNewEntryManager.cs
│ │ ├── OrderedDictionaryListAdaptor.cs
│ │ └── OrderedDictionaryPropertyDrawer.cs
│ └── _assembly.asmdef
├── Editor.meta
└── Source.meta
├── screenshot.png
├── screenshot2.png
├── index.js
├── .editorconfig
├── package.json
├── .gitignore
├── LICENSE
├── .gitattributes
└── README.md
/assets/Source/_assembly.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rotorz.unity3d-ordered-dictionary"
3 | }
4 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rotorz/unity3d-ordered-dictionary/HEAD/screenshot.png
--------------------------------------------------------------------------------
/screenshot2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rotorz/unity3d-ordered-dictionary/HEAD/screenshot2.png
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | throw new Error("This package is not supposed to be used directly.");
5 |
--------------------------------------------------------------------------------
/assets/Editor/_assembly.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5d0b2db64ad156946b22c01a4e0f1021
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/assets/Source/_assembly.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8578be3ad9d73394f9a6dd4094fea2f0
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/assets/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a458c3ead0ebed34dbd1da1dcaca8ef4
3 | folderAsset: yes
4 | timeCreated: 1487023990
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/assets/Source.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b34ced32e11f49049918f2e267ea6999
3 | folderAsset: yes
4 | timeCreated: 1487023990
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/assets/Source/Common.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ff17ab9a5747d8042a5437ae5592c595
3 | folderAsset: yes
4 | timeCreated: 1487044964
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/assets/Editor/Collections.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 022fb295db48e2b49bbe7e5b8fb533a4
3 | folderAsset: yes
4 | timeCreated: 1487044921
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/assets/Source/Collections.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ab4fce98a9a74ce4a9f363929055aeb9
3 | folderAsset: yes
4 | timeCreated: 1487044905
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/assets/Source/Collections/EditableEntry.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bc802a3efa95cbf40ab22850b4dccdc9
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Collections/OrderedDictionary.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 19a29261b9989ff43a24261551a4d6e1
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Collections/EditableEntryAttribute.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: aaba14ff07617e54fb69826f026e4106
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Collections/EditableEntry{TKey,TValue}.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8aa282f26d1672b4382afa2c522ad731
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Editor/Collections/IOrderedDictionaryListAdaptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 619a24560573b46468632ee1accb1469
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Editor/Collections/OrderedDictionaryListAdaptor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6896a707d2259a349b1264c4fb43025b
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Editor/Collections/OrderedDictionaryPropertyDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ba7be57680bfec648b85531737eeb4ae
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Collections/OrderedDictionary{TKey,TValue}.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9077c4a3478778540aedf115d9764937
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Editor/Collections/IEditableOrderedDictionaryContext.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 454adf930789bdc4bb27af9a2cdc0dd7
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Editor/Collections/OrderedDictionaryNewEntryManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 612f49b08bca3144b908bd6d19dc04a9
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_Sprite.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fa6d97adb8f8d1a4ea24eb432ccc1890
3 | timeCreated: 1483510231
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_Texture.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 56a765fa677501041bb3ced9c584a34e
3 | timeCreated: 1483509947
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_string.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 94ddce6038a8156429fc89350d3ef381
3 | timeCreated: 1484298612
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Collections/OrderedDictionary{TKey,TValue}.Enumerator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e20ad9a33c382fc4087384aeb1a865ff
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_Texture2D.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a9a9298cdd7d1b94e8ce0b5b89f17a9d
3 | timeCreated: 1483524383
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Collections/OrderedDictionary{TKey,TValue}.KeyCollection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a93726b225093b0469996afafaad1a80
3 | timeCreated: 1487023991
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Source/Collections/OrderedDictionary{TKey,TValue}.ValueCollection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: edce5f4531cda8f4f9d2acf37f39b71c
3 | timeCreated: 1487023992
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/assets/Editor/_assembly.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rotorz.unity3d-ordered-dictionary.editor",
3 | "references": [
4 | "rotorz.unity3d-ordered-dictionary",
5 | "rotorz.unity3d-reorderable-list",
6 | "rotorz.unity3d-reorderable-list.editor",
7 | "rotorz.unity3d-utils.editor"
8 | ],
9 | "optionalUnityReferences": [],
10 | "includePlatforms": [
11 | "Editor"
12 | ],
13 | "excludePlatforms": [],
14 | "allowUnsafeCode": false
15 | }
16 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | ; Grab the EditorConfig extension for Visual Studio:
2 | ; https://visualstudiogallery.msdn.microsoft.com/c8bccfe2-650c-4b42-bc5c-845e21f96328
3 |
4 | ; Top-most EditorConfig file
5 | root = true
6 |
7 | ; Unix-style newlines with a newline ending every file
8 | [*]
9 | end_of_line = LF
10 | insert_final_newline = true
11 | indent_style = space
12 | indent_size = 4
13 | trim_trailing_whitespace = true
14 |
15 | [*.{md,yaml}]
16 | trim_trailing_whitespace = false
17 |
18 | [*.{js,json,yaml,html,css,styl}]
19 | indent_size = 2
20 |
21 | [Makefile]
22 | indent_style = tab
23 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@rotorz/unity3d-ordered-dictionary",
3 | "version": "1.0.3",
4 | "description": "Library for adding ordered dictionaries to custom `ScriptableObject` and `MonoBehaviour` classes in a way that can be serialized by Unity provided that the key and value types are serializable.",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "https://github.com/rotorz/unity3d-ordered-dictionary"
12 | },
13 | "author": "Rotorz Limited",
14 | "license": "MIT",
15 | "keywords": [
16 | "unity3d",
17 | "unity3d-package"
18 | ],
19 | "dependencies": {
20 | "@rotorz/unity3d-reorderable-list": "github:rotorz/unity3d-reorderable-list#semver:^1.0.2",
21 | "@rotorz/unity3d-utils": "github:rotorz/unity3d-utils#semver:^1.0.1"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Derived From:
2 | # http://kleber-swf.com/the-definitive-gitignore-for-unity-projects/
3 |
4 | # ============= #
5 | # Working Files #
6 | # ============= #
7 | node_modules/
8 | npm-debug.log
9 |
10 | # ===================== #
11 | # Working Files - Unity #
12 | # ===================== #
13 | /Temp/
14 | /Library/
15 | /Packages/
16 | /ProjectSettings/
17 | /assets/Plugins/
18 | /assets/Plugins.meta
19 | /*.csproj
20 | /*.sln
21 |
22 | # ===================================== #
23 | # Visual Studio / MonoDevelop generated #
24 | # ===================================== #
25 | /.vs/
26 | bin
27 | obj
28 | ExportedObj/
29 | *.svd
30 | *.userprefs
31 | *.pidb
32 | *.suo
33 | *.user
34 | *.unityproj
35 | *.booproj
36 | *.pdb
37 | *.pdb.meta
38 |
39 | # ============ #
40 | # OS generated #
41 | # ============ #
42 | .DS_Store
43 | .DS_Store?
44 | *~
45 | ._*
46 | .Spotlight-V100
47 | .Trashes
48 | Icon?
49 | ehthumbs.db
50 | Thumbs.db
51 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_string.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | using System;
5 |
6 | namespace Rotorz.Games.Collections
7 | {
8 | ///
9 | /// An object that allows users to edit
10 | /// objects when using the Unity inspector.
11 | ///
12 | public sealed class EditableOrderedDictionary_string_string : EditableEntry
13 | {
14 | }
15 |
16 |
17 | ///
18 | /// An ordered dictionary with keys mapped to other
19 | ///
21 | [Serializable, EditableEntry(typeof(EditableOrderedDictionary_string_string))]
22 | public sealed class OrderedDictionary_string_string : OrderedDictionary
23 | {
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_Sprite.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | using System;
5 | using UnityEngine;
6 |
7 | namespace Rotorz.Games.Collections
8 | {
9 | ///
10 | /// An object that allows users to edit
11 | /// objects when using the Unity inspector.
12 | ///
13 | public sealed class EditableOrderedDictionary_string_Sprite : EditableEntry
14 | {
15 | }
16 |
17 |
18 | ///
19 | /// An ordered dictionary with keys mapped to
20 | /// values.
21 | ///
22 | [Serializable, EditableEntry(typeof(EditableOrderedDictionary_string_Sprite))]
23 | public sealed class OrderedDictionary_string_Sprite : OrderedDictionary
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_Texture.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | using System;
5 | using UnityEngine;
6 |
7 | namespace Rotorz.Games.Collections
8 | {
9 | ///
10 | /// An object that allows users to edit
11 | /// objects when using the Unity inspector.
12 | ///
13 | public sealed class EditableOrderedDictionary_string_Texture : EditableEntry
14 | {
15 | }
16 |
17 |
18 | ///
19 | /// An ordered dictionary with keys mapped to
20 | /// values.
21 | ///
22 | [Serializable, EditableEntry(typeof(EditableOrderedDictionary_string_Texture))]
23 | public sealed class OrderedDictionary_string_Texture : OrderedDictionary
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/assets/Source/Common/EditableOrderedDictionary_string_Texture2D.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license.
3 |
4 | using System;
5 | using UnityEngine;
6 |
7 | namespace Rotorz.Games.Collections
8 | {
9 | ///
10 | /// An object that allows users to edit
11 | /// objects when using the Unity inspector.
12 | ///
13 | public sealed class EditableOrderedDictionary_string_Texture2D : EditableEntry
14 | {
15 | }
16 |
17 |
18 | ///
19 | /// An ordered dictionary with keys mapped to
20 | /// values.
21 | ///
22 | [Serializable, EditableEntry(typeof(EditableOrderedDictionary_string_Texture2D))]
23 | public sealed class OrderedDictionary_string_Texture2D : OrderedDictionary
24 | {
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016-2017 Rotorz Limited
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/assets/Source/Collections/EditableEntryAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | using System;
5 |
6 | namespace Rotorz.Games.Collections
7 | {
8 | ///
9 | /// Associates a type of with a type of .
10 | ///
11 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
12 | public sealed class EditableEntryAttribute : Attribute
13 | {
14 | ///
15 | /// Initializes a new instance of the class.
16 | ///
17 | /// The type of editable entry.
18 | public EditableEntryAttribute(Type editableEntryType)
19 | {
20 | this.EditableEntryType = editableEntryType;
21 | }
22 |
23 |
24 | ///
25 | /// Gets the type of that is to be associated with
26 | /// the class.
27 | ///
28 | public Type EditableEntryType { get; private set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/assets/Editor/Collections/IOrderedDictionaryListAdaptor.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | using UnityEditor;
5 |
6 | namespace Rotorz.Games.Collections
7 | {
8 | ///
9 | /// Interface represents the context of an editable entry.
10 | ///
11 | public interface IOrderedDictionaryListAdaptor : IReorderableListAdaptor
12 | {
13 | ///
14 | /// Gets a value indicating whether a null key error was encountered.
15 | ///
16 | bool HadNullKeyErrorOnLastRepaint { get; }
17 |
18 |
19 | ///
20 | /// Adds a new entry to the ordered dictionary.
21 | ///
22 | /// Key for the new entry (will be copied from
23 | /// another serialized object).
24 | /// Value for the new entry (will be copied from
25 | /// another serialized object).
26 | ///
27 | /// If entry cannot be added because the collection has an inconsistent quantity
28 | /// of keys and values.
29 | ///
30 | void Add(SerializedProperty inputKeyProperty, SerializedProperty inputValueProperty);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/assets/Source/Collections/EditableEntry.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | using UnityEngine;
5 |
6 | namespace Rotorz.Games.Collections
7 | {
8 | ///
9 | /// A class with a field that can be used to draw
10 | /// an 'Add Entry' control below the entries of an actual
11 | /// in an editor interface (i.e. the inspector).
12 | ///
13 | ///
14 | public abstract class EditableEntry : ScriptableObject
15 | {
16 | ///
17 | /// Gets the that has exactly one key/value entry.
18 | ///
19 | ///
20 | /// This property is exposed so that a list adaptor can be constructed to
21 | /// draw the 'Add Entry' controls.
22 | ///
23 | public abstract OrderedDictionary Dictionary { get; }
24 |
25 | ///
26 | /// Gets the user input for the new entry key.
27 | ///
28 | public abstract object Key { get; }
29 |
30 | ///
31 | /// Gets the user input for the new entry value.
32 | ///
33 | public abstract object Value { get; }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/assets/Source/Collections/EditableEntry{TKey,TValue}.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | using UnityEngine;
5 |
6 | namespace Rotorz.Games.Collections
7 | {
8 | ///
9 | /// A class with a field that can
10 | /// be used to draw an 'Add Entry' control below the entries of an actual
11 | /// in an editor interface (i.e. the inspector).
12 | ///
13 | ///
14 | /// Type of ordered dictionary that is to be edited.
15 | public abstract class EditableEntry : EditableEntry
16 | where TOrderedDictionary : OrderedDictionary, new()
17 | {
18 | [SerializeField]
19 | private TOrderedDictionary dictionary = new TOrderedDictionary();
20 |
21 |
22 | ///
23 | public override OrderedDictionary Dictionary {
24 | get { return this.dictionary; }
25 | }
26 |
27 | ///
28 | public override object Key {
29 | get { return this.dictionary.GetKeyFromIndex(0); }
30 | }
31 |
32 | ///
33 | public override object Value {
34 | get { return this.dictionary.GetValueFromIndex(0); }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/assets/Editor/Collections/IEditableOrderedDictionaryContext.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | using System;
5 | using UnityEditor;
6 |
7 | namespace Rotorz.Games.Collections
8 | {
9 | ///
10 | /// Interface represents the context of an editable entry.
11 | ///
12 | public interface IEditableOrderedDictionaryContext
13 | {
14 | ///
15 | /// Gets the unique value that identifies the control.
16 | ///
17 | Guid ControlID { get; }
18 |
19 | ///
20 | /// Gets the ordered dictionary that is being edited.
21 | ///
22 | OrderedDictionary OrderedDictionary { get; }
23 |
24 | ///
25 | /// Gets the type of the ordered dictionary.
26 | ///
27 | Type OrderedDictionaryType { get; }
28 |
29 |
30 | ///
31 | /// Creates a that will be used to draw and
32 | /// manipulate the list of ordered dictionary entries.
33 | ///
34 | /// Property representing the ordered dictionary.
35 | ///
36 | /// The new instance.
37 | ///
38 | IOrderedDictionaryListAdaptor CreateListAdaptor(SerializedProperty dictionaryProperty);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Apply native OS line-endings on checkout of these files...
2 | *.boo text
3 | *.c text
4 | *.cginc text
5 | *.config text
6 | *.contentproj text
7 | *.cpp text
8 | *.cs text
9 | *.css text
10 | *.dae text
11 | *.DAE text
12 | *.dtd text
13 | *.fx text
14 | *.glsl text
15 | *.h text
16 | *.htm text
17 | *.html text
18 | *.inc text
19 | *.ini text
20 | *.js text
21 | *.JSFL text
22 | *.jsfl text
23 | *.json text
24 | *.log text
25 | *.md text
26 | *.mel text
27 | *.php text
28 | *.po text
29 | *.shader text
30 | *.txt text
31 | *.TXT text
32 | *.xaml text
33 | *.xml text
34 | *.xsd text
35 | .gitattributes text
36 | .gitignore text
37 | COPYING text
38 | INSTALL* text
39 | KEYS* text
40 | LICENSE* text
41 | NEWS* text
42 | NOTICE* text
43 | README* text
44 | TODO* text
45 | WHATSNEW* text
46 |
47 | # Apply Unix-style LF line-endings on checkout for these files since Unity
48 | # project has been configured to force text output for them...
49 | *.anim text eol=lf
50 | *.asset text eol=lf
51 | *.controller text eol=lf
52 | *.cubemap text eol=lf
53 | *.guiskin text eol=lf
54 | *.mat text eol=lf
55 | *.prefab text eol=lf
56 | *.physicMaterial text eol=lf
57 | *.physicmaterial text eol=lf
58 | *.unity text eol=lf
59 |
60 | # Apply Unix-style LF line-endings on checkout of these files...
61 | *.meta text eol=lf
62 | *.sh text eol=lf
63 | *.vspscc text eol=lf
64 | .htaccess text eol=lf
65 |
66 | # Apply Windows/DOS-style CR-LF line-endings on checkout of these files...
67 | *.bat text eol=crlf
68 | *.cmd text eol=crlf
69 | *.csproj text eol=crlf
70 | *.sln text eol=crlf
71 | *.user text eol=crlf
72 | *.vcproj text eol=crlf
73 |
74 | # No end-of-line conversions are applied (i.e., "-text -diff") to these files...
75 | *.7z binary
76 | *.ai binary
77 | *.apk binary
78 | *.bin binary
79 | *.bmp binary
80 | *.BMP binary
81 | *.com binary
82 | *.COM binary
83 | *.dex binary
84 | *.dll binary
85 | *.DLL binary
86 | *.dylib binary
87 | *.eps binary
88 | *.exe binary
89 | *.EXE binary
90 | *.exr binary
91 | *.fbx binary
92 | *.FBX binary
93 | *.fla binary
94 | *.flare binary
95 | *.flv binary
96 | *.gif binary
97 | *.gz binary
98 | *.ht binary
99 | *.ico binary
100 | *.jpeg binary
101 | *.jpg binary
102 | *.keystore binary
103 | *.mask binary
104 | *.mb binary
105 | *.mo binary
106 | *.mp3 binary
107 | *.mp4 binary
108 | *.mpg binary
109 | *.ogg binary
110 | *.PCX binary
111 | *.pcx binary
112 | *.pdb binary
113 | *.pdf binary
114 | *.png binary
115 | *.ps binary
116 | *.psd binary
117 | *.qt binary
118 | *.so binary
119 | *.swf binary
120 | *.tga binary
121 | *.tif binary
122 | *.tiff binary
123 | *.ttf binary
124 | *.TTF binary
125 | *.unitypackage binary
126 | *.unityPackage binary
127 | *.wav binary
128 | *.wmv binary
129 | *.zip binary
130 | *.ZIP binary
131 |
--------------------------------------------------------------------------------
/assets/Source/Collections/OrderedDictionary{TKey,TValue}.Enumerator.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | using System;
5 | using System.Collections;
6 | using System.Collections.Generic;
7 |
8 | namespace Rotorz.Games.Collections
9 | {
10 | public partial class OrderedDictionary
11 | {
12 | ///
13 | /// Enumerator for enumerating through the key/value pairs of an ordered dictionary.
14 | ///
15 | public struct Enumerator : IEnumerator>, IDictionaryEnumerator
16 | {
17 | private readonly OrderedDictionary dictionary;
18 | private readonly int version;
19 | private readonly bool returnDictionaryEntry;
20 |
21 | private int index;
22 | private KeyValuePair current;
23 |
24 |
25 | ///
26 | /// Initializes a new instance of the structure.
27 | ///
28 | /// The associated dictionary.
29 | public Enumerator(OrderedDictionary dictionary, bool returnDictionaryEntry)
30 | {
31 | this.dictionary = dictionary;
32 | this.version = dictionary.version;
33 | this.returnDictionaryEntry = returnDictionaryEntry;
34 |
35 | this.index = 0;
36 | this.current = default(KeyValuePair);
37 | }
38 |
39 |
40 | ///
41 | void IDisposable.Dispose()
42 | {
43 | }
44 |
45 | ///
46 | public KeyValuePair Current {
47 | get { return this.current; }
48 | }
49 |
50 | ///
51 | object IEnumerator.Current {
52 | get {
53 | if (this.returnDictionaryEntry) {
54 | return new DictionaryEntry(this.current.Key, this.current.Value);
55 | }
56 | else {
57 | return this.current;
58 | }
59 | }
60 | }
61 |
62 | ///
63 | /// Gets the key of the current entry.
64 | ///
65 | public TKey Key {
66 | get { return this.current.Key; }
67 | }
68 |
69 | ///
70 | /// Gets the value of the current entry.
71 | ///
72 | public TValue Value {
73 | get { return this.current.Value; }
74 | }
75 |
76 | ///
77 | DictionaryEntry IDictionaryEnumerator.Entry {
78 | get { return new DictionaryEntry(this.current.Key, this.current.Value); }
79 | }
80 |
81 | ///
82 | object IDictionaryEnumerator.Key {
83 | get { return this.current.Key; }
84 | }
85 |
86 | ///
87 | object IDictionaryEnumerator.Value {
88 | get { return this.current.Value; }
89 | }
90 |
91 | ///
92 | public bool MoveNext()
93 | {
94 | this.dictionary.CheckVersion(version);
95 |
96 | if (this.index < this.dictionary.Count) {
97 | this.current = new KeyValuePair(this.dictionary.keys[this.index], this.dictionary.values[this.index]);
98 | ++this.index;
99 | return true;
100 | }
101 |
102 | this.current = default(KeyValuePair);
103 | return false;
104 | }
105 |
106 | ///
107 | void IEnumerator.Reset()
108 | {
109 | this.dictionary.CheckVersion(version);
110 |
111 | this.index = 0;
112 | this.current = default(KeyValuePair);
113 | }
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # unity3d-ordered-dictionary
2 |
3 | Library for adding ordered dictionaries to custom `ScriptableObject` and `MonoBehaviour`
4 | classes in a way that can be serialized by Unity provided that the key and value types
5 | are serializable.
6 |
7 |
8 | ```sh
9 | $ yarn add rotorz/unity3d-ordered-dictionary
10 | ```
11 |
12 | This package is compatible with the [unity3d-package-syncer][tool] tool. Refer to the
13 | tools' [README][tool] for information on syncing packages into a Unity project.
14 |
15 | [tool]: https://github.com/rotorz/unity3d-package-syncer
16 |
17 | 
18 |
19 |
20 | ## Features
21 |
22 | - Default inspector with intuitive interface.
23 | - Drop insertion for UnityEngine.Object's where name is used for key.
24 | - Have multiple dictionaries per `ScriptableObject` or `MonoBehaviour`!
25 | - Serializable dictionary asset files.
26 | - Supports any serializable key and value types.
27 | - Ordered dictionary.
28 |
29 |
30 | ## Installation
31 |
32 | The **unity3d-ordered-dictionary** library is designed to be installed into Unity projects
33 | using the **npm** package manager and then synchronized into the "Assets" directory using
34 | the **unity3d-package-syncer** utility. For more information regarding this workflow refer
35 | to the [unity3d-package-syncer](https://github.com/rotorz/unity3d-package-syncer)
36 | repository.
37 |
38 | Alternatively you can download the contents of this repository and add directly into your
39 | project, but you would also need to download the sources of other packages that this
40 | package is dependant upon. Refer to the `packages.json` file to see these.
41 |
42 |
43 | ## Boilerplate Generation Tool
44 |
45 | This is a simple client side (offline) tool that runs to quickly generate the boilerplate
46 | that Unity needs to make the Ordered Dictionary for Unity library work since Unity doesn't
47 | currently support serialization with generic types:
48 |
49 | http://rotorz.com/unity/misc/ordered-dictionary-boilerplate
50 |
51 |
52 | ## A couple of examples!
53 |
54 | ### Sprite Library
55 |
56 | ```csharp
57 | // StringSpriteDictionaryEditable.cs
58 | using Rotorz.Games.Collections;
59 | using System;
60 | using UnityEngine;
61 |
62 | // Script filename must match this class.
63 | public sealed class StringSpriteDictionaryEditable : EditableEntry
64 | {
65 | }
66 |
67 | // This class can exist in same file with any name.
68 | [Serializable, EditableEntry(typeof(StringSpriteDictionaryEditable))]
69 | public sealed class StringSpriteDictionary : OrderedDictionary
70 | {
71 | }
72 |
73 |
74 | // SpriteLibrary.cs
75 | using UnityEditor;
76 | using UnityEngine;
77 |
78 | [CreateAssetMenu]
79 | public class SpriteLibrary : ScriptableObject
80 | {
81 | public StringSpriteDictionary sprites;
82 | }
83 | ```
84 |
85 |
86 | ### String Lookup Table
87 |
88 | 
89 |
90 | ```csharp
91 | // StringStringDictionaryEditable.cs
92 | using Rotorz.Games.Collections;
93 | using System;
94 | using UnityEngine;
95 |
96 | // Script filename must match this class.
97 | public sealed class StringStringDictionaryEditable : EditableEntry
98 | {
99 | }
100 |
101 | // This class can exist in same file with any name.
102 | [Serializable, EditableEntry(typeof(StringStringDictionaryEditable))]
103 | public sealed class StringStringDictionary : OrderedDictionary
104 | {
105 | }
106 |
107 |
108 | // AchievementNamesBehaviour.cs
109 | using UnityEditor;
110 | using UnityEngine;
111 |
112 | public class AchievementNamesBehaviour : MonoBehaviour
113 | {
114 | public StringStringDictionary names;
115 | }
116 | ```
117 |
118 |
119 | ## Contribution Agreement
120 |
121 | This project is licensed under the MIT license (see LICENSE). To be in the best
122 | position to enforce these licenses the copyright status of this project needs to
123 | be as simple as possible. To achieve this the following terms and conditions
124 | must be met:
125 |
126 | - All contributed content (including but not limited to source code, text,
127 | image, videos, bug reports, suggestions, ideas, etc.) must be the
128 | contributors own work.
129 |
130 | - The contributor disclaims all copyright and accepts that their contributed
131 | content will be released to the public domain.
132 |
133 | - The act of submitting a contribution indicates that the contributor agrees
134 | with this agreement. This includes (but is not limited to) pull requests, issues,
135 | tickets, e-mails, newsgroups, blogs, forums, etc.
136 |
--------------------------------------------------------------------------------
/assets/Source/Collections/OrderedDictionary.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Rotorz Limited. All rights reserved.
2 | // Licensed under the MIT license. See LICENSE file in the project root.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using UnityEngine;
7 |
8 | namespace Rotorz.Games.Collections
9 | {
10 | ///
11 | /// Base class for a serializable ordered dictionary asset. Custom dictionary asset
12 | /// classes should inherit from the
13 | /// generic class instead.
14 | ///
15 | public abstract class OrderedDictionary
16 | {
17 | ///
18 | [SerializeField, HideInInspector]
19 | public bool suppressErrors;
20 |
21 |
22 | ///
23 | /// Initializes a new instance of the class.
24 | ///
25 | /// Data type of a key.
26 | /// Data type of a value.
27 | protected OrderedDictionary(Type keyType, Type valueType)
28 | {
29 | this.KeyType = keyType;
30 | this.ValueType = valueType;
31 | }
32 |
33 |
34 | ///
35 | /// Gets the data type of a key.
36 | ///
37 | ///
38 | public Type KeyType { get; private set; }
39 |
40 | ///
41 | /// Gets the data type of a value.
42 | ///
43 | ///
44 | public Type ValueType { get; private set; }
45 |
46 |
47 | ///
48 | /// Gets the total count of entries in the dictionary.
49 | ///
50 | public abstract int Count { get; }
51 |
52 |
53 | ///
54 | /// Gets the collection of keys that somehow have two or more associated values.
55 | ///
56 | public abstract IEnumerable