This commit is contained in:
CortexCore
2024-04-16 04:15:06 +08:00
parent b673a9438d
commit 0362b2c606
183 changed files with 5695 additions and 1453 deletions

View File

@@ -103,7 +103,7 @@ MonoBehaviour:
m_PrefilterSSAOSampleCountHigh: 1
m_PrefilterDBufferMRT1: 1
m_PrefilterDBufferMRT2: 1
m_PrefilterDBufferMRT3: 1
m_PrefilterDBufferMRT3: 0
m_PrefilterSoftShadowsQualityLow: 1
m_PrefilterSoftShadowsQualityMedium: 1
m_PrefilterSoftShadowsQualityHigh: 1

View File

@@ -9775,6 +9775,7 @@ Transform:
- {fileID: 324953849}
- {fileID: 495300441}
- {fileID: 2087774128}
- {fileID: 554909162}
- {fileID: 1237214210}
- {fileID: 1228132877}
- {fileID: 676926185}
@@ -11200,6 +11201,69 @@ Transform:
m_CorrespondingSourceObject: {fileID: 1093686136660250980, guid: d25e6ff943432834c877c29af5e8ff40, type: 3}
m_PrefabInstance: {fileID: 541966726}
m_PrefabAsset: {fileID: 0}
--- !u!1 &554909161
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 554909162}
- component: {fileID: 554909164}
- component: {fileID: 554909163}
m_Layer: 0
m_Name: Waiting
m_TagString: Untagged
m_Icon: {fileID: 2800000, guid: 2427f62ec555df341837da126e892853, type: 3}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &554909162
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 554909161}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 475671028}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &554909163
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 554909161}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 241915c4814e5224f9d3ffd6dab7a98e, type: 3}
m_Name:
m_EditorClassIdentifier:
handleTemplate: {fileID: 9197481963319205126, guid: 418bc306b2e063847b56f7b5f5a23f7d, type: 3}
asGlobal: 1
--- !u!114 &554909164
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 554909161}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: 64cd93f02c042ad43a96d66da32f0c6c, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: fd7776bbc384e3747a370568288ad98c, type: 3}
m_SortingOrder: 8
--- !u!1001 &555911125
PrefabInstance:
m_ObjectHideFlags: 0
@@ -12219,6 +12283,109 @@ Transform:
m_CorrespondingSourceObject: {fileID: 2723349985642794010, guid: d22a44843d244fc4fb4459be68ead0bb, type: 3}
m_PrefabInstance: {fileID: 596252691}
m_PrefabAsset: {fileID: 0}
--- !u!1 &599164994
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 599164995}
- component: {fileID: 599164997}
- component: {fileID: 599164996}
m_Layer: 0
m_Name: manual-button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &599164995
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 599164994}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1237214210}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &599164996
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 599164994}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7c307dd96b0ae44db43b135d73ae46a, type: 3}
m_Name:
m_EditorClassIdentifier:
mark:
actions:
- rid: 1308798704739418115
references:
version: 2
RefIds:
- rid: -2
type: {class: , ns: , asm: }
- rid: 1308798704739418115
type: {class: BITAppForUnity/OpenUrl, ns: BITKit, asm: BITKit}
data:
url: http://server.bitfall.icu:3000/root/iFactory.Cutting.Unity
urlReference:
rid: -2
--- !u!114 &599164997
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 599164994}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 44e9dc9ae2389a74abe198bbd3f86c69, type: 3}
m_Name:
m_EditorClassIdentifier:
document: {fileID: 1237214209}
bindName:
bindNameProvider:
rid: 1308798704739418114
allowRightClick: 0
onClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 599164996}
m_TargetAssemblyTypeName: BITKit.MonoAction, BITKit
m_MethodName: Execute
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
onRightClick:
m_PersistentCalls:
m_Calls: []
clicked:
Targets: []
references:
version: 2
RefIds:
- rid: 1308798704739418114
type: {class: GetNameFromGameobject, ns: BITKit, asm: BITKit}
data:
gameobject: {fileID: 599164994}
--- !u!1001 &599941887
PrefabInstance:
m_ObjectHideFlags: 0
@@ -24689,6 +24856,7 @@ Transform:
- {fileID: 128062587}
- {fileID: 857627674}
- {fileID: 698951664}
- {fileID: 599164995}
- {fileID: 1460596583}
m_Father: {fileID: 475671028}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@@ -2,6 +2,7 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using AYellowpaper.SerializedCollections;
@@ -120,85 +121,7 @@ namespace BITFactory.Cutting
_brushFieldsContainer.Clear();
var fields = arg2.GetType().GetFields(ReflectionHelper.Flags);
foreach (var fieldInfo in fields)
{
if (Attribute.IsDefined(fieldInfo, typeof(ExportAttribute)) is false) continue;
var exportAttribute = fieldInfo.GetCustomAttribute<ExportAttribute>();
// var runtimeFieldInfo = arg2.GetType().GetRuntimeField(fieldInfo.Name);
// runtimeFieldInfo= arg2.GetType().GetField(fieldInfo.Name);
//
// Debug.Log(runtimeFieldInfo);
// var _ref = TypedReference.MakeTypedReference(arg2, new []{runtimeFieldInfo});
var handler = UXDataBindingService.CreateBinding(arg2.GetExport(fieldInfo.Name),fieldInfo.GetValue(arg2));
//var handler = UXDataBindingService.CreateBinding(_ref);
_brushFieldsContainer.Add(handler.visualElement);
handler.visualElement.GetType().GetProperty("label")!.SetValue(handler.visualElement,
string.IsNullOrEmpty(exportAttribute.Name) ? fieldInfo.Name:exportAttribute.Name
);
//var handler = UXDataBindingService.CreateBinding(ref arg2.GetExport(fieldInfo.Name));
// switch (fieldInfo.GetValue(arg2))
// {
// case float _float:
// var floatField = _brushFieldsContainer.Create<FloatField>();
// floatField.label =string.IsNullOrEmpty(exportAttribute.Name) ? fieldInfo.Name:exportAttribute.Name;
// floatField.value = _float;
// floatField.RegisterValueChangedCallback(evt =>
// {
// fieldInfo.SetValue(arg2, evt.newValue);
// });
// break;
// case Vector3 _vector3:
// var vector3Field = _brushFieldsContainer.Create<Vector3Field>();
// vector3Field.label =string.IsNullOrEmpty(exportAttribute.Name) ? fieldInfo.Name:exportAttribute.Name;
// vector3Field.value = _vector3;
// vector3Field.RegisterValueChangedCallback(evt =>
// {
// fieldInfo.SetValue(arg2, evt.newValue);
// });
// break;
// }
}
foreach (var methodInfo in arg2.GetType().GetMethods(ReflectionHelper.Flags))
{
if (Attribute.IsDefined(methodInfo, typeof(ExportAttribute)) is false) continue;
var exportAttribute = methodInfo.GetCustomAttribute<ExportAttribute>();
var button = _brushFieldsContainer.Create<Button>();
button.text =string.IsNullOrEmpty(exportAttribute.Name) ? methodInfo.Name:exportAttribute.Name;
button.clicked += OnClicked;
return;
void OnClicked()
{
try
{
methodInfo.Invoke(arg2, null);
}
catch (TargetInvocationException targetInvocationException)
{
if (targetInvocationException.InnerException is InGameException e is false) return;
switch (e)
{
case {InnerException:not null}:
Alert.Print(e.Message,e.InnerException.Message);
break;
default:
Alert.Print(e.Message,e.Source);
break;
}
}
}
}
_brushFieldsContainer.Add(UXDataBindingService.Create(arg2));
}
}
}

View File

@@ -1,10 +1,13 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BITKit;
using BITKit.StateMachine;
using Newtonsoft.Json;
using PaintIn3D;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
@@ -26,14 +29,9 @@ namespace BITFactory.Cutting
public override string Name => "点切削";
public override string Description => "按住鼠标左键进行画笔切削";
[BITKit.Export("切削半径")]
[Export("切削半径")]
public float Radius = 0;
public override unsafe void* GetExport(string name)
{
return name == nameof(Radius) ? UnsafeUtility.AddressOf(ref Radius) : base.GetExport(name);
}
public override void HandlePoint(bool isPreview, float3 normal, float3 point)
{
if (!isPreview) return;
@@ -84,15 +82,6 @@ namespace BITFactory.Cutting
private float3 _normal=Vector3.up;
private readonly IntervalUpdate _interrupt = new(0.1f);
public override unsafe void* GetExport(string name)
{
return name switch
{
nameof(snapDifference)=>UnsafeUtility.AddressOf(ref snapDifference),
_ => base.GetExport(name)
};
}
public override void OnStateExit(IState old, IState newState)
{
base.OnStateExit(old, newState);
@@ -183,7 +172,21 @@ namespace BITFactory.Cutting
{
[SerializeField] private Transform transform;
public override string Name => "填充切削";
public override string Description => "仅在该程序中使用,用于预览被裁剪的区域";
public override string Description => "仅在该程序中使用,用于预览被裁剪的区域\n事实上现在用于测试运行时序列化字段";
[Export(name:"字符串列表")] private List<string> stringList = new();
[Export(name:"单浮点列表")] private List<float> floatList = new();
[Export(name:"整数列表")] private List<int> intList = new();
[Export(name:"字符串数组")] private string[] stringArray = Array.Empty<string>();
[Export(name:"单浮点数组")] private float[] floatArray = Array.Empty<float>();
[Export(name:"整数数组")] private int[] intArray = Array.Empty<int>();
[Export(name:"float3数组")] private float3 position;
public override void ReleasePoint(float3 normal, float3 point)
{
base.ReleasePoint(normal, point);
stringList.Add(JsonConvert.SerializeObject((Vector3)point));
}
[Export(name:"自动填充")]
private void AutoFill()

View File

@@ -19,16 +19,6 @@ namespace BITFactory.Cutting
[Export("位置")] private Vector3 point;
[Export("半径")] private float radius = 0.01f;
public override unsafe void* GetExport(string name)
{
var x = __makeref(radius);
return name switch
{
nameof(radius) => UnsafeUtility.AddressOf(ref radius),
nameof(point) => UnsafeUtility.AddressOf(ref point),
_ => base.GetExport(name)
};
}
[Export("确认")]
private void Release()

View File

@@ -13,7 +13,8 @@
"GUID:d525ad6bd40672747bde77962f1c401e",
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
"GUID:f51ebe6a0ceec4240a699833d6309b23",
"GUID:15fc0a57446b3144c949da3e2b9737a9"
"GUID:15fc0a57446b3144c949da3e2b9737a9",
"GUID:e0cd26848372d4e5c891c569017e11f1"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -37,22 +37,31 @@
</ui:VisualElement>
<ui:Label tabindex="-1" text="笔刷" parse-escape-sequences="true" display-tooltip-when-elided="true" class="tl" style="display: none;" />
<ui:VisualElement picking-mode="Ignore" style="flex-direction: row;">
<ui:VisualElement name="cuttingBrush-container">
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" class="unity-disabled" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
</ui:VisualElement>
<ui:VisualElement picking-mode="Ignore" style="margin-right: 16px; margin-left: 8px;">
<ui:Label tabindex="-1" text="切削笔刷&#10;用于各种切割" parse-escape-sequences="true" display-tooltip-when-elided="true" name="brush-info-label" />
<ui:Label tabindex="-1" text="笔刷参数" parse-escape-sequences="true" display-tooltip-when-elided="true" class="tl" />
<ui:VisualElement name="brush-fields-container">
<ui:TextField picking-mode="Ignore" label="Text Field" value="filler text" />
<ui:Hash128Field label="Hash128 Field" value="885eea9fcca73bdadde4ecd6a3af1312" />
<ui:ScrollView>
<ui:VisualElement name="cuttingBrush-container">
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" class="unity-disabled" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
<ui:Instance template="CuttingBrush" name="CuttingBrush" />
</ui:VisualElement>
</ui:VisualElement>
</ui:ScrollView>
<ui:ScrollView elasticity="1" style="max-width: 512px; max-height: 384px;">
<ui:VisualElement picking-mode="Ignore" style="margin-right: 16px; margin-left: 8px;">
<ui:Label tabindex="-1" text="切削笔刷&#10;用于各种切割" parse-escape-sequences="true" display-tooltip-when-elided="true" name="brush-info-label" />
<ui:Label tabindex="-1" text="笔刷参数" parse-escape-sequences="true" display-tooltip-when-elided="true" class="tl" />
<ui:VisualElement name="brush-fields-container">
<ui:VisualElement style="flex-direction: row;">
<ui:TextField picking-mode="Ignore" label="Text Field" value="filler text" />
<ui:Button parse-escape-sequences="true" display-tooltip-when-elided="true" class="icon-remove" />
</ui:VisualElement>
<ui:TextField picking-mode="Ignore" label="Text Field" value="filler text" />
<ui:TextField picking-mode="Ignore" label="Text Field" value="filler text" class="error" />
<ui:Hash128Field label="Hash128 Field" value="885eea9fcca73bdadde4ecd6a3af1312" />
</ui:VisualElement>
</ui:VisualElement>
</ui:ScrollView>
</ui:VisualElement>
</ui:VisualElement>
</ui:VisualElement>
@@ -76,6 +85,7 @@
<ui:Button text="创意工坊" parse-escape-sequences="true" display-tooltip-when-elided="true" name="workshop-button" />
<ui:Foldout text="应用设置" class="--button">
<ui:Button text="设置" parse-escape-sequences="true" display-tooltip-when-elided="true" name="options-button" />
<ui:Button text="用户手册" parse-escape-sequences="true" display-tooltip-when-elided="true" name="manual-button" />
<ui:Button text="退出" parse-escape-sequences="true" display-tooltip-when-elided="true" name="exit-button" />
</ui:Foldout>
<ui:VisualElement style="flex-direction: row; align-items: center;">
@@ -104,7 +114,7 @@
</ui:VisualElement>
<ui:VisualElement>
<ui:Label tabindex="-1" text="切削命令历史" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Label" class="tl" />
<ui:ScrollView>
<ui:ScrollView elasticity="1">
<ui:VisualElement name="commands-container">
<ui:Button text="切割:1" parse-escape-sequences="true" display-tooltip-when-elided="true" />
<ui:Button text="切割:1" parse-escape-sequences="true" display-tooltip-when-elided="true" />