补充旧装配岛项目中的修改

This commit is contained in:
2026-06-01 10:36:06 +08:00
parent d3eb238bd6
commit a71f9cfc93
38 changed files with 54057 additions and 206 deletions
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f6d9af83259f2a74bab221b541a1b2ed
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 89918c623ee85524abc8f3b1392af91a
guid: 280743e46bd93cd44bf044c9b1012e4e
folderAsset: yes
DefaultImporter:
externalObjects: {}
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4743ef177c5bfb546b5b9c72efc59b3b
guid: 198450882a29a6641bdefb9f5f04ba6b
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b13df369c6ed3a64a9c4024a6333b4cf
guid: 77cded201c68d71448203ef1be615239
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c508188bc2ab04746ba729aded8434fa
guid: 10fb48704e4629d40a97198ec7047bf2
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
+1 -1
View File
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 44e5a14a3900d124bb47f540a23b0451
guid: 32d95f0d0bed1b241a81d0d1aef9358d
folderAsset: yes
DefaultImporter:
externalObjects: {}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a03a3cfcd64713a4f83bd9966e474ac1
guid: 04f8c720856f3454fbae92e14994b385
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 41f84080474f68743b85cc98577121dc
guid: 7da14d69552d5a64791f8abd5e98dc5b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c67d7ef6c97613b41b9095a945725e91
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7ecd892b1d2f0b24ea4164b078492a36
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5a61f0f8f8df56c42af4507d63579616
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 138831b823d56714db753f3bbfcca789
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5f497a3b416599744ba515971811704f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+7
View File
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fb503c733f83e0f42aa53b2bcf414e44
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d98e03d6c3f900341838908516882fd0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
using UnityEngine.UI;
namespace LRC
@@ -33,13 +31,27 @@ namespace LRC
/// </summary>
public double delta = 1;
public TMP_InputField TargetInput
{
get
{
if (targetInput != null)
{
return targetInput;
}
Debug.LogError("输入目标不存在", this);
return null;
}
set => targetInput = value;
}
public override bool AllowInput
{
get => base.AllowInput;
set
{
if (targetInput != null)
targetInput.readOnly = !value;
if (TargetInput != null)
TargetInput.readOnly = !value;
if (digitalAddButton != null)
digitalAddButton.interactable = value;
if (digitalSubButton != null)
@@ -56,32 +68,32 @@ namespace LRC
{
base.OnValidate();
#if UNITY_EDITOR
if (targetInput != null)
targetInput.text = editorInput.ToString();
if (TargetInput != null)
TargetInput.text = editorInput.ToString(numberFormat);
#endif
}
protected override void Awake()
{
base.Awake();
if (ReferenceEquals(targetInput, null))
if (ReferenceEquals(TargetInput, null))
{
Debug.LogError($"{name}配置项目条目的基本元素不存在");
Debug.LogError($"{name}配置项目条目的基本元素不存在", this);
return;
}
targetInput.onSelect.AddListener(a =>
TargetInput.onSelect.AddListener(a =>
{
WhenStartEdit();
});
targetInput.onValueChanged.AddListener(o =>
TargetInput.onValueChanged.AddListener(o =>
{
double value = 0;
if (double.TryParse(o, out value))
{
SetValue(value);
SetValue(value.ToString(numberFormat));
}
});
targetInput.onEndEdit.AddListener(delegate
TargetInput.onEndEdit.AddListener(delegate
{
WhenEndEdit();
});
@@ -120,10 +132,10 @@ namespace LRC
if (component is TMP_InputField inputField)
{
if (targetInput != null)
targetInput = inputField;
if (TargetInput != null)
TargetInput = inputField;
}
else if(component is Button button)
else if (component is Button button)
{
var name = component.transform.name;
switch (name)
@@ -145,7 +157,7 @@ namespace LRC
protected override void RefreshFormatValue(object newValue)
{
base.RefreshFormatValue(newValue);
targetInput.text = CastDigitalNumber(newValue).ToString(numberFormat);
TargetInput.text = CastDigitalNumber(newValue).ToString(numberFormat);
}
#endregion
@@ -1,11 +1,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
using UnityEngine.UI;
using XericLibrary.Runtime.CustomEditor;
using XericLibrary.Runtime.MacroLibrary;
@@ -342,7 +340,11 @@ namespace LRC
public string TitleName
{
get => titleLabel.text;
set => titleLabel.text = value;
set
{
if (titleLabel != null)
titleLabel.text = value;
}
}
/// <summary>
@@ -614,7 +616,7 @@ namespace LRC
IsDirty = false;
var value = GetSourceValue?.Invoke(this);
if (value == null)
return ;
return;
RefreshValueWithoutEvent(value, forceSet);
RefreshAutoUpdateValue();
}
@@ -1,10 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace LRC
{
@@ -22,6 +17,11 @@ namespace LRC
public TMP_InputField targetInput;
// 定义一个委托,接受字符串参数并返回布尔值
public delegate bool StringEventHandler(string input);
// 声明事件
public static event StringEventHandler 判断是否重名;
public override bool AllowInput
{
get => base.AllowInput;
@@ -53,15 +53,21 @@ namespace LRC
{
WhenStartEdit();
});
targetInput.onValueChanged.AddListener(o =>
targetInput.onEndEdit.AddListener(o =>
{
if(double.TryParse(o, out var value))
SetValue(value);
if (判断是否重名 != null)
{
if (判断是否重名.Invoke(o))
{
SetValue(o);
}
}
});
targetInput.onEndEdit.AddListener(delegate
{
WhenEndEdit();
});
}
#endregion
@@ -78,6 +78,8 @@ namespace LRC
// toggle.isOn = true;
// Debug.Log(TitleName +":ÉèÖò¼¶ûÏîÄ¿");
// }
//toggles[newIndex].isOn = true;
toggles[newIndex].SetIsOnWithoutNotify(true);
}
@@ -1,12 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Deconstruction.Element;
using Deconstruction.Interface;
using Deconstruction.Manager;
using Deconstruction.Tool;
using Deconstruction.Trajectory;
using Deconstruction.Type.DMToolSlot;
using Deconstruction.Type.Linkable;
using UnityEngine;
@@ -14,8 +6,6 @@ using XericLibrary.Runtime.MacroLibrary;
namespace SesothoLine
{
using LineSegment2 = Deconstruction.Element.PromptLine2.LineSegment2;
/// <summary>
/// 绘制轨迹线的操作
/// <code>
@@ -83,6 +73,7 @@ namespace SesothoLine
// public SesothoArrangementWiresTool myWiresTool;
// myWiresTool = targetTool as SesothoArrangementWiresTool;
public static bool 判断是否在绘制区域内;
#endregion
#region 引用封装
@@ -179,7 +170,13 @@ namespace SesothoLine
ReplaceThis(new DrawTerminalLine2T3_OpSlot());
}
// 取消
else if (IsReleaseCanelKey())
else if (IsReleaseCanelKey() || (!判断是否在绘制区域内))
{
RemoveThis();
EndPrecondition();
}
// 判断按下ESC取消线段绘制 2024.8.8
else if (Input.GetKeyDown(KeyCode.Escape))
{
RemoveThis();
EndPrecondition();
@@ -192,6 +189,8 @@ namespace SesothoLine
*/
}
protected override void AsyncBeforeUpdate()
{
base.AsyncBeforeUpdate();
@@ -272,15 +271,17 @@ namespace SesothoLine
selfWiresTool.DeleteElement(_endPoint);
}
/// <summary>
/// 线路绘制过程
/// </summary>
private void DrawingProcess()
{
var forceStr = SesothoArrangementWiresTool.OpKey_ForceStr.Getkey();
var forceStraightLine = SesothoArrangementWiresTool.OpKey_ForceStraightLine.Getkey();
var force90Arc = SesothoArrangementWiresTool.OpKey_90Arc.Getkey();
// 获取当前的坐标
_helperPosition = PlaceElementManager.Inst.InputHelper.CurrentGridPosition;
_startPoint.transform.position = _lastPointPosition;
_isFreeEndPoint = true;
@@ -315,6 +316,36 @@ namespace SesothoLine
_endPoint.transform.position = _helperPosition;
}
if (forceStr)
{
Vector3 startPos = _startPoint.GetPosition3();
Vector3 endPoint = _endPoint.GetPosition3();
if ((int)startPos.x != (int)endPoint.x && (int)startPos.z != (int)endPoint.z)
{
Vector3 vector3 = endPoint - startPos;
if (Mathf.Abs(vector3.x) > Mathf.Abs(vector3.z))
{
Vector3 vector = new Vector3(endPoint.x, endPoint.y, startPos.z);
_endPoint.SetPosition3(vector);
}
else if (Mathf.Abs(vector3.x) < Mathf.Abs(vector3.z))
{
Vector3 vector = new Vector3(startPos.x, endPoint.y, endPoint.z);
_endPoint.SetPosition3(vector);
}
_helperPosition = _endPoint.GetPosition3();
_line.SetLineSegment(
_lastPointPosition, _helperPosition,
_lastPointNormal, _helperNormal
);
}
}
else if (force90Arc)
{
_helperPosition = _line.GetEndPointWorldPosition();
}
_line.SetLineSegment(
_lastPointPosition, _helperPosition,
_lastPointNormal, _helperNormal
@@ -326,22 +357,24 @@ namespace SesothoLine
// Debug.Log($"角度{arc.Angle} {arc.AngleExact}");
// }
var forceStr = SesothoArrangementWiresTool.OpKey_ForceStr.Getkey();
if (forceStr)
if (forceStr || forceStraightLine)
{
_line.DrawStraightLine();
}
else
{
var force90Arc = SesothoArrangementWiresTool.OpKey_90Arc.Getkey();
var force180Arc = SesothoArrangementWiresTool.OpKey_180Arc.Getkey();
var forceRevCisoid = SesothoArrangementWiresTool.OpKey_RevCisoid.Getkey();
var angle = -1;
if (force90Arc || force180Arc)
{
angle = 0;
if (force90Arc)
{
angle += 90;
}
if (force180Arc)
angle += 180;
}
@@ -1,8 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using Deconstruction.Element;
using Deconstruction.Interface;
using Deconstruction.Manager;
@@ -13,7 +10,6 @@ using Deconstruction.Type.Linkable;
using SerializerHelper.Type;
using UnityEngine;
using UnityEngine.Pool;
using XericLibrary.Runtime.MacroLibrary;
using XericLibrary.Runtime.Nav;
namespace SesothoLine
@@ -62,10 +58,18 @@ namespace SesothoLine
* shift+n 忽略网格吸附
*/
/// <summary>
/// 强制X轴或Y轴
/// </summary>
public static KeyPack OpKey_PlotTheXAndYAxes = new KeyPack();
/// <summary>
/// 强制X轴或Y轴直线
/// </summary>
public static KeyPack OpKey_ForceStr = new KeyPack(KeyCode.LeftControl);
/// <summary>
/// 强制直线
/// </summary>
public static KeyPack OpKey_ForceStr = new KeyPack(KeyCode.Alpha1);
public static KeyPack OpKey_ForceStraightLine = new KeyPack(KeyCode.LeftShift, KeyCode.Q);
/// <summary>
/// 强制90度圆弧
/// </summary>
@@ -82,7 +86,7 @@ namespace SesothoLine
/// <summary>
/// 忽略吸附功能
/// </summary>
public static KeyPack OpKey_IgnoreNeighborAdsorption = new KeyPack(KeyCode.LeftShift, KeyCode.B);
public static KeyPack OpKey_IgnoreNeighborAdsorption = new KeyPack(KeyCode.Alpha1);
/// <summary>
/// 忽略网格吸附
/// </summary>
@@ -94,6 +98,8 @@ namespace SesothoLine
private ObjectPool<TerminalLine2T3> _linePool;
private ObjectPool<TerminalPoint> _pointPool;
public ObjectPool<TerminalLine2T3> LinePool => _linePool;
public ObjectPool<TerminalPoint> PointPool => _pointPool;
#endregion
@@ -153,7 +159,7 @@ namespace SesothoLine
return true;
}
End:
End:
line = null;
normal = default;
return false;
@@ -236,7 +242,7 @@ namespace SesothoLine
var deserializeList = new List<(PlacementBase, SerializeUnion)>();
var safeCount = ushort.MaxValue;
Debug.Log("反序列化过程开始创建对象");
while (0 <-- safeCount && SerializeTemp.IndexMoveToNext(out var block))
while (0 < --safeCount && SerializeTemp.IndexMoveToNext(out var block))
{
var union = SerializeTemp.GetDeserializeObject<SerializeUnion>();
var type = TypeConsignMap.GetMapType(union.Index);
+23 -19
View File
@@ -12,10 +12,12 @@ using Deconstruction.Manager;
using Deconstruction.Tool;
using Deconstruction.Type.Area;
using Deconstruction.Type.Serialize;
using Newtonsoft.Json;
using SerializerHelper.Type;
using UnityEngine.UI;
using XericLibrary.Runtime.Debuger;
using XericLibrary.Runtime.MacroLibrary;
using Deconstruction.Type.DMToolSlot;
namespace SesothoLine
{
@@ -29,9 +31,6 @@ namespace SesothoLine
{
#region 静态成员
/// <summary>
/// 此处提供的单例与父类单例是独立的
/// </summary>
public new static SesothoPeManager Inst => _inst;
private static SesothoPeManager _inst;
@@ -59,7 +58,6 @@ namespace SesothoLine
public static PlacementBase NearestObject => TrackingTool.TrackingCurrentTarget;
private static TrajectoryTrackingTool.TrackPersistentCommunicate _lineTangentTraceTool;
#endregion
#region 调试功能
@@ -72,9 +70,7 @@ namespace SesothoLine
public void DebugFunc()
{
if (EnableGridDebugDraw)
{
PlacementNeighbor.DebugDrawGrid();
}
}
#endif
@@ -101,8 +97,6 @@ namespace SesothoLine
// 手动开启代理更新
EnableUpdate = true;
}
protected override void Start()
@@ -127,7 +121,6 @@ namespace SesothoLine
// new SerializeUnion();
}
private string serializeContext = null;
protected override void LateUpdate()
{
base.LateUpdate();
@@ -136,18 +129,27 @@ namespace SesothoLine
#if !UNITY_EDITOR || !_DEBUG_
return;
#endif
// 取消路线绘制 2024.8.8
/*if (Input.GetKeyDown(KeyCode.Escape))
{
_wiresTool.EnableTool = false;
//DrawTerminalLine2T3_OpSlot.RemoveThis();
//DrawTerminalLine2T3_OpSlot.EndPrecondition();
}*/
// 工具功能测试
if (Input.GetKeyDown(KeyCode.L))
/*if (Input.GetKeyDown(KeyCode.L))
{
_wiresTool.EnableTool = !_wiresTool.EnableTool;
Debug.Log($"{(_wiresTool.EnableTool ? "绘制工具已激活" : "工具已取消激活")}");
}
}*/
// 存档功能测试
if (Input.GetKeyDown(KeyCode.S))
/*if (Input.GetKeyDown(KeyCode.S))
{
var obj = _wiresTool.ToolSerializeDispost();
serializeContext = MacroFile.JsonSerializerFormatter.formatter.Serializer(obj);
serializeContext = JsonConvert.SerializeObject(obj);
Debug.Log(obj.ToString());
}
if (Input.GetKeyDown(KeyCode.D))
@@ -158,29 +160,31 @@ namespace SesothoLine
return;
}
var obj = MacroFile.JsonSerializerFormatter.formatter.Deserializer<SerializeUnion>(serializeContext);
var obj = JsonConvert.DeserializeObject<SerializeUnion>(serializeContext);
_wiresTool.ToolDiserializDispost(obj);
}
if (Input.GetKeyDown(KeyCode.A))
{
_wiresTool.EnableCompress = !_wiresTool.EnableCompress;
if (_wiresTool.EnableCompress )
if (_wiresTool.EnableCompress)
Debug.Log("开启压缩");
else
Debug.Log("关闭压缩");
}
}*/
// 绘制一下吸附的目标位置
if (TrackingTool.EnableTool || TrackingTool._enableAuxiliaryTool)
{
MacroDebugDraw.DrawDownArrow(NearestPoint, Quaternion.identity, Color.magenta);
MacroDebugDraw.DrawDownArrow(NearestLineTangentPoint, Quaternion.identity, Color.green);
MacroDebugDraw.SetColor(Color.magenta);
MacroDebugDraw.DrawDownArrow(NearestPoint);
MacroDebugDraw.SetColor(Color.green);
MacroDebugDraw.DrawDownArrow(NearestLineTangentPoint);
MacroDebugDraw.ResetColor();
}
}
#endregion
}
}
+12 -16
View File
@@ -1,21 +1,14 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using Deconstruction.Element;
using Deconstruction.Interface;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
using XericLibrary.Runtime.Debuger;
using XericLibrary.Runtime.MacroLibrary;
using XericLibrary.Runtime.Type;
namespace SesothoLine
{
@@ -39,6 +32,8 @@ namespace SesothoLine
public bool DebugDrawGrid = false;
public Vector3 ah, bh;
#endregion
#region 生命周期
@@ -61,10 +56,7 @@ namespace SesothoLine
SesothoPeManager.Inst.RemoveEmbedded(this);
}
protected virtual void OnDestroy()
{
}
protected override void AgencyOnEnable()
{
@@ -86,9 +78,10 @@ namespace SesothoLine
{
foreach (var index in indexs.Indexs)
{
MacroDebugDraw.SetColor(Color.red);
MacroDebugDraw.DrawDownArrow(
index.GetCellWorldIndexPosition() + MacroMath.RandomVector3(0.1f, Identifier), Quaternion.identity,
Color.red);
index.GetCellWorldIndexPosition() + MacroMath.RandomVector3(0.1f, Identifier));
MacroDebugDraw.ResetColor();
}
}
@@ -128,8 +121,12 @@ namespace SesothoLine
b.UpwardPlaneToVector2(),
ah.UpwardPlaneToVector2(),
bh.UpwardPlaneToVector2());
// ah?.GetEndPointNormal ?? default,
// bh?.GetStartPointNormal ?? default);
// ah?.GetEndPointNormal ?? default,
// bh?.GetStartPointNormal ?? default);
this.ah = ah;
this.bh = bh;
return _lineSegment;
}
@@ -145,7 +142,6 @@ namespace SesothoLine
AutomaticDrawCircularLine(straightLine);
}
/// <summary>
/// 重新计算原点
/// <code>