提交编辑器确定数据

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-10-21 03:15:02 +08:00
parent cbacd5a501
commit 0371576f87
35 changed files with 11621 additions and 16049 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 51922f216cbd4930b00d06d6a29f20f5
timeCreated: 1729451383

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1cde07f51182ff8468222d53e8b68a3b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9d216843f46a51749af90b7caf51e94b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4d2e4e3df57fbb54baa4a96387b8a5a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 85b5253c1064906439345bb0bdfd40d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fe44ed4b9a2ec9b4fa98cc8de406a1ef
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8de5a0082785b684aa51934e5c8d8818
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -13,7 +13,7 @@ namespace JNGame.Math
{
/// <summary>
/// 基于long定点数
/// </summary>
/// </summary>LFloat
[Serializable]
public struct LFloat : IEquatable<LFloat>, IComparable<LFloat>
{

View File

@@ -1,4 +1,5 @@
using System.Linq;
using JNGame.Math;
using Sirenix.OdinInspector;
using UnityEngine;
@@ -54,11 +55,11 @@ namespace GAS.Runtime
[InfoBox("计算逻辑与ScalableFloatModCalculation一致, 公式AttributeValue * k + b")]
[TabGroup("Default", "AttributeBasedModCalculation")]
[LabelText("系数(k)")]
public float k = 1;
public LFloat k = 1;
[TabGroup("Default", "AttributeBasedModCalculation")]
[LabelText("常量(b)")]
public float b = 0;
public LFloat b = 0;
public override float CalculateMagnitude(GameplayEffectSpec spec, float modifierMagnitude)
{

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 49241b5db40b450f934fb9de0841b2fc
timeCreated: 1729415696

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 7f1317ff9b314419b0e48ae76657c960
timeCreated: 1729415730

View File

@@ -1,28 +0,0 @@
using System;
using JNGame.Math;
using Sirenix.OdinInspector;
using UnityEngine;
namespace JNGame.Runtime.Odin.TypeCustomize
{
[Serializable]
public class OdinLVector3
{
[LabelText("X (x1000)")]
public int X;
[LabelText("Y (x1000)")]
public int Y;
[LabelText("Z (x1000)")]
public int Z;
public Vector3 ToVector3()
{
return (new LVector3(true, X * LFloat.RateOfOldPrecision, Y * LFloat.RateOfOldPrecision, Z * LFloat.RateOfOldPrecision)).ToVector3();
}
public LVector3 ToLVector3()
{
return (new LVector3(true, X * LFloat.RateOfOldPrecision, Y * LFloat.RateOfOldPrecision, Z * LFloat.RateOfOldPrecision));
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: bfdfa8bae636419282b29d0cfb4d9239
timeCreated: 1729415750

View File

@@ -289,7 +289,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!4 &1449950259
Transform:
m_ObjectHideFlags: 0

View File

@@ -16,10 +16,16 @@ MonoBehaviour:
RequiredTags: []
ImmunityTags: []
start:
X: 0
Y: 0
Z: 0
x:
rawValue: 0
y:
rawValue: 0
z:
rawValue: 0
end:
X: 10000
Y: 0
Z: 0
x:
rawValue: 10000000
y:
rawValue: 0
z:
rawValue: 0

View File

@@ -0,0 +1,24 @@
%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: c712e05924784c5593896e5c7c1d2708, type: 3}
m_Name: MMC_AttributeBasedModCalculation
m_EditorClassIdentifier:
Description:
captureType: 0
attributeFromType: 0
attributeName: AS_BaseAttribute.HP
attributeSetName: AS_BaseAttribute
attributeShortName: HP
k:
rawValue: 1580000
b:
rawValue: 0

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 71b523e86dd62c942b51606055e200bc
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,9 +1,6 @@
using GAS.General;
using GAS.Runtime;
using GASSamples.Scripts;
using GAS.Runtime;
using GASSamples.Scripts.Game.GAS;
using JNGame.Math;
using JNGame.Runtime.Odin.TypeCustomize;
using Sirenix.OdinInspector;
using UnityEngine;
@@ -14,10 +11,10 @@ namespace Demo.Scripts.GAS.GameplayCue
[BoxGroup]
[LabelText("开始位置")]
public OdinLVector3 start;
public LVector3 start;
[BoxGroup]
[LabelText("结束位置")]
public OdinLVector3 end;
public LVector3 end;
public override GameplayCueDurationalSpec CreateSpec(GameplayCueParameters parameters)
{
@@ -70,7 +67,7 @@ namespace Demo.Scripts.GAS.GameplayCue
{
Debug.Log($"GameplayCueDurational_PlayerDemo01_Spec OnTick {frame}");
((GAbilitySystemComponent)Owner).Entity.Transform.Position = LVector3.Lerp(cue.start.ToLVector3(), cue.end.ToLVector3(), (LFloat)(frame - startFrame) / endFrame);
((GAbilitySystemComponent)Owner).Entity.Transform.Position = LVector3.Lerp(cue.start, cue.end, (LFloat)(frame - startFrame) / endFrame);
}
}