net.dreditor.editor.utility.converting 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,34 +1,34 @@
1
- {
2
- "name": "DREditor.Editor.Utility.Converting",
3
- "rootNamespace": "",
4
- "references": [
5
- "Unity.RenderPipelines.Universal.Runtime",
6
- "Unity.InputSystem",
7
- "DREditor.Editor",
8
- "DREditor",
9
- "DREditor.Controls",
10
- "DREditor.States",
11
- "DREditor.Progressing.Handling",
12
- "DREditor.DialogueMechanics.Investigation",
13
- "DREditor.RoomStateBuilding",
14
- "DREditor.RoomBuilding",
15
- "DREditor.Actors",
16
- "DREditor.Doors",
17
- "DREditor.Talkables",
18
- "DREditor.SubAreas",
19
- "DREditor.Triggers",
20
- "DREditor.DebugTesting",
21
- "DREditor.UI"
22
- ],
23
- "includePlatforms": [
24
- "Editor"
25
- ],
26
- "excludePlatforms": [],
27
- "allowUnsafeCode": false,
28
- "overrideReferences": false,
29
- "precompiledReferences": [],
30
- "autoReferenced": true,
31
- "defineConstraints": [],
32
- "versionDefines": [],
33
- "noEngineReferences": false
1
+ {
2
+ "name": "DREditor.Editor.Utility.Converting",
3
+ "rootNamespace": "",
4
+ "references": [
5
+ "Unity.RenderPipelines.Universal.Runtime",
6
+ "Unity.InputSystem",
7
+ "DREditor.Editor",
8
+ "DREditor",
9
+ "DREditor.Controls",
10
+ "DREditor.States",
11
+ "DREditor.Progressing.Handling",
12
+ "DREditor.DialogueMechanics.Investigation",
13
+ "DREditor.RoomStateBuilding",
14
+ "DREditor.RoomBuilding",
15
+ "DREditor.Actors",
16
+ "DREditor.Doors",
17
+ "DREditor.Talkables",
18
+ "DREditor.SubAreas",
19
+ "DREditor.Triggers",
20
+ "DREditor.DebugTesting",
21
+ "DREditor.UI"
22
+ ],
23
+ "includePlatforms": [
24
+ "Editor"
25
+ ],
26
+ "excludePlatforms": [],
27
+ "allowUnsafeCode": false,
28
+ "overrideReferences": false,
29
+ "precompiledReferences": [],
30
+ "autoReferenced": true,
31
+ "defineConstraints": [],
32
+ "versionDefines": [],
33
+ "noEngineReferences": false
34
34
  }
@@ -1,7 +1,7 @@
1
- fileFormatVersion: 2
2
- guid: 2135f79bd7a042d4bab6d1690fc7fba9
3
- AssemblyDefinitionImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 2135f79bd7a042d4bab6d1690fc7fba9
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -1,129 +1,129 @@
1
- //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
- #if UNITY_EDITOR
3
- using DREditor.UI.Buttons;
4
- using System.Collections.Generic;
5
- using System.Linq;
6
- using UnityEditor;
7
- using UnityEngine;
8
- using UnityEngine.UI;
9
-
10
- namespace DREditor.Editor.Utility.Converting
11
- {
12
- /// <summary>
13
- ///
14
- /// </summary>
15
- public static class MigrationUtility
16
- {
17
- /// <summary>
18
- ///
19
- /// </summary>
20
- static readonly string MonoscriptSearch = "t:MonoScript ";
21
-
22
- /// <summary>
23
- ///
24
- /// </summary>
25
- static readonly string PrefabSearch = "t:Prefab";
26
-
27
- /// <summary>
28
- ///
29
- /// </summary>
30
- static readonly string ScriptPropertyName = "m_Script";
31
-
32
-
33
- /// <summary>
34
- ///
35
- /// </summary>
36
- [MenuItem("DREditor/Convert/Buttons/Migrate Buttons to DREButton")]
37
- public static void MigrateButtons() => MigrateType<Button, DREButton>();
38
-
39
- /// <summary>
40
- ///
41
- /// </summary>
42
- /// <typeparam name="T"></typeparam>
43
- /// <typeparam name="T2"></typeparam>
44
- public static void MigrateType<T, T2>() where T : Object
45
- {
46
- if (FindTypeScript<T2>(out var childScript))
47
- {
48
- MigrateSceneObjects<T>(childScript);
49
-
50
- MigratePrefabs<T>(childScript);
51
-
52
- AssetDatabase.SaveAssets();
53
- }
54
- else
55
- UnityEngine.Debug.LogError($"ALERT: {typeof(T2).Name} script not found in project.");
56
- }
57
-
58
- /// <summary>
59
- ///
60
- /// </summary>
61
- /// <typeparam name="T"></typeparam>
62
- /// <param name="childScript"></param>
63
- /// <returns></returns>
64
- private static bool FindTypeScript<T>(out MonoScript childScript)
65
- {
66
- childScript = AssetDatabase.FindAssets(MonoscriptSearch + typeof(T).Name)
67
- .Select(guid => AssetDatabase.LoadAssetAtPath<MonoScript>(AssetDatabase.GUIDToAssetPath(guid)))
68
- .FirstOrDefault(s => s != null && s.GetClass() == typeof(T));
69
-
70
- return childScript != null;
71
- }
72
-
73
- /// <summary>
74
- ///
75
- /// </summary>
76
- /// <typeparam name="T"></typeparam>
77
- /// <param name="childScript"></param>
78
- private static void MigrateSceneObjects<T>(MonoScript childScript) where T : Object
79
- => SwappedReferences(UnityEngine.Object.FindObjectsByType<T>(), childScript);
80
-
81
- /// <summary>
82
- ///
83
- /// </summary>
84
- /// <typeparam name="T"></typeparam>
85
- /// <param name="childScript"></param>
86
- private static void MigratePrefabs<T>(MonoScript childScript) where T : Object
87
- {
88
- foreach (string guid in AssetDatabase.FindAssets(PrefabSearch))
89
- {
90
- string path = AssetDatabase.GUIDToAssetPath(guid);
91
-
92
- GameObject prefab = PrefabUtility.LoadPrefabContents(path);
93
-
94
- bool modified = SwappedReferences(prefab.GetComponentsInChildren<Button>(true), childScript);
95
-
96
- if (modified)
97
- PrefabUtility.SaveAsPrefabAsset(prefab, path);
98
-
99
- PrefabUtility.UnloadPrefabContents(prefab);
100
- }
101
- }
102
-
103
- /// <summary>
104
- ///
105
- /// </summary>
106
- /// <param name="references"></param>
107
- /// <param name="childScript"></param>
108
- /// <returns></returns>
109
- /// <remarks></remarks>
110
- private static bool SwappedReferences<T>(IEnumerable<T> references, MonoScript childScript) where T : Object
111
- {
112
- bool modified = false;
113
-
114
- foreach (T reference in references.Where(b => b.GetType() == typeof(T)))
115
- {
116
- SerializedObject serializedButton = new(reference);
117
-
118
- serializedButton.FindProperty(ScriptPropertyName).objectReferenceValue = childScript;
119
-
120
- serializedButton.ApplyModifiedPropertiesWithoutUndo();
121
-
122
- modified = true;
123
- }
124
-
125
- return modified;
126
- }
127
- }
128
- }
1
+ //Author: Benjamin "Sweden" Jillson : Discord: sweden_gaming For Project Eden's Garden
2
+ #if UNITY_EDITOR
3
+ using DREditor.UI.Buttons;
4
+ using System.Collections.Generic;
5
+ using System.Linq;
6
+ using UnityEditor;
7
+ using UnityEngine;
8
+ using UnityEngine.UI;
9
+
10
+ namespace DREditor.Editor.Utility.Converting
11
+ {
12
+ /// <summary>
13
+ ///
14
+ /// </summary>
15
+ public static class MigrationUtility
16
+ {
17
+ /// <summary>
18
+ ///
19
+ /// </summary>
20
+ static readonly string MonoscriptSearch = "t:MonoScript ";
21
+
22
+ /// <summary>
23
+ ///
24
+ /// </summary>
25
+ static readonly string PrefabSearch = "t:Prefab";
26
+
27
+ /// <summary>
28
+ ///
29
+ /// </summary>
30
+ static readonly string ScriptPropertyName = "m_Script";
31
+
32
+
33
+ /// <summary>
34
+ ///
35
+ /// </summary>
36
+ [MenuItem("DREditor/Convert/Buttons/Migrate Buttons to DREButton")]
37
+ public static void MigrateButtons() => MigrateType<Button, DREButton>();
38
+
39
+ /// <summary>
40
+ ///
41
+ /// </summary>
42
+ /// <typeparam name="T"></typeparam>
43
+ /// <typeparam name="T2"></typeparam>
44
+ public static void MigrateType<T, T2>() where T : Object
45
+ {
46
+ if (FindTypeScript<T2>(out var childScript))
47
+ {
48
+ MigrateSceneObjects<T>(childScript);
49
+
50
+ MigratePrefabs<T>(childScript);
51
+
52
+ AssetDatabase.SaveAssets();
53
+ }
54
+ else
55
+ UnityEngine.Debug.LogError($"ALERT: {typeof(T2).Name} script not found in project.");
56
+ }
57
+
58
+ /// <summary>
59
+ ///
60
+ /// </summary>
61
+ /// <typeparam name="T"></typeparam>
62
+ /// <param name="childScript"></param>
63
+ /// <returns></returns>
64
+ private static bool FindTypeScript<T>(out MonoScript childScript)
65
+ {
66
+ childScript = AssetDatabase.FindAssets(MonoscriptSearch + typeof(T).Name)
67
+ .Select(guid => AssetDatabase.LoadAssetAtPath<MonoScript>(AssetDatabase.GUIDToAssetPath(guid)))
68
+ .FirstOrDefault(s => s != null && s.GetClass() == typeof(T));
69
+
70
+ return childScript != null;
71
+ }
72
+
73
+ /// <summary>
74
+ ///
75
+ /// </summary>
76
+ /// <typeparam name="T"></typeparam>
77
+ /// <param name="childScript"></param>
78
+ private static void MigrateSceneObjects<T>(MonoScript childScript) where T : Object
79
+ => SwappedReferences(UnityEngine.Object.FindObjectsByType<T>(), childScript);
80
+
81
+ /// <summary>
82
+ ///
83
+ /// </summary>
84
+ /// <typeparam name="T"></typeparam>
85
+ /// <param name="childScript"></param>
86
+ private static void MigratePrefabs<T>(MonoScript childScript) where T : Object
87
+ {
88
+ foreach (string guid in AssetDatabase.FindAssets(PrefabSearch))
89
+ {
90
+ string path = AssetDatabase.GUIDToAssetPath(guid);
91
+
92
+ GameObject prefab = PrefabUtility.LoadPrefabContents(path);
93
+
94
+ bool modified = SwappedReferences(prefab.GetComponentsInChildren<Button>(true), childScript);
95
+
96
+ if (modified)
97
+ PrefabUtility.SaveAsPrefabAsset(prefab, path);
98
+
99
+ PrefabUtility.UnloadPrefabContents(prefab);
100
+ }
101
+ }
102
+
103
+ /// <summary>
104
+ ///
105
+ /// </summary>
106
+ /// <param name="references"></param>
107
+ /// <param name="childScript"></param>
108
+ /// <returns></returns>
109
+ /// <remarks></remarks>
110
+ private static bool SwappedReferences<T>(IEnumerable<T> references, MonoScript childScript) where T : Object
111
+ {
112
+ bool modified = false;
113
+
114
+ foreach (T reference in references.Where(b => b.GetType() == typeof(T)))
115
+ {
116
+ SerializedObject serializedButton = new(reference);
117
+
118
+ serializedButton.FindProperty(ScriptPropertyName).objectReferenceValue = childScript;
119
+
120
+ serializedButton.ApplyModifiedPropertiesWithoutUndo();
121
+
122
+ modified = true;
123
+ }
124
+
125
+ return modified;
126
+ }
127
+ }
128
+ }
129
129
  #endif
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 1c9d4197915d6524697ab09b1e2671e0
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 1c9d4197915d6524697ab09b1e2671e0
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,48 +1,53 @@
1
- {
2
- "name": "net.dreditor.editor.utility.converting",
3
- "version": "0.1.6",
4
- "displayName": "DREditor Editor Utility Converting",
5
- "description": "The beta for DREditor. A tool to create death game style projects without having to code.",
6
- "unity": "6000.4",
7
- "dependencies": {
8
- "com.unity.render-pipelines.universal": "17.4.0",
9
- "com.unity.inputsystem": "1.19.0",
10
- "net.dreditor.core": "0.1.6",
11
- "net.dreditor.states": "0.1.6",
12
- "net.dreditor.progressing.handling": "0.1.6",
13
- "net.dreditor.dialoguemechanics.investigation": "0.1.6",
14
- "net.dreditor.roomstatebuilding": "0.1.6",
15
- "net.dreditor.roombuilding": "0.1.6",
16
- "net.dreditor.actors": "0.1.6",
17
- "net.dreditor.doors": "0.1.6",
18
- "net.dreditor.talkables": "0.1.6",
19
- "net.dreditor.subareas": "0.1.6",
20
- "net.dreditor.triggers": "0.1.6",
21
- "net.dreditor.debugtesting": "0.1.6",
22
- "net.dreditor.ui": "0.1.6"
23
- },
24
- "keywords": [
25
- "editor",
26
- "tool",
27
- "dreditor"
28
- ],
29
- "publishConfig": {
30
- "access": "public"
31
- },
32
- "author": {
33
- "name": "Benjamin \"Sweden\" Jillson",
34
- "email": "dreditortool@gmail.com",
35
- "url": "https://dreditor.net"
36
- },
37
- "samples": [
38
- {
39
- "displayName": "Samples",
40
- "description": "",
41
- "path": "Samples~"
42
- }
43
- ],
44
- "documentationUrl": "https://dreditor.net",
45
- "license": "Apache-2.0",
46
- "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
47
- "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html"
48
- }
1
+ {
2
+ "name": "net.dreditor.editor.utility.converting",
3
+ "version": "0.1.8",
4
+ "displayName": "DREditor Editor Utility Converting",
5
+ "description": "The beta for DREditor. A tool to create death game style projects without having to code.",
6
+ "unity": "6000.4",
7
+ "dependencies": {
8
+ "com.unity.render-pipelines.universal": "17.4.0",
9
+ "com.unity.inputsystem": "1.19.0",
10
+ "net.dreditor.core": "0.1.8",
11
+ "net.dreditor.states": "0.1.8",
12
+ "net.dreditor.progressing.handling": "0.1.8",
13
+ "net.dreditor.dialoguemechanics.investigation": "0.1.8",
14
+ "net.dreditor.roomstatebuilding": "0.1.8",
15
+ "net.dreditor.roombuilding": "0.1.8",
16
+ "net.dreditor.actors": "0.1.8",
17
+ "net.dreditor.doors": "0.1.8",
18
+ "net.dreditor.talkables": "0.1.8",
19
+ "net.dreditor.subareas": "0.1.8",
20
+ "net.dreditor.triggers": "0.1.8",
21
+ "net.dreditor.debugtesting": "0.1.8",
22
+ "net.dreditor.ui": "0.1.8"
23
+ },
24
+ "keywords": [
25
+ "editor",
26
+ "tool",
27
+ "dreditor"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "author": {
33
+ "name": "Benjamin \"Sweden\" Jillson",
34
+ "email": "dreditortool@gmail.com",
35
+ "url": "https://dreditor.net"
36
+ },
37
+ "samples": [
38
+ {
39
+ "displayName": "Samples",
40
+ "description": "",
41
+ "path": "Samples~"
42
+ }
43
+ ],
44
+ "documentationUrl": "https://dreditor.net",
45
+ "license": "Apache-2.0",
46
+ "licensesUrl": "https://dreditor.net/docs/LICENSE.html",
47
+ "changelogUrl": "https://dreditor.net/docs/CHANGELOG.html",
48
+ "repository": {
49
+ "url": "https://github.com/CertifiedSharp/DREditor",
50
+ "type": "git",
51
+ "revision": "416b18f937fb917bf3f595362a1082ed97457744"
52
+ }
53
+ }
package/package.json.meta CHANGED
@@ -1,7 +1,7 @@
1
- fileFormatVersion: 2
2
- guid: 2c1cfb89d0cc0de418d66bffb850ce03
3
- TextScriptImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 2c1cfb89d0cc0de418d66bffb850ce03
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant: