mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交编辑器确定数据
This commit is contained in:
3
JNFrame2/Assets/HotScripts/JNGame/Editor/Math.meta
Normal file
3
JNFrame2/Assets/HotScripts/JNGame/Editor/Math.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51922f216cbd4930b00d06d6a29f20f5
|
||||
timeCreated: 1729451383
|
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* @FileName: EditorLFloat.cs
|
||||
* @Date: 2024-04-20 20:06:14
|
||||
* @LastEditTime: 2024-04-21 13:07:09
|
||||
* @Description: 编辑器绘制定点数
|
||||
*/
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using JNGame.Math;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomPropertyDrawer(typeof(LFloat))]
|
||||
public class EditorLFloat : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var xProperty = property.FindPropertyRelative("rawValue");
|
||||
float LabelWidth = EditorGUIUtility.labelWidth;
|
||||
var labelRect = new Rect(position.x, position.y, LabelWidth, position.height);
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
float filedWid = (position.width - LabelWidth);
|
||||
float initX = position.x + LabelWidth;
|
||||
var valRect = new Rect(initX, position.y, filedWid, position.height);
|
||||
var fVal = EditorGUI.FloatField(valRect, xProperty.longValue * 1.0f / LFloat.Precision);
|
||||
xProperty.longValue = ((long)(fVal * LFloat.Precision));
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1cde07f51182ff8468222d53e8b68a3b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* @FileName: EditorLVector2.cs
|
||||
* @Date: 2024-04-20 20:06:14
|
||||
* @LastEditTime: 2024-04-21 13:05:56
|
||||
* @Description: 编辑器下绘制定点数2D向量
|
||||
*/
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using JNGame.Math;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
[CustomPropertyDrawer(typeof(LVector2))]
|
||||
public class EditorLVector2 : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var xProperty = property.FindPropertyRelative("x");
|
||||
var yProperty = property.FindPropertyRelative("y");
|
||||
float LabelWidth = EditorGUIUtility.labelWidth; // 向量属性名标签宽度
|
||||
float innerLabelWid = EditorLVectorDrawTool.LableWid; // 向量内部XYZ标准宽度
|
||||
float innnerSpaceWid = 10; // 向量内部XYZ属性绘制间距
|
||||
var labelRect = new Rect(position.x, position.y, LabelWidth, position.height);
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
float filedWid = (position.width - LabelWidth - innnerSpaceWid) / 2 - innerLabelWid;
|
||||
float initX = position.x + LabelWidth;
|
||||
float offset = 0;
|
||||
EditorLVectorDrawTool.DrawFieldLFloat(position, initX, ref offset, innerLabelWid, filedWid, xProperty, new GUIContent("X"));
|
||||
offset += innnerSpaceWid;
|
||||
EditorLVectorDrawTool.DrawFieldLFloat(position, initX, ref offset, innerLabelWid, filedWid, yProperty, new GUIContent("Y"));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d216843f46a51749af90b7caf51e94b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* @FileName: EditorLVector2Int.cs
|
||||
* @Date: 2024-04-20 20:06:14
|
||||
* @LastEditTime: 2024-04-21 13:04:55
|
||||
* @Description: 编辑器下绘制2D整数向量
|
||||
*/
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using JNGame.Math;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(LVector2Int))]
|
||||
public class EditorLVector2Int : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var xProperty = property.FindPropertyRelative("x");
|
||||
var yProperty = property.FindPropertyRelative("y");
|
||||
float LabelWidth = EditorGUIUtility.labelWidth; // 向量属性名标签宽度
|
||||
float innerLableWid = EditorLVectorDrawTool.LableWid; // 向量内部XYZ标准宽度
|
||||
float innerSpaceWid = 10; // 向量内部XYZ属性绘制间距
|
||||
var labelRect = new Rect(position.x, position.y, LabelWidth, position.height);
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
float filedWid = (position.width - LabelWidth - innerSpaceWid ) / 2 - innerLableWid;
|
||||
float initX = position.x + LabelWidth;
|
||||
float offset = 0;
|
||||
EditorLVectorDrawTool.DrawFieldInt(position, initX, ref offset, innerLableWid, filedWid, xProperty, new GUIContent("X"));
|
||||
offset += innerSpaceWid;
|
||||
EditorLVectorDrawTool.DrawFieldInt(position, initX, ref offset, innerLableWid, filedWid, yProperty, new GUIContent("Y"));
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d2e4e3df57fbb54baa4a96387b8a5a3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* @FileName: EditorLVector3.cs
|
||||
* @Date: 2024-04-20 20:06:14
|
||||
* @LastEditTime: 2024-04-21 13:06:21
|
||||
* @Description: 编辑器下绘制定点数3D向量
|
||||
*/
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using JNGame.Math;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
[CustomPropertyDrawer(typeof(LVector3))]
|
||||
public class EditorLVector3 : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var xProperty = property.FindPropertyRelative("x");
|
||||
var yProperty = property.FindPropertyRelative("y");
|
||||
var zProperty = property.FindPropertyRelative("z");
|
||||
float LabelWidth = EditorGUIUtility.labelWidth; // 向量属性名标签宽度
|
||||
float innerLableWid = EditorLVectorDrawTool.LableWid; // 向量内部xyz属性标签宽度
|
||||
float innerSpaceWid = 10; // 向量内部XYZ属性绘制间距
|
||||
var labelRect = new Rect(position.x, position.y, LabelWidth, position.height);
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
float filedWid = (position.width - LabelWidth - innerSpaceWid * 2) / 3 - innerLableWid;
|
||||
float initX = position.x + LabelWidth;
|
||||
float offset = 0;
|
||||
EditorLVectorDrawTool.DrawFieldLFloat(position, initX, ref offset, innerLableWid, filedWid, xProperty, new GUIContent("X"));
|
||||
offset += innerSpaceWid;
|
||||
EditorLVectorDrawTool.DrawFieldLFloat(position, initX, ref offset, innerLableWid, filedWid, yProperty, new GUIContent("Y"));
|
||||
offset += innerSpaceWid;
|
||||
EditorLVectorDrawTool.DrawFieldLFloat(position, initX, ref offset, innerLableWid, filedWid, zProperty, new GUIContent("Z"));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85b5253c1064906439345bb0bdfd40d4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* @FileName: EditorLVector3Int.cs
|
||||
* @Date: 2024-04-20 20:06:14
|
||||
* @LastEditTime: 2024-04-21 13:06:39
|
||||
* @Description: 绘制整数3D向量
|
||||
*/
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using JNGame.Math;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomPropertyDrawer(typeof(LVector3Int))]
|
||||
public class EditorLVector3Int : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var xProperty = property.FindPropertyRelative("x");
|
||||
var yProperty = property.FindPropertyRelative("y");
|
||||
var zProperty = property.FindPropertyRelative("z");
|
||||
float LabelWidth = EditorGUIUtility.labelWidth; // 向量属性名标签宽度
|
||||
float innerLableWid = EditorLVectorDrawTool.LableWid; // 向量内部XYZ标准宽度
|
||||
float innerSpaceWid = 10; // 向量内部XYZ属性绘制间距
|
||||
var labelRect = new Rect(position.x, position.y, LabelWidth, position.height);
|
||||
EditorGUI.LabelField(labelRect, label);
|
||||
float filedWid = (position.width - LabelWidth - innerSpaceWid * 2) / 3 - innerLableWid;
|
||||
float initX = position.x + LabelWidth;
|
||||
float offset = 0;
|
||||
EditorLVectorDrawTool.DrawFieldInt(position, initX, ref offset, innerLableWid, filedWid, xProperty, new GUIContent("X"));
|
||||
offset += innerSpaceWid;
|
||||
EditorLVectorDrawTool.DrawFieldInt(position, initX, ref offset, innerLableWid, filedWid, yProperty, new GUIContent("Y"));
|
||||
offset += innerSpaceWid;
|
||||
EditorLVectorDrawTool.DrawFieldInt(position, initX, ref offset, innerLableWid, filedWid, zProperty, new GUIContent("Z"));
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe44ed4b9a2ec9b4fa98cc8de406a1ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* @FileName: EditorLVectorDrawTool.cs
|
||||
* @Date: 2024-04-20 20:06:14
|
||||
* @LastEditTime: 2024-04-21 12:54:43
|
||||
* @Description: 定点数向量辅助绘制
|
||||
*/
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using JNGame.Math;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
public static class EditorLVectorDrawTool
|
||||
{
|
||||
public const float LableWidthOffset = 45;
|
||||
public const float LableWid = 20;
|
||||
|
||||
public static void DrawFieldLFloat(Rect position, float initX, ref float offset, float lableWid, float filedWid,
|
||||
SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var lableRect = new Rect(initX + offset, position.y, lableWid, position.height);
|
||||
EditorGUI.LabelField(lableRect, label.text);
|
||||
var valRect = new Rect(initX + offset + lableWid, position.y, filedWid, position.height);
|
||||
var rawProperty = property.FindPropertyRelative("rawValue");
|
||||
var fVal = EditorGUI.FloatField(valRect, rawProperty.longValue * 1.0f / LFloat.Precision);
|
||||
rawProperty.longValue = (long)(fVal * LFloat.Precision);
|
||||
offset += filedWid + lableWid;
|
||||
}
|
||||
public static void DrawFieldInt(Rect position, float initX, ref float offset, float lableWid, float filedWid,
|
||||
SerializedProperty property, GUIContent label)
|
||||
{
|
||||
var lableRect = new Rect(initX + offset, position.y, lableWid, position.height);
|
||||
EditorGUI.LabelField(lableRect, label.text);
|
||||
var valRect = new Rect(initX + offset + lableWid, position.y, filedWid, position.height);
|
||||
var fVal = EditorGUI.IntField(valRect, property.intValue);
|
||||
property.intValue = (int)(fVal);
|
||||
offset += filedWid + lableWid;
|
||||
}
|
||||
}
|
||||
#endif
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8de5a0082785b684aa51934e5c8d8818
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user