修改了一些bug,并补充了一些函数
This commit is contained in:
@@ -37,6 +37,11 @@ MonoBehaviour:
|
|||||||
- Dreamteck.Splines
|
- Dreamteck.Splines
|
||||||
- Dreamteck.Utilities
|
- Dreamteck.Utilities
|
||||||
- EasySave3
|
- EasySave3
|
||||||
|
- glTFast
|
||||||
|
- glTFast.Documentation.Examples
|
||||||
|
- glTFast.dots
|
||||||
|
- glTFast.Export
|
||||||
|
- glTFast.Newtonsoft
|
||||||
- LeanCommon
|
- LeanCommon
|
||||||
- LeanGUI
|
- LeanGUI
|
||||||
- LeanTransition
|
- LeanTransition
|
||||||
|
@@ -1,6 +1,3 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Cinemachine;
|
|
||||||
using Convention.WindowsUI.Variant;
|
using Convention.WindowsUI.Variant;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
@@ -29,6 +26,16 @@ namespace Convention
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetMoveSpeed(float value)
|
||||||
|
{
|
||||||
|
moveSpeed = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRotationSpeed(float value)
|
||||||
|
{
|
||||||
|
rotationSpeed = value;
|
||||||
|
}
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
m_IsFocus = false;
|
m_IsFocus = false;
|
||||||
|
@@ -1064,33 +1064,62 @@ namespace Convention
|
|||||||
|
|
||||||
public class ActionStepCoroutineWrapper
|
public class ActionStepCoroutineWrapper
|
||||||
{
|
{
|
||||||
private List<KeyValuePair<YieldInstruction, Action>> steps = new();
|
private class YieldInstructionWrapper
|
||||||
|
{
|
||||||
|
public YieldInstruction UnityYieldInstruction;
|
||||||
|
public CustomYieldInstruction CustomYieldInstruction;
|
||||||
|
|
||||||
|
public YieldInstructionWrapper()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public YieldInstructionWrapper(YieldInstruction unityYieldInstruction)
|
||||||
|
{
|
||||||
|
this.UnityYieldInstruction = unityYieldInstruction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public YieldInstructionWrapper(CustomYieldInstruction customYieldInstruction)
|
||||||
|
{
|
||||||
|
this.CustomYieldInstruction = customYieldInstruction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<KeyValuePair<YieldInstructionWrapper, Action>> steps = new();
|
||||||
public ActionStepCoroutineWrapper Update(Action action)
|
public ActionStepCoroutineWrapper Update(Action action)
|
||||||
{
|
{
|
||||||
steps.Add(new(null, action));
|
steps.Add(new(new(), action));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public ActionStepCoroutineWrapper Wait(float time, Action action)
|
public ActionStepCoroutineWrapper Wait(float time, Action action)
|
||||||
{
|
{
|
||||||
steps.Add(new(new WaitForSeconds(time), action));
|
steps.Add(new(new(new WaitForSeconds(time)), action));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public ActionStepCoroutineWrapper FixedUpdate(Action action)
|
public ActionStepCoroutineWrapper FixedUpdate(Action action)
|
||||||
{
|
{
|
||||||
steps.Add(new(new WaitForFixedUpdate(), action));
|
steps.Add(new(new (new WaitForFixedUpdate()), action));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public ActionStepCoroutineWrapper Next(Action action)
|
public ActionStepCoroutineWrapper Next(Action action)
|
||||||
{
|
{
|
||||||
steps.Add(new(new WaitForEndOfFrame(), action));
|
steps.Add(new(new(new WaitForEndOfFrame()), action));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
private static IEnumerator Execute(List<KeyValuePair<YieldInstruction, Action>> steps)
|
public ActionStepCoroutineWrapper Until(Func<bool> pr, Action action)
|
||||||
|
{
|
||||||
|
steps.Add(new(new(new WaitUntil(pr)), action));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
private static IEnumerator Execute(List<KeyValuePair<YieldInstructionWrapper, Action>> steps)
|
||||||
{
|
{
|
||||||
foreach (var (waiting, action) in steps)
|
foreach (var (waiting, action) in steps)
|
||||||
{
|
{
|
||||||
action();
|
action();
|
||||||
yield return waiting;
|
if (waiting.UnityYieldInstruction != null)
|
||||||
|
yield return waiting.UnityYieldInstruction;
|
||||||
|
else
|
||||||
|
yield return waiting.CustomYieldInstruction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~ActionStepCoroutineWrapper()
|
~ActionStepCoroutineWrapper()
|
||||||
@@ -1099,7 +1128,7 @@ namespace Convention
|
|||||||
}
|
}
|
||||||
public void Invoke()
|
public void Invoke()
|
||||||
{
|
{
|
||||||
StartCoroutine(Execute(new List<KeyValuePair<YieldInstruction, Action>>(steps)));
|
StartCoroutine(Execute(new List<KeyValuePair<YieldInstructionWrapper, Action>>(steps)));
|
||||||
steps.Clear();
|
steps.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -283,6 +283,18 @@ namespace Convention
|
|||||||
callback(result.assetBundle);
|
callback(result.assetBundle);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
public IEnumerator LoadAsAssetBundle([In]Action<float> progress, [In] Action<AssetBundle> callback)
|
||||||
|
{
|
||||||
|
AssetBundleCreateRequest result = AssetBundle.LoadFromFileAsync(FullPath);
|
||||||
|
while (result.isDone == false)
|
||||||
|
{
|
||||||
|
progress(result.progress);
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
yield return result;
|
||||||
|
callback(result.assetBundle);
|
||||||
|
yield return null;
|
||||||
|
}
|
||||||
|
|
||||||
public string LoadAsUnknown(string suffix)
|
public string LoadAsUnknown(string suffix)
|
||||||
{
|
{
|
||||||
|
@@ -34,7 +34,7 @@ namespace Convention
|
|||||||
{
|
{
|
||||||
colorKeys = new GradientColorKey[]
|
colorKeys = new GradientColorKey[]
|
||||||
{
|
{
|
||||||
new GradientColorKey(Color.white, 1),
|
new GradientColorKey(Color.white, 0),
|
||||||
new GradientColorKey(Color.white, 1)
|
new GradientColorKey(Color.white, 1)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -8,27 +8,51 @@ namespace Convention.WindowsUI.Variant
|
|||||||
{
|
{
|
||||||
[Setting, Range(0, 1), Percentage(0, 1)] public float Speed = 0.36f;
|
[Setting, Range(0, 1), Percentage(0, 1)] public float Speed = 0.36f;
|
||||||
[Resources, OnlyNotNullMode] public RectTransform RectBox;
|
[Resources, OnlyNotNullMode] public RectTransform RectBox;
|
||||||
[Resources, OnlyNotNullMode] public RectTransform RopParent;
|
[Resources, OnlyNotNullMode] public RectTransform TopParent;
|
||||||
[Resources] public List<RectTransform> Targets = new();
|
[Resources] public List<RectTransform> Targets = new();
|
||||||
[Content] public int TargetIndex;
|
[Content] public int TargetIndex;
|
||||||
[Content, OnlyPlayMode] public RectTransform Target;
|
public RectTransform Target { get; private set; }
|
||||||
|
|
||||||
|
private Stack<ConventionUtility.ActionStepCoroutineWrapper> Tasks = new();
|
||||||
|
|
||||||
public void SetTargetRectTransform(RectTransform target)
|
public void SetTargetRectTransform(RectTransform target)
|
||||||
{
|
{
|
||||||
Target = target;
|
if (target == null)
|
||||||
|
{
|
||||||
|
Target = null;
|
||||||
|
RectTransformInfo.UpdateAnimationPlane(TopParent, RectBox, Speed, 0, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ConventionUtility.ActionStepCoroutineWrapper task = ConventionUtility.CreateSteps();
|
||||||
|
task.Next(() =>
|
||||||
|
{
|
||||||
|
if (gameObject.activeInHierarchy == false)
|
||||||
|
RectTransformInfo.UpdateAnimationPlane(TopParent, RectBox, 1, 0, true);
|
||||||
|
})
|
||||||
|
.Until(() => target.gameObject.activeInHierarchy == true && Tasks.Peek() == task, () => Target = target)
|
||||||
|
.Next(() => Tasks.TryPop(out var _))
|
||||||
|
.Invoke();
|
||||||
|
Tasks.Push(task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void SelectNextTarget()
|
public void SelectNextTarget()
|
||||||
{
|
{
|
||||||
Debug.Log(TargetIndex);
|
|
||||||
Target = Targets[TargetIndex = (TargetIndex + 1) % Targets.Count];
|
Target = Targets[TargetIndex = (TargetIndex + 1) % Targets.Count];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
if (TopParent == null)
|
||||||
|
TopParent = transform.parent as RectTransform;
|
||||||
|
}
|
||||||
|
|
||||||
private void LateUpdate()
|
private void LateUpdate()
|
||||||
{
|
{
|
||||||
if (Target != null)
|
if (Target != null)
|
||||||
RectTransformInfo.UpdateAnimationPlane(Target, RectBox, Speed, 0, true);
|
RectTransformInfo.UpdateAnimationPlane(Target, RectBox, Speed, 0, true);
|
||||||
else
|
else
|
||||||
RectTransformInfo.UpdateAnimationPlane(RopParent, RectBox, Speed, 0, true);
|
RectTransformInfo.UpdateAnimationPlane(TopParent, RectBox, Speed, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -125,6 +125,25 @@ namespace Convention.WindowsUI.Variant
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void MakeFocusOn(HierarchyItem target)
|
||||||
|
{
|
||||||
|
static void BFS(HierarchyItem t)
|
||||||
|
{
|
||||||
|
var next = t.Entry.GetParent();
|
||||||
|
if (next != null)
|
||||||
|
{
|
||||||
|
BFS(next.GetHierarchyItem());
|
||||||
|
next.GetHierarchyItem().IsFold = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BFS(target);
|
||||||
|
if (FocusWindowIndictaor.instance != null)
|
||||||
|
{
|
||||||
|
FocusWindowIndictaor.instance.SetTargetRectTransform(target.TextRectTransform);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,7 +91,7 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Speed: 0.32
|
Speed: 0.32
|
||||||
RectBox: {fileID: 6272003121708756342}
|
RectBox: {fileID: 6272003121708756342}
|
||||||
RopParent: {fileID: 8773560469810817739}
|
TopParent: {fileID: 0}
|
||||||
Targets:
|
Targets:
|
||||||
- {fileID: 0}
|
- {fileID: 0}
|
||||||
- {fileID: 7709311530016948315}
|
- {fileID: 7709311530016948315}
|
||||||
@@ -100,7 +100,6 @@ MonoBehaviour:
|
|||||||
- {fileID: 2403051311178796671}
|
- {fileID: 2403051311178796671}
|
||||||
- {fileID: 5377214671440830306}
|
- {fileID: 5377214671440830306}
|
||||||
TargetIndex: 0
|
TargetIndex: 0
|
||||||
Target: {fileID: 0}
|
|
||||||
--- !u!114 &7462675906960032546
|
--- !u!114 &7462675906960032546
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
Reference in New Issue
Block a user