补充旧装配岛项目中的修改
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f6d9af83259f2a74bab221b541a1b2ed
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 89918c623ee85524abc8f3b1392af91a
|
guid: 280743e46bd93cd44bf044c9b1012e4e
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 4743ef177c5bfb546b5b9c72efc59b3b
|
guid: 198450882a29a6641bdefb9f5f04ba6b
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: b13df369c6ed3a64a9c4024a6333b4cf
|
guid: 77cded201c68d71448203ef1be615239
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
mainObjectFileID: 2100000
|
mainObjectFileID: 2100000
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c508188bc2ab04746ba729aded8434fa
|
guid: 10fb48704e4629d40a97198ec7047bf2
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 44e5a14a3900d124bb47f540a23b0451
|
guid: 32d95f0d0bed1b241a81d0d1aef9358d
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a03a3cfcd64713a4f83bd9966e474ac1
|
guid: 04f8c720856f3454fbae92e14994b385
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
mainObjectFileID: 2100000
|
mainObjectFileID: 2100000
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 41f84080474f68743b85cc98577121dc
|
guid: 7da14d69552d5a64791f8abd5e98dc5b
|
||||||
ScriptedImporter:
|
ScriptedImporter:
|
||||||
internalIDToNameTable: []
|
internalIDToNameTable: []
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c67d7ef6c97613b41b9095a945725e91
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7ecd892b1d2f0b24ea4164b078492a36
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5a61f0f8f8df56c42af4507d63579616
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 138831b823d56714db753f3bbfcca789
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5f497a3b416599744ba515971811704f
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -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:
|
||||||
+38
-26
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace LRC
|
namespace LRC
|
||||||
@@ -14,7 +12,7 @@ namespace LRC
|
|||||||
public class ConfigDigitalInputField : ConfigSelectableItem
|
public class ConfigDigitalInputField : ConfigSelectableItem
|
||||||
{
|
{
|
||||||
#region 属性字段
|
#region 属性字段
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
public float editorInput;
|
public float editorInput;
|
||||||
#endif
|
#endif
|
||||||
@@ -32,14 +30,28 @@ namespace LRC
|
|||||||
/// 增量
|
/// 增量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double delta = 1;
|
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
|
public override bool AllowInput
|
||||||
{
|
{
|
||||||
get => base.AllowInput;
|
get => base.AllowInput;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (targetInput != null)
|
if (TargetInput != null)
|
||||||
targetInput.readOnly = !value;
|
TargetInput.readOnly = !value;
|
||||||
if (digitalAddButton != null)
|
if (digitalAddButton != null)
|
||||||
digitalAddButton.interactable = value;
|
digitalAddButton.interactable = value;
|
||||||
if (digitalSubButton != null)
|
if (digitalSubButton != null)
|
||||||
@@ -47,7 +59,7 @@ namespace LRC
|
|||||||
base.AllowInput = value;
|
base.AllowInput = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 生命周期
|
#region 生命周期
|
||||||
@@ -56,35 +68,35 @@ namespace LRC
|
|||||||
{
|
{
|
||||||
base.OnValidate();
|
base.OnValidate();
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
if (targetInput != null)
|
if (TargetInput != null)
|
||||||
targetInput.text = editorInput.ToString();
|
TargetInput.text = editorInput.ToString(numberFormat);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
base.Awake();
|
base.Awake();
|
||||||
if (ReferenceEquals(targetInput, null))
|
if (ReferenceEquals(TargetInput, null))
|
||||||
{
|
{
|
||||||
Debug.LogError($"{name}配置项目条目的基本元素不存在");
|
Debug.LogError($"{name}配置项目条目的基本元素不存在", this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
targetInput.onSelect.AddListener(a =>
|
TargetInput.onSelect.AddListener(a =>
|
||||||
{
|
{
|
||||||
WhenStartEdit();
|
WhenStartEdit();
|
||||||
});
|
});
|
||||||
targetInput.onValueChanged.AddListener(o =>
|
TargetInput.onValueChanged.AddListener(o =>
|
||||||
{
|
{
|
||||||
double value = 0;
|
double value = 0;
|
||||||
if (double.TryParse(o, out value))
|
if (double.TryParse(o, out value))
|
||||||
{
|
{
|
||||||
SetValue(value);
|
SetValue(value.ToString(numberFormat));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
targetInput.onEndEdit.AddListener(delegate
|
TargetInput.onEndEdit.AddListener(delegate
|
||||||
{
|
{
|
||||||
WhenEndEdit();
|
WhenEndEdit();
|
||||||
});
|
});
|
||||||
if (!ReferenceEquals(digitalAddButton, null))
|
if (!ReferenceEquals(digitalAddButton, null))
|
||||||
digitalAddButton.onClick.AddListener(delegate
|
digitalAddButton.onClick.AddListener(delegate
|
||||||
{
|
{
|
||||||
@@ -100,7 +112,7 @@ namespace LRC
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 实现
|
#region 实现
|
||||||
|
|
||||||
protected override void SetValue(object newValue)
|
protected override void SetValue(object newValue)
|
||||||
@@ -112,18 +124,18 @@ namespace LRC
|
|||||||
{
|
{
|
||||||
base.RefreshValueWithoutEvent(CastDigitalNumber(newValue, minValue, maxValue, digits), forceSet);
|
base.RefreshValueWithoutEvent(CastDigitalNumber(newValue, minValue, maxValue, digits), forceSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialization_ChildConstruction(UIBehaviour component)
|
protected override void Initialization_ChildConstruction(UIBehaviour component)
|
||||||
{
|
{
|
||||||
base.Initialization_ChildConstruction(component);
|
base.Initialization_ChildConstruction(component);
|
||||||
|
|
||||||
|
|
||||||
if (component is TMP_InputField inputField)
|
if (component is TMP_InputField inputField)
|
||||||
{
|
{
|
||||||
if (targetInput != null)
|
if (TargetInput != null)
|
||||||
targetInput = inputField;
|
TargetInput = inputField;
|
||||||
}
|
}
|
||||||
else if(component is Button button)
|
else if (component is Button button)
|
||||||
{
|
{
|
||||||
var name = component.transform.name;
|
var name = component.transform.name;
|
||||||
switch (name)
|
switch (name)
|
||||||
@@ -145,9 +157,9 @@ namespace LRC
|
|||||||
protected override void RefreshFormatValue(object newValue)
|
protected override void RefreshFormatValue(object newValue)
|
||||||
{
|
{
|
||||||
base.RefreshFormatValue(newValue);
|
base.RefreshFormatValue(newValue);
|
||||||
targetInput.text = CastDigitalNumber(newValue).ToString(numberFormat);
|
TargetInput.text = CastDigitalNumber(newValue).ToString(numberFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+42
-40
@@ -1,11 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.Serialization;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using XericLibrary.Runtime.CustomEditor;
|
using XericLibrary.Runtime.CustomEditor;
|
||||||
using XericLibrary.Runtime.MacroLibrary;
|
using XericLibrary.Runtime.MacroLibrary;
|
||||||
@@ -51,10 +49,10 @@ namespace LRC
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当数值收到修改时,产生事件,其中值的含义是修改前的值
|
/// 当数值收到修改时,产生事件,其中值的含义是修改前的值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static event Action<ConfigSelectableItem, object> OnAnyValueChange;
|
public static event Action<ConfigSelectableItem, object> OnAnyValueChange;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 静态成员
|
#region 静态成员
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -66,7 +64,7 @@ namespace LRC
|
|||||||
/// 项目列表有效成员的数量
|
/// 项目列表有效成员的数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int ConfigItemListCount => ConfigItemList.Count;
|
public static int ConfigItemListCount => ConfigItemList.Count;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取
|
/// 获取
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -74,7 +72,7 @@ namespace LRC
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ConfigSelectableItem GetConfigItemByIndex(int index) => ConfigItemList[index];
|
public static ConfigSelectableItem GetConfigItemByIndex(int index) => ConfigItemList[index];
|
||||||
public static IEnumerable<ConfigSelectableItem> ConfigItemLists => ConfigItemList;
|
public static IEnumerable<ConfigSelectableItem> ConfigItemLists => ConfigItemList;
|
||||||
|
|
||||||
private static bool autoUpdateValueAll;
|
private static bool autoUpdateValueAll;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自动更新所有数值
|
/// 自动更新所有数值
|
||||||
@@ -89,9 +87,9 @@ namespace LRC
|
|||||||
autoUpdateValueAll = value;
|
autoUpdateValueAll = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 状态
|
#region 状态
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -147,7 +145,7 @@ namespace LRC
|
|||||||
/// </code>
|
/// </code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Func<ConfigSelectableItem, bool> GetSourceValueAutoUpdate;
|
public event Func<ConfigSelectableItem, bool> GetSourceValueAutoUpdate;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当前属性的自动更新请求设置
|
/// 当前属性的自动更新请求设置
|
||||||
/// <code>
|
/// <code>
|
||||||
@@ -157,9 +155,9 @@ namespace LRC
|
|||||||
/// </code>
|
/// </code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<bool> SetSourceValueAutoUpdate;
|
public event Action<bool> SetSourceValueAutoUpdate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 请求此属性设置值(将值应用到寄存中)
|
/// 请求此属性设置值(将值应用到寄存中)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -167,9 +165,9 @@ namespace LRC
|
|||||||
{
|
{
|
||||||
SetSourceValue?.Invoke(this, Value);
|
SetSourceValue?.Invoke(this, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 属性字段
|
#region 属性字段
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -177,7 +175,7 @@ namespace LRC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Rename("映射标记")]
|
[Rename("映射标记")]
|
||||||
public string configTag;
|
public string configTag;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设定是否有效。
|
/// 设定是否有效。
|
||||||
/// 如果无效,则不允许输入
|
/// 如果无效,则不允许输入
|
||||||
@@ -199,14 +197,14 @@ namespace LRC
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
[Rename("允许阻塞自动更新")]
|
[Rename("允许阻塞自动更新")]
|
||||||
private bool allowBlockUpdate = true;
|
private bool allowBlockUpdate = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 阻塞自动更新,一般由程序自动根据焦点更新
|
/// 阻塞自动更新,一般由程序自动根据焦点更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
[Rename("阻塞自动更新")]
|
[Rename("阻塞自动更新")]
|
||||||
private bool forceBlockUpdate = false;
|
private bool forceBlockUpdate = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 格式化文本
|
/// 格式化文本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -253,7 +251,7 @@ namespace LRC
|
|||||||
|
|
||||||
[Rename("反转自动更新状态")]
|
[Rename("反转自动更新状态")]
|
||||||
public bool autoUpdateValueReversalState;
|
public bool autoUpdateValueReversalState;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 脏属性自动复位。
|
/// 脏属性自动复位。
|
||||||
/// 当属性被重新开关时,将取消脏状态
|
/// 当属性被重新开关时,将取消脏状态
|
||||||
@@ -262,7 +260,7 @@ namespace LRC
|
|||||||
public bool dirtyAutoReset = false;
|
public bool dirtyAutoReset = false;
|
||||||
|
|
||||||
// ==== 属性 ==== //
|
// ==== 属性 ==== //
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设定是否输入有效
|
/// 设定是否输入有效
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -295,13 +293,13 @@ namespace LRC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
|
|
||||||
_isDirty = true;
|
_isDirty = true;
|
||||||
OnAnyValueDirty?.Invoke(this);
|
OnAnyValueDirty?.Invoke(this);
|
||||||
OnValueDirty?.Invoke(this);
|
OnValueDirty?.Invoke(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设定自动更新状态,并同步选框
|
/// 设定自动更新状态,并同步选框
|
||||||
/// <code>
|
/// <code>
|
||||||
@@ -333,16 +331,20 @@ namespace LRC
|
|||||||
public bool ForceBlockUpdate
|
public bool ForceBlockUpdate
|
||||||
{
|
{
|
||||||
get => forceBlockUpdate;
|
get => forceBlockUpdate;
|
||||||
set => forceBlockUpdate = value;
|
set => forceBlockUpdate = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 项目标题
|
/// 项目标题
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TitleName
|
public string TitleName
|
||||||
{
|
{
|
||||||
get => titleLabel.text;
|
get => titleLabel.text;
|
||||||
set => titleLabel.text = value;
|
set
|
||||||
|
{
|
||||||
|
if (titleLabel != null)
|
||||||
|
titleLabel.text = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -375,7 +377,7 @@ namespace LRC
|
|||||||
get => unitLabel.text;
|
get => unitLabel.text;
|
||||||
set => unitLabel.text = value;
|
set => unitLabel.text = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
// [Obsolete("请使用访问器")]
|
// [Obsolete("请使用访问器")]
|
||||||
private object _value;
|
private object _value;
|
||||||
@@ -385,7 +387,7 @@ namespace LRC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public object Value
|
public object Value
|
||||||
{
|
{
|
||||||
get => _value;
|
get => _value;
|
||||||
protected set
|
protected set
|
||||||
{
|
{
|
||||||
if (IsValueInitNull && value != null)
|
if (IsValueInitNull && value != null)
|
||||||
@@ -395,11 +397,11 @@ namespace LRC
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ==== 暂存 ==== //
|
// ==== 暂存 ==== //
|
||||||
|
|
||||||
public FieldInfo FieldInfo;
|
public FieldInfo FieldInfo;
|
||||||
|
|
||||||
public Type FieldType;
|
public Type FieldType;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 生命周期
|
#region 生命周期
|
||||||
@@ -431,7 +433,7 @@ namespace LRC
|
|||||||
ConfigItemList.Add(this);
|
ConfigItemList.Add(this);
|
||||||
ForceUpdateAllConfigEvent += ForceUpdate;
|
ForceUpdateAllConfigEvent += ForceUpdate;
|
||||||
ForceSetAllSourceValueEvent += SetSourceValueRequest;
|
ForceSetAllSourceValueEvent += SetSourceValueRequest;
|
||||||
|
|
||||||
if (dirtyAutoReset)
|
if (dirtyAutoReset)
|
||||||
IsDirty = false;
|
IsDirty = false;
|
||||||
}
|
}
|
||||||
@@ -535,9 +537,9 @@ namespace LRC
|
|||||||
_ => Vector3.zero
|
_ => Vector3.zero
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 初始化方法
|
#region 初始化方法
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -600,7 +602,7 @@ namespace LRC
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 更新方法
|
#region 更新方法
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新函数
|
/// 更新函数
|
||||||
/// <code>
|
/// <code>
|
||||||
@@ -614,7 +616,7 @@ namespace LRC
|
|||||||
IsDirty = false;
|
IsDirty = false;
|
||||||
var value = GetSourceValue?.Invoke(this);
|
var value = GetSourceValue?.Invoke(this);
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return ;
|
return;
|
||||||
RefreshValueWithoutEvent(value, forceSet);
|
RefreshValueWithoutEvent(value, forceSet);
|
||||||
RefreshAutoUpdateValue();
|
RefreshAutoUpdateValue();
|
||||||
}
|
}
|
||||||
@@ -665,15 +667,15 @@ namespace LRC
|
|||||||
{
|
{
|
||||||
var isSourceValueAutoUpdate = GetSourceValueAutoUpdate?.Invoke(this);
|
var isSourceValueAutoUpdate = GetSourceValueAutoUpdate?.Invoke(this);
|
||||||
if (isSourceValueAutoUpdate != null)
|
if (isSourceValueAutoUpdate != null)
|
||||||
AutoUpdateValue = isSourceValueAutoUpdate.Value;
|
AutoUpdateValue = isSourceValueAutoUpdate.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 刷新格式化文本,在触发刷新时将产生更新
|
/// 刷新格式化文本,在触发刷新时将产生更新
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void RefreshFormatValue(object newValue)
|
protected virtual void RefreshFormatValue(object newValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void WhenStartEdit()
|
protected void WhenStartEdit()
|
||||||
@@ -681,7 +683,7 @@ namespace LRC
|
|||||||
// Debug.Log("开始编辑");
|
// Debug.Log("开始编辑");
|
||||||
ForceBlockUpdate = true;
|
ForceBlockUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数值输入完毕,或焦点移除时调用。
|
/// 数值输入完毕,或焦点移除时调用。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -691,7 +693,7 @@ namespace LRC
|
|||||||
ForceBlockUpdate = false;
|
ForceBlockUpdate = false;
|
||||||
OnEndEdit?.Invoke(this, Value);
|
OnEndEdit?.Invoke(this, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 外观设定
|
#region 外观设定
|
||||||
@@ -705,7 +707,7 @@ namespace LRC
|
|||||||
Destroy(autoUpdateValueToggle.gameObject);
|
Destroy(autoUpdateValueToggle.gameObject);
|
||||||
this.autoUpdateValue = autoUpdateValueReversalState ^ autoUpdateValue;
|
this.autoUpdateValue = autoUpdateValueReversalState ^ autoUpdateValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
+21
-15
@@ -1,10 +1,5 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
namespace LRC
|
namespace LRC
|
||||||
{
|
{
|
||||||
@@ -14,14 +9,19 @@ namespace LRC
|
|||||||
public class ConfigTextInputField : ConfigSelectableItem
|
public class ConfigTextInputField : ConfigSelectableItem
|
||||||
{
|
{
|
||||||
#region ÊôÐÔ×Ö¶Î
|
#region ÊôÐÔ×Ö¶Î
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
public string editorInput;
|
public string editorInput;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public TMP_InputField targetInput;
|
public TMP_InputField targetInput;
|
||||||
|
|
||||||
|
|
||||||
|
// 定义一个委托,接受字符串参数并返回布尔值
|
||||||
|
public delegate bool StringEventHandler(string input);
|
||||||
|
// 声明事件
|
||||||
|
public static event StringEventHandler 判断是否重名;
|
||||||
|
|
||||||
public override bool AllowInput
|
public override bool AllowInput
|
||||||
{
|
{
|
||||||
get => base.AllowInput;
|
get => base.AllowInput;
|
||||||
@@ -53,19 +53,25 @@ namespace LRC
|
|||||||
{
|
{
|
||||||
WhenStartEdit();
|
WhenStartEdit();
|
||||||
});
|
});
|
||||||
targetInput.onValueChanged.AddListener(o =>
|
targetInput.onEndEdit.AddListener(o =>
|
||||||
{
|
{
|
||||||
if(double.TryParse(o, out var value))
|
if (判断是否重名 != null)
|
||||||
SetValue(value);
|
{
|
||||||
|
if (判断是否重名.Invoke(o))
|
||||||
|
{
|
||||||
|
SetValue(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
targetInput.onEndEdit.AddListener(delegate
|
targetInput.onEndEdit.AddListener(delegate
|
||||||
{
|
{
|
||||||
WhenEndEdit();
|
WhenEndEdit();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ʵÏÖ
|
#region ʵÏÖ
|
||||||
|
|
||||||
protected override void SetValue(object newValue)
|
protected override void SetValue(object newValue)
|
||||||
@@ -77,11 +83,11 @@ namespace LRC
|
|||||||
{
|
{
|
||||||
base.RefreshValueWithoutEvent(newValue, forceSet);
|
base.RefreshValueWithoutEvent(newValue, forceSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialization_ChildConstruction(UIBehaviour component)
|
protected override void Initialization_ChildConstruction(UIBehaviour component)
|
||||||
{
|
{
|
||||||
base.Initialization_ChildConstruction(component);
|
base.Initialization_ChildConstruction(component);
|
||||||
|
|
||||||
if (component is TMP_InputField inputField)
|
if (component is TMP_InputField inputField)
|
||||||
{
|
{
|
||||||
if (targetInput != null)
|
if (targetInput != null)
|
||||||
@@ -94,7 +100,7 @@ namespace LRC
|
|||||||
base.RefreshFormatValue(newValue);
|
base.RefreshFormatValue(newValue);
|
||||||
targetInput.text = newValue.ToString();
|
targetInput.text = newValue.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
@@ -78,6 +78,8 @@ namespace LRC
|
|||||||
// toggle.isOn = true;
|
// toggle.isOn = true;
|
||||||
// Debug.Log(TitleName +":ÉèÖò¼¶ûÏîÄ¿");
|
// Debug.Log(TitleName +":ÉèÖò¼¶ûÏîÄ¿");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
//toggles[newIndex].isOn = true;
|
||||||
toggles[newIndex].SetIsOnWithoutNotify(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.Manager;
|
||||||
using Deconstruction.Tool;
|
|
||||||
using Deconstruction.Trajectory;
|
|
||||||
using Deconstruction.Type.DMToolSlot;
|
using Deconstruction.Type.DMToolSlot;
|
||||||
using Deconstruction.Type.Linkable;
|
using Deconstruction.Type.Linkable;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -14,8 +6,6 @@ using XericLibrary.Runtime.MacroLibrary;
|
|||||||
|
|
||||||
namespace SesothoLine
|
namespace SesothoLine
|
||||||
{
|
{
|
||||||
using LineSegment2 = Deconstruction.Element.PromptLine2.LineSegment2;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 绘制轨迹线的操作
|
/// 绘制轨迹线的操作
|
||||||
/// <code>
|
/// <code>
|
||||||
@@ -83,6 +73,7 @@ namespace SesothoLine
|
|||||||
// public SesothoArrangementWiresTool myWiresTool;
|
// public SesothoArrangementWiresTool myWiresTool;
|
||||||
// myWiresTool = targetTool as SesothoArrangementWiresTool;
|
// myWiresTool = targetTool as SesothoArrangementWiresTool;
|
||||||
|
|
||||||
|
public static bool 判断是否在绘制区域内;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 引用封装
|
#region 引用封装
|
||||||
@@ -179,7 +170,13 @@ namespace SesothoLine
|
|||||||
ReplaceThis(new DrawTerminalLine2T3_OpSlot());
|
ReplaceThis(new DrawTerminalLine2T3_OpSlot());
|
||||||
}
|
}
|
||||||
// 取消
|
// 取消
|
||||||
else if (IsReleaseCanelKey())
|
else if (IsReleaseCanelKey() || (!判断是否在绘制区域内))
|
||||||
|
{
|
||||||
|
RemoveThis();
|
||||||
|
EndPrecondition();
|
||||||
|
}
|
||||||
|
// 判断按下ESC取消线段绘制 2024.8.8
|
||||||
|
else if (Input.GetKeyDown(KeyCode.Escape))
|
||||||
{
|
{
|
||||||
RemoveThis();
|
RemoveThis();
|
||||||
EndPrecondition();
|
EndPrecondition();
|
||||||
@@ -192,6 +189,8 @@ namespace SesothoLine
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override void AsyncBeforeUpdate()
|
protected override void AsyncBeforeUpdate()
|
||||||
{
|
{
|
||||||
base.AsyncBeforeUpdate();
|
base.AsyncBeforeUpdate();
|
||||||
@@ -245,8 +244,8 @@ namespace SesothoLine
|
|||||||
{
|
{
|
||||||
_isStartPointSubstitute = false;
|
_isStartPointSubstitute = false;
|
||||||
selfWiresTool.GetElement(out _startPoint);
|
selfWiresTool.GetElement(out _startPoint);
|
||||||
_lastPointPosition = SesothoArrangementWiresTool.OpKey_IgnoreNeighborAdsorption.Getkey() ?
|
_lastPointPosition = SesothoArrangementWiresTool.OpKey_IgnoreNeighborAdsorption.Getkey() ?
|
||||||
wfui_Slot.MouseHelperPosition :
|
wfui_Slot.MouseHelperPosition :
|
||||||
CameraMouseInputHelper.Inst.GetGridAdsorb(wfui_Slot.MouseHelperPosition);
|
CameraMouseInputHelper.Inst.GetGridAdsorb(wfui_Slot.MouseHelperPosition);
|
||||||
_lastPointNormal = default;
|
_lastPointNormal = default;
|
||||||
}
|
}
|
||||||
@@ -272,15 +271,17 @@ namespace SesothoLine
|
|||||||
selfWiresTool.DeleteElement(_endPoint);
|
selfWiresTool.DeleteElement(_endPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 线路绘制过程
|
/// 线路绘制过程
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void DrawingProcess()
|
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;
|
_helperPosition = PlaceElementManager.Inst.InputHelper.CurrentGridPosition;
|
||||||
|
|
||||||
_startPoint.transform.position = _lastPointPosition;
|
_startPoint.transform.position = _lastPointPosition;
|
||||||
|
|
||||||
_isFreeEndPoint = true;
|
_isFreeEndPoint = true;
|
||||||
@@ -292,7 +293,7 @@ namespace SesothoLine
|
|||||||
_isFreeEndPoint = false;
|
_isFreeEndPoint = false;
|
||||||
if (_endPoint.gameObject.activeSelf)
|
if (_endPoint.gameObject.activeSelf)
|
||||||
_endPoint.gameObject.SetActive(false);
|
_endPoint.gameObject.SetActive(false);
|
||||||
|
|
||||||
_helperPosition = SesothoPeManager.NearestPoint;
|
_helperPosition = SesothoPeManager.NearestPoint;
|
||||||
_endPoint.transform.position = SesothoPeManager.NearestPoint;
|
_endPoint.transform.position = SesothoPeManager.NearestPoint;
|
||||||
if (SesothoArrangementWiresTool.GetNearestObjectAsLine(_otherPoint, out var terminalLine,
|
if (SesothoArrangementWiresTool.GetNearestObjectAsLine(_otherPoint, out var terminalLine,
|
||||||
@@ -304,7 +305,7 @@ namespace SesothoLine
|
|||||||
// {
|
// {
|
||||||
// NearestLineTangentPoint
|
// NearestLineTangentPoint
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// 否则自由点
|
// 否则自由点
|
||||||
if (_isFreeEndPoint)
|
if (_isFreeEndPoint)
|
||||||
{
|
{
|
||||||
@@ -315,6 +316,36 @@ namespace SesothoLine
|
|||||||
_endPoint.transform.position = _helperPosition;
|
_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(
|
_line.SetLineSegment(
|
||||||
_lastPointPosition, _helperPosition,
|
_lastPointPosition, _helperPosition,
|
||||||
_lastPointNormal, _helperNormal
|
_lastPointNormal, _helperNormal
|
||||||
@@ -326,22 +357,24 @@ namespace SesothoLine
|
|||||||
// Debug.Log($"角度{arc.Angle} {arc.AngleExact}");
|
// Debug.Log($"角度{arc.Angle} {arc.AngleExact}");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
var forceStr = SesothoArrangementWiresTool.OpKey_ForceStr.Getkey();
|
if (forceStr || forceStraightLine)
|
||||||
if (forceStr)
|
{
|
||||||
_line.DrawStraightLine();
|
_line.DrawStraightLine();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var force90Arc = SesothoArrangementWiresTool.OpKey_90Arc.Getkey();
|
|
||||||
var force180Arc = SesothoArrangementWiresTool.OpKey_180Arc.Getkey();
|
var force180Arc = SesothoArrangementWiresTool.OpKey_180Arc.Getkey();
|
||||||
var forceRevCisoid = SesothoArrangementWiresTool.OpKey_RevCisoid.Getkey();
|
var forceRevCisoid = SesothoArrangementWiresTool.OpKey_RevCisoid.Getkey();
|
||||||
|
|
||||||
|
|
||||||
var angle = -1;
|
var angle = -1;
|
||||||
if (force90Arc || force180Arc)
|
if (force90Arc || force180Arc)
|
||||||
{
|
{
|
||||||
angle = 0;
|
angle = 0;
|
||||||
if (force90Arc)
|
if (force90Arc)
|
||||||
|
{
|
||||||
angle += 90;
|
angle += 90;
|
||||||
|
|
||||||
|
}
|
||||||
if (force180Arc)
|
if (force180Arc)
|
||||||
angle += 180;
|
angle += 180;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Deconstruction.Element;
|
using Deconstruction.Element;
|
||||||
using Deconstruction.Interface;
|
using Deconstruction.Interface;
|
||||||
using Deconstruction.Manager;
|
using Deconstruction.Manager;
|
||||||
@@ -13,7 +10,6 @@ using Deconstruction.Type.Linkable;
|
|||||||
using SerializerHelper.Type;
|
using SerializerHelper.Type;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Pool;
|
using UnityEngine.Pool;
|
||||||
using XericLibrary.Runtime.MacroLibrary;
|
|
||||||
using XericLibrary.Runtime.Nav;
|
using XericLibrary.Runtime.Nav;
|
||||||
|
|
||||||
namespace SesothoLine
|
namespace SesothoLine
|
||||||
@@ -39,19 +35,19 @@ namespace SesothoLine
|
|||||||
/// 工具中成员移除事件
|
/// 工具中成员移除事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event ToolMemberChange OnDecreasing;
|
public event ToolMemberChange OnDecreasing;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当任意元素苏醒
|
/// 当任意元素苏醒
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event ToolMemberChange OnAnyVivification;
|
public event ToolMemberChange OnAnyVivification;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 当任意元素休眠
|
/// 当任意元素休眠
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event ToolMemberChange OnAnyDormancy;
|
public event ToolMemberChange OnAnyDormancy;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 快捷键
|
#region 快捷键
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -61,11 +57,19 @@ namespace SesothoLine
|
|||||||
* shift+b 忽略对象吸附
|
* shift+b 忽略对象吸附
|
||||||
* shift+n 忽略网格吸附
|
* 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>
|
||||||
/// 强制直线
|
/// 强制直线
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static KeyPack OpKey_ForceStr = new KeyPack(KeyCode.Alpha1);
|
public static KeyPack OpKey_ForceStraightLine = new KeyPack(KeyCode.LeftShift, KeyCode.Q);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 强制90度圆弧
|
/// 强制90度圆弧
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -82,18 +86,20 @@ namespace SesothoLine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 忽略吸附功能
|
/// 忽略吸附功能
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static KeyPack OpKey_IgnoreNeighborAdsorption = new KeyPack(KeyCode.LeftShift, KeyCode.B);
|
public static KeyPack OpKey_IgnoreNeighborAdsorption = new KeyPack(KeyCode.Alpha1);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 忽略网格吸附
|
/// 忽略网格吸附
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static KeyPack OpKey_IgnoreGridAdsorption = new KeyPack(KeyCode.LeftShift, KeyCode.N);
|
public static KeyPack OpKey_IgnoreGridAdsorption = new KeyPack(KeyCode.LeftShift, KeyCode.N);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 字段属性
|
#region 字段属性
|
||||||
|
|
||||||
private ObjectPool<TerminalLine2T3> _linePool;
|
private ObjectPool<TerminalLine2T3> _linePool;
|
||||||
private ObjectPool<TerminalPoint> _pointPool;
|
private ObjectPool<TerminalPoint> _pointPool;
|
||||||
|
public ObjectPool<TerminalLine2T3> LinePool => _linePool;
|
||||||
|
public ObjectPool<TerminalPoint> PointPool => _pointPool;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -115,7 +121,7 @@ namespace SesothoLine
|
|||||||
point = null;
|
point = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取光标下最近的对象为线
|
/// 获取光标下最近的对象为线
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -146,27 +152,27 @@ namespace SesothoLine
|
|||||||
if (point is null)
|
if (point is null)
|
||||||
goto End;
|
goto End;
|
||||||
// 检查最近线切线是否有效,是否相连
|
// 检查最近线切线是否有效,是否相连
|
||||||
if (SesothoPeManager.NearestLineTangentObject is TerminalLine2T3 otherLine &&
|
if (SesothoPeManager.NearestLineTangentObject is TerminalLine2T3 otherLine &&
|
||||||
point.TryGetLinkLineNormal(otherLine, out normal))
|
point.TryGetLinkLineNormal(otherLine, out normal))
|
||||||
{
|
{
|
||||||
line = otherLine;
|
line = otherLine;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
End:
|
End:
|
||||||
line = null;
|
line = null;
|
||||||
normal = default;
|
normal = default;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 生命周期
|
#region 生命周期
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
base.Awake();
|
base.Awake();
|
||||||
|
|
||||||
_linePool = new ObjectPool<TerminalLine2T3>(
|
_linePool = new ObjectPool<TerminalLine2T3>(
|
||||||
createFunc: CreatElement<TerminalLine2T3>,
|
createFunc: CreatElement<TerminalLine2T3>,
|
||||||
actionOnGet: ElementActive,
|
actionOnGet: ElementActive,
|
||||||
@@ -176,7 +182,7 @@ namespace SesothoLine
|
|||||||
collectionCheck: true,
|
collectionCheck: true,
|
||||||
defaultCapacity: 10,
|
defaultCapacity: 10,
|
||||||
maxSize: 10000);
|
maxSize: 10000);
|
||||||
|
|
||||||
_pointPool = new ObjectPool<TerminalPoint>(
|
_pointPool = new ObjectPool<TerminalPoint>(
|
||||||
createFunc: CreatElement<TerminalPoint>,
|
createFunc: CreatElement<TerminalPoint>,
|
||||||
actionOnGet: ElementActive,
|
actionOnGet: ElementActive,
|
||||||
@@ -186,7 +192,7 @@ namespace SesothoLine
|
|||||||
collectionCheck: true,
|
collectionCheck: true,
|
||||||
defaultCapacity: 10,
|
defaultCapacity: 10,
|
||||||
maxSize: 10000);
|
maxSize: 10000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnEnableTool()
|
protected override void OnEnableTool()
|
||||||
@@ -194,13 +200,13 @@ namespace SesothoLine
|
|||||||
// 启用时创建一个输入等待行为,随后进入绘制行为
|
// 启用时创建一个输入等待行为,随后进入绘制行为
|
||||||
var target = GenerateOperateSlot<WaitForUserInput_OpSlot>();
|
var target = GenerateOperateSlot<WaitForUserInput_OpSlot>();
|
||||||
target.InitializeNextTodo(() => new DrawTerminalLine2T3_OpSlot());
|
target.InitializeNextTodo(() => new DrawTerminalLine2T3_OpSlot());
|
||||||
|
|
||||||
Debug.Log("激活线路绘制工具");
|
Debug.Log("激活线路绘制工具");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDisableTool()
|
protected override void OnDisableTool()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnFinalEnd()
|
protected override void OnFinalEnd()
|
||||||
@@ -232,11 +238,11 @@ namespace SesothoLine
|
|||||||
{
|
{
|
||||||
if (!base.ToolDiserializDispost(context))
|
if (!base.ToolDiserializDispost(context))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var deserializeList = new List<(PlacementBase, SerializeUnion)>();
|
var deserializeList = new List<(PlacementBase, SerializeUnion)>();
|
||||||
var safeCount = ushort.MaxValue;
|
var safeCount = ushort.MaxValue;
|
||||||
Debug.Log("反序列化过程开始创建对象");
|
Debug.Log("反序列化过程开始创建对象");
|
||||||
while (0 <-- safeCount && SerializeTemp.IndexMoveToNext(out var block))
|
while (0 < --safeCount && SerializeTemp.IndexMoveToNext(out var block))
|
||||||
{
|
{
|
||||||
var union = SerializeTemp.GetDeserializeObject<SerializeUnion>();
|
var union = SerializeTemp.GetDeserializeObject<SerializeUnion>();
|
||||||
var type = TypeConsignMap.GetMapType(union.Index);
|
var type = TypeConsignMap.GetMapType(union.Index);
|
||||||
@@ -258,18 +264,18 @@ namespace SesothoLine
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.LogError($"无法创建序列化元素,原因是类型不支持{type}");
|
Debug.LogError($"无法创建序列化元素,原因是类型不支持{type}");
|
||||||
|
|
||||||
if (block) break;
|
if (block) break;
|
||||||
}
|
}
|
||||||
Debug.Log("反序列化过程开始恢复链接关系");
|
Debug.Log("反序列化过程开始恢复链接关系");
|
||||||
foreach (var item in deserializeList)
|
foreach (var item in deserializeList)
|
||||||
item.Item1.DeserializeHysteresisOccurs(item.Item2);
|
item.Item1.DeserializeHysteresisOccurs(item.Item2);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 方法
|
#region 方法
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -319,7 +325,7 @@ namespace SesothoLine
|
|||||||
obj.gameObject.SetActive(false);
|
obj.gameObject.SetActive(false);
|
||||||
OnAnyDormancy?.Invoke(obj);
|
OnAnyDormancy?.Invoke(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取元素
|
/// 获取元素
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -343,7 +349,7 @@ namespace SesothoLine
|
|||||||
obj = null;
|
obj = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取元素
|
/// 获取元素
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -368,7 +374,7 @@ namespace SesothoLine
|
|||||||
obj = null;
|
obj = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 删除元素
|
/// 删除元素
|
||||||
@@ -376,7 +382,7 @@ namespace SesothoLine
|
|||||||
/// <param name="obj"></param>
|
/// <param name="obj"></param>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public void DeleteElement<T>(T obj)
|
public void DeleteElement<T>(T obj)
|
||||||
where T : PlacementBase,
|
where T : PlacementBase,
|
||||||
ILinkconfidentPe
|
ILinkconfidentPe
|
||||||
{
|
{
|
||||||
var name = typeof(T).Name;
|
var name = typeof(T).Name;
|
||||||
@@ -394,8 +400,8 @@ namespace SesothoLine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存元素链,在创建并常态化元素后都需要执行的操作 (注意不是在创建后立刻保存)
|
/// 保存元素链,在创建并常态化元素后都需要执行的操作 (注意不是在创建后立刻保存)
|
||||||
/// <code>
|
/// <code>
|
||||||
@@ -404,7 +410,7 @@ namespace SesothoLine
|
|||||||
/// </code>
|
/// </code>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void PersistentElement<T>(T obj)
|
public void PersistentElement<T>(T obj)
|
||||||
where T : PlacementBase,
|
where T : PlacementBase,
|
||||||
ILinkconfidentPe
|
ILinkconfidentPe
|
||||||
{
|
{
|
||||||
// 保存链表结构,反过来也持有这个节点,便于后续查找
|
// 保存链表结构,反过来也持有这个节点,便于后续查找
|
||||||
@@ -418,14 +424,14 @@ namespace SesothoLine
|
|||||||
/// <param name="obj"></param>
|
/// <param name="obj"></param>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public void ExcisionElement<T>(T obj)
|
public void ExcisionElement<T>(T obj)
|
||||||
where T : PlacementBase,
|
where T : PlacementBase,
|
||||||
ILinkconfidentPe
|
ILinkconfidentPe
|
||||||
{
|
{
|
||||||
if (obj.GetLinkedNode(out var node))
|
if (obj.GetLinkedNode(out var node))
|
||||||
SesothoPeManager.Inst.RemoveLinkedTarget(node);
|
SesothoPeManager.Inst.RemoveLinkedTarget(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加小型元素到网格中
|
/// 添加小型元素到网格中
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -442,7 +448,7 @@ namespace SesothoLine
|
|||||||
}
|
}
|
||||||
SesothoPeManager.Inst.InsertNeighbor(obj, out var index);
|
SesothoPeManager.Inst.InsertNeighbor(obj, out var index);
|
||||||
obj.NeighborGridIndex = index;
|
obj.NeighborGridIndex = index;
|
||||||
|
|
||||||
// 回调事件
|
// 回调事件
|
||||||
OnAdditional?.Invoke(obj);
|
OnAdditional?.Invoke(obj);
|
||||||
}
|
}
|
||||||
@@ -451,8 +457,8 @@ namespace SesothoLine
|
|||||||
/// 添加大型元素到网格中
|
/// 添加大型元素到网格中
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddBulkPeToNeighborGrid<T>(T obj)
|
public void AddBulkPeToNeighborGrid<T>(T obj)
|
||||||
where T : PlacementBase,
|
where T : PlacementBase,
|
||||||
ILinkconfidentPe,
|
ILinkconfidentPe,
|
||||||
IPossessorTrajectory2
|
IPossessorTrajectory2
|
||||||
{
|
{
|
||||||
if (obj.NeighborGridIndex != null)
|
if (obj.NeighborGridIndex != null)
|
||||||
@@ -462,7 +468,7 @@ namespace SesothoLine
|
|||||||
}
|
}
|
||||||
SesothoPeManager.Inst.InsertGiantNeighbor<T>(obj, out var index);
|
SesothoPeManager.Inst.InsertGiantNeighbor<T>(obj, out var index);
|
||||||
obj.NeighborGridIndex = index;
|
obj.NeighborGridIndex = index;
|
||||||
|
|
||||||
// 回调事件
|
// 回调事件
|
||||||
OnAdditional?.Invoke(obj);
|
OnAdditional?.Invoke(obj);
|
||||||
}
|
}
|
||||||
@@ -476,7 +482,7 @@ namespace SesothoLine
|
|||||||
where T : PlacementBase,
|
where T : PlacementBase,
|
||||||
ILinkconfidentPe
|
ILinkconfidentPe
|
||||||
{
|
{
|
||||||
if (obj.NeighborGridIndex != null &&
|
if (obj.NeighborGridIndex != null &&
|
||||||
obj.NeighborGridIndex.GetAsIndex(out var index))
|
obj.NeighborGridIndex.GetAsIndex(out var index))
|
||||||
SesothoPeManager.Inst.RemoveNeighbor(index);
|
SesothoPeManager.Inst.RemoveNeighbor(index);
|
||||||
else
|
else
|
||||||
@@ -485,16 +491,16 @@ namespace SesothoLine
|
|||||||
// 回调事件
|
// 回调事件
|
||||||
OnDecreasing?.Invoke(obj);
|
OnDecreasing?.Invoke(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移除这个大型元素
|
/// 移除这个大型元素
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void RemoveBulkPeFormNeighborGrid<T>(T obj)
|
public void RemoveBulkPeFormNeighborGrid<T>(T obj)
|
||||||
where T : PlacementBase,
|
where T : PlacementBase,
|
||||||
ILinkconfidentPe,
|
ILinkconfidentPe,
|
||||||
IPossessorTrajectory2
|
IPossessorTrajectory2
|
||||||
{
|
{
|
||||||
if (obj.NeighborGridIndex != null &&
|
if (obj.NeighborGridIndex != null &&
|
||||||
obj.NeighborGridIndex.GetAsMappingIndex(out var index))
|
obj.NeighborGridIndex.GetAsMappingIndex(out var index))
|
||||||
SesothoPeManager.Inst.RemoveGiantNeighbor(index);
|
SesothoPeManager.Inst.RemoveGiantNeighbor(index);
|
||||||
else
|
else
|
||||||
@@ -513,7 +519,7 @@ namespace SesothoLine
|
|||||||
*
|
*
|
||||||
* 主要提供绘制线路时的多段线拟合,障碍物避让
|
* 主要提供绘制线路时的多段线拟合,障碍物避让
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取一个可以通过的路径
|
/// 获取一个可以通过的路径
|
||||||
/// <code>
|
/// <code>
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ using Deconstruction.Manager;
|
|||||||
using Deconstruction.Tool;
|
using Deconstruction.Tool;
|
||||||
using Deconstruction.Type.Area;
|
using Deconstruction.Type.Area;
|
||||||
using Deconstruction.Type.Serialize;
|
using Deconstruction.Type.Serialize;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SerializerHelper.Type;
|
using SerializerHelper.Type;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using XericLibrary.Runtime.Debuger;
|
using XericLibrary.Runtime.Debuger;
|
||||||
using XericLibrary.Runtime.MacroLibrary;
|
using XericLibrary.Runtime.MacroLibrary;
|
||||||
|
using Deconstruction.Type.DMToolSlot;
|
||||||
|
|
||||||
namespace SesothoLine
|
namespace SesothoLine
|
||||||
{
|
{
|
||||||
@@ -29,9 +31,6 @@ namespace SesothoLine
|
|||||||
{
|
{
|
||||||
#region 静态成员
|
#region 静态成员
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 此处提供的单例与父类单例是独立的
|
|
||||||
/// </summary>
|
|
||||||
public new static SesothoPeManager Inst => _inst;
|
public new static SesothoPeManager Inst => _inst;
|
||||||
private static SesothoPeManager _inst;
|
private static SesothoPeManager _inst;
|
||||||
|
|
||||||
@@ -57,52 +56,47 @@ namespace SesothoLine
|
|||||||
/// 光标下最近的对象
|
/// 光标下最近的对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static PlacementBase NearestObject => TrackingTool.TrackingCurrentTarget;
|
public static PlacementBase NearestObject => TrackingTool.TrackingCurrentTarget;
|
||||||
|
|
||||||
private static TrajectoryTrackingTool.TrackPersistentCommunicate _lineTangentTraceTool;
|
private static TrajectoryTrackingTool.TrackPersistentCommunicate _lineTangentTraceTool;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 调试功能
|
#region 调试功能
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
|
||||||
public bool EnableGridDebugDraw = false;
|
public bool EnableGridDebugDraw = false;
|
||||||
|
|
||||||
|
|
||||||
public void DebugFunc()
|
public void DebugFunc()
|
||||||
{
|
{
|
||||||
if (EnableGridDebugDraw)
|
if (EnableGridDebugDraw)
|
||||||
{
|
PlacementNeighbor.DebugDrawGrid();
|
||||||
PlacementNeighbor.DebugDrawGrid();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 生命周期
|
#region 生命周期
|
||||||
|
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
base.Awake();
|
base.Awake();
|
||||||
_inst = this;
|
_inst = this;
|
||||||
|
|
||||||
if (LineMaterial == null)
|
if (LineMaterial == null)
|
||||||
Debug.LogError("需要给管理器提供一个线段材质");
|
Debug.LogError("需要给管理器提供一个线段材质");
|
||||||
if (PointMaterial == null)
|
if (PointMaterial == null)
|
||||||
Debug.LogError("需要给管理器提供一个点材质");
|
Debug.LogError("需要给管理器提供一个点材质");
|
||||||
|
|
||||||
// 初始化画线工具
|
// 初始化画线工具
|
||||||
_wiresTool = new SesothoArrangementWiresTool();
|
_wiresTool = new SesothoArrangementWiresTool();
|
||||||
_wiresTool.InitializeParent(transform);
|
_wiresTool.InitializeParent(transform);
|
||||||
|
|
||||||
_lineTangentTraceTool = TrackingTool.InstantiationTrackCaculate(PlaceholdersAreaType.LinearContinuity);
|
_lineTangentTraceTool = TrackingTool.InstantiationTrackCaculate(PlaceholdersAreaType.LinearContinuity);
|
||||||
|
|
||||||
// 手动开启代理更新
|
// 手动开启代理更新
|
||||||
EnableUpdate = true;
|
EnableUpdate = true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Start()
|
protected override void Start()
|
||||||
@@ -127,7 +121,6 @@ namespace SesothoLine
|
|||||||
// new SerializeUnion();
|
// new SerializeUnion();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string serializeContext = null;
|
|
||||||
protected override void LateUpdate()
|
protected override void LateUpdate()
|
||||||
{
|
{
|
||||||
base.LateUpdate();
|
base.LateUpdate();
|
||||||
@@ -136,18 +129,27 @@ namespace SesothoLine
|
|||||||
#if !UNITY_EDITOR || !_DEBUG_
|
#if !UNITY_EDITOR || !_DEBUG_
|
||||||
return;
|
return;
|
||||||
#endif
|
#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;
|
_wiresTool.EnableTool = !_wiresTool.EnableTool;
|
||||||
Debug.Log($"{(_wiresTool.EnableTool ? "绘制工具已激活" : "工具已取消激活")}");
|
Debug.Log($"{(_wiresTool.EnableTool ? "绘制工具已激活" : "工具已取消激活")}");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// 存档功能测试
|
// 存档功能测试
|
||||||
if (Input.GetKeyDown(KeyCode.S))
|
/*if (Input.GetKeyDown(KeyCode.S))
|
||||||
{
|
{
|
||||||
var obj = _wiresTool.ToolSerializeDispost();
|
var obj = _wiresTool.ToolSerializeDispost();
|
||||||
serializeContext = MacroFile.JsonSerializerFormatter.formatter.Serializer(obj);
|
serializeContext = JsonConvert.SerializeObject(obj);
|
||||||
Debug.Log(obj.ToString());
|
Debug.Log(obj.ToString());
|
||||||
}
|
}
|
||||||
if (Input.GetKeyDown(KeyCode.D))
|
if (Input.GetKeyDown(KeyCode.D))
|
||||||
@@ -158,29 +160,31 @@ namespace SesothoLine
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var obj = MacroFile.JsonSerializerFormatter.formatter.Deserializer<SerializeUnion>(serializeContext);
|
var obj = JsonConvert.DeserializeObject<SerializeUnion>(serializeContext);
|
||||||
_wiresTool.ToolDiserializDispost(obj);
|
_wiresTool.ToolDiserializDispost(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.A))
|
if (Input.GetKeyDown(KeyCode.A))
|
||||||
{
|
{
|
||||||
_wiresTool.EnableCompress = !_wiresTool.EnableCompress;
|
_wiresTool.EnableCompress = !_wiresTool.EnableCompress;
|
||||||
if (_wiresTool.EnableCompress )
|
if (_wiresTool.EnableCompress)
|
||||||
Debug.Log("开启压缩");
|
Debug.Log("开启压缩");
|
||||||
else
|
else
|
||||||
Debug.Log("关闭压缩");
|
Debug.Log("关闭压缩");
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// 绘制一下吸附的目标位置
|
// 绘制一下吸附的目标位置
|
||||||
if (TrackingTool.EnableTool || TrackingTool._enableAuxiliaryTool)
|
if (TrackingTool.EnableTool || TrackingTool._enableAuxiliaryTool)
|
||||||
{
|
{
|
||||||
MacroDebugDraw.DrawDownArrow(NearestPoint, Quaternion.identity, Color.magenta);
|
MacroDebugDraw.SetColor(Color.magenta);
|
||||||
MacroDebugDraw.DrawDownArrow(NearestLineTangentPoint, Quaternion.identity, Color.green);
|
MacroDebugDraw.DrawDownArrow(NearestPoint);
|
||||||
|
MacroDebugDraw.SetColor(Color.green);
|
||||||
|
MacroDebugDraw.DrawDownArrow(NearestLineTangentPoint);
|
||||||
|
MacroDebugDraw.ResetColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,14 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
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.Element;
|
||||||
using Deconstruction.Interface;
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Serialization;
|
using UnityEngine.UIElements;
|
||||||
using XericLibrary.Runtime.Debuger;
|
using XericLibrary.Runtime.Debuger;
|
||||||
using XericLibrary.Runtime.MacroLibrary;
|
using XericLibrary.Runtime.MacroLibrary;
|
||||||
using XericLibrary.Runtime.Type;
|
|
||||||
|
|
||||||
namespace SesothoLine
|
namespace SesothoLine
|
||||||
{
|
{
|
||||||
@@ -38,7 +31,9 @@ namespace SesothoLine
|
|||||||
private LineSegment2 _lineSegment = new LineSegment2();
|
private LineSegment2 _lineSegment = new LineSegment2();
|
||||||
|
|
||||||
public bool DebugDrawGrid = false;
|
public bool DebugDrawGrid = false;
|
||||||
|
|
||||||
|
public Vector3 ah, bh;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 生命周期
|
#region 生命周期
|
||||||
@@ -61,10 +56,7 @@ namespace SesothoLine
|
|||||||
SesothoPeManager.Inst.RemoveEmbedded(this);
|
SesothoPeManager.Inst.RemoveEmbedded(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnDestroy()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void AgencyOnEnable()
|
protected override void AgencyOnEnable()
|
||||||
{
|
{
|
||||||
@@ -86,9 +78,10 @@ namespace SesothoLine
|
|||||||
{
|
{
|
||||||
foreach (var index in indexs.Indexs)
|
foreach (var index in indexs.Indexs)
|
||||||
{
|
{
|
||||||
|
MacroDebugDraw.SetColor(Color.red);
|
||||||
MacroDebugDraw.DrawDownArrow(
|
MacroDebugDraw.DrawDownArrow(
|
||||||
index.GetCellWorldIndexPosition() + MacroMath.RandomVector3(0.1f, Identifier), Quaternion.identity,
|
index.GetCellWorldIndexPosition() + MacroMath.RandomVector3(0.1f, Identifier));
|
||||||
Color.red);
|
MacroDebugDraw.ResetColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,8 +121,12 @@ namespace SesothoLine
|
|||||||
b.UpwardPlaneToVector2(),
|
b.UpwardPlaneToVector2(),
|
||||||
ah.UpwardPlaneToVector2(),
|
ah.UpwardPlaneToVector2(),
|
||||||
bh.UpwardPlaneToVector2());
|
bh.UpwardPlaneToVector2());
|
||||||
// ah?.GetEndPointNormal ?? default,
|
// ah?.GetEndPointNormal ?? default,
|
||||||
// bh?.GetStartPointNormal ?? default);
|
// bh?.GetStartPointNormal ?? default);
|
||||||
|
|
||||||
|
this.ah = ah;
|
||||||
|
this.bh = bh;
|
||||||
|
|
||||||
return _lineSegment;
|
return _lineSegment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +142,6 @@ namespace SesothoLine
|
|||||||
AutomaticDrawCircularLine(straightLine);
|
AutomaticDrawCircularLine(straightLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重新计算原点
|
/// 重新计算原点
|
||||||
/// <code>
|
/// <code>
|
||||||
|
|||||||
Reference in New Issue
Block a user