Skip to content

Commit

Permalink
First stable version !
Browse files Browse the repository at this point in the history
  • Loading branch information
caphosra committed Mar 31, 2018
1 parent 79b3adf commit 13221c3
Show file tree
Hide file tree
Showing 23 changed files with 1,659 additions and 0 deletions.
82 changes: 82 additions & 0 deletions Assets/ReorderableListEx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#if UNITY_EDITOR

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

using UnityEditor;
using UnityEditorInternal;

namespace CPRUnitySystem
{
public class EasyReorderableList<T>
{
private ReorderableList reorderableList;
private T t_default;
private ElementCallback<T> elementDrawCallback;

public List<T> Data { get; private set; }
public event OnListChangedEventHandler<T> OnListChanged;

public EasyReorderableList(string title, List<T> data, ElementCallback<T> drawCallback, T init = default(T))
{
Data = data;
t_default = init;
reorderableList = new ReorderableList(data, typeof(T));

reorderableList.drawHeaderCallback += (rect) =>
{
EditorGUI.LabelField(rect, title);
};

reorderableList.drawElementCallback += (rect, index, isActive, isFocused) =>
{
Data[index] = elementDrawCallback(rect, Data[index], isActive, isFocused);
};
elementDrawCallback = drawCallback;

reorderableList.onAddCallback += OnAdd;
reorderableList.onRemoveCallback += OnRemove;
reorderableList.onChangedCallback += OnChangedCallback;
}

public void DoList(Rect rect)
{
reorderableList.DoList(rect);
}

public void DoLayoutList()
{
reorderableList.DoLayoutList();
}

private void OnAdd(ReorderableList list)
{
Data.Add(t_default);
}

private void OnRemove(ReorderableList list)
{
var remove = Data.Count;
Data.RemoveAt(remove - 1);
}

private void OnChangedCallback(ReorderableList list)
{
if (OnListChanged != null)
OnListChanged(Data);
}
}

public delegate void OnListChangedEventHandler<T>(List<T> list);

public delegate T ElementCallback<T>(Rect rect, T data, bool isActive, bool isFocused);

[System.Obsolete("This interface is not used.")]
public interface IReorderableSetting
{

}
}

#endif
13 changes: 13 additions & 0 deletions Assets/ReorderableListEx.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Assets/Test Scriptable.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 92ca96b34f69341439dfc0764584ff13, type: 3}
m_Name: New Test Scriptable
m_EditorClassIdentifier:
i: 05000000020000000300000000000000000000000000000000000000e8030000
10 changes: 10 additions & 0 deletions Assets/Test Scriptable.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions Assets/TestScriptable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using CPRUnitySystem;
using System.Linq;

[CreateAssetMenu]
public class TestScriptable : ScriptableObject
{
public List<int> i = new List<int>();

[CanEditMultipleObjects]
[CustomEditor(typeof(TestScriptable))]
public class TestEx : Editor
{
private EasyReorderableList<int> easyList;

public override void OnInspectorGUI()
{
var Target = target as TestScriptable;
if(easyList == null) easyList = new EasyReorderableList<int>("i", Target.i, Draw, 10);
easyList.DoLayoutList();
EditorUtility.SetDirty(Target);
}

public int Draw(Rect rect, int data, bool isActive, bool isFocused)
{
return EditorGUI.IntField(rect, "int", data);
}
}
}
13 changes: 13 additions & 0 deletions Assets/TestScriptable.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions ProjectSettings/AudioManager.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!11 &1
AudioManager:
m_ObjectHideFlags: 0
m_Volume: 1
Rolloff Scale: 1
Doppler Factor: 1
Default Speaker Mode: 2
m_SampleRate: 0
m_DSPBufferSize: 0
m_VirtualVoiceCount: 512
m_RealVoiceCount: 32
m_SpatializerPlugin:
m_AmbisonicDecoderPlugin:
m_DisableAudio: 0
m_VirtualizeEffects: 1
6 changes: 6 additions & 0 deletions ProjectSettings/ClusterInputManager.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!236 &1
ClusterInputManager:
m_ObjectHideFlags: 0
m_Inputs: []
29 changes: 29 additions & 0 deletions ProjectSettings/DynamicsManager.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 7
m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6
m_DefaultSolverVelocityIterations: 1
m_QueriesHitBackfaces: 0
m_QueriesHitTriggers: 1
m_EnableAdaptiveForce: 0
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 1
m_ClothInterCollisionSettingsToggle: 0
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 250, y: 250, z: 250}
m_WorldSubdivisions: 8
7 changes: 7 additions & 0 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1045 &1
EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
21 changes: 21 additions & 0 deletions ProjectSettings/EditorSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!159 &1
EditorSettings:
m_ObjectHideFlags: 0
serializedVersion: 7
m_ExternalVersionControlSupport: Hidden Meta Files
m_SerializationMode: 2
m_LineEndingsForNewScripts: 2
m_DefaultBehaviorMode: 1
m_SpritePackerMode: 4
m_SpritePackerPaddingPower: 1
m_EtcTextureCompressorBehavior: 1
m_EtcTextureFastCompressor: 1
m_EtcTextureNormalCompressor: 2
m_EtcTextureBestCompressor: 4
m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp
m_ProjectGenerationRootNamespace:
m_UserGeneratedProjectSuffix:
m_CollabEditorSettings:
inProgressEnabled: 1
61 changes: 61 additions & 0 deletions ProjectSettings/GraphicsSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
m_DeferredReflections:
m_Mode: 1
m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
m_ScreenSpaceShadows:
m_Mode: 1
m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0}
m_LegacyDeferred:
m_Mode: 1
m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
m_DepthNormals:
m_Mode: 1
m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0}
m_MotionVectors:
m_Mode: 1
m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0}
m_LightHalo:
m_Mode: 1
m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0}
m_LensFlare:
m_Mode: 1
m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0}
m_AlwaysIncludedShaders:
- {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
m_CustomRenderPipeline: {fileID: 0}
m_TransparencySortMode: 0
m_TransparencySortAxis: {x: 0, y: 0, z: 1}
m_DefaultRenderingPath: 1
m_DefaultMobileRenderingPath: 1
m_TierSettings: []
m_LightmapStripping: 0
m_FogStripping: 0
m_InstancingStripping: 0
m_LightmapKeepPlain: 1
m_LightmapKeepDirCombined: 1
m_LightmapKeepDynamicPlain: 1
m_LightmapKeepDynamicDirCombined: 1
m_LightmapKeepShadowMask: 1
m_LightmapKeepSubtractive: 1
m_FogKeepLinear: 1
m_FogKeepExp: 1
m_FogKeepExp2: 1
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0
Loading

0 comments on commit 13221c3

Please sign in to comment.