添加bool3,在inspecter中展示为横着的三个勾选框,但是保存为一个整数(๑•̀ㅂ•́)و✧
This commit is contained in:
8
Editor/Initializer.meta
Normal file
8
Editor/Initializer.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44450adff1997d74f8382bb7ecbaa7f0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
42
Editor/Initializer/InitializedXeric.cs
Normal file
42
Editor/Initializer/InitializedXeric.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Callbacks;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XericLibrary.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
|
||||
/// </summary>
|
||||
[InitializeOnLoad]
|
||||
public class InitializedXeric
|
||||
{
|
||||
static InitializedXeric()
|
||||
{
|
||||
//Debug.Log("Editor is loaded. Initializing...");
|
||||
}
|
||||
|
||||
[InitializeOnLoadMethod]
|
||||
static void MyMethod()
|
||||
{
|
||||
//Debug.Log("InitializeOnLoadMethod is called.");
|
||||
}
|
||||
|
||||
[PostProcessScene]
|
||||
public static void OnPostProcessScene()
|
||||
{
|
||||
Debug.Log("OnPostProcessScene is called.");
|
||||
}
|
||||
}
|
||||
|
||||
[DidReloadScripts]
|
||||
public class MyScript
|
||||
{
|
||||
static void OnScriptsReloaded()
|
||||
{
|
||||
Debug.Log("OnScriptsReloaded is called.");
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Initializer/InitializedXeric.cs.meta
Normal file
11
Editor/Initializer/InitializedXeric.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90ef394b99d429642aee067ce4d220b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,10 +1,18 @@
|
||||
{
|
||||
"name": "Lrss3.XericLibrary.Editor",
|
||||
"rootNamespace": "XericLibrary.Editor",
|
||||
"references": [
|
||||
"Lrss3.XericLibrary"
|
||||
"Lrss3.XericLibrary"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": []
|
||||
}
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
8
Runtime/CollisionLOD.meta
Normal file
8
Runtime/CollisionLOD.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce8d9db674f10b94c89f78d4a196f3b0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Runtime/CollisionLOD/LodBoxCollider.cs
Normal file
35
Runtime/CollisionLOD/LodBoxCollider.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using XericLibrary.Runtime.Type;
|
||||
|
||||
namespace XericLibrary.Runtime.CollisionLOD
|
||||
{
|
||||
public class LodBoxCollider : LodColliderBase
|
||||
{
|
||||
#region <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public Bool3 EnableCollisionAxis = new Bool3(1,0,1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
private bool CheckCollision()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
Runtime/CollisionLOD/LodBoxCollider.cs.meta
Normal file
11
Runtime/CollisionLOD/LodBoxCollider.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05ae1487ca501af4583c3f2d5307c5b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Runtime/CollisionLOD/LodSphereCollider.cs
Normal file
12
Runtime/CollisionLOD/LodSphereCollider.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace XericLibrary.Runtime.CollisionLOD
|
||||
{
|
||||
public class LodSphereCollider : LodColliderBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Runtime/CollisionLOD/LodSphereCollider.cs.meta
Normal file
11
Runtime/CollisionLOD/LodSphereCollider.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6882978c69b0a1f40b440f8ef70f8fc2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Runtime/CollisionLOD/base.meta
Normal file
8
Runtime/CollisionLOD/base.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d3709d62d6ccbc40acfb2b368f8aa5b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
120
Runtime/CollisionLOD/base/LodColliderBase.cs
Normal file
120
Runtime/CollisionLOD/base/LodColliderBase.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using XericLibrary.Runtime.Type;
|
||||
|
||||
namespace XericLibrary.Runtime.CollisionLOD
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD><C5B5><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public abstract class LodColliderBase : WeaklyMonoBase , IComparable
|
||||
{
|
||||
/*
|
||||
* <20><>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ʱ<EFBFBD>ԣ<EFBFBD><D4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>Э<EFBFBD>̣<EFBFBD><CCA3>첽<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
*/
|
||||
|
||||
#region <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD>Ա
|
||||
|
||||
#region <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
protected static ProgramFlowLinear ProgramFlow;
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
|
||||
/// </summary>
|
||||
public int SeqLevels = -1;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʾ<EFBFBD><CABE><EFBFBD>еȼ<D0B5><C8BC>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
[SerializeField]
|
||||
private bool noInitializationRequired = false;
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD>ߴ<EFBFBD><DFB4><EFBFBD>Ϣ
|
||||
/// </summary>
|
||||
public Bounds BoundSize;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
private List<LodColliderBase> allLodColliderList = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
private void OnValidate()
|
||||
{
|
||||
noInitializationRequired = true;
|
||||
|
||||
var allColliders = transform.GetComponents<LodColliderBase>();
|
||||
if(SeqLevels < 0)
|
||||
SeqLevels = allColliders.Length;
|
||||
|
||||
var genList = allColliders.ToList();
|
||||
MakeLevelLinearArray(genList);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if(noInitializationRequired)
|
||||
return;
|
||||
// <20><>̬<EFBFBD><CCAC><EFBFBD>ӵĴ<D3B5><C4B4><EFBFBD>
|
||||
//allLodColliderList = transform.GetComponents<LodColliderBase>()
|
||||
//.ToList();
|
||||
//MakeLevelLinearArray(allLodColliderList);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// ʹ<>б<EFBFBD><D0B1>ȼ<EFBFBD><C8BC><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD>ظ<EFBFBD>
|
||||
/// </summary>
|
||||
private void MakeLevelLinearArray(List<LodColliderBase> genList)
|
||||
{
|
||||
genList.Sort();
|
||||
int seqIndex = 0;
|
||||
foreach(var item in genList)
|
||||
item.SeqLevels = seqIndex++;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD>ӿ<EFBFBD>
|
||||
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
if(obj is LodColliderBase lod)
|
||||
return SeqLevels.CompareTo(lod.SeqLevels);
|
||||
else
|
||||
return this.CompareTo(obj);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
Runtime/CollisionLOD/base/LodColliderBase.cs.meta
Normal file
11
Runtime/CollisionLOD/base/LodColliderBase.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 306fe8a0033a9e74bb27f07803ead32b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Lrss3.XericLibrary",
|
||||
"rootNamespace": "XericLibrary",
|
||||
"rootNamespace": "XericLibrary.Runtime",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -73,6 +71,21 @@ namespace XericLibrary.Runtime.MacroLibrary
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>ע<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="examineCC">Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
||||
/// <param name="filterCC"><3E><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckEnum(T examineCC, T filterCC)
|
||||
{
|
||||
var cc = Convert.ToInt32(filterCC);
|
||||
var isValid = Convert.ToInt32(examineCC) & cc;
|
||||
var isFull = isValid ^ cc;
|
||||
|
||||
return isValid > 0 && isFull <= 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ö<EFBFBD><C3B6>ֵ
|
||||
/// </summary>
|
||||
@@ -146,25 +159,28 @@ namespace XericLibrary.Runtime.MacroLibrary
|
||||
target ^= Convert.ToInt32(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>ע<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="examineCC">Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></param>
|
||||
/// <param name="filterCC"><3E><><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD></param>
|
||||
/// <returns></returns>
|
||||
public static bool CheckEnum(T examineCC, T filterCC)
|
||||
{
|
||||
var cc = Convert.ToInt32(filterCC);
|
||||
var isValid = Convert.ToInt32(examineCC) & cc;
|
||||
var isFull = isValid ^ cc;
|
||||
|
||||
return isValid > 0 && isFull <= 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static partial class MacroMath
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>λ<EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
/// </summary>
|
||||
/// <param name="target"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public static bool GetEnumIndex(this int target, int index)
|
||||
{
|
||||
return 0 != ((target >> index) & 1);
|
||||
}
|
||||
|
||||
public static void SetEnumIndex(this ref int target, int index)
|
||||
{
|
||||
target |= 1 << index;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static int EnumToInt32(this Enum target)
|
||||
{
|
||||
|
||||
8
Runtime/Type/Base.meta
Normal file
8
Runtime/Type/Base.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7294966259431443ae3001869eef2b5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
154
Runtime/Type/Base/Bool3.cs
Normal file
154
Runtime/Type/Base/Bool3.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using XericLibrary.Runtime.MacroLibrary;
|
||||
|
||||
namespace XericLibrary.Runtime.Type
|
||||
{
|
||||
[Serializable]
|
||||
public struct Bool3
|
||||
{
|
||||
#region <EFBFBD>ֶι<EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
[SerializeField]
|
||||
private int axis;
|
||||
|
||||
public bool x
|
||||
{
|
||||
get => axis.GetEnumIndex(0);
|
||||
set => axis.SetEnumIndex(0);
|
||||
}
|
||||
public bool y
|
||||
{
|
||||
get => axis.GetEnumIndex(1);
|
||||
set => axis.SetEnumIndex(1);
|
||||
}
|
||||
public bool z
|
||||
{
|
||||
get => axis.GetEnumIndex(2);
|
||||
set => axis.SetEnumIndex(2);
|
||||
}
|
||||
|
||||
public Bool3(bool x, bool y, bool z)
|
||||
{
|
||||
axis = x ? 1 : 0;
|
||||
axis |= y ? 2 : 0;
|
||||
axis |= z ? 4 : 0;
|
||||
}
|
||||
|
||||
public Bool3(int x, int y, int z)
|
||||
{
|
||||
axis = x > 0 ? 1 : 0;
|
||||
axis |= y > 0 ? 2 : 0;
|
||||
axis |= z > 0 ? 4 : 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
public static implicit operator Bool3(int x)
|
||||
{
|
||||
var res = new Bool3();
|
||||
res.axis = x;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static implicit operator int(Bool3 x)
|
||||
=> x.axis;
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(Bool3))]
|
||||
public class Bool3DDrawer : PropertyDrawer
|
||||
{
|
||||
private readonly GUIContent[] labels = { new GUIContent("X"), new GUIContent("Y"), new GUIContent("Z") };
|
||||
|
||||
//public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
//{
|
||||
// EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// // ʹ<><CAB9>SerializedObject<63><74>SerializedProperty<74><79><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// SerializedProperty xProp = property.FindPropertyRelative("x");
|
||||
// SerializedProperty yProp = property.FindPropertyRelative("y");
|
||||
// SerializedProperty zProp = property.FindPropertyRelative("z");
|
||||
|
||||
// // <20><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
// float labelWidth = EditorGUIUtility.labelWidth;
|
||||
// float checkboxWidth = 30f;
|
||||
// Rect labelRect = new Rect(position.x, position.y, labelWidth, position.height);
|
||||
|
||||
// EditorGUI.LabelField(labelRect, label);
|
||||
|
||||
// for(int i = 0; i < 3; i++)
|
||||
// {
|
||||
// float checkboxX = position.x + labelWidth + i * (checkboxWidth + 2);
|
||||
// Rect checkboxRect = new Rect(checkboxX, position.y, checkboxWidth, position.height);
|
||||
// EditorGUI.PrefixLabel(checkboxRect, GUIUtility.GetControlID(FocusType.Passive), labels[i]);
|
||||
|
||||
// Rect toggleRect = new Rect(checkboxX + 12, position.y, checkboxWidth, position.height);
|
||||
// switch(i)
|
||||
// {
|
||||
// case 0:
|
||||
// xProp.boolValue = EditorGUI.Toggle(toggleRect, xProp.boolValue);
|
||||
// break;
|
||||
// case 1:
|
||||
// yProp.boolValue = EditorGUI.Toggle(toggleRect, yProp.boolValue);
|
||||
// break;
|
||||
// case 2:
|
||||
// zProp.boolValue = EditorGUI.Toggle(toggleRect, zProp.boolValue);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// EditorGUI.EndProperty();
|
||||
//}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
|
||||
// ʹ<><CAB9>SerializedObject<63><74>SerializedProperty<74><79><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SerializedProperty axisProp = property.FindPropertyRelative("axis");
|
||||
|
||||
// <20><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
float labelWidth = EditorGUIUtility.labelWidth;
|
||||
float checkboxWidth = 30f;
|
||||
Rect labelRect = new Rect(position.x, position.y, labelWidth, position.height);
|
||||
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
|
||||
bool[] axisValue = new bool[3];
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
float checkboxX = position.x + labelWidth + i * (checkboxWidth + 2);
|
||||
Rect checkboxRect = new Rect(checkboxX, position.y, checkboxWidth, position.height);
|
||||
EditorGUI.PrefixLabel(checkboxRect, GUIUtility.GetControlID(FocusType.Passive), labels[i]);
|
||||
|
||||
Rect toggleRect = new Rect(checkboxX + 12, position.y, checkboxWidth, position.height);
|
||||
switch(i)
|
||||
{
|
||||
case 0:
|
||||
axisValue[0] = EditorGUI.Toggle(toggleRect, axisProp.intValue.GetEnumIndex(0));
|
||||
break;
|
||||
case 1:
|
||||
axisValue[1] = EditorGUI.Toggle(toggleRect, axisProp.intValue.GetEnumIndex(1));
|
||||
break;
|
||||
case 2:
|
||||
axisValue[2] = EditorGUI.Toggle(toggleRect, axisProp.intValue.GetEnumIndex(2));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
axisProp.intValue = new Bool3(axisValue[0], axisValue[1], axisValue[2]);
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/Type/Base/Bool3.cs.meta
Normal file
11
Runtime/Type/Base/Bool3.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 101054efc7a817b4aa6080d90116d08e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user