first commit
8
Assets/Core.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26fc21f3084c52d4fae059ef173fc7b8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/Networking.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb39f799f5942e144bc38fc10af7d61f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/Core/Networking/DefaultNetworkPrefabs.asset
Normal file
@@ -0,0 +1,16 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e651dbb3fbac04af2b8f5abf007ddc23, type: 3}
|
||||
m_Name: DefaultNetworkPrefabs
|
||||
m_EditorClassIdentifier:
|
||||
IsDefault: 1
|
||||
List: []
|
||||
8
Assets/Core/Networking/DefaultNetworkPrefabs.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b7088a2536c57e40bcf7ddddeac4dce
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/Rendering.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8894c0add3c8924b9b1ff16d22a75ae
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/Rendering/URP Assets.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7100261ad038920408a0eccdc673330e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2cd5d6f85e7b9a42a1c75d275092613
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/UI/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c97be309d6141ab4b9aa18e18ddee035
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/UI/Editor/Graphics.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dada185529eccfc45bfa55f099a00136
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Core/UI/Editor/Graphics/EditorRsc-Vector2Graph.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
117
Assets/Core/UI/Editor/Graphics/EditorRsc-Vector2Graph.png.meta
Normal file
@@ -0,0 +1,117 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86e57470e4f0e904ebd93d52cb02fe36
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 0
|
||||
wrapV: 0
|
||||
wrapW: 0
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 4
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 4
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/UI/Editor/Layouts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6c4147f1e24d14547aed6f4a1f1ed043
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Core/UI/Editor/Layouts/Common.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4153d5495ff191f4ca0222ce5154a057
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||
<Style src="project://database/Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss?fileID=7433441132597879392&guid=a6bd99e5b08b3de4190806c83ae5dfff&type=3#WildsEditors" />
|
||||
<engine:VisualElement style="flex-grow: 0; padding-top: 4px; padding-right: 4px; padding-bottom: 4px; padding-left: 4px;">
|
||||
<engine:VisualElement style="flex-grow: 1; background-color: rgba(65, 65, 65, 0.98); padding-top: 6px; padding-right: 6px; padding-bottom: 6px; padding-left: 6px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">
|
||||
<engine:Foldout text="Default Inspector " name="DefaultFoldout" style="padding-top: 10px; padding-right: 20px; padding-bottom: 5px; padding-left: 20px;" />
|
||||
</engine:VisualElement>
|
||||
</engine:VisualElement>
|
||||
</engine:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c85834aad99ee874aa0341f781e998fa
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
19
Assets/Core/UI/Editor/Layouts/Common/Vector2DGraph.uxml
Normal file
@@ -0,0 +1,19 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
|
||||
<Style src="project://database/Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss?fileID=7433441132597879392&guid=a6bd99e5b08b3de4190806c83ae5dfff&type=3#WildsEditors" />
|
||||
<ui:VisualElement name="Vector2DViewer" class="analogGraph" style="height: 336px;">
|
||||
<ui:VisualElement name="Background" style="position: absolute;" />
|
||||
<ui:VisualElement name="GraphContainer" style="flex-grow: 1; position: absolute; width: 100%; height: 100%; padding-top: 6px; padding-right: 6px; padding-bottom: 6px; padding-left: 6px;">
|
||||
<ui:VisualElement name="Graph" style="flex-grow: 1; background-image: url("project://database/Assets/Core/UI/Editor/Graphics/EditorRsc-Vector2Graph.png?fileID=2800000&guid=86e57470e4f0e904ebd93d52cb02fe36&type=3#EditorRsc-Vector2Graph"); -unity-background-image-tint-color: rgba(143, 153, 255, 0.38); background-color: rgba(17, 3, 3, 0.03);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="Vector2DCursor" focusable="true" style="flex-grow: 1; justify-content: center; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px;">
|
||||
<ui:VisualElement name="CursorCenter" style="flex-grow: 0; position: relative; width: 50%; height: 50%; flex-direction: row; justify-content: center; align-items: center; flex-shrink: 0; align-self: center; align-content: center;">
|
||||
<ui:VisualElement name="Cursor" style="position: relative; top: 0; left: 0;">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="style.top" data-source-path="y" binding-mode="ToTarget" source-to-ui-converters="Normalized to Percent (Inverted)" data-source-type="UnityEngine.Vector2, UnityEngine.CoreModule" />
|
||||
<ui:DataBinding property="style.left" data-source-path="y" binding-mode="ToTarget" source-to-ui-converters="Normalized to Percent" data-source-type="UnityEngine.Vector2, UnityEngine.CoreModule" />
|
||||
</Bindings>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
10
Assets/Core/UI/Editor/Layouts/Common/Vector2DGraph.uxml.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e1f23ecea0e1984d919c4487e654c8f
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
8
Assets/Core/UI/Editor/Layouts/Player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c91222387747c8244ae541778b3edc84
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
|
||||
<Style src="project://database/Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss?fileID=7433441132597879392&guid=a6bd99e5b08b3de4190806c83ae5dfff&type=3#WildsEditors" />
|
||||
<ui:VisualElement name="VisualElement" data-source-type="PlayerControls, Assembly-CSharp" style="flex-grow: 0; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; flex-direction: row;">
|
||||
<ui:VisualElement name="LeftStickInpputContainer" template="Vector2DViewer" style="flex-grow: 1;">
|
||||
<Style src="project://database/Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss?fileID=7433441132597879392&guid=a6bd99e5b08b3de4190806c83ae5dfff&type=3#WildsEditors" />
|
||||
<ui:VisualElement name="Vector2DViewer" class="analogGraph">
|
||||
<ui:VisualElement name="Background" style="position: absolute;" />
|
||||
<ui:VisualElement name="GraphContainer" style="flex-grow: 1; position: absolute; width: 100%; height: 100%; padding-top: 6px; padding-right: 6px; padding-bottom: 6px; padding-left: 6px;">
|
||||
<ui:VisualElement name="Graph" style="flex-grow: 1; background-image: url("project://database/Assets/Core/UI/Editor/Graphics/EditorRsc-Vector2Graph.png?fileID=2800000&guid=86e57470e4f0e904ebd93d52cb02fe36&type=3#EditorRsc-Vector2Graph"); -unity-background-image-tint-color: rgba(143, 153, 255, 0.38); background-color: rgba(17, 3, 3, 0.03);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="CursorContainer" style="flex-grow: 1; justify-content: center; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px;">
|
||||
<ui:VisualElement name="CursorCenter" style="flex-grow: 0; position: relative; width: 50%; height: 50%; flex-direction: row; justify-content: center; align-items: center; flex-shrink: 0; align-self: center; align-content: center;">
|
||||
<ui:VisualElement name="Cursor" data-source-type="PlayerControls, Assembly-CSharp" enabled="true" style="position: relative; top: 0; left: 0;">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="style.top" binding-mode="ToTarget" source-to-ui-converters="Normalized to Percent (Inverted)" data-source-type="PlayerControls, Assembly-CSharp" data-source-path="rawMoveInput.y" />
|
||||
<ui:DataBinding property="style.left" data-source-path="rawMoveInput.x" binding-mode="ToTarget" source-to-ui-converters="Normalized to Percent" data-source-type="PlayerControls, Assembly-CSharp" />
|
||||
</Bindings>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="Spacer" style="flex-grow: 0; width: 10px;" />
|
||||
<ui:VisualElement template="Vector2DViewer" style="flex-grow: 1;">
|
||||
<Style src="project://database/Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss?fileID=7433441132597879392&guid=a6bd99e5b08b3de4190806c83ae5dfff&type=3#WildsEditors" />
|
||||
<ui:VisualElement name="Vector2DViewer" class="analogGraph">
|
||||
<ui:VisualElement name="Background" style="position: absolute;" />
|
||||
<ui:VisualElement name="GraphContainer" style="flex-grow: 1; position: absolute; width: 100%; height: 100%; padding-top: 6px; padding-right: 6px; padding-bottom: 6px; padding-left: 6px;">
|
||||
<ui:VisualElement name="Graph" style="flex-grow: 1; background-image: url("project://database/Assets/Core/UI/Editor/Graphics/EditorRsc-Vector2Graph.png?fileID=2800000&guid=86e57470e4f0e904ebd93d52cb02fe36&type=3#EditorRsc-Vector2Graph"); -unity-background-image-tint-color: rgba(143, 153, 255, 0.38); background-color: rgba(17, 3, 3, 0.03);" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="CursorContainer" style="flex-grow: 1; justify-content: center; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px;">
|
||||
<ui:VisualElement name="CursorCenter" style="flex-grow: 0; position: relative; width: 50%; height: 50%; flex-direction: row; justify-content: center; align-items: center; flex-shrink: 0; align-self: center; align-content: center;">
|
||||
<ui:VisualElement name="Cursor" data-source-type="UnityEngine.Vector2, UnityEngine.CoreModule" style="position: relative; top: 0; left: 0;">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="style.top" binding-mode="ToTarget" source-to-ui-converters="Normalized to Percent (Inverted)" data-source-type="PlayerControls, Assembly-CSharp" data-source-path="rawLookInput.y" />
|
||||
<ui:DataBinding property="style.left" data-source-path="rawLookInput.x" binding-mode="ToTarget" source-to-ui-converters="Normalized to Percent" data-source-type="PlayerControls, Assembly-CSharp" />
|
||||
</Bindings>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a2992a2c5b670a45a9c379e22338521
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@@ -0,0 +1,168 @@
|
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="True">
|
||||
<Style src="project://database/Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss?fileID=7433441132597879392&guid=a6bd99e5b08b3de4190806c83ae5dfff&type=3#WildsEditors" />
|
||||
<Style src="project://database/Assets/Core/UI/Editor/Stylesheets/PlayerMovementStyles.uss?fileID=7433441132597879392&guid=184c6057804f222428c94a16d4412e0c&type=3#PlayerMovementStyles" />
|
||||
<ui:VisualElement style="flex-grow: 1; padding-bottom: 1px;">
|
||||
<ui:Foldout text="Sprinting" data-source-type="PlayerMovement, Assembly-CSharp" class="sectionFoldout">
|
||||
<ui:VisualElement name="VisualElement" class="statusViewer active" style="background-color: rgb(46, 46, 46);">
|
||||
<ui:Label text="Sprinting" style="padding-right: 10px; padding-bottom: 5px; padding-top: 5px; padding-left: 10px;" />
|
||||
<Bindings>
|
||||
<ui:DataBinding property="style.backgroundColor" data-source-path="sprinting" binding-mode="ToTarget" source-to-ui-converters="Bool to Color" />
|
||||
</Bindings>
|
||||
</ui:VisualElement>
|
||||
</ui:Foldout>
|
||||
<ui:Foldout text="Gravity & Jumping" toggle-on-label-click="true" data-source-type="PlayerMovement, Assembly-CSharp" name="Foldout" class="sectionFoldout" style="width: auto;">
|
||||
<ui:FloatField label="Gravity Acceleration" value="42.2" class="property-fullwidth">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="gravityAcceleration" data-source-type="PlayerMovement, Player" binding-mode="TwoWay" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
<ui:FloatField label="Jump Height" value="42.2" class="property-fullwidth">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpHeight" data-source-type="PlayerMovement, Player" binding-mode="TwoWay" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
<ui:FloatField label="Jump Deacceleration" value="42.2" class="property-fullwidth">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpDeacceleration" data-source-type="PlayerMovement, Player" binding-mode="TwoWay" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
<ui:VisualElement name="JumpPower" class="group" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="VisualElement" style="flex-direction: row;">
|
||||
<ui:Label text="Current Jump Power" enabled="true" enable-rich-text="true" class="title" style="margin-right: 11px;" />
|
||||
<ui:Label text="0.000" style="width: 60px; color: rgba(210, 210, 210, 0.25);">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="text" data-source-path="jumpPower" data-source-type="PlayerMovement, Player" binding-mode="ToTarget" update-trigger="OnSourceChanged" />
|
||||
</Bindings>
|
||||
</ui:Label>
|
||||
</ui:VisualElement>
|
||||
<ui:Slider high-value="20" fill="true" name="Slider" show-input-field="false" direction="Horizontal" inverted="false" enabled="false" style="flex-grow: 1;">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpPower" data-source-type="PlayerMovement, Player" binding-mode="ToTarget" />
|
||||
</Bindings>
|
||||
</ui:Slider>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="JumpInfo" style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px;">
|
||||
<ui:VisualElement name="VisualElement" enabled="true" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="GroundJumps" data-source-type="PlayerMovement, Player" data-source-path="groundJumpParams" enabled="true" class="gravityParameters" style="flex-direction: row;">
|
||||
<ui:VisualElement data-source-path="active" style="flex-grow: 0; width: 20px; margin-right: 8px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(106, 106, 106);" />
|
||||
<ui:VisualElement style="flex-grow: 1;">
|
||||
<ui:Label text="Ground Jump" name="Name" />
|
||||
<ui:VisualElement name="Properties" style="flex-direction: row;">
|
||||
<ui:VisualElement name="GravityValue" class="property">
|
||||
<ui:Label text="Gravity" name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpGravityMultiplier" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="HeightValue" class="property">
|
||||
<ui:Label text="Height " name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpHeightMultiplier" data-source-type="PlayerMovement+JumpParameters, Player" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="DeaccelValue" class="property">
|
||||
<ui:Label text="Deacceleration" name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpDeaccelMultiplier" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="AirJumpCount" class="property">
|
||||
<ui:Label text="Count" name="VariableName" />
|
||||
<ui:VisualElement name="VisualElement" style="flex-direction: row; align-items: center;">
|
||||
<ui:Label text="-" style="font-size: 14px; -unity-font-style: bold; -unity-text-align: middle-left; color: rgba(210, 210, 210, 0.82);" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="GroundJumps" data-source-type="PlayerMovement, Player" data-source-path="initialAirJumpParams" enabled="true" class="gravityParameters" style="flex-direction: row;">
|
||||
<ui:VisualElement data-source-path="active" style="flex-grow: 0; width: 20px; margin-right: 8px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(106, 106, 106);" />
|
||||
<ui:VisualElement style="flex-grow: 1;">
|
||||
<ui:Label text="Air Jump, Initial" name="Name" />
|
||||
<ui:VisualElement name="Properties" style="flex-direction: row;">
|
||||
<ui:VisualElement name="GravityValue" class="property">
|
||||
<ui:Label text="Gravity" name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpGravityMultiplier" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="HeightValue" class="property">
|
||||
<ui:Label text="Height " name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpHeightMultiplier" data-source-type="PlayerMovement+JumpParameters, Player" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="DeaccelValue" class="property">
|
||||
<ui:Label text="Deacceleration" name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpDeaccelMultiplier" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="AirJumpCount" class="property">
|
||||
<ui:Label text="Count" name="VariableName" />
|
||||
<ui:VisualElement name="VisualElement" style="flex-direction: row; align-items: center;">
|
||||
<ui:Label text="3" data-source-type="PlayerMovement, Player" style="font-size: 14px; -unity-font-style: bold; -unity-text-align: middle-left; color: rgba(210, 210, 210, 0.82);" />
|
||||
<ui:Label text="/ " enable-rich-text="false" style="color: rgba(210, 210, 210, 0.41);" />
|
||||
<ui:IntegerField value="3" data-source-type="PlayerMovement, Player" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="GroundJumps" data-source-type="PlayerMovement, Player" data-source-path="followupAirJumpParams" enabled="true" class="gravityParameters" style="flex-direction: row;">
|
||||
<ui:VisualElement data-source-path="active" style="flex-grow: 0; width: 20px; margin-right: 8px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(106, 106, 106);" />
|
||||
<ui:VisualElement style="flex-grow: 1;">
|
||||
<ui:Label text="Air Jump, Follow-up" name="Name" />
|
||||
<ui:VisualElement name="Properties" style="flex-direction: row;">
|
||||
<ui:VisualElement name="GravityValue" class="property">
|
||||
<ui:Label text="Gravity" name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpGravityMultiplier" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="HeightValue" class="property">
|
||||
<ui:Label text="Height " name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpHeightMultiplier" data-source-type="PlayerMovement+JumpParameters, Player" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="DeaccelValue" class="property">
|
||||
<ui:Label text="Deacceleration" name="VariableName" />
|
||||
<ui:FloatField value="0">
|
||||
<Bindings>
|
||||
<ui:DataBinding property="value" data-source-path="jumpDeaccelMultiplier" binding-mode="ToSource" />
|
||||
</Bindings>
|
||||
</ui:FloatField>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="AirJumpCount" class="property">
|
||||
<ui:Label text="Count" name="VariableName" />
|
||||
<ui:VisualElement name="VisualElement" style="flex-direction: row; align-items: center;">
|
||||
<ui:Label text="3" style="font-size: 14px; -unity-font-style: bold; -unity-text-align: middle-left; color: rgba(210, 210, 210, 0.82);" />
|
||||
<ui:Label text="/ " enable-rich-text="false" style="color: rgba(210, 210, 210, 0.41);" />
|
||||
<ui:IntegerField value="3" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:Foldout>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 50b1bee0d09a86b4ba186a7a2e264a78
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
8
Assets/Core/UI/Editor/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b941c70611640fa498b3fb39f6aaa281
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
97
Assets/Core/UI/Editor/Scripts/PlayerEditorWindow.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine.UIElements;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
// TODO: Move to same document as WildsEditorWindow
|
||||
// Core editor interface for holding folder and stylesheet information
|
||||
public interface IWildsEditor{
|
||||
public string layoutsFolder{ get; }
|
||||
public string stylesheetsFolder{ get; }
|
||||
}
|
||||
|
||||
// TODO: Move to own document
|
||||
// Core editor window for all classes in document
|
||||
public abstract class WildsEditorWindow : Editor, IWildsEditor{
|
||||
public abstract string layoutsFolder { get; }
|
||||
public abstract string stylesheetsFolder { get; }
|
||||
|
||||
string coreLayoutsFolder = "Assets/Core/UI/Editor/Layouts/";
|
||||
//string coreStylesheetsFolder = "Assets/Core/UI/Editor/Stylesheets/";
|
||||
|
||||
public override VisualElement CreateInspectorGUI(){
|
||||
VisualElement newEditorWindow = GetVisualElement();
|
||||
|
||||
VisualElement inspectorFoldout = AssetDatabase
|
||||
.LoadAssetAtPath<VisualTreeAsset>(coreLayoutsFolder + "/Common/DefaultInspectorFoldout.uxml").Instantiate();
|
||||
|
||||
newEditorWindow.Add(inspectorFoldout);
|
||||
|
||||
AddOriginalInspector(inspectorFoldout);
|
||||
|
||||
return newEditorWindow;
|
||||
}
|
||||
|
||||
public VisualElement GetVisualElement(){
|
||||
VisualElement myInspector = null;
|
||||
|
||||
string GetVisualTreeString(){
|
||||
return coreLayoutsFolder + layoutsFolder + "/" + this.GetType().FullName + ".uxml";
|
||||
}
|
||||
|
||||
try {
|
||||
myInspector = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(GetVisualTreeString()).Instantiate();
|
||||
} catch {
|
||||
Debug.LogError($"Failed to find the following layout: {GetVisualTreeString()}");
|
||||
}
|
||||
|
||||
BindEditor(myInspector);
|
||||
|
||||
return myInspector;
|
||||
}
|
||||
|
||||
public abstract void BindEditor(VisualElement element);
|
||||
|
||||
public void AddOriginalInspector(VisualElement foldout){
|
||||
// Attach a default Inspector to the Foldout.
|
||||
InspectorElement.FillDefaultInspector(foldout.Q("DefaultFoldout"), serializedObject, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Core editor window for all player classes in document. Mainly just so if I change the player folder I don't have to change every classes layoutsFolder, just this one. (or whatever class)
|
||||
public abstract class PlayerEditorWindow : WildsEditorWindow{
|
||||
public override string layoutsFolder{ get; } = "Player";
|
||||
public override string stylesheetsFolder{ get; } = "";
|
||||
}
|
||||
|
||||
[CustomEditor(typeof(PlayerControls))]
|
||||
public class PlayerControlsInspector: PlayerEditorWindow{
|
||||
public PlayerControls script;
|
||||
public Object player;
|
||||
|
||||
public override void BindEditor(VisualElement element){
|
||||
SerializedObject so = new (player);
|
||||
element.dataSource = player;
|
||||
}
|
||||
|
||||
void OnEnable(){
|
||||
player = target;
|
||||
}
|
||||
}
|
||||
|
||||
[CustomEditor(typeof(PlayerMovement))]
|
||||
public class PlayerMovementInspector : PlayerEditorWindow{
|
||||
public PlayerControls script;
|
||||
public Object player;
|
||||
|
||||
public override void BindEditor(VisualElement element){
|
||||
SerializedObject so = new (player);
|
||||
element.dataSource = player;
|
||||
}
|
||||
|
||||
void OnEnable(){
|
||||
player = target;
|
||||
}
|
||||
}
|
||||
2
Assets/Core/UI/Editor/Scripts/PlayerEditorWindow.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be70d6f2acc39ce408b051148cef730c
|
||||
39
Assets/Core/UI/Editor/Scripts/UIConverters.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.UIElements;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.UIElements.Experimental;
|
||||
|
||||
public class UIConverters
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
[InitializeOnLoadMethod]
|
||||
#else
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
#endif
|
||||
public static void InitConverters(){
|
||||
var group = new ConverterGroup("Normalized to Percent");
|
||||
group.AddConverter<float, StyleLength >((ref float input) => Length.Percent(input * 100));
|
||||
ConverterGroups.RegisterConverterGroup(group);
|
||||
|
||||
var invert = new ConverterGroup("Normalized to Percent (Inverted)");
|
||||
invert.AddConverter<float, StyleLength>((ref float input) => Length.Percent(-input * 100f));
|
||||
ConverterGroups.RegisterConverterGroup(invert);
|
||||
|
||||
var boolColorConverter = new ConverterGroup("Bool to Color");
|
||||
boolColorConverter.AddConverter<bool, StyleColor>(((ref bool input) => boolToColor(input)));
|
||||
ConverterGroups.RegisterConverterGroup(boolColorConverter);
|
||||
|
||||
return;
|
||||
|
||||
StyleColor boolToColor(bool value){
|
||||
if (value == true) {
|
||||
return new Color(113, 113, 113);
|
||||
}
|
||||
|
||||
return new Color(73, 132, 99);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Core/UI/Editor/Scripts/UIConverters.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecdfab6df41ac144282b331ee296a5fd
|
||||
8
Assets/Core/UI/Editor/Stylesheets.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a7ceafd0569eea4a82010a343e5335e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
68
Assets/Core/UI/Editor/Stylesheets/PlayerMovementStyles.uss
Normal file
@@ -0,0 +1,68 @@
|
||||
.gravityParameters {
|
||||
background-color: rgba(70, 70, 70, 0.47);
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-left-color: rgb(42, 42, 42);
|
||||
border-right-color: rgb(42, 42, 42);
|
||||
border-top-color: rgb(42, 42, 42);
|
||||
border-bottom-color: rgb(42, 42, 42);
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 2px;
|
||||
margin-bottom: 6px;
|
||||
padding-top: 6px;
|
||||
padding-right: 6px;
|
||||
padding-bottom: 6px;
|
||||
padding-left: 6px;
|
||||
flex-shrink: 0;
|
||||
transition-duration: 0.1s;
|
||||
}
|
||||
|
||||
.gravityParameters.active {
|
||||
border-left-width: 11px;
|
||||
border-left-color: rgb(58, 118, 35);
|
||||
border-right-color: rgb(58, 118, 35);
|
||||
border-top-color: rgb(58, 118, 35);
|
||||
border-bottom-color: rgb(58, 118, 35);
|
||||
}
|
||||
|
||||
.gravityParameters #Properties {
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.gravityParameters .property {
|
||||
width: 100%;
|
||||
background-color: rgba(51, 51, 51, 0.78);
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
margin-right: 13px;
|
||||
padding-top: 4px;
|
||||
padding-right: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding-left: 4px;
|
||||
flex-grow: 0;
|
||||
min-width: 60px;
|
||||
max-width: 80px;
|
||||
}
|
||||
|
||||
.gravityParameters #VariableName {
|
||||
font-size: 8px;
|
||||
color: rgba(210, 210, 210, 0.44);
|
||||
-unity-text-align: upper-left;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.gravityParameters #Name {
|
||||
flex-shrink: 0;
|
||||
margin-top: 2px;
|
||||
margin-right: 2px;
|
||||
margin-bottom: 6px;
|
||||
margin-left: 2px;
|
||||
-unity-font-style: normal;
|
||||
font-size: 10px;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 184c6057804f222428c94a16d4412e0c
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
142
Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss
Normal file
@@ -0,0 +1,142 @@
|
||||
.analogGraph {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.analogGraph #Cursor {
|
||||
position: absolute;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: rgba(255, 119, 119, 0.82);
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
}
|
||||
|
||||
.analogGraph #Background {
|
||||
background-color: rgba(72, 72, 82, 0.96);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-left-color: rgba(43, 43, 51, 0.8);
|
||||
border-right-color: rgba(43, 43, 51, 0.8);
|
||||
border-top-color: rgba(43, 43, 51, 0.8);
|
||||
border-bottom-color: rgba(43, 43, 51, 0.8);
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
|
||||
.statusViewer {
|
||||
padding-top: 6px;
|
||||
padding-right: 6px;
|
||||
padding-bottom: 6px;
|
||||
padding-left: 6px;
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
background-color: rgb(70, 70, 70);
|
||||
}
|
||||
|
||||
.statusViewer .unity-label {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.sectionFoldout {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.statusViewer.active {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.statusViewer.inactive {
|
||||
font-size: 14px;
|
||||
opacity: 0.26;
|
||||
}
|
||||
|
||||
.property-fullwidth {
|
||||
width: 100%;
|
||||
flex-shrink: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.unity-foldout {
|
||||
width: 100%;
|
||||
-unity-text-align: upper-left;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
background-color: rgba(14, 14, 14, 0.16);
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.unity-foldout--depth-0 > #unity-content {
|
||||
width: 100%;
|
||||
padding-left: 6px;
|
||||
margin-left: 0;
|
||||
padding-right: 6px;
|
||||
padding-top: 6px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.unity-foldout .unity-foldout__toggle {
|
||||
width: 100%;
|
||||
-unity-text-align: upper-left;
|
||||
font-size: 10px;
|
||||
background-color: rgba(72, 72, 72, 0.71);
|
||||
padding-top: 4px;
|
||||
margin-top: 0;
|
||||
padding-right: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding-left: 4px;
|
||||
margin-bottom: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
}
|
||||
|
||||
.group {
|
||||
padding-top: 6px;
|
||||
padding-right: 6px;
|
||||
padding-bottom: 6px;
|
||||
padding-left: 6px;
|
||||
background-color: rgb(53, 53, 53);
|
||||
margin-top: 4px;
|
||||
margin-bottom: 4px;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
border-left-color: rgb(38, 38, 38);
|
||||
border-right-color: rgb(38, 38, 38);
|
||||
border-top-color: rgb(38, 38, 38);
|
||||
border-bottom-color: rgb(38, 38, 38);
|
||||
border-top-width: 1px;
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
|
||||
.group .title {
|
||||
font-size: 12px;
|
||||
-unity-font-style: bold;
|
||||
color: rgb(128, 128, 128);
|
||||
}
|
||||
11
Assets/Core/UI/Editor/Stylesheets/WildsEditors.uss.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6bd99e5b08b3de4190806c83ae5dfff
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
16
Assets/DefaultNetworkPrefabs.asset
Normal file
@@ -0,0 +1,16 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e651dbb3fbac04af2b8f5abf007ddc23, type: 3}
|
||||
m_Name: DefaultNetworkPrefabs
|
||||
m_EditorClassIdentifier:
|
||||
IsDefault: 1
|
||||
List: []
|
||||
8
Assets/DefaultNetworkPrefabs.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 935babab2affb8f4683610c7e463c3ad
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dce5b93d5dab8754ba1e190d835dc63c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Player/Graphs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb87f5f35d1ed2644b3e02293ec71bc0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
27
Assets/Player/Graphs/PlayerLocomotionFSM.asset
Normal file
@@ -0,0 +1,27 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: f945e777233a59f4aba40aeca29093a6, type: 3}
|
||||
m_Name: PlayerLocomotionFSM
|
||||
m_EditorClassIdentifier:
|
||||
_serializedGraph: '{"type":"NodeCanvas.StateMachines.FSM","nodes":[{"_actionList":{"executionMode":1,"actions":[{"baseMoveSpeed":{"_value":10.0},"sprintAdditionalSpeed":{},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.ProcessFlatLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":0.3},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":559.9924,"y":711.7622},"$type":"NodeCanvas.StateMachines.ActionState","$id":"0"},{"_actionList":{"executionMode":1,"actions":[{"baseMoveSpeed":{"_value":17.0},"sprintAdditionalSpeed":{},"moveDirection":{"_name":"groundMoveDirection","_targetVariableID":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6"},"$type":"NodeCanvas.Tasks.Actions.ProcessFlatLocomotion"},{"valueA":{"_name":"rotationSpeed","_targetVariableID":"d888730f-97df-4288-bb99-1f6c8a34a7c5"},"valueB":{"_value":0.2},"$type":"NodeCanvas.Tasks.Actions.SetFloat"}]},"_repeatStateActions":true,"_color":{"r":1.0,"g":0.42,"b":0.32,"a":1.0},"_position":{"x":874.288,"y":572.152},"$type":"NodeCanvas.StateMachines.ActionState","$id":"1"},{"_position":{"x":430.6569,"y":381.1322},"$type":"NodeCanvas.StateMachines.AnyState","$id":"2"},{"_position":{"x":465.0,"y":561.0},"$type":"NodeCanvas.StateMachines.EmptyState","$id":"3"}],"connections":[{"_condition":{"actionName":{"_value":"Sprint"},"actionValue":{"_value":""},"$type":"NodeCanvas.Tasks.Conditions.CheckInput"},"_sourceNode":{"$ref":"0"},"_targetNode":{"$ref":"1"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"desiredVector3":{"_value":{"z":1.0}},"tolerance":{"_value":0.5},"negate":{},"$type":"NodeCanvas.Tasks.Conditions.GetMovementInputDotProduct"},"_sourceNode":{"$ref":"1"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"2"},"_targetNode":{"$ref":"3"},"$type":"NodeCanvas.StateMachines.FSMConnection"},{"_condition":{"valueA":{"_name":"isGrounded","_targetVariableID":"321e55c7-f93e-4667-a0dc-559eb61c6898"},"valueB":{"_value":true},"$type":"NodeCanvas.Tasks.Conditions.CheckBoolean"},"_sourceNode":{"$ref":"3"},"_targetNode":{"$ref":"0"},"$type":"NodeCanvas.StateMachines.FSMConnection"}],"canvasGroups":[],"localBlackboard":{"_variables":{"isGrounded":{"_propertyPath":"UnityEngine.CharacterController.isGrounded","_name":"isGrounded","_id":"321e55c7-f93e-4667-a0dc-559eb61c6898","$type":"NodeCanvas.Framework.Variable`1[[System.Boolean,
|
||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"},"groundMoveDirection":{"_name":"groundMoveDirection","_id":"16ae5ce4-097a-4c21-94a5-2c5d9ce73eb6","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[UnityEngine.Vector3,
|
||||
UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]"},"rotationSpeed":{"_name":"rotationSpeed","_id":"d888730f-97df-4288-bb99-1f6c8a34a7c5","_isPublic":true,"$type":"NodeCanvas.Framework.Variable`1[[System.Single,
|
||||
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"}}}}'
|
||||
_objectReferences: []
|
||||
_graphSource:
|
||||
_version: 3.31
|
||||
_category:
|
||||
_comments:
|
||||
_translation: {x: 75, y: -142}
|
||||
_zoomFactor: 0.9962392
|
||||
_haltSerialization: 0
|
||||
_externalSerializationFile: {fileID: 0}
|
||||
8
Assets/Player/Graphs/PlayerLocomotionFSM.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b307c218c1a404548afe65e66737fa80
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Player/Input.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58a4147d2b9083846957575fc3b16667
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
38
Assets/Player/Input/InputSystem.inputsettings.asset
Normal file
@@ -0,0 +1,38 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: c46f07b5ed07e4e92aa78254188d3d10, type: 3}
|
||||
m_Name: InputSystem.inputsettings
|
||||
m_EditorClassIdentifier:
|
||||
m_SupportedDevices: []
|
||||
m_UpdateMode: 1
|
||||
m_ScrollDeltaBehavior: 0
|
||||
m_MaxEventBytesPerUpdate: 5242880
|
||||
m_MaxQueuedEventsPerUpdate: 1000
|
||||
m_CompensateForScreenOrientation: 1
|
||||
m_BackgroundBehavior: 0
|
||||
m_EditorInputBehaviorInPlayMode: 0
|
||||
m_InputActionPropertyDrawerMode: 0
|
||||
m_DefaultDeadzoneMin: 0.125
|
||||
m_DefaultDeadzoneMax: 0.925
|
||||
m_DefaultButtonPressPoint: 0.5
|
||||
m_ButtonReleaseThreshold: 0.75
|
||||
m_DefaultTapTime: 0.2
|
||||
m_DefaultSlowTapTime: 0.5
|
||||
m_DefaultHoldTime: 0.4
|
||||
m_TapRadius: 5
|
||||
m_MultiTapDelayTime: 0.75
|
||||
m_DisableRedundantEventsMerging: 0
|
||||
m_ShortcutKeysConsumeInputs: 0
|
||||
m_iOSSettings:
|
||||
m_MotionUsage:
|
||||
m_Enabled: 0
|
||||
m_Description:
|
||||
8
Assets/Player/Input/InputSystem.inputsettings.asset.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e19eb4aa4fac2a409e792d0d3e5f944
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
182
Assets/Player/Input/PlayerInputs.inputactions
Normal file
@@ -0,0 +1,182 @@
|
||||
{
|
||||
"name": "PlayerInputs",
|
||||
"maps": [
|
||||
{
|
||||
"name": "In-Game",
|
||||
"id": "b2eefcc8-f0a6-4007-854d-f0b59159e624",
|
||||
"actions": [
|
||||
{
|
||||
"name": "Move",
|
||||
"type": "Value",
|
||||
"id": "41601e85-3a3a-4865-9f70-b65ab837729f",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Jump",
|
||||
"type": "Button",
|
||||
"id": "1e973b69-1ed8-4400-9bf1-5eaa4fe948de",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "Look",
|
||||
"type": "Value",
|
||||
"id": "eed161d4-9040-4c9b-819e-19c74f9a5eaa",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Sprint",
|
||||
"type": "Button",
|
||||
"id": "96c67847-6fdb-414e-92a8-96291cfb76d4",
|
||||
"expectedControlType": "",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "3a45214b-2843-4ccb-8e46-fa3a48b2db34",
|
||||
"path": "<Gamepad>/leftStick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Controller",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "2D Vector",
|
||||
"id": "a129cc03-7f0b-462f-a482-66953f5425b0",
|
||||
"path": "2DVector",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Move",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "up",
|
||||
"id": "6a80eb76-f646-4503-8c00-c5cc59b15505",
|
||||
"path": "<Keyboard>/upArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Mouse and Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "down",
|
||||
"id": "c363b7e9-dc14-442a-99e2-3d01d3add079",
|
||||
"path": "<Keyboard>/downArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Mouse and Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "left",
|
||||
"id": "ed05960b-fc86-4e05-a493-62c598254992",
|
||||
"path": "<Keyboard>/leftArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Mouse and Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "right",
|
||||
"id": "6b0f60c1-d8f4-4169-af98-bccc51ff8f0d",
|
||||
"path": "<Keyboard>/rightArrow",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Mouse and Keyboard",
|
||||
"action": "Move",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "0e718dbf-72f9-4583-817b-6ef7856830bb",
|
||||
"path": "<Gamepad>/buttonSouth",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Controller",
|
||||
"action": "Jump",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "d5dd6ba2-6f53-4ffa-b0f4-9bf0f160bcc0",
|
||||
"path": "<Gamepad>/rightStick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": ";Controller",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "17ccd7fc-f831-4a14-9bca-e78161ba3b25",
|
||||
"path": "<Gamepad>/leftStickPress",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Sprint",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"controlSchemes": [
|
||||
{
|
||||
"name": "Controller",
|
||||
"bindingGroup": "Controller",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Gamepad>",
|
||||
"isOptional": true,
|
||||
"isOR": false
|
||||
},
|
||||
{
|
||||
"devicePath": "<Joystick>",
|
||||
"isOptional": true,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Mouse and Keyboard",
|
||||
"bindingGroup": "Mouse and Keyboard",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Keyboard>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
},
|
||||
{
|
||||
"devicePath": "<Mouse>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
14
Assets/Player/Input/PlayerInputs.inputactions.meta
Normal file
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 652c4cc5d47d8de45a54e21abc9d8d1a
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 0
|
||||
wrapperCodePath:
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
||||
8
Assets/Plugins.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 65c18d699fcadad459bc3e16558c2bd2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Plugins/ParadoxNotion.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 792ac276a8632414b96fb500de414262
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Plugins/ParadoxNotion/CanvasCore.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd9f4941b19037f4a88460b874a8a3e1
|
||||
folderAsset: yes
|
||||
timeCreated: 1538755212
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Plugins/ParadoxNotion/CanvasCore/Common.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0aa2a0733358abb4c90587d3628d0ff9
|
||||
folderAsset: yes
|
||||
timeCreated: 1538657332
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4ff0b9c7cca6004d96e43fd71a2ec44
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary>Marker attribute to include generic type or a type's generic methods in the AOT spoof generation</summary>
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Delegate)]
|
||||
public class SpoofAOTAttribute : Attribute { }
|
||||
|
||||
///<summary>To exclude a type from being listed. Abstract classes are not listed anyway.</summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class DoNotListAttribute : Attribute { }
|
||||
|
||||
///<summary>When a type should for some reason be marked as protected so to always have one instance active.</summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class ProtectedSingletonAttribute : Attribute { }
|
||||
|
||||
///<summary>Use for execution prioratizing when it matters.</summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class ExecutionPriorityAttribute : Attribute
|
||||
{
|
||||
readonly public int priority;
|
||||
public ExecutionPriorityAttribute(int priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Marks a generic type to be exposed at it's base definition rather than wrapping all preferred types around it.</summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class ExposeAsDefinitionAttribute : Attribute { }
|
||||
|
||||
///<summary>Marks a field to be exposed for inspection even if private (within the context of custom inspector).</summary>
|
||||
///<summary>In custom inspector, private fields even if with [SerializedField] are not exposed by default.</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ExposeFieldAttribute : Attribute { }
|
||||
|
||||
///<summary>Options attribute for list inspector editors</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ListInspectorOptionAttribute : Attribute
|
||||
{
|
||||
readonly public bool allowAdd;
|
||||
readonly public bool allowRemove;
|
||||
readonly public bool showFoldout;
|
||||
public ListInspectorOptionAttribute(bool allowAdd, bool allowRemove, bool alwaysExpanded) {
|
||||
this.allowAdd = allowAdd;
|
||||
this.allowRemove = allowRemove;
|
||||
this.showFoldout = alwaysExpanded;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Use for friendly names and optional priority in relation to naming only</summary>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class NameAttribute : Attribute
|
||||
{
|
||||
readonly public string name;
|
||||
readonly public int priority;
|
||||
public NameAttribute(string name, int priority = 0) {
|
||||
this.name = name;
|
||||
this.priority = priority;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Use for categorization</summary>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class CategoryAttribute : Attribute
|
||||
{
|
||||
readonly public string category;
|
||||
public CategoryAttribute(string category) {
|
||||
this.category = category;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Use to give a description</summary>
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class DescriptionAttribute : Attribute
|
||||
{
|
||||
readonly public string description;
|
||||
public DescriptionAttribute(string description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>When a type is associated with an icon</summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class IconAttribute : Attribute
|
||||
{
|
||||
readonly public string iconName;
|
||||
readonly public bool fixedColor;
|
||||
readonly public string runtimeIconTypeCallback;
|
||||
readonly public Type fromType;
|
||||
public IconAttribute(string iconName = "", bool fixedColor = false, string runtimeIconTypeCallback = "") {
|
||||
this.iconName = iconName;
|
||||
this.fixedColor = fixedColor;
|
||||
this.runtimeIconTypeCallback = runtimeIconTypeCallback;
|
||||
}
|
||||
public IconAttribute(Type fromType) {
|
||||
this.fromType = fromType;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>When a type is associated with a color (provide in hex string without "#")</summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class ColorAttribute : Attribute
|
||||
{
|
||||
readonly public string hexColor;
|
||||
public ColorAttribute(string hexColor) {
|
||||
this.hexColor = hexColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6a1b03fabc29f2479f8b63c5ae861f2
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/DesignAttributes.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
///<summary>Derive this to create custom attributes to be drawn with an AttributeDrawer<T>.</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
abstract public class DrawerAttribute : Attribute
|
||||
{
|
||||
virtual public int priority { get { return int.MaxValue; } }
|
||||
virtual public bool isDecorator { get { return false; } }
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Will dim control for bool, int, float, string if its default value (or empty for string)</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class HeaderAttribute : DrawerAttribute
|
||||
{
|
||||
readonly public string title;
|
||||
public override bool isDecorator { get { return true; } }
|
||||
public HeaderAttribute(string title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will dim control for bool, int, float, string if its default value (or empty for string)</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class DimIfDefaultAttribute : DrawerAttribute
|
||||
{
|
||||
public override bool isDecorator { get { return true; } }
|
||||
public override int priority { get { return 0; } }
|
||||
}
|
||||
|
||||
///<summary>Use on top of any field to show it only if the provided field is equal to the provided check value</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ShowIfAttribute : DrawerAttribute
|
||||
{
|
||||
readonly public string fieldName;
|
||||
readonly public int checkValue;
|
||||
public override bool isDecorator { get { return true; } }
|
||||
public override int priority { get { return 1; } }
|
||||
public ShowIfAttribute(string fieldName, int checkValue) {
|
||||
this.fieldName = fieldName;
|
||||
this.checkValue = checkValue;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Helper attribute. Denotes that the field is required not to be null or string.empty</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class RequiredFieldAttribute : DrawerAttribute
|
||||
{
|
||||
public override bool isDecorator { get { return false; } }
|
||||
public override int priority { get { return 2; } }
|
||||
}
|
||||
|
||||
///<summary>Show a button above field</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ShowButtonAttribute : DrawerAttribute
|
||||
{
|
||||
readonly public string buttonTitle;
|
||||
readonly public string methodName;
|
||||
public override bool isDecorator { get { return true; } }
|
||||
public override int priority { get { return 3; } }
|
||||
public ShowButtonAttribute(string buttonTitle, string methodnameCallback) {
|
||||
this.buttonTitle = buttonTitle;
|
||||
this.methodName = methodnameCallback;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will invoke a callback method when the field is changed</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class CallbackAttribute : DrawerAttribute
|
||||
{
|
||||
readonly public string methodName;
|
||||
public override bool isDecorator { get { return true; } }
|
||||
public override int priority { get { return 4; } }
|
||||
public CallbackAttribute(string methodName) {
|
||||
this.methodName = methodName;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Will clamp float or int value to min</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class MinValueAttribute : DrawerAttribute
|
||||
{
|
||||
public override int priority { get { return 5; } }
|
||||
readonly public float min;
|
||||
public MinValueAttribute(float min) {
|
||||
this.min = min;
|
||||
}
|
||||
public MinValueAttribute(int min) {
|
||||
this.min = min;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Makes float, int or string field show in a delayed control</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class DelayedFieldAttribute : DrawerAttribute { }
|
||||
|
||||
///<summary>Makes the int field show as layerfield</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class LayerFieldAttribute : DrawerAttribute { }
|
||||
|
||||
///<summary>Makes the string field show as tagfield</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class TagFieldAttribute : DrawerAttribute { }
|
||||
|
||||
///<summary>Makes the string field show as text field with specified number of lines</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class TextAreaFieldAttribute : DrawerAttribute
|
||||
{
|
||||
readonly public int numberOfLines;
|
||||
public TextAreaFieldAttribute(int numberOfLines) {
|
||||
this.numberOfLines = numberOfLines;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Use on top of any type of field to restict values to the provided ones through a popup by providing a params array of options.</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class PopupFieldAttribute : DrawerAttribute
|
||||
{
|
||||
readonly public object[] options;
|
||||
public PopupFieldAttribute(params object[] options) {
|
||||
this.options = options;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Makes the float or integer field show as slider</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class SliderFieldAttribute : DrawerAttribute
|
||||
{
|
||||
readonly public float min;
|
||||
readonly public float max;
|
||||
public SliderFieldAttribute(float min, float max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
public SliderFieldAttribute(int min, int max) {
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Forces the field to show as a Unity Object field. Usefull for interface fields</summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ForceObjectFieldAttribute : DrawerAttribute { }
|
||||
|
||||
///<summary>Can be used on an interface type field to popup select a concrete implementation.<summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ReferenceFieldAttribute : DrawerAttribute { }
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f408bebe1629994794006aa2e272ae5
|
||||
timeCreated: 1513958511
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/DrawerAttributes.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be3277af62533fc4c8d68065c61db942
|
||||
folderAsset: yes
|
||||
timeCreated: 1538665292
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,55 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary>Utility for handling player setting defines</summary>
|
||||
public static class DefinesManager
|
||||
{
|
||||
|
||||
///<summary>Is define..defined in player settings for current target?</summary>
|
||||
public static bool HasDefineForCurrentTargetGroup(string define) {
|
||||
var currentTarget = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
|
||||
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(currentTarget).Split(';');
|
||||
return defines.Contains(define);
|
||||
}
|
||||
|
||||
///<summary>Set define for current target</summary>
|
||||
public static void SetDefineActiveForCurrentTargetGroup(string define, bool enable) {
|
||||
var currentTarget = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
|
||||
SetDefineActiveForTargetGroup(currentTarget, define, enable);
|
||||
}
|
||||
|
||||
///<summary>Set define for target</summary>
|
||||
public static void SetDefineActiveForTargetGroup(BuildTargetGroup target, string define, bool enable) {
|
||||
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(target).Split(';').ToList();
|
||||
if ( enable == true && !defines.Contains(define) ) {
|
||||
defines.Add(define);
|
||||
}
|
||||
if ( enable == false ) {
|
||||
defines.Remove(define);
|
||||
}
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(target, string.Join(";", defines));
|
||||
}
|
||||
|
||||
///<summary>Toggle define in player settings for all targets</summary>
|
||||
public static void SetDefineActiveForAllTargetGroups(string define, bool enable) {
|
||||
foreach ( BuildTargetGroup target in System.Enum.GetValues(typeof(BuildTargetGroup)) ) {
|
||||
if ( target == BuildTargetGroup.Unknown ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( typeof(BuildTargetGroup).GetField(target.ToString()).IsDefined(typeof(System.ObsoleteAttribute), true) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SetDefineActiveForTargetGroup(target, define, enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 133797bc4f2687b42a8a5f1baa7ba63f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/DefinesManager.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 781130fb96acf5f4384bd574f6cd9704
|
||||
folderAsset: yes
|
||||
timeCreated: 1538665299
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,111 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17c9c4eff9e8ef144ba8beb631fefc75
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/Resources/Community.png
|
||||
uploadId: 704937
|
||||
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,63 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae3fd876b2e88a94e9391b1ad6bbf549
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/Resources/Empty.png
|
||||
uploadId: 704937
|
||||
|
After Width: | Height: | Size: 54 KiB |
@@ -0,0 +1,65 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0aaf9b1e5a05024d9fe4e3215b9f73f
|
||||
timeCreated: 1464506051
|
||||
licenseType: Store
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
cubemapConvolution: 0
|
||||
cubemapConvolutionSteps: 7
|
||||
cubemapConvolutionExponent: 1.5
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
rGBM: 0
|
||||
compressionQuality: 50
|
||||
allowsAlphaSplitting: 0
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
outline: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/Resources/FlowCanvasHeader.png
|
||||
uploadId: 704937
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,110 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7db3c001bdf39ca46ab6bb3bbfe58d00
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 10
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/Resources/Manual.png
|
||||
uploadId: 704937
|
||||
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,111 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0b6a905426516149a73490df47637cc
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 0
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/Resources/NodeCanvasHeader.png
|
||||
uploadId: 704937
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,110 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 18c197a350b700d4f96e039071ffd2b6
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 10
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/Resources/Resources.png
|
||||
uploadId: 704937
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,110 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70b53005eb048f14ab18fcbb26bf6774
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 10
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: -100
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: -1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/Editor/Resources/Support.png
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3774cc9cbacfc4a41b0fb7fa91f7950f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,242 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
public static class AOTClassesGenerator
|
||||
{
|
||||
|
||||
//always spoof those for shake of convenience
|
||||
static readonly List<Type> defaultSpoofTypes = new List<Type>
|
||||
{
|
||||
typeof(bool),
|
||||
typeof(float),
|
||||
typeof(int),
|
||||
typeof(Vector2),
|
||||
typeof(Vector3),
|
||||
typeof(Vector4),
|
||||
typeof(Quaternion),
|
||||
typeof(Keyframe),
|
||||
typeof(Bounds),
|
||||
typeof(Color),
|
||||
typeof(Rect),
|
||||
typeof(ContactPoint),
|
||||
typeof(ContactPoint2D),
|
||||
typeof(Collision),
|
||||
typeof(Collision2D),
|
||||
typeof(RaycastHit),
|
||||
typeof(RaycastHit2D),
|
||||
typeof(Ray),
|
||||
typeof(Space),
|
||||
};
|
||||
|
||||
///<summary>Custom generic types to spoof were we cant use [SpoofAOT]</summary>
|
||||
static readonly List<Type> customGenericSpoof = new List<Type>
|
||||
{
|
||||
typeof(System.Action<>),
|
||||
typeof(System.Func<>),
|
||||
typeof(UnityEngine.Events.UnityAction<>),
|
||||
typeof(IList<>),
|
||||
typeof(List<>),
|
||||
typeof(Nullable<>),
|
||||
};
|
||||
|
||||
///<summary>Generates AOT classes file out of preferred types list</summary>
|
||||
public static void GenerateAOTClasses(string path, Type[] targetTypes) {
|
||||
|
||||
if ( string.IsNullOrEmpty(path) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var spoofTypes = defaultSpoofTypes.Where(t => t.IsValueType).ToList();
|
||||
spoofTypes.AddRange(targetTypes.Where(t => t.IsValueType && !spoofTypes.Contains(t)));
|
||||
spoofTypes = spoofTypes.Distinct().ToList();
|
||||
var types = ReflectionTools.GetAllTypes(true).Where(t => t.RTIsDefined(typeof(SpoofAOTAttribute), true)).Distinct();
|
||||
|
||||
var nTypes = 0;
|
||||
var nMethods = 0;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("#pragma warning disable 0219, 0168, 0612");
|
||||
sb.AppendLine("namespace ParadoxNotion.Internal{");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("\t//Auto generated classes for AOT support, where using undeclared generic classes with value types is limited. These are not actualy used but rather just declared for the compiler");
|
||||
sb.AppendLine("\tpartial class AOTDummy{");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("\t\tobject o = null;");
|
||||
|
||||
sb.AppendLine("\t\t///----------------------------------------------------------------------------------------------");
|
||||
|
||||
//Generic Types
|
||||
foreach ( var type in types ) {
|
||||
if ( !type.IsAbstract && type.IsGenericTypeDefinition && type.RTGetGenericArguments().Length == 1 ) {
|
||||
|
||||
var constrains = type.RTGetGenericArguments()[0].GetGenericParameterConstraints();
|
||||
|
||||
if ( constrains.Length == 0 || constrains[0].IsValueType || constrains[0] == typeof(Enum) ) {
|
||||
|
||||
if ( typeof(Delegate).IsAssignableFrom(type) ) {
|
||||
nTypes++;
|
||||
sb.AppendLine(string.Format("\t\tvoid {0}()", type.FriendlyName(true).Replace(".", "_").Replace("<T>", "_Delegate")) + "{");
|
||||
foreach ( var spoofType in spoofTypes ) {
|
||||
var a = type.FriendlyName(true).Replace("<T>", "<" + spoofType.FullName + ">").Replace("+", ".");
|
||||
var b = "_" + type.FriendlyName(true).Replace(".", "_").Replace("<T>", "_" + spoofType.FullName.Replace(".", "_").Replace("+", "_"));
|
||||
sb.AppendLine(string.Format("\t\t\t{0} {1};", a, b));
|
||||
}
|
||||
sb.AppendLine("\t\t}");
|
||||
|
||||
} else {
|
||||
|
||||
foreach ( var spoofType in spoofTypes ) {
|
||||
if ( constrains.Length == 1 && constrains[0] == typeof(Enum) && !spoofType.IsEnum ) { continue; }
|
||||
nTypes++;
|
||||
var a = type.FriendlyName(true).Replace("<T>", "<" + spoofType.FullName + ">").Replace("+", ".");
|
||||
var b = type.FriendlyName(true).Replace(".", "_").Replace("<T>", "_" + spoofType.FullName.Replace(".", "_").Replace("+", "_"));
|
||||
sb.AppendLine(string.Format("\t\t{0} {1};", a, b));
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t///----------------------------------------------------------------------------------------------");
|
||||
|
||||
//Generic Methods
|
||||
foreach ( var type in types ) {
|
||||
var index = 0;
|
||||
foreach ( var method in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly) ) {
|
||||
|
||||
if ( method.IsObsolete() ) { continue; }
|
||||
|
||||
if ( method.IsGenericMethodDefinition && method.RTGetGenericArguments().Length == 1 ) {
|
||||
|
||||
var constrains = method.RTGetGenericArguments()[0].GetGenericParameterConstraints();
|
||||
|
||||
if ( constrains.Length == 0 || constrains[0].IsValueType ) {
|
||||
|
||||
index++;
|
||||
|
||||
var decType = method.DeclaringType;
|
||||
var varName = "_" + decType.FullName.Replace(".", "_");
|
||||
sb.AppendLine(string.Format("\t\tvoid {0}_{1}_{2}()", decType.FullName.Replace(".", "_"), method.Name, index) + " {");
|
||||
if ( !method.IsStatic ) {
|
||||
sb.AppendLine(string.Format("\t\t\t{0} {1} = default({2});", decType.FullName, varName, decType.FullName));
|
||||
}
|
||||
|
||||
foreach ( var spoofType in spoofTypes ) {
|
||||
nMethods++;
|
||||
var a = method.IsStatic ? decType.FullName : varName;
|
||||
var b = method.Name;
|
||||
var c = spoofType.FullName.Replace("+", ".");
|
||||
var paramsString = "";
|
||||
var parameters = method.GetParameters();
|
||||
for ( var i = 0; i < parameters.Length; i++ ) {
|
||||
var parameter = parameters[i];
|
||||
var toString = parameter.ParameterType.FullName;
|
||||
if ( parameter.ParameterType.IsGenericParameter ) {
|
||||
toString = spoofType.FullName;
|
||||
}
|
||||
if ( parameter.ParameterType.IsGenericType ) {
|
||||
toString = parameter.ParameterType.FriendlyName(true).Replace("<T>", "<" + spoofType.FullName + ">");
|
||||
toString = toString.Replace("[[T]]", "");
|
||||
}
|
||||
toString = toString.Replace("+", ".");
|
||||
paramsString += string.Format("({0})o", toString);
|
||||
if ( i < parameters.Length - 1 ) {
|
||||
paramsString += ", ";
|
||||
}
|
||||
}
|
||||
var d = paramsString;
|
||||
sb.AppendLine(string.Format("\t\t\t{0}.{1}<{2}>( {3} );", a, b, c, d));
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t}");
|
||||
sb.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine("\t\t///----------------------------------------------------------------------------------------------");
|
||||
|
||||
//custom stuff
|
||||
sb.AppendLine("\t\tvoid CustomSpoof(){");
|
||||
foreach ( var spoofType in spoofTypes ) {
|
||||
var sName = spoofType.FullName.Replace("+", ".");
|
||||
var fName = spoofType.FullName.Replace(".", "_").Replace("+", "_");
|
||||
foreach ( var genericType in customGenericSpoof ) {
|
||||
nTypes++;
|
||||
var a = genericType.FriendlyName(true).Replace("<T>", "<" + sName + ">");
|
||||
var b = genericType.FriendlyName(true).Replace(".", "_").Replace("<T>", "_") + fName;
|
||||
sb.AppendLine(string.Format("\t\t\t{0} {1};", a, b));
|
||||
}
|
||||
nTypes++;
|
||||
sb.AppendLine(string.Format("\t\t\tSystem.Collections.Generic.IDictionary<System.String, {0}> IDict_{1};", sName, fName));
|
||||
sb.AppendLine(string.Format("\t\t\tSystem.Collections.Generic.Dictionary<System.String, {0}> Dict_{1};", sName, fName));
|
||||
sb.AppendLine("\t\t\t///------");
|
||||
}
|
||||
sb.AppendLine("\t\t}");
|
||||
sb.AppendLine("\t}");
|
||||
sb.AppendLine("}");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(string.Format("//{0} Types | {1} Methods spoofed", nTypes, nMethods));
|
||||
sb.AppendLine("#pragma warning restore 0219, 0168, 0612");
|
||||
|
||||
File.WriteAllText(path, sb.ToString());
|
||||
}
|
||||
|
||||
///<summary>Generates a link.xml file out of preferred types list</summary>
|
||||
public static void GenerateLinkXML(string path, Type[] targetTypes) {
|
||||
|
||||
if ( string.IsNullOrEmpty(path) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var spoofTypes = defaultSpoofTypes;
|
||||
spoofTypes.AddRange(targetTypes);
|
||||
var pairs = new Dictionary<string, List<Type>>();
|
||||
foreach ( var type in spoofTypes ) {
|
||||
var asmName = type.Assembly.GetName().Name;
|
||||
if ( !pairs.ContainsKey(asmName) ) {
|
||||
pairs[asmName] = new List<Type>();
|
||||
}
|
||||
pairs[asmName].Add(type);
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("<linker>");
|
||||
|
||||
sb.AppendLine("\t<assembly fullname=\"Assembly-CSharp\" preserve=\"all\">");
|
||||
sb.AppendLine("\t</assembly>");
|
||||
|
||||
//get assembly from a common paradoxnotion *runtime* type
|
||||
var paradoxAsmName = typeof(ParadoxNotion.Serialization.JSONSerializer).Assembly.GetName().Name;
|
||||
sb.AppendLine(string.Format("\t<assembly fullname=\"{0}\" preserve=\"all\">", paradoxAsmName));
|
||||
sb.AppendLine("\t</assembly>");
|
||||
|
||||
foreach ( var pair in pairs ) {
|
||||
sb.AppendLine(string.Format("\t<assembly fullname=\"{0}\">", pair.Key));
|
||||
foreach ( var type in pair.Value ) {
|
||||
sb.AppendLine("\t\t<type fullname=\"" + type.FullName + "\" preserve=\"all\"/>");
|
||||
}
|
||||
sb.AppendLine("\t</assembly>");
|
||||
}
|
||||
sb.AppendLine("</linker>");
|
||||
|
||||
File.WriteAllText(path, sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b148b00f34f1a94488008fd63cdd171
|
||||
timeCreated: 1430214156
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/AOTClassesGenerator.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,86 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary>Can track assets of specific type when required. This is faster than requesting AssetDabase all the time and can also be used in separate thread.</summary>
|
||||
public class AssetTracker : AssetPostprocessor
|
||||
{
|
||||
public static event System.Action<string[]> onAssetsImported;
|
||||
public static event System.Action<string[]> onAssetsDeleted;
|
||||
public static event System.Action<string[], string[]> onAssetsMoved;
|
||||
|
||||
public static Dictionary<string, UnityEngine.Object> trackedAssets { get; private set; }
|
||||
public static List<System.Type> trackedTypes { get; private set; }
|
||||
|
||||
///<summary>Call this to start tracking assets of specified type (and assignables to that)</summary>
|
||||
public static void BeginTrackingAssetsOfType(System.Type type) {
|
||||
if ( trackedAssets == null ) { trackedAssets = new Dictionary<string, UnityEngine.Object>(); }
|
||||
if ( trackedTypes == null ) { trackedTypes = new List<System.Type>(); }
|
||||
|
||||
if ( trackedTypes.Contains(type) ) {
|
||||
UnityEngine.Debug.LogError("Asset type is already tracked: " + type);
|
||||
return;
|
||||
}
|
||||
|
||||
trackedTypes.Add(type);
|
||||
|
||||
//we need to immediately fetch them here now
|
||||
var assetGUIDS = AssetDatabase.FindAssets(string.Format("t:{0}", type.Name));
|
||||
foreach ( var guid in assetGUIDS ) {
|
||||
var path = AssetDatabase.GUIDToAssetPath(guid);
|
||||
var asset = AssetDatabase.LoadAssetAtPath(path, type);
|
||||
trackedAssets[path] = asset;
|
||||
}
|
||||
}
|
||||
|
||||
//unity callback
|
||||
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) {
|
||||
AssetsImported(importedAssets);
|
||||
if ( onAssetsImported != null ) { onAssetsImported(importedAssets); }
|
||||
|
||||
AssetsDeleted(deletedAssets);
|
||||
if ( onAssetsDeleted != null ) { onAssetsDeleted(deletedAssets); }
|
||||
|
||||
AssetsMoved(movedAssets, movedFromAssetPaths);
|
||||
if ( onAssetsMoved != null ) { onAssetsMoved(movedAssets, movedFromAssetPaths); }
|
||||
|
||||
}
|
||||
|
||||
//..
|
||||
static void AssetsImported(string[] paths) {
|
||||
if ( trackedTypes == null ) { return; }
|
||||
foreach ( var path in paths ) {
|
||||
var asset = AssetDatabase.LoadAssetAtPath(path, typeof(UnityEngine.Object));
|
||||
if ( asset != null && trackedTypes.Any(t => t.IsAssignableFrom(asset.GetType())) ) {
|
||||
trackedAssets[path] = asset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//..
|
||||
static void AssetsDeleted(string[] paths) {
|
||||
if ( trackedTypes == null ) { return; }
|
||||
foreach ( var path in paths ) {
|
||||
if ( trackedAssets.ContainsKey(path) ) {
|
||||
trackedAssets.Remove(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//..
|
||||
static void AssetsMoved(string[] moveToPaths, string[] moveFromPaths) {
|
||||
if ( trackedTypes == null ) { return; }
|
||||
AssetsDeleted(moveFromPaths);
|
||||
AssetsImported(moveToPaths);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09cec26775978914c969e7c507315723
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/AssetTracker.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,256 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.Linq;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
///<summary>Used to create header / separators similar to Unity's Header attribute</summary>
|
||||
public class HeaderDrawer : AttributeDrawer<HeaderAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
GUILayout.Space(8);
|
||||
GUILayout.Label(string.Format("<b>- {0}</b>", attribute.title));
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will dim control for bool, int, float, string if its default value (or empty for string)</summary>
|
||||
public class DimIfDefaultDrawer : AttributeDrawer<DimIfDefaultAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
var dim = false;
|
||||
|
||||
if ( fieldInfo.FieldType.IsClass ) {
|
||||
dim = instance == null;
|
||||
}
|
||||
|
||||
if ( fieldInfo.FieldType == typeof(bool) ) {
|
||||
dim = (bool)instance == false;
|
||||
}
|
||||
|
||||
if ( fieldInfo.FieldType == typeof(int) ) {
|
||||
dim = (int)instance == 0;
|
||||
}
|
||||
|
||||
if ( fieldInfo.FieldType == typeof(float) ) {
|
||||
dim = (float)instance == 0;
|
||||
}
|
||||
|
||||
if ( fieldInfo.FieldType == typeof(string) ) {
|
||||
dim = string.IsNullOrEmpty((string)instance);
|
||||
}
|
||||
|
||||
if ( dim ) { GUI.color = GUI.color.WithAlpha(0.5f); }
|
||||
instance = MoveNextDrawer();
|
||||
GUI.color = Color.white;
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will show value only if another field or prop is equal to target</summary>
|
||||
public class ShowIfDrawer : AttributeDrawer<ShowIfAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
var member = context.GetType().RTGetFieldOrProp(attribute.fieldName);
|
||||
if ( member != null ) {
|
||||
var memberValue = member.RTGetFieldOrPropValue(context);
|
||||
var memberType = memberValue?.GetType();
|
||||
int intValue;
|
||||
if ( memberType == null || !memberType.IsValueType ) {
|
||||
intValue = memberValue != null ? 1 : 0;
|
||||
} else {
|
||||
intValue = (int)System.Convert.ChangeType(memberValue, typeof(int));
|
||||
}
|
||||
if ( intValue != attribute.checkValue ) {
|
||||
return instance; //return instance without any editor (thus hide it)
|
||||
}
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will show in red if value is null or empty</summary>
|
||||
public class RequiredFieldDrawer : AttributeDrawer<RequiredFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
var isNull = instance == null || instance.Equals(null) || ( ( instance is string ) && string.IsNullOrEmpty((string)instance) );
|
||||
instance = MoveNextDrawer();
|
||||
if ( isNull ) { EditorUtils.MarkLastFieldError("An instance is required."); }
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will show a button above field</summary>
|
||||
public class ShowButtonDrawer : AttributeDrawer<ShowButtonAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( !string.IsNullOrEmpty(attribute.methodName) ) {
|
||||
var method = info.wrapperInstanceContext.GetType().RTGetMethod(attribute.methodName);
|
||||
if ( method != null && method.GetParameters().Length == 0 ) {
|
||||
if ( GUILayout.Button(attribute.buttonTitle) ) {
|
||||
method.Invoke(info.wrapperInstanceContext, null);
|
||||
}
|
||||
} else {
|
||||
GUILayout.Label(string.Format("Can't find ShowIf method '{0}'.", attribute.methodName));
|
||||
}
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will invoke a callback method when value change</summary>
|
||||
public class CallbackDrawer : AttributeDrawer<CallbackAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
var newValue = MoveNextDrawer();
|
||||
if ( !Equals(newValue, instance) ) {
|
||||
var method = info.wrapperInstanceContext.GetType().RTGetMethod(attribute.methodName);
|
||||
if ( method != null && method.GetParameters().Length == 0 ) {
|
||||
fieldInfo.SetValue(context, newValue); //manual set field before invoke
|
||||
method.Invoke(info.wrapperInstanceContext, null);
|
||||
} else {
|
||||
GUILayout.Label(string.Format("Can't find Callback method '{0}'.", attribute.methodName));
|
||||
}
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Will clamp float or int value to min</summary>
|
||||
public class MinValueDrawer : AttributeDrawer<MinValueAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( fieldInfo.FieldType == typeof(float) ) {
|
||||
return Mathf.Max((float)MoveNextDrawer(), (float)attribute.min);
|
||||
}
|
||||
if ( fieldInfo.FieldType == typeof(int) ) {
|
||||
return Mathf.Max((int)MoveNextDrawer(), (int)attribute.min);
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Will make float, int or string field show in a delayed control</summary>
|
||||
public class DelayedFieldDrawer : AttributeDrawer<DelayedFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( fieldInfo.FieldType == typeof(float) ) {
|
||||
return EditorGUILayout.DelayedFloatField(content, (float)instance);
|
||||
}
|
||||
if ( fieldInfo.FieldType == typeof(int) ) {
|
||||
return EditorGUILayout.DelayedIntField(content, (int)instance);
|
||||
}
|
||||
if ( fieldInfo.FieldType == typeof(string) ) {
|
||||
return EditorGUILayout.DelayedTextField(content, (string)instance);
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will force to use ObjectField editor, usefull for interfaces</summary>
|
||||
public class ForceObjectFieldDrawer : AttributeDrawer<ForceObjectFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( typeof(UnityEngine.Object).IsAssignableFrom(fieldInfo.FieldType) || fieldInfo.FieldType.IsInterface ) {
|
||||
return EditorGUILayout.ObjectField(content, instance as UnityEngine.Object, fieldInfo.FieldType, true);
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will restrict selection on provided values</summary>
|
||||
public class PopupFieldDrawer : AttributeDrawer<PopupFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( attribute.options != null && attribute.options.Length > 0 ) {
|
||||
var optType = attribute.options[0].GetType();
|
||||
if ( fieldInfo.FieldType.IsAssignableFrom(optType) ) {
|
||||
return EditorUtils.Popup<object>(content, instance, attribute.options);
|
||||
}
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will show a slider for int and float values</summary>
|
||||
public class SliderFieldDrawer : AttributeDrawer<SliderFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( fieldInfo.FieldType == typeof(float) ) {
|
||||
return EditorGUILayout.Slider(content, (float)instance, (float)attribute.min, (float)attribute.max);
|
||||
}
|
||||
if ( fieldInfo.FieldType == typeof(int) ) {
|
||||
return EditorGUILayout.IntSlider(content, (int)instance, (int)attribute.min, (int)attribute.max);
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will show a layer selection for int values</summary>
|
||||
public class LayerFieldDrawer : AttributeDrawer<LayerFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( fieldInfo.FieldType == typeof(int) ) {
|
||||
return EditorGUILayout.LayerField(content, (int)instance);
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will show a Tag selection for string values</summary>
|
||||
public class TagFieldDrawer : AttributeDrawer<TagFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( fieldInfo.FieldType == typeof(string) ) {
|
||||
return EditorGUILayout.TagField(content, (string)instance);
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Will show a text area for string values</summary>
|
||||
public class TextAreaDrawer : AttributeDrawer<TextAreaFieldAttribute>
|
||||
{
|
||||
private static GUIStyle areaStyle;
|
||||
static TextAreaDrawer() {
|
||||
areaStyle = new GUIStyle(GUI.skin.GetStyle("TextArea"));
|
||||
areaStyle.wordWrap = true;
|
||||
}
|
||||
public override object OnGUI(GUIContent content, object instance) {
|
||||
if ( fieldInfo.FieldType == typeof(string) ) {
|
||||
GUILayout.Label(content);
|
||||
return EditorGUILayout.TextArea((string)instance, areaStyle, GUILayout.Height(attribute.numberOfLines * areaStyle.lineHeight));
|
||||
}
|
||||
return MoveNextDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Can be used on an interface to popup select a concrete implementation.<summary>
|
||||
public class ReferenceFieldDrawer : AttributeDrawer<ReferenceFieldAttribute>
|
||||
{
|
||||
public override object OnGUI(GUIContent content, object instance)
|
||||
{
|
||||
var options = ReflectionTools.GetImplementationsOf(fieldInfo.FieldType);
|
||||
var selection = EditorUtils.Popup<System.Type>(content, instance != null? instance.GetType() : fieldInfo.FieldType, options);
|
||||
if (selection == null){ return instance = null; }
|
||||
|
||||
if (instance == null || instance.GetType() != selection ) {
|
||||
if (!typeof(UnityEngine.Object).IsAssignableFrom(selection)){
|
||||
return System.Activator.CreateInstance(selection);
|
||||
}
|
||||
}
|
||||
EditorGUI.indentLevel++;
|
||||
EditorUtils.ReflectedObjectInspector(instance, contextUnityObject);
|
||||
EditorGUI.indentLevel--;
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bc5dd489056dda48ad29f55f5da5c78
|
||||
timeCreated: 1513884114
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/AttributeDrawers.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,74 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ParadoxNotion.Serialization;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary>A very simple pool to handle Copy/Pasting</summary>
|
||||
public static class CopyBuffer
|
||||
{
|
||||
|
||||
private static Dictionary<Type, string> cachedCopies = new Dictionary<Type, string>();
|
||||
private static Dictionary<Type, object> cachedObjects = new Dictionary<Type, object>();
|
||||
|
||||
public static void FlushMem() {
|
||||
cachedCopies = new Dictionary<Type, string>();
|
||||
cachedObjects = new Dictionary<Type, object>();
|
||||
}
|
||||
|
||||
///<summary>Is copy available?</summary>
|
||||
public static bool Has<T>() {
|
||||
return ( cachedCopies.TryGetValue(typeof(T), out string json) );
|
||||
}
|
||||
|
||||
///<summary>Returns true if copy exist and the copy</summary>
|
||||
public static bool TryGet<T>(out T copy) {
|
||||
copy = Get<T>();
|
||||
return object.Equals(copy, default(T)) == false;
|
||||
}
|
||||
|
||||
///<summary>Returns a copy</summary>
|
||||
public static T Get<T>() {
|
||||
if ( cachedCopies.TryGetValue(typeof(T), out string json) ) {
|
||||
return JSONSerializer.Deserialize<T>(json);
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
///<summary>Sets a copy</summary>
|
||||
public static void Set<T>(T obj) {
|
||||
cachedCopies[typeof(T)] = JSONSerializer.Serialize(typeof(T), obj); ;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary></summary>
|
||||
public static bool HasCache<T>() {
|
||||
return ( cachedObjects.TryGetValue(typeof(T), out object obj) );
|
||||
}
|
||||
|
||||
///<summary></summary>
|
||||
public static bool TryGetCache<T>(out T copy) {
|
||||
copy = GetCache<T>();
|
||||
return object.Equals(copy, default(T)) == false;
|
||||
}
|
||||
|
||||
///<summary></summary>
|
||||
public static T GetCache<T>() {
|
||||
if ( cachedObjects.TryGetValue(typeof(T), out object obj) ) {
|
||||
return (T)obj;
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
///<summary></summary>
|
||||
public static void SetCache<T>(T obj) {
|
||||
cachedObjects[typeof(T)] = obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2177b57a40461d4484f7675d40b6fd0
|
||||
timeCreated: 1510990664
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/CopyBuffer.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e2a7ec01cbc8b5744b88354fd6b2e310
|
||||
folderAsset: yes
|
||||
timeCreated: 1541186478
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
[InitializeOnLoad]
|
||||
public static class Colors
|
||||
{
|
||||
|
||||
static Colors() { Load(); }
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
static void Load() {
|
||||
lightOrange = EditorGUIUtility.isProSkin ? new Color(1, 0.9f, 0.4f) : Color.white;
|
||||
lightBlue = EditorGUIUtility.isProSkin ? new Color(0.8f, 0.8f, 1) : Color.white;
|
||||
lightRed = EditorGUIUtility.isProSkin ? new Color(1, 0.5f, 0.5f, 0.8f) : Color.white;
|
||||
prefabOverrideColor = new Color(0.05f, 0.5f, 0.75f, 1f);
|
||||
}
|
||||
|
||||
public const string HEX_LIGHT = "#d2d2d2";
|
||||
public const string HEX_DARK = "#333333";
|
||||
|
||||
public static Color lightOrange { get; private set; }
|
||||
public static Color lightBlue { get; private set; }
|
||||
public static Color lightRed { get; private set; }
|
||||
public static Color prefabOverrideColor { get; private set; }
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>A greyscale color</summary>
|
||||
public static Color Grey(float value) {
|
||||
return new Color(value, value, value);
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Return a color for a type.</summary>
|
||||
public static Color GetTypeColor(System.Type type) {
|
||||
return TypePrefs.GetTypeColor(type);
|
||||
}
|
||||
|
||||
///<summary>Return a string hex color for a type.</summary>
|
||||
public static string GetTypeHexColor(System.Type type) {
|
||||
return TypePrefs.GetTypeHexColor(type);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 987618a20a0698a429059efcc504a5c9
|
||||
timeCreated: 1510968237
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/Databases/Colors.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,71 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary>Common Icons Database</summary>
|
||||
[InitializeOnLoad]
|
||||
public static class Icons
|
||||
{
|
||||
|
||||
static Icons() { Load(); }
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
static void Load() {
|
||||
playIcon = EditorGUIUtility.FindTexture("d_PlayButton");
|
||||
pauseIcon = EditorGUIUtility.FindTexture("d_PauseButton");
|
||||
stepIcon = EditorGUIUtility.FindTexture("d_StepButton");
|
||||
viewIcon = EditorGUIUtility.FindTexture("d_ViewToolOrbit On");
|
||||
csIcon = EditorGUIUtility.FindTexture("cs Script Icon");
|
||||
tagIcon = EditorGUIUtility.FindTexture("d_FilterByLabel");
|
||||
searchIcon = EditorGUIUtility.FindTexture("Search Icon");
|
||||
infoIcon = EditorGUIUtility.FindTexture("d_console.infoIcon.sml");
|
||||
warningIcon = EditorGUIUtility.FindTexture("d_console.warnicon.sml");
|
||||
warningIconBig = EditorGUIUtility.FindTexture("d_console.warnicon");
|
||||
errorIcon = EditorGUIUtility.FindTexture("d_console.erroricon.sml");
|
||||
errorIconBig = EditorGUIUtility.FindTexture("d_console.erroricon");
|
||||
folderIcon = EditorGUIUtility.FindTexture("Folder Icon");
|
||||
favoriteIcon = EditorGUIUtility.FindTexture("Favorite Icon");
|
||||
gearPopupIcon = EditorGUIUtility.FindTexture("d__Popup");
|
||||
gearIcon = EditorGUIUtility.FindTexture("EditorSettings Icon");
|
||||
scaleIcon = EditorGUIUtility.FindTexture("d_ScaleTool");
|
||||
minMaxIcon = EditorGUIUtility.FindTexture("d_winbtn_win_max");
|
||||
plusIcon = EditorGUIUtility.FindTexture("d_CreateAddNew");
|
||||
helpIcon = EditorGUIUtility.FindTexture("d__Help");
|
||||
}
|
||||
|
||||
public static Texture2D playIcon { get; private set; }
|
||||
public static Texture2D pauseIcon { get; private set; }
|
||||
public static Texture2D stepIcon { get; private set; }
|
||||
public static Texture2D viewIcon { get; private set; }
|
||||
public static Texture2D csIcon { get; private set; }
|
||||
public static Texture2D tagIcon { get; private set; }
|
||||
public static Texture2D searchIcon { get; private set; }
|
||||
public static Texture2D infoIcon { get; private set; }
|
||||
public static Texture2D warningIcon { get; private set; }
|
||||
public static Texture2D warningIconBig { get; private set; }
|
||||
public static Texture2D errorIcon { get; private set; }
|
||||
public static Texture2D errorIconBig { get; private set; }
|
||||
public static Texture2D folderIcon { get; private set; }
|
||||
public static Texture2D favoriteIcon { get; private set; }
|
||||
public static Texture2D gearPopupIcon { get; private set; }
|
||||
public static Texture2D gearIcon { get; private set; }
|
||||
public static Texture2D scaleIcon { get; private set; }
|
||||
public static Texture2D minMaxIcon { get; private set; }
|
||||
public static Texture2D plusIcon { get; private set; }
|
||||
public static Texture2D helpIcon { get; private set; }
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Returns a type icon</summary>
|
||||
public static Texture GetTypeIcon(System.Type type) {
|
||||
return TypePrefs.GetTypeIcon(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69ab7b26fef952b43af5148544cd9a0c
|
||||
timeCreated: 1510968237
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/Databases/Icons.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,231 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary>Common Styles Database</summary>
|
||||
public static class Styles
|
||||
{
|
||||
|
||||
private static GUIStyle _centerLabel;
|
||||
public static GUIStyle centerLabel {
|
||||
get
|
||||
{
|
||||
if ( _centerLabel == null ) {
|
||||
_centerLabel = new GUIStyle(GUI.skin.label);
|
||||
_centerLabel.richText = true;
|
||||
_centerLabel.fontSize = 11;
|
||||
_centerLabel.alignment = TextAnchor.MiddleCenter;
|
||||
}
|
||||
return _centerLabel;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _topCenterLabel;
|
||||
public static GUIStyle topCenterLabel {
|
||||
get
|
||||
{
|
||||
if ( _topCenterLabel == null ) {
|
||||
_topCenterLabel = new GUIStyle(GUI.skin.label);
|
||||
_topCenterLabel.richText = true;
|
||||
_topCenterLabel.fontSize = 11;
|
||||
_topCenterLabel.alignment = TextAnchor.UpperCenter;
|
||||
}
|
||||
return _topCenterLabel;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static GUIStyle _leftLabel;
|
||||
public static GUIStyle leftLabel {
|
||||
get
|
||||
{
|
||||
if ( _leftLabel == null ) {
|
||||
_leftLabel = new GUIStyle(GUI.skin.label);
|
||||
_leftLabel.richText = true;
|
||||
_leftLabel.fontSize = 11;
|
||||
_leftLabel.alignment = TextAnchor.MiddleLeft;
|
||||
_leftLabel.padding.right = 6;
|
||||
}
|
||||
return _leftLabel;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _rightLabel;
|
||||
public static GUIStyle rightLabel {
|
||||
get
|
||||
{
|
||||
if ( _rightLabel == null ) {
|
||||
_rightLabel = new GUIStyle(GUI.skin.label);
|
||||
_rightLabel.richText = true;
|
||||
_rightLabel.fontSize = 11;
|
||||
_rightLabel.alignment = TextAnchor.MiddleRight;
|
||||
_rightLabel.padding.left = 6;
|
||||
}
|
||||
return _rightLabel;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _topLeftLabel;
|
||||
public static GUIStyle topLeftLabel {
|
||||
get
|
||||
{
|
||||
if ( _topLeftLabel == null ) {
|
||||
_topLeftLabel = new GUIStyle(GUI.skin.label);
|
||||
_topLeftLabel.richText = true;
|
||||
_topLeftLabel.fontSize = 11;
|
||||
_topLeftLabel.alignment = TextAnchor.UpperLeft;
|
||||
_topLeftLabel.padding.right = 6;
|
||||
}
|
||||
return _topLeftLabel;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _topRight;
|
||||
public static GUIStyle topRightLabel {
|
||||
get
|
||||
{
|
||||
if ( _topRight == null ) {
|
||||
_topRight = new GUIStyle(GUI.skin.label);
|
||||
_topRight.richText = true;
|
||||
_topRight.fontSize = 11;
|
||||
_topRight.alignment = TextAnchor.UpperRight;
|
||||
_topRight.padding.left = 6;
|
||||
}
|
||||
return _topRight;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _bottomCenter;
|
||||
public static GUIStyle bottomCenterLabel {
|
||||
get
|
||||
{
|
||||
if ( _bottomCenter == null ) {
|
||||
_bottomCenter = new GUIStyle(GUI.skin.label);
|
||||
_bottomCenter.richText = true;
|
||||
_bottomCenter.fontSize = 11;
|
||||
_bottomCenter.alignment = TextAnchor.LowerCenter;
|
||||
}
|
||||
return _bottomCenter;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
private static GUIStyle _portContentImage;
|
||||
public static GUIStyle proxyContentImage {
|
||||
get
|
||||
{
|
||||
if ( _portContentImage == null ) {
|
||||
_portContentImage = new GUIStyle(GUI.skin.label);
|
||||
_portContentImage.alignment = TextAnchor.MiddleCenter;
|
||||
_portContentImage.padding = new RectOffset(0, 0, _portContentImage.padding.top, _portContentImage.padding.bottom);
|
||||
_portContentImage.margin = new RectOffset(0, 0, _portContentImage.margin.top, _portContentImage.margin.bottom);
|
||||
}
|
||||
return _portContentImage;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _proxyRightContentLabel;
|
||||
public static GUIStyle proxyRightContentLabel {
|
||||
get
|
||||
{
|
||||
if ( _proxyRightContentLabel == null ) {
|
||||
_proxyRightContentLabel = new GUIStyle(ParadoxNotion.Design.Styles.rightLabel);
|
||||
_proxyRightContentLabel.margin = new RectOffset(0, 0, _proxyRightContentLabel.margin.top, _proxyRightContentLabel.margin.bottom);
|
||||
_proxyRightContentLabel.padding = new RectOffset(8, 0, _proxyRightContentLabel.padding.top, _proxyRightContentLabel.padding.bottom);
|
||||
}
|
||||
return _proxyRightContentLabel;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _proxyLeftContentLabel;
|
||||
public static GUIStyle proxyLeftContentLabel {
|
||||
get
|
||||
{
|
||||
if ( _proxyLeftContentLabel == null ) {
|
||||
_proxyLeftContentLabel = new GUIStyle(ParadoxNotion.Design.Styles.leftLabel);
|
||||
_proxyLeftContentLabel.margin = new RectOffset(0, 0, _proxyLeftContentLabel.margin.top, _proxyLeftContentLabel.margin.bottom);
|
||||
_proxyLeftContentLabel.padding = new RectOffset(0, 8, _proxyLeftContentLabel.padding.top, _proxyLeftContentLabel.padding.bottom);
|
||||
}
|
||||
return _proxyLeftContentLabel;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
private static GUIStyle _wrapTextArea;
|
||||
public static GUIStyle wrapTextArea {
|
||||
get
|
||||
{
|
||||
if ( _wrapTextArea == null ) {
|
||||
_wrapTextArea = new GUIStyle(GUI.skin.textArea);
|
||||
_wrapTextArea.wordWrap = true;
|
||||
}
|
||||
return _wrapTextArea;
|
||||
}
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
private static GUIStyle _roundedBox;
|
||||
public static GUIStyle roundedBox {
|
||||
get
|
||||
{
|
||||
if ( _roundedBox != null ) { return _roundedBox; }
|
||||
_roundedBox = new GUIStyle((GUIStyle)"ShurikenEffectBg");
|
||||
if ( !UnityEditor.EditorGUIUtility.isProSkin ) {
|
||||
_roundedBox.normal.background = null;
|
||||
}
|
||||
return _roundedBox;
|
||||
}
|
||||
}
|
||||
|
||||
private static GUIStyle _buttonLeft;
|
||||
public static GUIStyle buttonLeft {
|
||||
get { return _buttonLeft ?? ( _buttonLeft = new GUIStyle((GUIStyle)"AppCommandLeft") ); }
|
||||
}
|
||||
|
||||
private static GUIStyle _buttonMid;
|
||||
public static GUIStyle buttonMid {
|
||||
get { return _buttonMid ?? ( _buttonMid = new GUIStyle((GUIStyle)"AppCommandMid") ); }
|
||||
}
|
||||
|
||||
private static GUIStyle _buttonRight;
|
||||
public static GUIStyle buttonRight {
|
||||
get { return _buttonRight ?? ( _buttonRight = new GUIStyle((GUIStyle)"AppCommandRight") ); }
|
||||
}
|
||||
|
||||
private static GUIStyle _highlightBox;
|
||||
public static GUIStyle highlightBox {
|
||||
get { return _highlightBox ?? ( _highlightBox = new GUIStyle((GUIStyle)"LightmapEditorSelectedHighlight") ); }
|
||||
}
|
||||
|
||||
private static GUIStyle _toolbarSearchField;
|
||||
public static GUIStyle toolbarSearchTextField {
|
||||
get { return _toolbarSearchField ?? ( _toolbarSearchField = new GUIStyle((GUIStyle)"ToolbarSearchTextField") ); }
|
||||
}
|
||||
|
||||
private static GUIStyle _toolbarSearchButton;
|
||||
public static GUIStyle toolbarSearchCancelButton {
|
||||
get { return _toolbarSearchButton ?? ( _toolbarSearchButton = new GUIStyle((GUIStyle)"ToolbarSearchCancelButton") ); }
|
||||
}
|
||||
|
||||
private static GUIStyle _shadowedBackground;
|
||||
public static GUIStyle shadowedBackground {
|
||||
get { return _shadowedBackground ?? ( _shadowedBackground = new GUIStyle((GUIStyle)"CurveEditorBackground") ); }
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Same as box, but saves me the trouble of writing string.empty all the time</summary>
|
||||
public static void Draw(Rect position, GUIStyle style) {
|
||||
GUI.Box(position, string.Empty, style);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ffba1313f15e5948a23e610947d90b8
|
||||
timeCreated: 1510968237
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/Databases/Styles.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d7a98bebbf5f384bad444fe79c2d315
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
@@ -0,0 +1,120 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary> AssetDatabase related utility</summary>
|
||||
partial class EditorUtils
|
||||
{
|
||||
|
||||
///<summary>Create asset of type T with a dialog prompt to chose path</summary>
|
||||
public static T CreateAsset<T>() where T : ScriptableObject {
|
||||
return (T)CreateAsset(typeof(T));
|
||||
}
|
||||
|
||||
///<summary>Create asset of type T at target path</summary>
|
||||
public static T CreateAsset<T>(string path) where T : ScriptableObject {
|
||||
return (T)CreateAsset(typeof(T), path);
|
||||
}
|
||||
|
||||
///<summary>Create asset of type and show or not the File Panel</summary>
|
||||
public static ScriptableObject CreateAsset(System.Type type) {
|
||||
ScriptableObject asset = null;
|
||||
var path = EditorUtility.SaveFilePanelInProject(
|
||||
"Create Asset of type " + type.ToString(),
|
||||
type.Name + ".asset",
|
||||
"asset", "");
|
||||
asset = CreateAsset(type, path);
|
||||
return asset;
|
||||
}
|
||||
|
||||
///<summary>Create asset of type at target path</summary>
|
||||
public static ScriptableObject CreateAsset(System.Type type, string path) {
|
||||
if ( string.IsNullOrEmpty(path) ) {
|
||||
return null;
|
||||
}
|
||||
ScriptableObject data = null;
|
||||
data = ScriptableObject.CreateInstance(type);
|
||||
AssetDatabase.CreateAsset(data, path);
|
||||
AssetDatabase.SaveAssets();
|
||||
return data;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Get a unique path at current project selection for creating an asset, providing the "filename.type"</summary>
|
||||
public static string GetAssetUniquePath(string fileName) {
|
||||
var path = AssetDatabase.GetAssetPath(Selection.activeObject);
|
||||
if ( path == "" ) {
|
||||
path = "Assets";
|
||||
}
|
||||
if ( System.IO.Path.GetExtension(path) != "" ) {
|
||||
path = path.Replace(System.IO.Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
|
||||
}
|
||||
return AssetDatabase.GenerateUniqueAssetPath(path + "/" + fileName);
|
||||
}
|
||||
|
||||
///<summary>Get MonoScript reference from type if able</summary>
|
||||
public static MonoScript MonoScriptFromType(System.Type targetType) {
|
||||
if ( targetType == null ) return null;
|
||||
var typeName = targetType.Name;
|
||||
if ( targetType.IsGenericType ) {
|
||||
targetType = targetType.GetGenericTypeDefinition();
|
||||
typeName = typeName.Substring(0, typeName.IndexOf('`'));
|
||||
}
|
||||
return AssetDatabase.FindAssets(string.Format("{0} t:MonoScript", typeName))
|
||||
.Select(AssetDatabase.GUIDToAssetPath)
|
||||
.Select(AssetDatabase.LoadAssetAtPath<MonoScript>)
|
||||
.FirstOrDefault(m => m != null && m.GetClass() == targetType);
|
||||
}
|
||||
|
||||
///<summary>Opens the MonoScript of a type if able</summary>
|
||||
public static bool OpenScriptOfType(System.Type type) {
|
||||
var mono = MonoScriptFromType(type);
|
||||
if ( mono != null ) {
|
||||
AssetDatabase.OpenAsset(mono);
|
||||
return true;
|
||||
}
|
||||
ParadoxNotion.Services.Logger.Log(string.Format("Can't open script of type '{0}', because a script with the same name does not exist.", type.FriendlyName()));
|
||||
return false;
|
||||
}
|
||||
|
||||
///<summary>Asset path to absolute system path</summary>
|
||||
public static string AssetToSystemPath(UnityEngine.Object obj) {
|
||||
var assetPath = AssetDatabase.GetAssetPath(obj);
|
||||
return AssetToSystemPath(assetPath);
|
||||
}
|
||||
|
||||
///<summary>Asset path to absolute system path</summary>
|
||||
public static string AssetToSystemPath(string assetPath) {
|
||||
if ( !string.IsNullOrEmpty(assetPath) ) {
|
||||
return Application.dataPath.Remove(Application.dataPath.LastIndexOf('/')) + '/' + assetPath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
///<summary>Get all scene names (added in build settings)</summary>
|
||||
public static List<string> GetSceneNames() {
|
||||
var allSceneNames = new List<string>();
|
||||
foreach ( var scene in EditorBuildSettings.scenes ) {
|
||||
if ( scene.enabled ) {
|
||||
var name = scene.path.Substring(scene.path.LastIndexOf("/") + 1);
|
||||
name = name.Substring(0, name.Length - 6);
|
||||
allSceneNames.Add(name);
|
||||
}
|
||||
}
|
||||
|
||||
return allSceneNames;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4676c1c75b3f474da4734cc2fd16c81
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/EditorUtils/EditorUtils.AssetDatabase.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,408 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary> ContextMenus, mostly reflection ones</summary>
|
||||
partial class EditorUtils
|
||||
{
|
||||
|
||||
///<summary>A generic purpose menu to pick an item</summary>
|
||||
public static GenericMenu GetMenu<T>(List<T> options, T current, Action<T> callback) {
|
||||
var menu = new GenericMenu();
|
||||
foreach ( var _option in options ) {
|
||||
var option = _option;
|
||||
var label = option != null ? option.ToString() : "null";
|
||||
menu.AddItem(new GUIContent(label), object.Equals(current, option), () => { callback(option); });
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
///<summary>Get a selection menu of types deriving base type</summary>
|
||||
public static GenericMenu GetTypeSelectionMenu(Type baseType, Action<Type> callback, GenericMenu menu = null, string subCategory = null) {
|
||||
|
||||
if ( menu == null ) {
|
||||
menu = new GenericMenu();
|
||||
}
|
||||
|
||||
if ( subCategory != null ) {
|
||||
subCategory = subCategory + "/";
|
||||
}
|
||||
|
||||
GenericMenu.MenuFunction2 Selected = delegate (object selectedType)
|
||||
{
|
||||
callback((Type)selectedType);
|
||||
};
|
||||
|
||||
var scriptInfos = GetScriptInfosOfType(baseType);
|
||||
|
||||
foreach ( var info in scriptInfos.Where(info => string.IsNullOrEmpty(info.category)) ) {
|
||||
menu.AddItem(new GUIContent(subCategory + info.name), false, info.type != null ? Selected : null, info.type);
|
||||
}
|
||||
|
||||
foreach ( var info in scriptInfos.Where(info => !string.IsNullOrEmpty(info.category)) ) {
|
||||
menu.AddItem(new GUIContent(subCategory + info.category + "/" + info.name), false, info.type != null ? Selected : null, info.type);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
///<summary> !* Providing an open GenericTypeDefinition for 'baseType', wraps the Preferred Types wihin the 1st Generic Argument of that Definition *!</summary>
|
||||
public static GenericMenu GetPreferedTypesSelectionMenu(Type baseType, Action<Type> callback, GenericMenu menu = null, string subCategory = null, bool showAddTypeOption = false) {
|
||||
|
||||
if ( menu == null ) {
|
||||
menu = new GenericMenu();
|
||||
}
|
||||
|
||||
if ( subCategory != null ) {
|
||||
subCategory = subCategory + "/";
|
||||
}
|
||||
|
||||
var constrainType = baseType;
|
||||
var isGenericDefinition = baseType.IsGenericTypeDefinition && baseType.RTGetGenericArguments().Length == 1;
|
||||
var genericDefinitionType = isGenericDefinition ? baseType : null;
|
||||
if ( isGenericDefinition ) {
|
||||
constrainType = genericDefinitionType.GetFirstGenericParameterConstraintType();
|
||||
}
|
||||
|
||||
GenericMenu.MenuFunction2 Selected = (object t) => { callback((Type)t); };
|
||||
|
||||
var listTypes = new Dictionary<Type, string>();
|
||||
var dictTypes = new Dictionary<Type, string>();
|
||||
|
||||
foreach ( var t in TypePrefs.GetPreferedTypesList(constrainType, true) ) {
|
||||
var nsString = t.NamespaceToPath() + "/";
|
||||
|
||||
var finalType = isGenericDefinition && genericDefinitionType.TryMakeGeneric(t, out Type genericType) ? genericType : t;
|
||||
var finalString = nsString + finalType.FriendlyName();
|
||||
menu.AddItem(new GUIContent(subCategory + finalString), false, Selected, finalType);
|
||||
|
||||
var listType = typeof(List<>).MakeGenericType(t);
|
||||
var finalListType = isGenericDefinition && genericDefinitionType.TryMakeGeneric(listType, out Type genericListType) ? genericListType : listType;
|
||||
if ( constrainType.IsAssignableFrom(finalListType) ) {
|
||||
listTypes[finalListType] = nsString;
|
||||
}
|
||||
|
||||
var dictType = typeof(Dictionary<,>).MakeGenericType(typeof(string), t);
|
||||
var finalDictType = isGenericDefinition && genericDefinitionType.TryMakeGeneric(dictType, out Type genericDictType) ? genericDictType : dictType;
|
||||
if ( constrainType.IsAssignableFrom(finalDictType) ) {
|
||||
dictTypes[finalDictType] = nsString;
|
||||
}
|
||||
|
||||
//by request extra append dictionary <string, List<T>>
|
||||
var dictListType = typeof(Dictionary<,>).MakeGenericType(typeof(string), typeof(List<>).MakeGenericType(t));
|
||||
var finalDictListType = isGenericDefinition && genericDefinitionType.TryMakeGeneric(dictListType, out Type genericDictListType) ? genericDictListType : dictListType;
|
||||
if ( constrainType.IsAssignableFrom(finalDictListType) ) {
|
||||
dictTypes[finalDictListType] = nsString;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( var pair in listTypes ) {
|
||||
menu.AddItem(new GUIContent(subCategory + TypePrefs.LIST_MENU_STRING + pair.Value + pair.Key.FriendlyName()), false, Selected, pair.Key);
|
||||
}
|
||||
|
||||
foreach ( var pair in dictTypes ) {
|
||||
menu.AddItem(new GUIContent(subCategory + TypePrefs.DICT_MENU_STRING + pair.Value + pair.Key.FriendlyName()), false, Selected, pair.Key);
|
||||
}
|
||||
|
||||
if ( showAddTypeOption ) {
|
||||
menu.AddItem(new GUIContent(subCategory + "Add Type..."), false, () => { TypePrefsEditorWindow.ShowWindow(); });
|
||||
}
|
||||
|
||||
if ( menu.GetItemCount() == 0 ) {
|
||||
menu.AddDisabledItem(new GUIContent(string.Format("No {0} derived types found in Preferred Types List", baseType.Name)));
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
//...
|
||||
public static void ShowPreferedTypesSelectionMenu(Type type, Action<Type> callback) {
|
||||
GetPreferedTypesSelectionMenu(type, callback).ShowAsBrowser("Select Type");
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
public static GenericMenu GetInstanceFieldSelectionMenu(Type type, Type fieldType, Action<FieldInfo> callback, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetFieldSelectionMenu(BindingFlags.Public | BindingFlags.Instance, type, fieldType, callback, menu, subMenu);
|
||||
}
|
||||
|
||||
public static GenericMenu GetStaticFieldSelectionMenu(Type type, Type fieldType, Action<FieldInfo> callback, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetFieldSelectionMenu(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy, type, fieldType, callback, menu, subMenu);
|
||||
}
|
||||
|
||||
///<summary>Get a GenericMenu for field selection in a type</summary>
|
||||
static GenericMenu Internal_GetFieldSelectionMenu(BindingFlags flags, Type type, Type fieldType, Action<FieldInfo> callback, GenericMenu menu = null, string subMenu = null) {
|
||||
|
||||
if ( menu == null ) {
|
||||
menu = new GenericMenu();
|
||||
}
|
||||
|
||||
if ( subMenu != null ) {
|
||||
subMenu = subMenu + "/";
|
||||
}
|
||||
|
||||
GenericMenu.MenuFunction2 Selected = delegate (object selectedField)
|
||||
{
|
||||
callback((FieldInfo)selectedField);
|
||||
};
|
||||
|
||||
foreach ( var field in type.GetFields(flags).Where(field => fieldType.IsAssignableFrom(field.FieldType)) ) {
|
||||
var inherited = field.DeclaringType != type;
|
||||
var category = inherited ? subMenu + type.FriendlyName() + "/Inherited" : subMenu + type.FriendlyName();
|
||||
menu.AddItem(new GUIContent(string.Format("{0}/{1} : {2}", category, field.Name, field.FieldType.FriendlyName())), false, Selected, field);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
public static GenericMenu GetInstancePropertySelectionMenu(Type type, Type propType, Action<PropertyInfo> callback, bool mustRead = true, bool mustWrite = true, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetPropertySelectionMenu(BindingFlags.Public | BindingFlags.Instance, type, propType, callback, mustRead, mustWrite, menu, subMenu);
|
||||
}
|
||||
|
||||
public static GenericMenu GetStaticPropertySelectionMenu(Type type, Type propType, Action<PropertyInfo> callback, bool mustRead = true, bool mustWrite = true, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetPropertySelectionMenu(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy, type, propType, callback, mustRead, mustWrite, menu, subMenu);
|
||||
}
|
||||
|
||||
///<summary>Get a GenericMenu for properties of a type optionaly specifying mustRead & mustWrite</summary>
|
||||
static GenericMenu Internal_GetPropertySelectionMenu(BindingFlags flags, Type type, Type propType, Action<PropertyInfo> callback, bool mustRead = true, bool mustWrite = true, GenericMenu menu = null, string subMenu = null) {
|
||||
|
||||
if ( menu == null ) {
|
||||
menu = new GenericMenu();
|
||||
}
|
||||
|
||||
if ( subMenu != null ) {
|
||||
subMenu = subMenu + "/";
|
||||
}
|
||||
|
||||
GenericMenu.MenuFunction2 Selected = delegate (object selectedProperty)
|
||||
{
|
||||
callback((PropertyInfo)selectedProperty);
|
||||
};
|
||||
|
||||
foreach ( var prop in type.GetProperties(flags) ) {
|
||||
|
||||
if ( !prop.CanRead && mustRead ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !prop.CanWrite && mustWrite ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !propType.IsAssignableFrom(prop.PropertyType) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( prop.GetCustomAttributes(typeof(System.ObsoleteAttribute), true).FirstOrDefault() != null ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var inherited = prop.DeclaringType != type;
|
||||
var category = inherited ? subMenu + type.FriendlyName() + "/Inherited" : subMenu + type.FriendlyName();
|
||||
menu.AddItem(new GUIContent(string.Format("{0}/{1} : {2}", category, prop.Name, prop.PropertyType.FriendlyName())), false, Selected, prop);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Get a menu for instance methods</summary>
|
||||
public static GenericMenu GetInstanceMethodSelectionMenu(Type type, Type returnType, Type acceptedParamsType, System.Action<MethodInfo> callback, int maxParameters, bool propertiesOnly, bool excludeVoid = false, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetMethodSelectionMenu(BindingFlags.Public | BindingFlags.Instance, type, returnType, acceptedParamsType, callback, maxParameters, propertiesOnly, excludeVoid, menu, subMenu);
|
||||
}
|
||||
|
||||
///<summary>Get a menu for static methods</summary>
|
||||
public static GenericMenu GetStaticMethodSelectionMenu(Type type, Type returnType, Type acceptedParamsType, System.Action<MethodInfo> callback, int maxParameters, bool propertiesOnly, bool excludeVoid = false, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetMethodSelectionMenu(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy, type, returnType, acceptedParamsType, callback, maxParameters, propertiesOnly, excludeVoid, menu, subMenu);
|
||||
}
|
||||
|
||||
///<summary>Get a GenericMenu for method or property get/set methods selection in a type</summary>
|
||||
static GenericMenu Internal_GetMethodSelectionMenu(BindingFlags flags, Type type, Type returnType, Type acceptedParamsType, System.Action<MethodInfo> callback, int maxParameters, bool propertiesOnly, bool excludeVoid = false, GenericMenu menu = null, string subMenu = null) {
|
||||
|
||||
if ( menu == null ) {
|
||||
menu = new GenericMenu();
|
||||
}
|
||||
|
||||
if ( subMenu != null ) {
|
||||
subMenu = subMenu + "/";
|
||||
}
|
||||
|
||||
GenericMenu.MenuFunction2 Selected = delegate (object selectedMethod)
|
||||
{
|
||||
callback((MethodInfo)selectedMethod);
|
||||
};
|
||||
|
||||
foreach ( var method in type.GetMethods(flags) ) {
|
||||
|
||||
if ( propertiesOnly != method.IsPropertyAccessor() ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( method.IsGenericMethod ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !returnType.IsAssignableFrom(method.ReturnType) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( method.ReturnType == typeof(void) && excludeVoid ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
if ( parameters.Length > maxParameters && maxParameters != -1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( parameters.Length > 0 ) {
|
||||
if ( acceptedParamsType != typeof(object) && parameters.Any(param => !acceptedParamsType.IsAssignableFrom(param.ParameterType)) ) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
MemberInfo member = method;
|
||||
//get the actual property to check for ObsoleteAttribute
|
||||
if ( method.Name.StartsWith("get_") || method.Name.StartsWith("set_") ) {
|
||||
member = method.DeclaringType.GetProperty(method.Name.Replace("get_", "").Replace("set_", ""));
|
||||
}
|
||||
if ( member == null || member.RTIsDefined(typeof(System.ObsoleteAttribute), true) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var inherited = method.DeclaringType != type;
|
||||
var category = inherited ? subMenu + type.FriendlyName() + "/Inherited" : subMenu + type.FriendlyName();
|
||||
menu.AddItem(new GUIContent(category + "/" + method.SignatureName()), false, Selected, method);
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
///<summary>Get a GenericMenu for Instance Events of the type and only event handler type of System.Action</summary>
|
||||
public static GenericMenu GetInstanceEventSelectionMenu(Type type, Type argType, Action<EventInfo> callback, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetEventSelectionMenu(BindingFlags.Public | BindingFlags.Instance, type, argType, callback, menu, subMenu);
|
||||
}
|
||||
|
||||
///<summary>Get a GenericMenu for Static Events of the type and only event handler type of System.Action</summary>
|
||||
public static GenericMenu GetStaticEventSelectionMenu(Type type, Type argType, Action<EventInfo> callback, GenericMenu menu = null, string subMenu = null) {
|
||||
return Internal_GetEventSelectionMenu(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy, type, argType, callback, menu, subMenu);
|
||||
}
|
||||
|
||||
///<summary>Get a GenericMenu for Events of the type and only event handler type of System.Action</summary>
|
||||
static GenericMenu Internal_GetEventSelectionMenu(BindingFlags flags, Type type, Type argType, Action<EventInfo> callback, GenericMenu menu = null, string subMenu = null) {
|
||||
|
||||
if ( menu == null ) {
|
||||
menu = new GenericMenu();
|
||||
}
|
||||
|
||||
if ( subMenu != null ) {
|
||||
subMenu = subMenu + "/";
|
||||
}
|
||||
|
||||
GenericMenu.MenuFunction2 Selected = delegate (object selectedEvent)
|
||||
{
|
||||
callback((EventInfo)selectedEvent);
|
||||
};
|
||||
|
||||
var eventType = argType == null ? typeof(System.Action) : typeof(System.Action<>).MakeGenericType(new Type[] { argType });
|
||||
foreach ( var e in type.GetEvents(flags) ) {
|
||||
if ( e.EventHandlerType == eventType ) {
|
||||
var eventInfoString = string.Format("{0}({1})", e.Name, argType != null ? argType.FriendlyName() : "");
|
||||
menu.AddItem(new GUIContent(subMenu + type.FriendlyName() + "/" + eventInfoString), false, Selected, e);
|
||||
}
|
||||
}
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
///<summary>MenuItemInfo exposition</summary>
|
||||
public struct MenuItemInfo
|
||||
{
|
||||
public bool isValid { get; private set; }
|
||||
public GUIContent content;
|
||||
public bool separator;
|
||||
public bool selected;
|
||||
public GenericMenu.MenuFunction func;
|
||||
public GenericMenu.MenuFunction2 func2;
|
||||
public object userData;
|
||||
public MenuItemInfo(GUIContent c, bool sep, bool slc, GenericMenu.MenuFunction f1, GenericMenu.MenuFunction2 f2, object o) {
|
||||
isValid = true;
|
||||
content = c;
|
||||
separator = sep;
|
||||
selected = slc;
|
||||
func = f1;
|
||||
func2 = f2;
|
||||
userData = o;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Gets an array of MenuItemInfo out of the GenericMenu provided</summary>
|
||||
public static MenuItemInfo[] GetMenuItems(GenericMenu menu) {
|
||||
|
||||
var itemField = typeof(GenericMenu).GetField("menuItems", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
if ( itemField == null ) { itemField = typeof(GenericMenu).GetField("m_MenuItems", BindingFlags.Instance | BindingFlags.NonPublic); }
|
||||
var items = itemField.GetValue(menu) as IList;
|
||||
if ( items.Count == 0 ) {
|
||||
return new MenuItemInfo[0];
|
||||
}
|
||||
|
||||
var itemType = items[0].GetType();
|
||||
var contentGetter = ReflectionTools.GetFieldGetter<object, GUIContent>(itemType.GetField("content"));
|
||||
var sepGetter = ReflectionTools.GetFieldGetter<object, bool>(itemType.GetField("separator"));
|
||||
var selectedGetter = ReflectionTools.GetFieldGetter<object, bool>(itemType.GetField("on"));
|
||||
var func1Getter = ReflectionTools.GetFieldGetter<object, GenericMenu.MenuFunction>(itemType.GetField("func"));
|
||||
var func2Getter = ReflectionTools.GetFieldGetter<object, GenericMenu.MenuFunction2>(itemType.GetField("func2"));
|
||||
var dataGetter = ReflectionTools.GetFieldGetter<object, object>(itemType.GetField("userData"));
|
||||
|
||||
var result = new List<MenuItemInfo>();
|
||||
foreach ( var item in items ) {
|
||||
var content = contentGetter(item);
|
||||
var separator = sepGetter(item);
|
||||
var selected = selectedGetter(item);
|
||||
var func1 = func1Getter(item);
|
||||
var func2 = func2Getter(item);
|
||||
var userData = dataGetter(item);
|
||||
result.Add(new MenuItemInfo(content, separator, selected, func1, func2, userData));
|
||||
}
|
||||
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
///<summary>Shows the Generic Menu as a browser with CompleteContextMenu.</summary>
|
||||
public static void ShowAsBrowser(this GenericMenu menu, Vector2 pos, string title, System.Type keyType = null) {
|
||||
if ( menu != null ) { GenericMenuBrowser.Show(menu, pos, title, keyType); }
|
||||
}
|
||||
|
||||
///<summary>Shows the Generic Menu as a browser with CompleteContextMenu.</summary>
|
||||
public static void ShowAsBrowser(this GenericMenu menu, string title, System.Type keyType = null) {
|
||||
if ( menu != null ) { GenericMenuBrowser.Show(menu, Event.current.mousePosition, title, keyType); }
|
||||
}
|
||||
|
||||
///<summary>Shortcut</summary>
|
||||
public static void Show(this GenericMenu menu, bool asBrowser, string title, System.Type keyType = null) {
|
||||
if ( asBrowser ) { menu.ShowAsBrowser(title, keyType); } else { menu.ShowAsContext(); Event.current.Use(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe15795089e56c545803799233bd2512
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/EditorUtils/EditorUtils.ContextMenus.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,382 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityObject = UnityEngine.Object;
|
||||
using Logger = ParadoxNotion.Services.Logger;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary> Specific Editor GUIs</summary>
|
||||
partial class EditorUtils
|
||||
{
|
||||
|
||||
///<summary>Stores fold states</summary>
|
||||
private static readonly Dictionary<Type, bool> registeredEditorFoldouts = new Dictionary<Type, bool>();
|
||||
|
||||
|
||||
///<summary>A cool label :-P (for headers)</summary>
|
||||
public static void CoolLabel(string text) {
|
||||
GUI.skin.label.richText = true;
|
||||
GUI.color = Colors.lightOrange;
|
||||
GUILayout.Label("<b><size=14>" + text + "</size></b>", Styles.topLeftLabel);
|
||||
GUI.color = Color.white;
|
||||
GUILayout.Space(2);
|
||||
}
|
||||
|
||||
///<summary>Combines the rest functions for a header style label</summary>
|
||||
public static void TitledSeparator(string title) {
|
||||
GUILayout.Space(1);
|
||||
BoldSeparator();
|
||||
CoolLabel(title + " ▼");
|
||||
Separator();
|
||||
}
|
||||
|
||||
///<summary>A thin separator</summary>
|
||||
public static void Separator() {
|
||||
var lastRect = GUILayoutUtility.GetLastRect();
|
||||
GUILayout.Space(7);
|
||||
GUI.color = new Color(0, 0, 0, 0.3f);
|
||||
GUI.DrawTexture(Rect.MinMaxRect(lastRect.xMin, lastRect.yMax + 4, lastRect.xMax, lastRect.yMax + 6), Texture2D.whiteTexture);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
///<summary>A thick separator</summary>
|
||||
public static void BoldSeparator() {
|
||||
var lastRect = GUILayoutUtility.GetLastRect();
|
||||
GUILayout.Space(14);
|
||||
GUI.color = new Color(0, 0, 0, 0.3f);
|
||||
GUI.DrawTexture(new Rect(0, lastRect.yMax + 6, Screen.width, 4), Texture2D.whiteTexture);
|
||||
GUI.DrawTexture(new Rect(0, lastRect.yMax + 6, Screen.width, 1), Texture2D.whiteTexture);
|
||||
GUI.DrawTexture(new Rect(0, lastRect.yMax + 9, Screen.width, 1), Texture2D.whiteTexture);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
///<summary>Just a fancy ending for inspectors</summary>
|
||||
public static void EndOfInspector() {
|
||||
var lastRect = GUILayoutUtility.GetLastRect();
|
||||
GUILayout.Space(8);
|
||||
GUI.color = new Color(0, 0, 0, 0.4f);
|
||||
GUI.DrawTexture(new Rect(0, lastRect.yMax + 6, Screen.width, 4), Texture2D.whiteTexture);
|
||||
GUI.DrawTexture(new Rect(0, lastRect.yMax + 4, Screen.width, 1), Texture2D.whiteTexture);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
///<summary>A Search Field</summary>
|
||||
public static string SearchField(string search) {
|
||||
GUILayout.BeginHorizontal();
|
||||
search = EditorGUILayout.TextField(search, Styles.toolbarSearchTextField);
|
||||
if ( !string.IsNullOrEmpty(search) && GUILayout.Button(string.Empty, Styles.toolbarSearchCancelButton) ) {
|
||||
search = string.Empty;
|
||||
GUIUtility.keyboardControl = 0;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
return search;
|
||||
}
|
||||
|
||||
///<summary>Used just after a textfield with no prefix to show an italic transparent text inside when empty</summary>
|
||||
public static void CommentLastTextField(string check, string comment = "Comments...") {
|
||||
if ( string.IsNullOrEmpty(check) ) {
|
||||
var lastRect = GUILayoutUtility.GetLastRect();
|
||||
GUI.Label(lastRect, " <i>" + comment + "</i>", Styles.topLeftLabel);
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Used just after a field to highlight it</summary>
|
||||
public static void HighlightLastField() {
|
||||
var lastRect = GUILayoutUtility.GetLastRect();
|
||||
lastRect.xMin += 2;
|
||||
lastRect.xMax -= 2;
|
||||
lastRect.yMax -= 4;
|
||||
Styles.Draw(lastRect, Styles.highlightBox);
|
||||
}
|
||||
|
||||
///<summary>Used just after a field to mark it as a prefab override (similar to native unity's one)</summary>
|
||||
public static void MarkLastFieldOverride() {
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
rect.x -= 3; rect.width = 2;
|
||||
GUI.color = Colors.prefabOverrideColor;
|
||||
GUI.DrawTexture(rect, Texture2D.whiteTexture);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
///<summary>Used just after a field to mark warning icon to it</summary>
|
||||
public static void MarkLastFieldWarning(string tooltip) {
|
||||
Internal_MarkLastField(ParadoxNotion.Design.Icons.warningIcon, tooltip);
|
||||
}
|
||||
|
||||
///<summary>Used just after a field to mark warning icon to it</summary>
|
||||
public static void MarkLastFieldError(string tooltip) {
|
||||
Internal_MarkLastField(ParadoxNotion.Design.Icons.errorIcon, tooltip);
|
||||
}
|
||||
|
||||
//...
|
||||
static void Internal_MarkLastField(Texture2D icon, string tooltip) {
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
rect.x += UnityEditor.EditorGUIUtility.labelWidth;
|
||||
rect.x -= 16;
|
||||
rect.y += 1;
|
||||
rect.width = 16;
|
||||
rect.height = 16;
|
||||
GUI.Box(rect, EditorUtils.GetTempContent(null, icon, tooltip), GUIStyle.none);
|
||||
}
|
||||
|
||||
// public static Rect BeginHighlightArea() {
|
||||
// var rect = GUILayoutUtility.GetLastRect();
|
||||
// GUILayout.BeginVertical();
|
||||
// return rect;
|
||||
// }
|
||||
|
||||
// public static void EndHighlightArea(Rect beginRect) {
|
||||
// GUILayout.EndVertical();
|
||||
// var last = GUILayoutUtility.GetLastRect();
|
||||
// var rect = Rect.MinMaxRect(beginRect.xMin, beginRect.yMin, last.xMax, last.yMax);
|
||||
// Styles.Draw(rect, Styles.highlightBox);
|
||||
// }
|
||||
|
||||
///<summary>Editor for LayerMask</summary>
|
||||
public static LayerMask LayerMaskField(string prefix, LayerMask layerMask, params GUILayoutOption[] layoutOptions) {
|
||||
return LayerMaskField(string.IsNullOrEmpty(prefix) ? GUIContent.none : new GUIContent(prefix), layerMask, layoutOptions);
|
||||
}
|
||||
|
||||
///<summary>Editor for LayerMask</summary>
|
||||
public static LayerMask LayerMaskField(GUIContent content, LayerMask layerMask, params GUILayoutOption[] layoutOptions) {
|
||||
LayerMask tempMask = EditorGUILayout.MaskField(content, UnityEditorInternal.InternalEditorUtility.LayerMaskToConcatenatedLayersMask(layerMask), UnityEditorInternal.InternalEditorUtility.layers, layoutOptions);
|
||||
layerMask = UnityEditorInternal.InternalEditorUtility.ConcatenatedLayersMaskToLayerMask(tempMask);
|
||||
return layerMask;
|
||||
}
|
||||
|
||||
///<summary>Do a cached editor Foldout based on provided key object</summary>
|
||||
public static bool CachedFoldout(Type key, GUIContent content) {
|
||||
var foldout = false;
|
||||
registeredEditorFoldouts.TryGetValue(key, out foldout);
|
||||
foldout = EditorGUILayout.Foldout(foldout, content);
|
||||
return registeredEditorFoldouts[key] = foldout;
|
||||
}
|
||||
|
||||
///<summary>An IList editor (List<T> and Arrays)</summary>
|
||||
public static IList ListEditor(GUIContent content, IList list, Type listType, InspectedFieldInfo info) {
|
||||
|
||||
var optionsAtt = info.attributes?.FirstOrDefault(x => x is ListInspectorOptionAttribute) as ListInspectorOptionAttribute;
|
||||
|
||||
var argType = listType.GetEnumerableElementType();
|
||||
if ( argType == null ) {
|
||||
return list;
|
||||
}
|
||||
|
||||
if ( object.Equals(list, null) ) {
|
||||
GUILayout.Label("Null List");
|
||||
return list;
|
||||
}
|
||||
|
||||
if ( optionsAtt == null || optionsAtt.showFoldout ) {
|
||||
if ( !CachedFoldout(listType, content) ) {
|
||||
return list;
|
||||
}
|
||||
} else {
|
||||
GUILayout.Label(content.text);
|
||||
}
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
EditorGUI.indentLevel++;
|
||||
|
||||
var options = new ReorderableListOptions();
|
||||
options.allowAdd = optionsAtt == null || optionsAtt.allowAdd;
|
||||
options.allowRemove = optionsAtt == null || optionsAtt.allowRemove;
|
||||
options.unityObjectContext = info.unityObjectContext;
|
||||
list = EditorUtils.ReorderableList(list, options, (i, r) =>
|
||||
{
|
||||
list[i] = ReflectedFieldInspector("Element " + i, list[i], argType, info);
|
||||
});
|
||||
|
||||
EditorGUI.indentLevel--;
|
||||
Separator();
|
||||
GUILayout.EndVertical();
|
||||
return list;
|
||||
}
|
||||
|
||||
///<summary>A IDictionary editor</summary>
|
||||
public static IDictionary DictionaryEditor(GUIContent content, IDictionary dict, Type dictType, InspectedFieldInfo info) {
|
||||
|
||||
var keyType = dictType.RTGetGenericArguments()[0];
|
||||
var valueType = dictType.RTGetGenericArguments()[1];
|
||||
|
||||
if ( object.Equals(dict, null) ) {
|
||||
GUILayout.Label("Null Dictionary");
|
||||
return dict;
|
||||
}
|
||||
|
||||
if ( !CachedFoldout(dictType, content) ) {
|
||||
return dict;
|
||||
}
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
var keys = dict.Keys.Cast<object>().ToList();
|
||||
var values = dict.Values.Cast<object>().ToList();
|
||||
|
||||
if ( GUILayout.Button("Add Element") ) {
|
||||
if ( !typeof(UnityObject).IsAssignableFrom(keyType) ) {
|
||||
object newKey = null;
|
||||
if ( keyType == typeof(string) ) {
|
||||
newKey = string.Empty;
|
||||
} else {
|
||||
newKey = Activator.CreateInstance(keyType);
|
||||
}
|
||||
|
||||
if ( dict.Contains(newKey) ) {
|
||||
Logger.LogWarning(string.Format("Key '{0}' already exists in Dictionary", newKey.ToString()), "Editor");
|
||||
return dict;
|
||||
}
|
||||
|
||||
keys.Add(newKey);
|
||||
|
||||
} else {
|
||||
Logger.LogWarning("Can't add a 'null' Dictionary Key", "Editor");
|
||||
return dict;
|
||||
}
|
||||
|
||||
values.Add(valueType.IsValueType ? Activator.CreateInstance(valueType) : null);
|
||||
}
|
||||
|
||||
for ( var i = 0; i < keys.Count; i++ ) {
|
||||
GUILayout.BeginHorizontal("box");
|
||||
GUILayout.Box("", GUILayout.Width(6), GUILayout.Height(35));
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
keys[i] = ReflectedFieldInspector("K:", keys[i], keyType, info);
|
||||
values[i] = ReflectedFieldInspector("V:", values[i], valueType, info);
|
||||
GUILayout.EndVertical();
|
||||
|
||||
if ( GUILayout.Button("X", GUILayout.Width(18), GUILayout.Height(34)) ) {
|
||||
keys.RemoveAt(i);
|
||||
values.RemoveAt(i);
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
//clear and reconstruct on separate pass after GUI controls
|
||||
dict.Clear();
|
||||
for ( var i = 0; i < keys.Count; i++ ) {
|
||||
try { dict.Add(keys[i], values[i]); }
|
||||
catch { Logger.Log("Dictionary Key removed due to duplicate found", "Editor"); }
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
GUILayout.EndVertical();
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
||||
///<summary>An editor field where if the component is null simply shows an object field, but if its not, shows a dropdown popup to select the specific component from within the gameobject</summary>
|
||||
public static Component ComponentField(GUIContent content, Component comp, Type type, params GUILayoutOption[] GUIOptions) {
|
||||
|
||||
if ( comp == null ) {
|
||||
return EditorGUILayout.ObjectField(content, comp, type, true, GUIOptions) as Component;
|
||||
}
|
||||
|
||||
var components = comp.GetComponents(type).ToList();
|
||||
var componentNames = components.Where(c => c != null).Select(c => c.GetType().FriendlyName() + " (" + c.gameObject.name + ")").ToList();
|
||||
componentNames.Insert(0, "[NONE]");
|
||||
|
||||
var index = components.IndexOf(comp);
|
||||
index = EditorGUILayout.Popup(content, index, componentNames.Select(n => new GUIContent(n)).ToArray(), GUIOptions);
|
||||
return index == 0 ? null : components[index];
|
||||
}
|
||||
|
||||
|
||||
///<summary>A popup that is based on the string rather than the index</summary>
|
||||
public static string StringPopup(GUIContent content, string selected, IEnumerable<string> options, params GUILayoutOption[] GUIOptions) {
|
||||
EditorGUILayout.BeginVertical();
|
||||
var index = 0;
|
||||
var copy = new List<string>(options);
|
||||
copy.Insert(0, "[NONE]");
|
||||
index = copy.Contains(selected) ? copy.IndexOf(selected) : 0;
|
||||
index = EditorGUILayout.Popup(content, index, copy.Select(n => new GUIContent(n)).ToArray(), GUIOptions);
|
||||
EditorGUILayout.EndVertical();
|
||||
return index == 0 ? string.Empty : copy[index];
|
||||
}
|
||||
|
||||
|
||||
///<summary>Generic Popup for selection of any element within a list</summary>
|
||||
public static T Popup<T>(T selected, IEnumerable<T> options, params GUILayoutOption[] GUIOptions) {
|
||||
return Popup<T>(GUIContent.none, selected, options, GUIOptions);
|
||||
}
|
||||
|
||||
///<summary>Generic Popup for selection of any element within a list</summary>
|
||||
public static T Popup<T>(string prefix, T selected, IEnumerable<T> options, params GUILayoutOption[] GUIOptions) {
|
||||
return Popup<T>(string.IsNullOrEmpty(prefix) ? GUIContent.none : new GUIContent(prefix), selected, options, GUIOptions);
|
||||
}
|
||||
|
||||
///<summary>Generic Popup for selection of any element within a list</summary>
|
||||
public static T Popup<T>(GUIContent content, T selected, IEnumerable<T> options, params GUILayoutOption[] GUIOptions) {
|
||||
var listOptions = new List<T>(options);
|
||||
listOptions.Insert(0, default(T));
|
||||
var stringedOptions = new List<string>(listOptions.Select(o => o != null ? o.ToString() : "[NONE]"));
|
||||
stringedOptions[0] = listOptions.Count == 1 ? "[NONE AVAILABLE]" : "[NONE]";
|
||||
|
||||
var index = 0;
|
||||
if ( listOptions.Contains(selected) ) {
|
||||
index = listOptions.IndexOf(selected);
|
||||
}
|
||||
|
||||
var wasEnable = GUI.enabled;
|
||||
GUI.enabled = wasEnable && stringedOptions.Count > 1;
|
||||
index = EditorGUILayout.Popup(content, index, stringedOptions.Select(s => new GUIContent(s)).ToArray(), GUIOptions);
|
||||
GUI.enabled = wasEnable;
|
||||
return index == 0 ? default(T) : listOptions[index];
|
||||
}
|
||||
|
||||
|
||||
///<summary>Generic Button Popup for selection of any element within a list</summary>
|
||||
public static void ButtonPopup<T>(string prefix, T selected, List<T> options, Action<T> Callback) {
|
||||
ButtonPopup<T>(string.IsNullOrEmpty(prefix) ? GUIContent.none : new GUIContent(prefix), selected, options, Callback);
|
||||
}
|
||||
|
||||
///<summary>Generic Button Popup for selection of any element within a list</summary>
|
||||
public static void ButtonPopup<T>(GUIContent content, T selected, List<T> options, Action<T> Callback) {
|
||||
var buttonText = selected != null ? selected.ToString() : "[NONE]";
|
||||
GUILayout.BeginHorizontal();
|
||||
if ( content != null && content != GUIContent.none ) {
|
||||
GUILayout.Label(content, GUILayout.Width(0), GUILayout.ExpandWidth(true));
|
||||
}
|
||||
if ( GUILayout.Button(buttonText, (GUIStyle)"MiniPopup", GUILayout.Width(0), GUILayout.ExpandWidth(true)) ) {
|
||||
var menu = new GenericMenu();
|
||||
foreach ( var _option in options ) {
|
||||
var option = _option;
|
||||
menu.AddItem(new GUIContent(option != null ? option.ToString() : "[NONE]"), object.Equals(selected, option), () => { Callback(option); });
|
||||
}
|
||||
menu.ShowAsBrowser("Select Option");
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
///<summary>Specialized Type button popup</summary>
|
||||
public static void ButtonTypePopup(string prefix, Type selected, Action<Type> Callback) {
|
||||
ButtonTypePopup(string.IsNullOrEmpty(prefix) ? GUIContent.none : new GUIContent(prefix), selected, Callback);
|
||||
}
|
||||
|
||||
///<summary>Specialized Type button popup</summary>
|
||||
public static void ButtonTypePopup(GUIContent content, Type selected, Action<Type> Callback) {
|
||||
var buttonText = selected != null ? selected.FriendlyName() : "[NONE]";
|
||||
GUILayout.BeginHorizontal();
|
||||
if ( content != null && content != GUIContent.none ) {
|
||||
GUILayout.Label(content, GUILayout.Width(0), GUILayout.ExpandWidth(true));
|
||||
}
|
||||
if ( GUILayout.Button(buttonText, (GUIStyle)"MiniPopup", GUILayout.Width(0), GUILayout.ExpandWidth(true)) ) {
|
||||
var menu = EditorUtils.GetPreferedTypesSelectionMenu(typeof(object), Callback);
|
||||
menu.ShowAsBrowser("Select Type");
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b2198a3a4aa5b44199f1deba4b3ed80
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/EditorUtils/EditorUtils.GUIEditors.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,309 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityObject = UnityEngine.Object;
|
||||
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
///<summary>Automatic Inspector functions</summary>
|
||||
partial class EditorUtils
|
||||
{
|
||||
|
||||
private static GUIContent tempContent;
|
||||
|
||||
///<summary>A cached temporary content</summary>
|
||||
public static GUIContent GetTempContent(string text = "", Texture image = null, string tooltip = null) {
|
||||
if ( tempContent == null ) { tempContent = new GUIContent(); }
|
||||
tempContent.text = text;
|
||||
tempContent.image = image;
|
||||
tempContent.tooltip = tooltip;
|
||||
return tempContent;
|
||||
}
|
||||
|
||||
///<summary>A cached temporary content</summary>
|
||||
public static GUIContent GetTempContent(Texture image = null, string tooltip = null) {
|
||||
return GetTempContent(null, image, tooltip);
|
||||
}
|
||||
|
||||
///<summary>Show an automatic editor GUI inspector for target object, taking into account drawer attributes</summary>
|
||||
public static void ReflectedObjectInspector(object target, UnityObject unityObjectContext) {
|
||||
|
||||
if ( target == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var fields = target.GetType().RTGetFields();
|
||||
for ( var i = 0; i < fields.Length; i++ ) {
|
||||
var field = fields[i];
|
||||
|
||||
//no statics
|
||||
if ( field.IsStatic ) { continue; }
|
||||
|
||||
//hide type altogether?
|
||||
if ( field.FieldType.RTIsDefined(typeof(HideInInspector), true) ) { continue; }
|
||||
|
||||
//inspect only public fields or private fields with the [ExposeField] attribute
|
||||
if ( field.IsPublic || field.RTIsDefined(typeof(ExposeFieldAttribute), true) ) {
|
||||
var attributes = field.RTGetAllAttributes();
|
||||
//Hide field?
|
||||
if ( attributes.Any(a => a is HideInInspector) ) { continue; }
|
||||
var serializationInfo = new InspectedFieldInfo(unityObjectContext, field, target, attributes);
|
||||
var currentValue = field.GetValue(target);
|
||||
var newValue = ReflectedFieldInspector(field.Name, currentValue, field.FieldType, serializationInfo);
|
||||
|
||||
var changed = !object.Equals(newValue, currentValue);
|
||||
if ( changed ) { UndoUtility.RecordObject(unityObjectContext, field.Name); }
|
||||
if ( changed || field.FieldType.IsValueType ) {
|
||||
field.SetValue(target, newValue);
|
||||
}
|
||||
if ( changed ) { UndoUtility.SetDirty(unityObjectContext); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///<summary>Draws an Editor field for object of type directly WITH taking into acount object drawers and drawer attributes</summary>
|
||||
public static object ReflectedFieldInspector(string name, object value, Type t, InspectedFieldInfo info) {
|
||||
var content = GetTempContent(name.SplitCamelCase());
|
||||
if ( info.attributes != null ) {
|
||||
//Create proper GUIContent
|
||||
var nameAtt = info.attributes.FirstOrDefault(a => a is NameAttribute) as NameAttribute;
|
||||
if ( nameAtt != null ) { content.text = nameAtt.name; }
|
||||
|
||||
var tooltipAtt = info.attributes.FirstOrDefault(a => a is TooltipAttribute) as TooltipAttribute;
|
||||
if ( tooltipAtt != null ) { content.tooltip = tooltipAtt.tooltip; }
|
||||
}
|
||||
|
||||
return ReflectedFieldInspector(content, value, t, info);
|
||||
}
|
||||
|
||||
///<summary>Draws an Editor field for object of type directly WITH taking into acount object drawers and drawer attributes</summary>
|
||||
public static object ReflectedFieldInspector(GUIContent content, object value, Type t, InspectedFieldInfo info) {
|
||||
|
||||
if ( t == null ) {
|
||||
GUILayout.Label("NO TYPE PROVIDED!");
|
||||
return value;
|
||||
}
|
||||
|
||||
//Use drawers
|
||||
var objectDrawer = PropertyDrawerFactory.GetObjectDrawer(t);
|
||||
var newValue = objectDrawer.DrawGUI(content, value, info);
|
||||
var changed = !object.Equals(newValue, value);
|
||||
if ( changed ) { UndoUtility.RecordObjectComplete(info.unityObjectContext, content.text + "Field Change"); }
|
||||
value = newValue;
|
||||
if ( changed ) { UndoUtility.SetDirty(info.unityObjectContext); }
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
///<summary>Draws an Editor field for object of type directly WITHOUT taking into acount object drawers and drawer attributes unless provided</summary>
|
||||
public static object DrawEditorFieldDirect(GUIContent content, object value, Type t, InspectedFieldInfo info) {
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
bool handled;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var newValue = DirectFieldControl(content, value, t, info.unityObjectContext, info.attributes, out handled);
|
||||
var changed = !object.Equals(newValue, value) || EditorGUI.EndChangeCheck();
|
||||
if ( changed ) { UndoUtility.RecordObjectComplete(info.unityObjectContext, content.text + "Field Change"); }
|
||||
value = newValue;
|
||||
if ( changed ) { UndoUtility.SetDirty(info.unityObjectContext); }
|
||||
if ( handled ) { return value; }
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if ( typeof(IList).IsAssignableFrom(t) ) {
|
||||
return ListEditor(content, (IList)value, t, info);
|
||||
}
|
||||
|
||||
if ( typeof(IDictionary).IsAssignableFrom(t) ) {
|
||||
return DictionaryEditor(content, (IDictionary)value, t, info);
|
||||
}
|
||||
|
||||
//show nested class members recursively, avoid all collections not handles above manually
|
||||
if ( value != null && ( t.IsClass || t.IsValueType ) && !typeof(ICollection).IsAssignableFrom(t) ) {
|
||||
|
||||
if ( EditorGUI.indentLevel <= 8 ) {
|
||||
|
||||
if ( !CachedFoldout(t, content) ) {
|
||||
return value;
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel++;
|
||||
ReflectedObjectInspector(value, info.unityObjectContext);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
EditorGUILayout.LabelField(content, new GUIContent(string.Format("NonInspectable ({0})", t.FriendlyName())));
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//...
|
||||
public static object DirectFieldControl(GUIContent content, object value, Type t, UnityEngine.Object unityObjectContext, object[] attributes, out bool handled, params GUILayoutOption[] options) {
|
||||
|
||||
handled = true;
|
||||
|
||||
//Check scene object type for UnityObjects. Consider Interfaces as scene object type. Assume that user uses interfaces with UnityObjects
|
||||
if ( typeof(UnityObject).IsAssignableFrom(t) || t.IsInterface ) {
|
||||
if ( value == null || value is UnityObject ) { //check this to avoid case of interface but no unityobject
|
||||
var isSceneObjectType = ( typeof(Component).IsAssignableFrom(t) || t == typeof(GameObject) || t == typeof(UnityObject) || t.IsInterface );
|
||||
var newValue = EditorGUILayout.ObjectField(content, (UnityObject)value, t, isSceneObjectType, options);
|
||||
if ( unityObjectContext != null && newValue != null ) {
|
||||
if ( !Application.isPlaying && EditorUtility.IsPersistent(unityObjectContext) && !EditorUtility.IsPersistent(newValue as UnityEngine.Object) ) {
|
||||
ParadoxNotion.Services.Logger.LogWarning("Assets can not have scene object references", "Editor", unityObjectContext);
|
||||
newValue = value as UnityObject;
|
||||
}
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
}
|
||||
|
||||
//Check Type second
|
||||
if ( t == typeof(Type) ) {
|
||||
return Popup<Type>(content, (Type)value, TypePrefs.GetPreferedTypesList(true), options);
|
||||
}
|
||||
|
||||
//get real current type
|
||||
t = value != null ? value.GetType() : t;
|
||||
|
||||
//for these just show type information
|
||||
if ( t.IsAbstract || t == typeof(object) || typeof(Delegate).IsAssignableFrom(t) || typeof(UnityEngine.Events.UnityEventBase).IsAssignableFrom(t) ) {
|
||||
EditorGUILayout.LabelField(content, new GUIContent(string.Format("({0})", t.FriendlyName())), options);
|
||||
return value;
|
||||
}
|
||||
|
||||
//create instance for value types
|
||||
if ( value == null && t.RTIsValueType() ) {
|
||||
value = System.Activator.CreateInstance(t);
|
||||
}
|
||||
|
||||
//create new instance with button for non value types
|
||||
if ( value == null && !t.IsAbstract && !t.IsInterface && ( t.IsArray || t.GetConstructor(Type.EmptyTypes) != null ) ) {
|
||||
if ( content != GUIContent.none ) {
|
||||
GUILayout.BeginHorizontal();
|
||||
EditorGUILayout.PrefixLabel(content, GUI.skin.button);
|
||||
}
|
||||
if ( GUILayout.Button("(null) Create", options) ) {
|
||||
value = t.IsArray ? Array.CreateInstance(t.GetElementType(), 0) : Activator.CreateInstance(t);
|
||||
}
|
||||
if ( content != GUIContent.none ) { GUILayout.EndHorizontal(); }
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
///----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
if ( t == typeof(string) ) {
|
||||
return EditorGUILayout.TextField(content, (string)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(char) ) {
|
||||
var c = (char)value;
|
||||
var s = c.ToString();
|
||||
s = EditorGUILayout.TextField(content, s, options);
|
||||
return string.IsNullOrEmpty(s) ? (char)c : (char)s[0];
|
||||
}
|
||||
|
||||
if ( t == typeof(bool) ) {
|
||||
return EditorGUILayout.Toggle(content, (bool)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(int) ) {
|
||||
return EditorGUILayout.IntField(content, (int)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(float) ) {
|
||||
return EditorGUILayout.FloatField(content, (float)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(byte) ) {
|
||||
return Convert.ToByte(Mathf.Clamp(EditorGUILayout.IntField(content, (byte)value, options), 0, 255));
|
||||
}
|
||||
|
||||
if ( t == typeof(long) ) {
|
||||
return EditorGUILayout.LongField(content, (long)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(double) ) {
|
||||
return EditorGUILayout.DoubleField(content, (double)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Vector2) ) {
|
||||
return EditorGUILayout.Vector2Field(content, (Vector2)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Vector2Int) ) {
|
||||
return EditorGUILayout.Vector2IntField(content, (Vector2Int)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Vector3) ) {
|
||||
return EditorGUILayout.Vector3Field(content, (Vector3)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Vector3Int) ) {
|
||||
return EditorGUILayout.Vector3IntField(content, (Vector3Int)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Vector4) ) {
|
||||
return EditorGUILayout.Vector4Field(content, (Vector4)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Quaternion) ) {
|
||||
var quat = (Quaternion)value;
|
||||
var vec4 = new Vector4(quat.x, quat.y, quat.z, quat.w);
|
||||
vec4 = EditorGUILayout.Vector4Field(content, vec4, options);
|
||||
return new Quaternion(vec4.x, vec4.y, vec4.z, vec4.w);
|
||||
}
|
||||
|
||||
if ( t == typeof(Color) ) {
|
||||
var att = attributes?.FirstOrDefault(a => a is ColorUsageAttribute) as ColorUsageAttribute;
|
||||
var hdr = att != null ? att.hdr : false;
|
||||
var showAlpha = att != null ? att.showAlpha : true;
|
||||
return EditorGUILayout.ColorField(content, (Color)value, true, showAlpha, hdr, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Gradient) ) {
|
||||
return EditorGUILayout.GradientField(content, (Gradient)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Rect) ) {
|
||||
return EditorGUILayout.RectField(content, (Rect)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(AnimationCurve) ) {
|
||||
return EditorGUILayout.CurveField(content, (AnimationCurve)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(Bounds) ) {
|
||||
return EditorGUILayout.BoundsField(content, (Bounds)value, options);
|
||||
}
|
||||
|
||||
if ( t == typeof(LayerMask) ) {
|
||||
return LayerMaskField(content, (LayerMask)value, options);
|
||||
}
|
||||
|
||||
if ( t.IsSubclassOf(typeof(System.Enum)) ) {
|
||||
if ( t.RTIsDefined(typeof(FlagsAttribute), true) ) {
|
||||
return EditorGUILayout.EnumFlagsField(content, (System.Enum)value, options);
|
||||
}
|
||||
return EditorGUILayout.EnumPopup(content, (System.Enum)value, options);
|
||||
}
|
||||
|
||||
handled = false;
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f82d383bba56d6a4d87929dcd962745a
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/EditorUtils/EditorUtils.ReflectedInspector.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,217 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityObject = UnityEngine.Object;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
partial class EditorUtils
|
||||
{
|
||||
|
||||
public delegate void ReorderableListCallback(int index, bool isPicked);
|
||||
|
||||
private static int pickedListIndex = -1;
|
||||
private static IList pickedList;
|
||||
|
||||
public struct ReorderableListOptions
|
||||
{
|
||||
public delegate GenericMenu GetItemMenuDelegate(int i);
|
||||
public bool blockReorder;
|
||||
public bool allowAdd;
|
||||
public bool allowRemove;
|
||||
public UnityObject unityObjectContext;
|
||||
public GetItemMenuDelegate customItemMenu;
|
||||
}
|
||||
|
||||
///<summary> A simple reorderable list. Pass the list and a function to call for GUI. The callback comes with the current iterated element index in the list</summary>
|
||||
public static IList ReorderableList(IList list, ReorderableListCallback GUICallback) {
|
||||
return ReorderableList(list, default(ReorderableListOptions), GUICallback);
|
||||
}
|
||||
|
||||
///<summary> A simple reorderable list. Pass the list and a function to call for GUI. The callback comes with the current iterated element index in the list</summary>
|
||||
public static IList ReorderableList(IList list, ReorderableListOptions options, ReorderableListCallback GUICallback) {
|
||||
|
||||
if ( list == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var listType = list.GetType();
|
||||
var argType = listType.GetEnumerableElementType();
|
||||
if ( argType == null ) {
|
||||
return list;
|
||||
}
|
||||
|
||||
var e = Event.current;
|
||||
|
||||
if ( options.allowAdd ) {
|
||||
|
||||
var dropRefs = DragAndDrop.objectReferences;
|
||||
|
||||
//Drag And Drop.
|
||||
if ( dropRefs.Length > 0 ) {
|
||||
if ( dropRefs.Any(r => argType.IsAssignableFrom(r.GetType()) || ( r.GetType() == typeof(GameObject) && typeof(Component).IsAssignableFrom(argType) )) ) {
|
||||
var dropRect = GUILayoutUtility.GetRect(0, 20, GUILayout.ExpandWidth(true));
|
||||
dropRect.xMin += 5;
|
||||
dropRect.xMax -= 5;
|
||||
Styles.Draw(dropRect, Styles.roundedBox);
|
||||
GUI.Box(dropRect, "Drop Here to Enlist", Styles.centerLabel);
|
||||
if ( dropRect.Contains(e.mousePosition) ) {
|
||||
if ( e.type == EventType.DragUpdated ) {
|
||||
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
|
||||
e.Use();
|
||||
}
|
||||
if ( e.type == EventType.DragPerform ) {
|
||||
for ( var i = 0; i < dropRefs.Length; i++ ) {
|
||||
var dropRef = dropRefs[i];
|
||||
var dropRefType = dropRef.GetType();
|
||||
if ( argType.IsAssignableFrom(dropRefType) ) {
|
||||
UndoUtility.RecordObject(options.unityObjectContext, "Drag Add Item");
|
||||
list.Add(dropRef);
|
||||
GUI.changed = true;
|
||||
UndoUtility.SetDirty(options.unityObjectContext);
|
||||
continue;
|
||||
}
|
||||
if ( dropRefType == typeof(GameObject) && typeof(Component).IsAssignableFrom(argType) ) {
|
||||
var componentToAdd = ( dropRef as GameObject ).GetComponent(argType);
|
||||
if ( componentToAdd != null ) {
|
||||
UndoUtility.RecordObject(options.unityObjectContext, "Drag Add Item");
|
||||
list.Add(componentToAdd);
|
||||
GUI.changed = true;
|
||||
UndoUtility.SetDirty(options.unityObjectContext);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
e.Use();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Add new default element
|
||||
if ( dropRefs.Length == 0 ) {
|
||||
if ( GUILayout.Button("Add Element") ) {
|
||||
UndoUtility.RecordObject(options.unityObjectContext, "Add Item");
|
||||
var o = argType.IsValueType ? argType.CreateObjectUninitialized() : null;
|
||||
if ( listType.IsArray ) {
|
||||
list = ReflectionTools.Resize((System.Array)list, list.Count + 1);
|
||||
} else {
|
||||
list.Add(o);
|
||||
}
|
||||
GUI.changed = true;
|
||||
UndoUtility.SetDirty(options.unityObjectContext);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( list.Count == 0 ) {
|
||||
return list;
|
||||
}
|
||||
|
||||
for ( var i = 0; i < list.Count; i++ ) {
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(16);
|
||||
GUILayout.BeginVertical();
|
||||
GUICallback(i, pickedListIndex == i && pickedList == list);
|
||||
GUILayout.EndVertical();
|
||||
var lastRect = GUILayoutUtility.GetLastRect();
|
||||
var pickRect = Rect.MinMaxRect(lastRect.xMin - 16, lastRect.yMin, lastRect.xMin, lastRect.yMax);
|
||||
GUI.color = new Color(1, 1, 1, 0.5f);
|
||||
GUI.Label(pickRect, options.blockReorder ? EditorUtils.GetTempContent("■", null, "Re-Ordering Is Disabled") : EditorUtils.GetTempContent("☰"), Styles.centerLabel);
|
||||
GUI.color = Color.white;
|
||||
if ( options.customItemMenu != null ) {
|
||||
GUILayout.Space(18);
|
||||
var buttonRect = Rect.MinMaxRect(lastRect.xMax, lastRect.yMin, lastRect.xMax + 22, lastRect.yMax + 1);
|
||||
EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);
|
||||
GUI.color = EditorGUIUtility.isProSkin ? Color.white : Color.grey;
|
||||
if ( GUI.Button(buttonRect, Icons.gearPopupIcon, Styles.centerLabel) ) {
|
||||
UndoUtility.RecordObject(options.unityObjectContext, "Menu Item");
|
||||
options.customItemMenu(i).ShowAsContext();
|
||||
GUI.changed = true;
|
||||
GUIUtility.hotControl = 0;
|
||||
GUIUtility.keyboardControl = 0;
|
||||
UndoUtility.SetDirty(options.unityObjectContext);
|
||||
}
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
if ( options.allowRemove ) {
|
||||
GUILayout.Space(20);
|
||||
var buttonRect = Rect.MinMaxRect(lastRect.xMax + 2, lastRect.yMin, lastRect.xMax + 20, lastRect.yMax);
|
||||
if ( GUI.Button(buttonRect, "X") ) {
|
||||
UndoUtility.RecordObject(options.unityObjectContext, "Remove Item");
|
||||
if ( listType.IsArray ) {
|
||||
list = ReflectionTools.Resize((System.Array)list, list.Count - 1);
|
||||
} else {
|
||||
list.RemoveAt(i);
|
||||
}
|
||||
GUI.changed = true;
|
||||
GUIUtility.hotControl = 0;
|
||||
GUIUtility.keyboardControl = 0;
|
||||
UndoUtility.SetDirty(options.unityObjectContext);
|
||||
}
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUI.color = Color.white;
|
||||
GUI.backgroundColor = Color.white;
|
||||
|
||||
if ( !options.blockReorder ) { EditorGUIUtility.AddCursorRect(pickRect, MouseCursor.MoveArrow); }
|
||||
var boundRect = GUILayoutUtility.GetLastRect();
|
||||
|
||||
if ( pickRect.Contains(e.mousePosition) && e.type == EventType.MouseDown && !options.blockReorder ) {
|
||||
pickedList = list;
|
||||
pickedListIndex = i;
|
||||
GUIUtility.hotControl = 0;
|
||||
GUIUtility.keyboardControl = 0;
|
||||
e.Use();
|
||||
}
|
||||
|
||||
if ( pickedList == list ) {
|
||||
if ( pickedListIndex == i ) {
|
||||
GUI.Box(boundRect, string.Empty);
|
||||
}
|
||||
|
||||
if ( pickedListIndex != -1 && pickedListIndex != i && boundRect.Contains(e.mousePosition) ) {
|
||||
|
||||
var markRect = new Rect(boundRect.x, boundRect.y - 2, boundRect.width, 2);
|
||||
if ( pickedListIndex < i ) {
|
||||
markRect.y = boundRect.yMax - 2;
|
||||
}
|
||||
|
||||
GUI.DrawTexture(markRect, Texture2D.whiteTexture);
|
||||
if ( e.type == EventType.MouseUp ) {
|
||||
UndoUtility.RecordObject(options.unityObjectContext, "Reorder Item");
|
||||
var pickObj = list[pickedListIndex];
|
||||
list.RemoveAt(pickedListIndex);
|
||||
list.Insert(i, pickObj);
|
||||
GUI.changed = true;
|
||||
UndoUtility.SetDirty(options.unityObjectContext);
|
||||
pickedList = null;
|
||||
pickedListIndex = -1;
|
||||
e.Use();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//just rest in case out of rect
|
||||
if ( e.rawType == EventType.MouseUp ) {
|
||||
if ( list == pickedList ) {
|
||||
pickedList = null;
|
||||
pickedListIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b97faf2d46c8ec043a8f0b20f9024058
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/EditorUtils/EditorUtils.ReorderableList.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,150 @@
|
||||
#if UNITY_EDITOR
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
|
||||
//reflection meta info
|
||||
partial class EditorUtils
|
||||
{
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
static void Initialize_ScriptInfos() {
|
||||
TypePrefs.onPreferredTypesChanged -= FlushScriptInfos;
|
||||
TypePrefs.onPreferredTypesChanged += FlushScriptInfos;
|
||||
}
|
||||
|
||||
//Flush script infos cache
|
||||
public static void FlushScriptInfos() {
|
||||
cachedInfos = null;
|
||||
}
|
||||
|
||||
//For gathering script/type meta-information
|
||||
public struct ScriptInfo
|
||||
{
|
||||
public bool isValid { get; private set; }
|
||||
|
||||
public Type originalType;
|
||||
public string originalName;
|
||||
public string originalCategory;
|
||||
|
||||
public Type type;
|
||||
public string name;
|
||||
public string category;
|
||||
public int priority;
|
||||
|
||||
public ScriptInfo(Type type, string name, string category, int priority) {
|
||||
this.isValid = true;
|
||||
this.originalType = type;
|
||||
this.originalName = name;
|
||||
this.originalCategory = category;
|
||||
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.category = category;
|
||||
this.priority = priority;
|
||||
}
|
||||
}
|
||||
|
||||
///<summary>Get a list of ScriptInfos of the baseType excluding: the base type, abstract classes, Obsolete classes and those with the DoNotList attribute, categorized as a list of ScriptInfo</summary>
|
||||
private static Dictionary<Type, List<ScriptInfo>> cachedInfos;
|
||||
public static List<ScriptInfo> GetScriptInfosOfType(Type baseType) {
|
||||
|
||||
if ( cachedInfos == null ) { cachedInfos = new Dictionary<Type, List<ScriptInfo>>(); }
|
||||
|
||||
List<ScriptInfo> infosResult;
|
||||
if ( cachedInfos.TryGetValue(baseType, out infosResult) ) {
|
||||
return infosResult.ToList();
|
||||
}
|
||||
|
||||
infosResult = new List<ScriptInfo>();
|
||||
|
||||
var subTypes = baseType.IsGenericTypeDefinition ? new Type[] { baseType } : ReflectionTools.GetImplementationsOf(baseType);
|
||||
foreach ( var subType in subTypes ) {
|
||||
|
||||
if ( subType.IsAbstract || subType.RTIsDefined(typeof(DoNotListAttribute), true) || subType.RTIsDefined(typeof(ObsoleteAttribute), true) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var isGeneric = subType.IsGenericTypeDefinition && subType.RTGetGenericArguments().Length == 1;
|
||||
var scriptName = subType.FriendlyName().SplitCamelCase();
|
||||
var scriptCategory = string.Empty;
|
||||
var scriptPriority = 0;
|
||||
|
||||
var nameAttribute = subType.RTGetAttribute<NameAttribute>(true);
|
||||
if ( nameAttribute != null ) {
|
||||
scriptPriority = nameAttribute.priority;
|
||||
scriptName = nameAttribute.name;
|
||||
if ( isGeneric && !scriptName.EndsWith("<T>") ) {
|
||||
scriptName += " (T)";
|
||||
}
|
||||
}
|
||||
|
||||
var categoryAttribute = subType.RTGetAttribute<CategoryAttribute>(true);
|
||||
if ( categoryAttribute != null ) {
|
||||
scriptCategory = categoryAttribute.category;
|
||||
}
|
||||
|
||||
var info = new ScriptInfo(subType, scriptName, scriptCategory, scriptPriority);
|
||||
|
||||
//add the generic types based on constrains and prefered types list
|
||||
if ( isGeneric ) {
|
||||
var exposeAsBaseDefinition = NodeCanvas.Editor.Prefs.collapseGenericTypes || subType.RTIsDefined<ExposeAsDefinitionAttribute>(true);
|
||||
if ( !exposeAsBaseDefinition ) {
|
||||
var typesToWrap = TypePrefs.GetPreferedTypesList(true);
|
||||
foreach ( var t in typesToWrap ) {
|
||||
infosResult.Add(info.MakeGenericInfo(t, string.Format("/{0}/{1}", info.name, t.NamespaceToPath())));
|
||||
infosResult.Add(info.MakeGenericInfo(typeof(List<>).MakeGenericType(t), string.Format("/{0}/{1}{2}", info.name, TypePrefs.LIST_MENU_STRING, t.NamespaceToPath()), -1));
|
||||
infosResult.Add(info.MakeGenericInfo(typeof(Dictionary<,>).MakeGenericType(typeof(string), t), string.Format("/{0}/{1}{2}", info.name, TypePrefs.DICT_MENU_STRING, t.NamespaceToPath()), -2));
|
||||
|
||||
//by request extra append dictionary <string, List<T>>
|
||||
infosResult.Add(info.MakeGenericInfo(typeof(Dictionary<,>).MakeGenericType(typeof(string), typeof(List<>).MakeGenericType (t) ), string.Format("/{0}/{1}{2}", info.name, TypePrefs.DICT_MENU_STRING, t.NamespaceToPath()), -2));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
infosResult.Add(info);
|
||||
}
|
||||
|
||||
infosResult = infosResult
|
||||
.Where(s => s.isValid)
|
||||
.OrderBy(s => s.originalCategory)
|
||||
.ThenBy(s => s.priority * -1)
|
||||
.ThenBy(s => s.originalName)
|
||||
.ToList();
|
||||
cachedInfos[baseType] = infosResult;
|
||||
return infosResult;
|
||||
}
|
||||
|
||||
///<summary>Makes and returns a closed generic ScriptInfo for targetType out of an existing ScriptInfo</summary>
|
||||
public static ScriptInfo MakeGenericInfo(this ScriptInfo info, Type targetType, string subCategory = null, int priorityShift = 0) {
|
||||
if ( !info.isValid || !info.originalType.IsGenericTypeDefinition ) {
|
||||
return default(ScriptInfo);
|
||||
}
|
||||
|
||||
if ( info.originalType.TryMakeGeneric(targetType, out Type genericType) ) {
|
||||
var genericCategory = info.originalCategory + subCategory;
|
||||
var genericName = info.originalName.Replace("(T)", string.Format("({0})", targetType.FriendlyName()));
|
||||
var newInfo = new ScriptInfo(genericType, genericName, genericCategory, info.priority + priorityShift);
|
||||
newInfo.originalType = info.originalType;
|
||||
newInfo.originalName = info.originalName;
|
||||
newInfo.originalCategory = info.originalCategory;
|
||||
return newInfo;
|
||||
}
|
||||
return default(ScriptInfo);
|
||||
}
|
||||
|
||||
///<summary>Not really. Only for purposes of menus usage.</summary>
|
||||
static string NamespaceToPath(this Type type) {
|
||||
if ( type == null ) { return string.Empty; }
|
||||
return string.IsNullOrEmpty(type.Namespace) ? "No Namespace" : type.Namespace.Split('.').First();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94b281ae1067f0c4ba9b8d27c2fb8178
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 14914
|
||||
packageName: NodeCanvas
|
||||
packageVersion: 3.3.1
|
||||
assetPath: Assets/ParadoxNotion/CanvasCore/Common/Design/PartialEditor/EditorUtils/EditorUtils.ScriptInfos.cs
|
||||
uploadId: 704937
|
||||
@@ -0,0 +1,7 @@
|
||||
#if UNITY_EDITOR
|
||||
namespace ParadoxNotion.Design
|
||||
{
|
||||
///<summary>Have some commonly stuff used across most inspectors and helper functions. Keep outside of Editor folder since many runtime classes use this in #if UNITY_EDITOR. This is a partial class. Different implementation provide different tools, so that everything is referenced from within one class.</summary>
|
||||
public static partial class EditorUtils { }
|
||||
}
|
||||
#endif
|
||||