移除了影响打包的部分;
修正了洗牌算法中的错误; 将弱类型中历史记录的功能拆开了,减小了不必要的消耗;
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using log4net.Util;
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -8,7 +8,7 @@ using System.Text;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using static Codice.CM.WorkspaceServer.WorkspaceTreeDataStore;
|
||||
|
||||
|
||||
namespace XericLibrary.Runtime.MacroLibrary
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Codice.CM.WorkspaceServer.Tree.GameUI.HeadTree;
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -6,7 +6,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using Unity.VisualScripting.YamlDotNet.Core.Tokens;
|
||||
#endif
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
#endif
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
@@ -21,9 +21,12 @@ namespace XericLibrary.Runtime.MacroLibrary
|
||||
/// <returns></returns>
|
||||
public static List<int> FisherYatesShuffle(int length, int select)
|
||||
{
|
||||
if(select > length)
|
||||
throw new ArgumentOutOfRangeException("<22>ڽ<EFBFBD><DABD><EFBFBD>ϴ<EFBFBD><CFB4>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>ӵ<EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD>");
|
||||
|
||||
var random = new System.Random();
|
||||
|
||||
List<int> arr = Enumerable.Range(1, length).ToList();
|
||||
List<int> arr = Enumerable.Range(0, length).ToList();
|
||||
List<int> res = new List<int>();
|
||||
|
||||
for(int i = 0; i < select; ++i)
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor.Experimental.GraphView;
|
||||
#endif
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
8
Runtime/SpatialTransform.meta
Normal file
8
Runtime/SpatialTransform.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 785b6db82960d6c49acaedc81c113019
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
51
Runtime/SpatialTransform/OffsetFromTrackTarget.cs
Normal file
51
Runtime/SpatialTransform/OffsetFromTrackTarget.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using XericLibrary.Runtime.Type;
|
||||
|
||||
namespace XericLibrary.Runtime.SpatialTransform
|
||||
{
|
||||
/// <summary>
|
||||
/// <20>趨ƫ<E8B6A8><C6AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7>Ŀ<EFBFBD><C4BF>
|
||||
/// </summary>
|
||||
public class OffsetFromTrackTarget : WeaklyMonoBase
|
||||
{
|
||||
/// <summary>
|
||||
/// <><D7B7>Ŀ<EFBFBD><C4BF>
|
||||
/// </summary>
|
||||
public Transform TrackTarget;
|
||||
|
||||
/// <summary>
|
||||
/// ƫ<><C6AB><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public Vector3 Offset;
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if(TrackTarget != null)
|
||||
{
|
||||
var pos = transform.position;
|
||||
pos.y = 0;
|
||||
var trackPos = TrackTarget.position;
|
||||
trackPos.y = 0;
|
||||
|
||||
|
||||
transform.position = TrackTarget.position + TrackTarget.rotation * Offset;
|
||||
|
||||
transform.rotation = Quaternion.LookRotation(pos - trackPos);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʼ<EFBFBD><CABC>
|
||||
/// </summary>
|
||||
/// <param name="tracK"></param>
|
||||
public void Initialized(Transform tracK, Vector3 offset)
|
||||
{
|
||||
TrackTarget = tracK;
|
||||
Offset = offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/SpatialTransform/OffsetFromTrackTarget.cs.meta
Normal file
11
Runtime/SpatialTransform/OffsetFromTrackTarget.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc5062889e515554690f2a00becd6359
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
160
Runtime/Type/BatchProcessor.cs
Normal file
160
Runtime/Type/BatchProcessor.cs
Normal file
@@ -0,0 +1,160 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using static XericLibrary.Runtime.Type.BatchProcessor;
|
||||
|
||||
namespace XericLibrary.Runtime.Type
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC>ٵ<EFBFBD><D9B5><EFBFBD>ջ<EFBFBD>л<EFBFBD>ʱ<EFBFBD>ĺ<EFBFBD>ʱ
|
||||
/// <code>
|
||||
/// һ<><D2BB>һ<EFBFBD><D2BB><EFBFBD>л<EFBFBD><D0BB><EFBFBD>ʱ <2us;
|
||||
/// <20>˾ٻ<CBBE>ʹ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD>ϸ<EFBFBD>µĸ<C2B5><C4B8><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>á<EFBFBD>
|
||||
/// </code>
|
||||
/// </summary>
|
||||
public abstract class BatchProcessor : SingleMonoBase<BatchProcessor>
|
||||
{
|
||||
#region <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
/// </summary>
|
||||
internal List<ActionAttribution> ProcessorList;
|
||||
|
||||
/// <summary>
|
||||
/// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
|
||||
/// </summary>
|
||||
public event Action AnonymousProcessing
|
||||
{
|
||||
add => AddProcess(value);
|
||||
remove => RemoveProcess(value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <20>ڸ<EFBFBD><DAB8><EFBFBD>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD>Ƴ<EFBFBD><C6B3>Ķ<EFBFBD><C4B6><EFBFBD>
|
||||
/// </summary>
|
||||
private List<ActionAttribution> needRemove = new List<ActionAttribution>();
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
|
||||
/// </summary>
|
||||
public class ActionAttribution
|
||||
{
|
||||
/// <summary>
|
||||
/// <20>¼<EFBFBD>
|
||||
/// </summary>
|
||||
internal Action EventAction;
|
||||
|
||||
/// <summary>
|
||||
/// Ŀ<><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
|
||||
/// </summary>
|
||||
internal MonoBehaviour TargetScript;
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="script"></param>
|
||||
/// <param name="action"></param>
|
||||
public ActionAttribution(MonoBehaviour script, Action action)
|
||||
{
|
||||
EventAction = action;
|
||||
TargetScript = script;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
foreach(var processor in ProcessorList)
|
||||
{
|
||||
if(ReferenceEquals(processor.TargetScript, null))
|
||||
needRemove.Add(processor);
|
||||
|
||||
processor.EventAction();
|
||||
}
|
||||
|
||||
if(needRemove.Count > 0)
|
||||
{
|
||||
ProcessorList = ProcessorList.Except(needRemove).ToList();
|
||||
needRemove.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="actuator"></param>
|
||||
protected internal void AddProcess(Action actuator)
|
||||
{
|
||||
ProcessorList.Add(new ActionAttribution(this, actuator));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="script"></param>
|
||||
/// <param name="actuator"></param>
|
||||
public void AddProcess(MonoBehaviour script, Action actuator)
|
||||
{
|
||||
ProcessorList.Add(new ActionAttribution(script, actuator));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="actuator"></param>
|
||||
protected internal void RemoveProcess(Action actuator)
|
||||
{
|
||||
RemoveProcess(a => a.EventAction == actuator && a.TargetScript == this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="actuator"></param>
|
||||
public void RemoveProcess(MonoBehaviour script, Action actuator)
|
||||
{
|
||||
RemoveProcess(a => a.EventAction == actuator && a.TargetScript == script);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
/// <param name="func"></param>
|
||||
private void RemoveProcess(Func<ActionAttribution, bool> func)
|
||||
{
|
||||
var target = ProcessorList
|
||||
.Where(func)
|
||||
.FirstOrDefault();
|
||||
|
||||
if(target != null)
|
||||
ProcessorList.Remove(target);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
11
Runtime/Type/BatchProcessor.cs.meta
Normal file
11
Runtime/Type/BatchProcessor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c968745f30c2aa9418d51be4291a0ccd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,6 +3,7 @@ using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XericLibrary.Runtime.Type
|
||||
{
|
||||
/// <summary>
|
||||
@@ -18,7 +19,7 @@ namespace XericLibrary.Runtime.Type
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
private static string rootNodeName = "DoNotDestroyThis";
|
||||
internal static string rootNodeName = "DoNotDestroyThis";
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
48
Runtime/Type/WeaklyHistoryMonoBase.cs
Normal file
48
Runtime/Type/WeaklyHistoryMonoBase.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using XericLibrary.Runtime.Type;
|
||||
|
||||
namespace XericLibrary.Runtime.Type
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʷ<EFBFBD><CAB7>¼<EFBFBD>Ľű<C4BD>
|
||||
/// </summary>
|
||||
public class WeaklyHistoryMonoBase : WeaklyMonoBase
|
||||
{
|
||||
#region <EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
private Vector3 history_Position;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʷ<EFBFBD><CAB7>ת
|
||||
/// </summary>
|
||||
private Quaternion history_Rotation;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
private Vector3 history_Scale;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public Vector3 HistoryPosition => history_Position;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1>ʷ<EFBFBD><CAB7>ת
|
||||
/// </summary>
|
||||
public Quaternion HistoryRotation => history_Rotation;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public Vector3 HistoryScale => history_Scale;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
11
Runtime/Type/WeaklyHistoryMonoBase.cs.meta
Normal file
11
Runtime/Type/WeaklyHistoryMonoBase.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 997bea0a9f4ef3846b808872a727eb65
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,5 +1,3 @@
|
||||
#define _HISTORY_
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -19,27 +17,6 @@ namespace XericLibrary.Runtime.Type
|
||||
|
||||
private WeaklyObjectBase weaklyBase = null;
|
||||
|
||||
#if _HISTORY_
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
private Vector3 history_Position;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʷ<EFBFBD><CAB7>ת
|
||||
/// </summary>
|
||||
private Quaternion history_Rotation;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
private Vector3 history_Scale;
|
||||
|
||||
//private
|
||||
|
||||
#endif
|
||||
|
||||
#if UNITY_EDITOR
|
||||
|
||||
private static PlayModeStateChange playModeState;
|
||||
@@ -53,29 +30,6 @@ namespace XericLibrary.Runtime.Type
|
||||
private set;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#if _HISTORY_
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public Vector3 HistoryPosition => history_Position;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1>ʷ<EFBFBD><CAB7>ת
|
||||
/// </summary>
|
||||
public Quaternion HistoryRotation => history_Rotation;
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1>ʷ<EFBFBD><CAB7><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public Vector3 HistoryScale => history_Scale;
|
||||
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user