mirror of
https://github.com/originalnicodr/CinematicUnityExplorer.git
synced 2026-10-11 01:48:07 +08:00
Fixed toggling NPC animators when we had too many to show at the same time. Also disabled the automatic stop of manually played animations if the user didn't have the animator disabled in the first place, or if they disabled it mid-animation. Also made the Animator panel longer and fixed the FreeCamPanel missing new line.
This commit is contained in:
1 parent
9e9a5e25ab
commit
467d5cf2d5
3 files changed
+44
-23
No files matched your search
@@ -19,7 +19,7 @@ using Animator = UnityEngine.Behaviour;
|
||||
|
||||
namespace UnityExplorer.UI.Panels
|
||||
{
|
||||
internal class AnimatorPanel : UEPanel, ICellPoolDataSource<AnimatorCell>
|
||||
public class AnimatorPanel : UEPanel, ICellPoolDataSource<AnimatorCell>
|
||||
{
|
||||
public AnimatorPanel(UIBase owner) : base(owner)
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
public override string Name => "Animator";
|
||||
public override UIManager.Panels PanelType => UIManager.Panels.AnimatorPanel;
|
||||
public override int MinWidth => 500;
|
||||
public override int MinWidth => 750;
|
||||
public override int MinHeight => 200;
|
||||
public override Vector2 DefaultAnchorMin => new(0.4f, 0.4f);
|
||||
public override Vector2 DefaultAnchorMax => new(0.6f, 0.6f);
|
||||
@@ -40,6 +40,7 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
private static ScrollPool<AnimatorCell> animatorScrollPool;
|
||||
internal List<Animator> animators = new List<Animator>();
|
||||
public Dictionary<Animator, bool> shouldIgnoreMasterToggle = new Dictionary<Animator, bool>();
|
||||
public int ItemCount => animators.Count;
|
||||
|
||||
private static bool DoneScrollPoolInit;
|
||||
@@ -64,7 +65,9 @@ namespace UnityExplorer.UI.Panels
|
||||
masterAnimatorToggle.isOn = true; // Will also trigger "MasterToggleAnimators(true)"
|
||||
animators.Clear();
|
||||
animationEndedFunctions.Clear();
|
||||
shouldIgnoreMasterToggle.Clear();
|
||||
#if MONO
|
||||
// TODO: Move the reset behavior to this panel, because we would only get the cells being currently displayed.
|
||||
foreach (AnimatorCell animatorCell in animatorScrollPool.CellPool)
|
||||
{
|
||||
animatorCell.ResetAnimation();
|
||||
@@ -79,18 +82,30 @@ namespace UnityExplorer.UI.Panels
|
||||
.OrderBy(x=>x.name)
|
||||
.ToList();
|
||||
|
||||
foreach(Animator animator in animators){
|
||||
shouldIgnoreMasterToggle[animator] = animator.gameObject.name.IndexOf("play", 0, StringComparison.OrdinalIgnoreCase) >= 0;
|
||||
}
|
||||
|
||||
animatorScrollPool.Refresh(true, false);
|
||||
}
|
||||
|
||||
public void MasterToggleAnimators(bool enable){
|
||||
// Load animators for the first time if there are not any
|
||||
if (animators.Count == 0) FindAllAnimators();
|
||||
|
||||
foreach (AnimatorCell animatorCell in animatorScrollPool.CellPool)
|
||||
{
|
||||
if (animatorCell.animator != null && !animatorCell.IgnoreMasterToggle.isOn){
|
||||
animatorCell.AnimatorToggle.isOn = enable;
|
||||
}
|
||||
}
|
||||
|
||||
// We gotta do this for the animators which cell are not being currently rendered.
|
||||
foreach (Animator animator in animators){
|
||||
if (!shouldIgnoreMasterToggle[animator]){
|
||||
animator.enabled = enable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HotkeyToggleAnimators(){
|
||||
@@ -146,8 +161,8 @@ namespace UnityExplorer.UI.Panels
|
||||
|
||||
cell.animator = animator;
|
||||
cell.name.text = animator.gameObject.name;
|
||||
cell.IgnoreMasterToggle.isOn = shouldIgnoreMasterToggle[animator];
|
||||
|
||||
cell.MaybeSetIgnoreMasterToggleSet();
|
||||
#if MONO
|
||||
cell.DrawAnimatorPlayer();
|
||||
animationEndedFunctions[animator] = cell.IsPlayingSelectedAnimation;
|
||||
|
||||
@@ -367,7 +367,7 @@ namespace UnityExplorer.UI.Panels
|
||||
$"- {ConfigManager.HUD_Toggle.Value}: HUD toggle\n" +
|
||||
$"- {ConfigManager.Pause.Value}: Pause\n" +
|
||||
$"- {ConfigManager.Frameskip.Value}: Frameskip\n" +
|
||||
$"- {ConfigManager.Toggle_Animations.Value}: Toggle NPC animations";
|
||||
$"- {ConfigManager.Toggle_Animations.Value}: Toggle NPC animations\n";
|
||||
|
||||
if (ConfigManager.Frameskip.Value != KeyCode.None) instructions = instructions + $"- {ConfigManager.Screenshot.Value}: Screenshot\n";
|
||||
|
||||
|
||||
Reference in new issue
Block a user