destroyed proj
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
public enum HierarchyBackground
|
||||
{
|
||||
// General
|
||||
None = 0,
|
||||
Custom = 1,
|
||||
|
||||
// Colors
|
||||
ClrRed = 1000,
|
||||
ClrVermilion = 2000,
|
||||
ClrOrange = 3000,
|
||||
ClrAmber = 4000,
|
||||
ClrYellow = 5000,
|
||||
ClrLime = 6000,
|
||||
ClrChartreuse = 7000,
|
||||
ClrHarlequin = 8000,
|
||||
ClrGreen = 9000,
|
||||
ClrEmerald = 10000,
|
||||
ClrSpringGreen = 11000,
|
||||
ClrAquamarine = 12000,
|
||||
ClrCyan = 13000,
|
||||
ClrSkyBlue = 14000,
|
||||
ClrAzure = 15000,
|
||||
ClrCerulean = 16000,
|
||||
ClrBlue = 17000,
|
||||
ClrIndigo = 18000,
|
||||
ClrViolet = 19000,
|
||||
ClrPurple = 20000,
|
||||
ClrMagenta = 21000,
|
||||
ClrFuchsia = 22000,
|
||||
ClrRose = 23000,
|
||||
ClrCrimson = 24000,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d11d1da58916d414e836041c47f31879
|
||||
timeCreated: 1445183351
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyBackground.cs
|
||||
uploadId: 716077
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
public static class HierarchyEditorProxy
|
||||
{
|
||||
public static Action<GameObject> UpdateOldRuleset;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a990858cde84341b16a4435ab8068bb
|
||||
timeCreated: 1650316756
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyEditorProxy.cs
|
||||
uploadId: 716077
|
||||
@@ -0,0 +1,309 @@
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
public enum HierarchyIcon
|
||||
{
|
||||
// General
|
||||
None = 0,
|
||||
Custom = 1,
|
||||
|
||||
// Colors
|
||||
Red = 1000,
|
||||
Vermilion = 2000,
|
||||
Orange = 3000,
|
||||
Amber = 4000,
|
||||
Yellow = 5000,
|
||||
Lime = 6000,
|
||||
Chartreuse = 7000,
|
||||
Harlequin = 8000,
|
||||
Green = 9000,
|
||||
Emerald = 10000,
|
||||
SpringGreen = 11000,
|
||||
Aquamarine = 12000,
|
||||
Cyan = 13000,
|
||||
SkyBlue = 14000,
|
||||
Azure = 15000,
|
||||
Cerulean = 16000,
|
||||
Blue = 17000,
|
||||
Indigo = 18000,
|
||||
Violet = 19000,
|
||||
Purple = 20000,
|
||||
Magenta = 21000,
|
||||
Fuchsia = 22000,
|
||||
Rose = 23000,
|
||||
Crimson = 24000,
|
||||
|
||||
// General
|
||||
EditorSettings = 103000,
|
||||
Font = 104000,
|
||||
Favorite = 104500,
|
||||
GuiSkin = 105000,
|
||||
Material = 106000,
|
||||
PhysicMaterial = 107000,
|
||||
Prefab = 108000,
|
||||
SceneAsset = 109000,
|
||||
ScriptableObject = 110000,
|
||||
Sprite = 110050,
|
||||
SpriteAtlas = 110100,
|
||||
Texture2D = 110150,
|
||||
Texture = 113000,
|
||||
RenderTexture = 113050,
|
||||
Transform = 114000,
|
||||
|
||||
// Animation
|
||||
Animation = 117000,
|
||||
AnimationClip = 117050,
|
||||
AnimatorController = 117100,
|
||||
AnimatorOverrideController = 117150,
|
||||
AnimationState = 117200,
|
||||
AnimationStateMachine = 117250,
|
||||
AnimationStateTransition = 117300,
|
||||
Animator = 117350,
|
||||
AnyStateNode = 117400,
|
||||
AvatarMask = 117450,
|
||||
BlendTree = 117500,
|
||||
|
||||
// AR
|
||||
WorldAnchor = 120000,
|
||||
ArAnchor = 121000,
|
||||
|
||||
// Assets
|
||||
DefaultAsset = 125000,
|
||||
TextAsset = 125150,
|
||||
TextScriptImporter = 125200,
|
||||
CsScript = 125250,
|
||||
ComputeShader = 125300,
|
||||
JsScript = 125350,
|
||||
RaytracingShader = 125400,
|
||||
ShaderImporter = 125450,
|
||||
StyleSheet = 125500,
|
||||
VisualTreeAsset = 125550,
|
||||
BooScript = 125600,
|
||||
AssemblyDefinitionAsset = 125650,
|
||||
MetaFile = 125700,
|
||||
Shader = 125750,
|
||||
ShaderVariant = 125800,
|
||||
TerrainData = 125850,
|
||||
|
||||
// Audio
|
||||
AudioChorusFilter = 130000,
|
||||
AudioDistortionFilter = 131000,
|
||||
AudioEchoFilter = 132000,
|
||||
AudioHighPassFilter = 133000,
|
||||
AudioListener = 134000,
|
||||
AudioLowPassFilter = 135000,
|
||||
AudioReverbFilter = 136000,
|
||||
AudioReverbZone = 137000,
|
||||
AudioSource = 138000,
|
||||
AudioClip = 138020,
|
||||
AudioMixerController = 138040,
|
||||
AudioMixerGroup = 138060,
|
||||
AudioMixerSnapshot = 138080,
|
||||
AudioMixerView = 138100,
|
||||
AudioSpatializer = 138120,
|
||||
Microphone = 138140,
|
||||
|
||||
// Collab
|
||||
CollabChanges = 138500,
|
||||
CollabChangesConflict = 138550,
|
||||
CollabChangesDeleted = 138600,
|
||||
CollabConflict = 138650,
|
||||
CollabCreate = 138700,
|
||||
CollabDeleted = 138750,
|
||||
CollabEdit = 138800,
|
||||
CollabExclude = 138850,
|
||||
CollabMoved = 138900,
|
||||
|
||||
// Console
|
||||
ConsoleError = 139100,
|
||||
ConsoleErrorGray = 139120,
|
||||
ConsoleInfo = 139140,
|
||||
ConsoleInfoGray = 139160,
|
||||
ConsoleWarning = 139180,
|
||||
ConsoleWarningGray = 139200,
|
||||
ConsoleWindow = 139220,
|
||||
|
||||
// Effects
|
||||
Halo = 139500,
|
||||
LensFlare = 140000,
|
||||
LineRenderer = 141000,
|
||||
ParticleSystem = 142000,
|
||||
Projector = 143000,
|
||||
TrailRenderer = 144000,
|
||||
VisualEffect = 145000,
|
||||
VisualEffectAsset = 145100,
|
||||
VisualEffectBlock = 145200,
|
||||
VisualEffectOperator = 145300,
|
||||
Flare = 145350,
|
||||
|
||||
// Events
|
||||
EventSystem = 150000,
|
||||
EventTrigger = 151000,
|
||||
GraphicRaycaster = 152000,
|
||||
Physics2DRaycaster = 153000,
|
||||
PhysicsRaycaster = 154000,
|
||||
StandaloneInputModule = 155000,
|
||||
TouchInputModule = 156000,
|
||||
HoloLensInputModule = 156100,
|
||||
|
||||
// Folders
|
||||
Folder = 158000,
|
||||
FolderEmpty = 158050,
|
||||
FolderFavorite = 158100,
|
||||
FolderOpened = 158150,
|
||||
|
||||
// Layout
|
||||
AspectRatioFitter = 160000,
|
||||
Canvas = 161000,
|
||||
CanvasGroup = 162000,
|
||||
CanvasScaler = 163000,
|
||||
ContentSizeFitter = 164000,
|
||||
GridLayoutGroup = 165000,
|
||||
HorizontalLayoutGroup = 166000,
|
||||
LayoutElement = 167000,
|
||||
RectTransform = 168000,
|
||||
RectTransformBlueprint = 168500,
|
||||
VerticalLayoutGroup = 169000,
|
||||
|
||||
// Light
|
||||
Light = 169500,
|
||||
AreaLight = 169510,
|
||||
DirectionalLight = 169520,
|
||||
Spotlight = 169530,
|
||||
LightProbes = 169540,
|
||||
LightProbeGroup = 169550,
|
||||
LightProbeProxyVolume = 169560,
|
||||
LightingDataAsset = 169570,
|
||||
LightingSettings = 169580,
|
||||
LightmapParameters = 169590,
|
||||
|
||||
// Meshes
|
||||
Mesh = 170000,
|
||||
MeshFilter = 171000,
|
||||
MeshRenderer = 172000,
|
||||
SkinnedMeshRenderer = 173000,
|
||||
TextMesh = 174000,
|
||||
|
||||
// Miscellaneous
|
||||
AimConstraint = 180000,
|
||||
ArticulationBody = 182500,
|
||||
BillboardRenderer = 183000,
|
||||
Grid = 184000,
|
||||
LookAtConstraint = 185000,
|
||||
ParentConstraint = 186000,
|
||||
ParticleSystemForceField = 186500,
|
||||
PositionConstraint = 187000,
|
||||
RotationConstraint = 189000,
|
||||
ScaleConstraint = 190000,
|
||||
SpriteMask = 191000,
|
||||
SpriteShapeRenderer = 192000,
|
||||
Terrain = 193000,
|
||||
WindZone = 194000,
|
||||
|
||||
// Navigation
|
||||
NavMeshAgent = 200000,
|
||||
NavMeshObstacle = 201000,
|
||||
OffMeshLink = 202000,
|
||||
NavMeshData = 202100,
|
||||
|
||||
// Network
|
||||
NetworkAnimator = 210000,
|
||||
NetworkDiscovery = 211000,
|
||||
NetworkIdentity = 212000,
|
||||
NetworkLobbyManager = 213000,
|
||||
NetworkManager = 214000,
|
||||
NetworkManagerHUD = 215000,
|
||||
NetworkMigrationManager = 216000,
|
||||
NetworkProximityChecker = 217000,
|
||||
NetworkStartPosition = 218000,
|
||||
NetworkTransform = 219000,
|
||||
NetworkTransformChild = 220000,
|
||||
NetworkTransformVisualizer = 221000,
|
||||
|
||||
// Physics 2D
|
||||
AreaEffector2D = 230000,
|
||||
BoxCollider2D = 231000,
|
||||
BuoyancyEffector2D = 232000,
|
||||
CapsuleCollider2D = 233000,
|
||||
CircleCollider2D = 234000,
|
||||
CompositeCollider2D = 235000,
|
||||
ConstantForce2D = 236000,
|
||||
DistanceJoint2D = 237000,
|
||||
EdgeCollider2D = 238000,
|
||||
FixedJoint2D = 239000,
|
||||
FrictionJoint2D = 240000,
|
||||
HingeJoint2D = 241000,
|
||||
PlatformEffector2D = 242000,
|
||||
PointEffector2D = 243000,
|
||||
PolygonCollider2D = 244000,
|
||||
RelativeJoint2D = 245000,
|
||||
Rigidbody2D = 246000,
|
||||
SliderJoint2D = 247000,
|
||||
SpringJoint2D = 248000,
|
||||
SurfaceEffector2D = 249000,
|
||||
TargetJoint2D = 250000,
|
||||
WheelJoint2D = 251000,
|
||||
|
||||
// Physics
|
||||
BoxCollider = 260000,
|
||||
CapsuleCollider = 261000,
|
||||
CharacterController = 262000,
|
||||
CharacterJoint = 263000,
|
||||
Cloth = 264000,
|
||||
ConfigurableJoint = 265000,
|
||||
ConstantForce = 266000,
|
||||
FixedJoint = 267000,
|
||||
HingeJoint = 268000,
|
||||
MeshCollider = 269000,
|
||||
Rigidbody = 270000,
|
||||
SphereCollider = 271000,
|
||||
SpringJoint = 272000,
|
||||
TerrainCollider = 273000,
|
||||
WheelCollider = 274000,
|
||||
|
||||
// Playables
|
||||
PlayableDirector = 280000,
|
||||
|
||||
// Rendering
|
||||
Camera = 290000,
|
||||
CanvasRenderer = 291000,
|
||||
FlareLayer = 292000,
|
||||
LODGroup = 296000,
|
||||
OcclusionArea = 297000,
|
||||
OcclusionPortal = 298000,
|
||||
ReflectionProbe = 299000,
|
||||
Skybox = 300000,
|
||||
Cubemap = 300500,
|
||||
SortingGroup = 301000,
|
||||
SpriteRenderer = 302000,
|
||||
StreamingController = 303000,
|
||||
|
||||
// Tilemap
|
||||
Tilemap = 310000,
|
||||
TilemapCollider2D = 311000,
|
||||
TilemapRenderer = 312000,
|
||||
Tile = 312100,
|
||||
|
||||
// UI
|
||||
Button = 320000,
|
||||
Dropdown = 321000,
|
||||
Image = 322000,
|
||||
InputField = 323000,
|
||||
Mask = 324000,
|
||||
RawImage = 325000,
|
||||
RectMask2D = 325500,
|
||||
Scrollbar = 326000,
|
||||
ScrollRect = 327000,
|
||||
Selectable = 328000,
|
||||
Slider = 329000,
|
||||
Text = 330000,
|
||||
Toggle = 331000,
|
||||
ToggleGroup = 332000,
|
||||
Outline = 333000,
|
||||
PositionAsUV1 = 334000,
|
||||
Shadow = 335000,
|
||||
|
||||
// Video
|
||||
VideoClipOld = 340000,
|
||||
VideoPlayer = 341000,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7286c04579fc2814e8dcdc6535ff594b
|
||||
timeCreated: 1445183351
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyIcon.cs
|
||||
uploadId: 716077
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
[Serializable]
|
||||
public class HierarchyRule
|
||||
{
|
||||
public KeyType Type;
|
||||
public string Name;
|
||||
public GameObject GameObject;
|
||||
|
||||
public int Ordinal;
|
||||
public int Priority;
|
||||
|
||||
public HierarchyIcon IconType;
|
||||
public Texture2D IconTexture;
|
||||
public bool IsIconRecursive;
|
||||
|
||||
public HierarchyBackground BackgroundType;
|
||||
public Texture2D BackgroundTexture;
|
||||
public bool IsBackgroundRecursive;
|
||||
|
||||
public bool IsHidden;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Ctors
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public HierarchyRule(KeyType type, GameObject gameObject, string name)
|
||||
{
|
||||
Type = type;
|
||||
GameObject = gameObject;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public HierarchyRule(HierarchyRule value)
|
||||
{
|
||||
Type = value.Type;
|
||||
Name = value.Name;
|
||||
GameObject = value.GameObject;
|
||||
|
||||
Ordinal = value.Ordinal;
|
||||
Priority = value.Priority;
|
||||
|
||||
IconType = value.IconType;
|
||||
IconTexture = value.IconTexture;
|
||||
IsIconRecursive = value.IsIconRecursive;
|
||||
|
||||
BackgroundType = value.BackgroundType;
|
||||
BackgroundTexture = value.BackgroundTexture;
|
||||
IsBackgroundRecursive = value.IsBackgroundRecursive;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Public
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public void CopyFrom(HierarchyRule target)
|
||||
{
|
||||
Type = target.Type;
|
||||
Name = target.Name;
|
||||
GameObject = target.GameObject;
|
||||
|
||||
Ordinal = target.Ordinal;
|
||||
Priority = target.Priority;
|
||||
|
||||
IconType = target.IconType;
|
||||
IconTexture = target.IconTexture;
|
||||
IsIconRecursive = target.IsIconRecursive;
|
||||
|
||||
BackgroundType = target.BackgroundType;
|
||||
BackgroundTexture = target.BackgroundTexture;
|
||||
IsBackgroundRecursive = target.IsBackgroundRecursive;
|
||||
}
|
||||
|
||||
public bool HasIcon()
|
||||
{
|
||||
return IconType != HierarchyIcon.None && (!HasCustomIcon() || IconTexture != null);
|
||||
}
|
||||
|
||||
public bool HasCustomIcon()
|
||||
{
|
||||
return IconType == HierarchyIcon.Custom;
|
||||
}
|
||||
|
||||
public bool HasBackground()
|
||||
{
|
||||
return BackgroundType != HierarchyBackground.None && (!HasCustomBackground() || BackgroundTexture != null);
|
||||
}
|
||||
|
||||
public bool HasCustomBackground()
|
||||
{
|
||||
return BackgroundType == HierarchyBackground.Custom;
|
||||
}
|
||||
|
||||
public bool HasAtLeastOneTexture()
|
||||
{
|
||||
return HasIcon() || HasBackground();
|
||||
}
|
||||
|
||||
public bool IsRecursive()
|
||||
{
|
||||
return IsIconRecursive || IsBackgroundRecursive;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Nested
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public enum KeyType
|
||||
{
|
||||
Object,
|
||||
Name
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 490b15219bc2e7a449e56c680dbc28f1
|
||||
timeCreated: 1445183351
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyRule.cs
|
||||
uploadId: 716077
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[HelpURL(AssetInfo.HELP_URL)]
|
||||
public class HierarchyRuleset : MonoBehaviour
|
||||
{
|
||||
public const int VERSION = 1;
|
||||
|
||||
[FormerlySerializedAs("HierarchyItems")]
|
||||
public List<HierarchyRule> Rules = new List<HierarchyRule>();
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Messages
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
HierarchyEditorProxy.UpdateOldRuleset?.Invoke(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a91f9bb857f77f4aab0a456be198b75
|
||||
timeCreated: 1650316756
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyRuleset.cs
|
||||
uploadId: 716077
|
||||
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using static Borodar.RainbowHierarchy.HierarchyRule;
|
||||
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[HelpURL(AssetInfo.HELP_URL)]
|
||||
public class HierarchyRulesetV2 : MonoBehaviour
|
||||
{
|
||||
public const int VERSION = 2;
|
||||
public const string EXTENSION = "rhset";
|
||||
|
||||
private const string RULESET_OBJ_NAME = "RainbowHierarchyRuleset";
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public static readonly List<HierarchyRulesetV2> Instances = new List<HierarchyRulesetV2>();
|
||||
|
||||
public static Action OnRulesetChangeCallback;
|
||||
|
||||
// Editor
|
||||
|
||||
public List<HierarchyRule> Rules = new List<HierarchyRule>();
|
||||
|
||||
// Internal
|
||||
|
||||
private Scene _scene;
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Messages
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Application.isEditor || !Application.isPlaying) return;
|
||||
|
||||
Instances.Remove(this);
|
||||
DestroyImmediate(gameObject);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_scene = gameObject.scene;
|
||||
UpdateOrdinals();
|
||||
|
||||
Instances.Add(this);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
Instances.Remove(this);
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "MemberCanBeMadeStatic.Local")]
|
||||
private void OnRulesetChange()
|
||||
{
|
||||
UpdateOrdinals();
|
||||
OnRulesetChangeCallback();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Public
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
public static HierarchyRulesetV2 GetRulesetByScene(Scene scene, bool createIfNotExist = false)
|
||||
{
|
||||
var existingRuleset = Instances.FirstOrDefault(ruleset => ruleset._scene == scene);
|
||||
if (existingRuleset != null || !createIfNotExist) return existingRuleset;
|
||||
|
||||
var newRuleset = CreateRuleset(scene);
|
||||
return newRuleset;
|
||||
}
|
||||
|
||||
public HierarchyRule GetRule(GameObject match)
|
||||
{
|
||||
for (var i = Rules.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var currentRule = Rules[i];
|
||||
|
||||
if (currentRule.Type == KeyType.Name && currentRule.Name == match.name) return currentRule;
|
||||
if (currentRule.Type == KeyType.Object && currentRule.GameObject == match) return currentRule;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void AddRule(HierarchyRule rule)
|
||||
{
|
||||
var newRule = new HierarchyRule(rule);
|
||||
Rules.Add(newRule);
|
||||
OnRulesetChange();
|
||||
}
|
||||
|
||||
public void RemoveAll(GameObject match, KeyType type)
|
||||
{
|
||||
if (match == null) return;
|
||||
|
||||
Rules.RemoveAll(x =>
|
||||
type == KeyType.Object && x.GameObject == match ||
|
||||
type == KeyType.Name && x.Name == match.name);
|
||||
|
||||
OnRulesetChange();
|
||||
}
|
||||
|
||||
public void UpdateRule(GameObject selectedObject, HierarchyRule rule)
|
||||
{
|
||||
var existingRule = GetRule(selectedObject);
|
||||
|
||||
if (existingRule != null)
|
||||
{
|
||||
if (rule.HasAtLeastOneTexture())
|
||||
{
|
||||
existingRule.CopyFrom(rule);
|
||||
OnRulesetChange();
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveAll(selectedObject, existingRule.Type);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rule.HasAtLeastOneTexture()) AddRule(rule);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Helpers
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
private static HierarchyRulesetV2 CreateRuleset(Scene scene)
|
||||
{
|
||||
var rulesetObject = new GameObject {name = RULESET_OBJ_NAME};
|
||||
if (rulesetObject.scene != scene) SceneManager.MoveGameObjectToScene(rulesetObject, scene);
|
||||
|
||||
var ruleset = rulesetObject.AddComponent<HierarchyRulesetV2>();
|
||||
ruleset.gameObject.tag = "EditorOnly";
|
||||
return ruleset;
|
||||
}
|
||||
|
||||
private void UpdateOrdinals()
|
||||
{
|
||||
for (var i = 0; i < Rules.Count; i++)
|
||||
{
|
||||
Rules[i].Ordinal = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 848a85510b808ee4994e553f35ca73bd
|
||||
timeCreated: 1502704924
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchyRulesetV2.cs
|
||||
uploadId: 716077
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
// Required for compatibility reasons with previous versions of the asset (v2.2 or less)
|
||||
|
||||
[ExecuteInEditMode]
|
||||
[HelpURL(AssetInfo.HELP_URL)]
|
||||
public class HierarchySceneConfig : MonoBehaviour
|
||||
{
|
||||
public List<HierarchyRule> HierarchyItems = new List<HierarchyRule>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (!Application.isEditor && Application.isPlaying)
|
||||
{
|
||||
DestroyImmediate(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add new ruleset and copy all items
|
||||
var ruleset = gameObject.AddComponent<HierarchyRulesetV2>();
|
||||
ruleset.Rules = HierarchyItems;
|
||||
|
||||
// Destroy old config
|
||||
DestroyImmediate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7825597678d643f4081068e8f8c24baf
|
||||
timeCreated: 1502704924
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/HierarchySceneConfig.cs
|
||||
uploadId: 716077
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9161d329490ff704f999c89daf6f32c4
|
||||
folderAsset: yes
|
||||
timeCreated: 1481219623
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace Borodar.RainbowHierarchy
|
||||
{
|
||||
public static class AssetInfo
|
||||
{
|
||||
public const string STORE_ID = "106670";
|
||||
public const string NAME = "Rainbow Hierarchy";
|
||||
public const string VERSION = "2.6.2";
|
||||
public const string HELP_URL = "http://www.borodar.com/stuff/rainbowhierarchy/docs/quickstart_v" + VERSION + ".pdf";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 20edc575f9deee843b3729e5fc8d582f
|
||||
timeCreated: 1481219632
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 106670
|
||||
packageName: Rainbow Hierarchy 2
|
||||
packageVersion: 2.6.2
|
||||
assetPath: Assets/Plugins/Borodar/RainbowHierarchy/Scripts/Runtime/Info/AssetInfo.cs
|
||||
uploadId: 716077
|
||||
Reference in New Issue
Block a user