This commit is contained in:
parent
4cd49f43e0
commit
1b66056427
|
@ -1,3 +1,4 @@
|
|||
SXElectricityFaultA&E/Library/
|
||||
SXElectricityFaultA&E/Temp/
|
||||
SXElectricityFaultA&E/Logs/
|
||||
SXElectricityFaultA&E/obj/
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise">
|
||||
<file url="file://$PROJECT_DIR$/Assets/taoruiqi/Script/NPC Dialogue.cs" charset="GBK" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="vcsConfiguration" value="2" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,106 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="68e05636-bf0a-4811-ba8b-ec9ef946e586" name="更改" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/UserSettings/EditorUserSettings.asset" beforeDir="false" afterPath="$PROJECT_DIR$/UserSettings/EditorUserSettings.asset" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
</component>
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"customColor": "",
|
||||
"associatedIndex": 6
|
||||
}]]></component>
|
||||
<component name="ProjectId" id="2iMLc1GQmi4vJB2Y0WRoGjL2uH4" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "SXElectricityFaultA&&E",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"rider.external.source.directories": [
|
||||
"C:\\Users\\PC\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache",
|
||||
"C:\\Users\\PC\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache",
|
||||
"C:\\Users\\PC\\AppData\\Local\\Symbols\\src"
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RunManager" selected="附加到 Unity 编辑器.附加到 Unity 编辑器">
|
||||
<configuration name="启动 Unity" type="RunUnityExe" factoryName="Unity Executable">
|
||||
<option name="EXE_PATH" value="E:\Program Files\Unity 2022.3.22f1\Editor\Unity.exe" />
|
||||
<option name="PROGRAM_PARAMETERS" value="-projectPath "E:\Unity Projects\GitLab\2024\SXElectricityFaultA&E\SXElectricityFaultA&E" -debugCodeOptimization" />
|
||||
<option name="WORKING_DIRECTORY" value="E:\Unity Projects\GitLab\2024\SXElectricityFaultA&E\SXElectricityFaultA&E" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="单元测试(批处理模式)" type="RunUnityExe" factoryName="Unity Executable">
|
||||
<option name="EXE_PATH" value="E:\Program Files\Unity 2022.3.22f1\Editor\Unity.exe" />
|
||||
<option name="PROGRAM_PARAMETERS" value="-runTests -batchmode -projectPath "E:\Unity Projects\GitLab\2024\SXElectricityFaultA&E\SXElectricityFaultA&E" -testResults Logs/results.xml -testPlatform EditMode -debugCodeOptimization" />
|
||||
<option name="WORKING_DIRECTORY" value="E:\Unity Projects\GitLab\2024\SXElectricityFaultA&E\SXElectricityFaultA&E" />
|
||||
<option name="PASS_PARENT_ENVS" value="1" />
|
||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="附加到 Unity 编辑器并运行" type="UNITY_DEBUG_RUN_CONFIGURATION" factoryName="UNITY_ATTACH_AND_PLAY" show_console_on_std_err="false" show_console_on_std_out="false" port="50000" address="localhost">
|
||||
<option name="allowRunningInParallel" value="false" />
|
||||
<option name="listenPortForConnections" value="false" />
|
||||
<option name="pid" />
|
||||
<option name="projectPathOnTarget" />
|
||||
<option name="selectedOptions">
|
||||
<list />
|
||||
</option>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<configuration name="附加到 Unity 编辑器" type="UNITY_DEBUG_RUN_CONFIGURATION" factoryName="Unity Debug" show_console_on_std_err="false" show_console_on_std_out="false" port="50000" address="localhost">
|
||||
<option name="allowRunningInParallel" value="false" />
|
||||
<option name="listenPortForConnections" value="false" />
|
||||
<option name="pid" />
|
||||
<option name="projectPathOnTarget" />
|
||||
<option name="selectedOptions">
|
||||
<list />
|
||||
</option>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="68e05636-bf0a-4811-ba8b-ec9ef946e586" name="更改" comment="" />
|
||||
<created>1719295576132</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1719295576132</updated>
|
||||
<workItem from="1719295579915" duration="339000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="UnityProjectConfiguration" hasMinimizedUI="true" />
|
||||
<component name="UnityProjectDiscoverer">
|
||||
<option name="hasUnityReference" value="true" />
|
||||
<option name="unityProject" value="true" />
|
||||
<option name="unityProjectFolder" value="true" />
|
||||
</component>
|
||||
<component name="UnityUnitTestConfiguration" currentTestLauncher="Both" />
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
||||
</component>
|
||||
</project>
|
|
@ -55,7 +55,6 @@
|
|||
<Compile Include="Assets\HighlightPlus\Scripts\HighlightEffectOccluderManager.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Vehicles\Aircraft\Scripts\AeroplaneControlSurfaceAnimator.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Vehicles\Aircraft\Scripts\LandingGear.cs" />
|
||||
<Compile Include="Assets\Scripts\ProcessMode\AnimationManager.cs" />
|
||||
<Compile Include="Assets\Scripts\ProcessMode\ActionWithDescription.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Utility\DragRigidbody.cs" />
|
||||
<Compile Include="Assets\HighlightPlus\Scripts\HighlightProfile.cs" />
|
||||
|
@ -102,6 +101,7 @@
|
|||
<Compile Include="Assets\Scripts\CharacterEquipWindow\CharacterEquipInfoManager.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Utility\AutoMoveAndRotate.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Utility\LerpControlledBob.cs" />
|
||||
<Compile Include="Assets\Scripts\Anima\AnimationManager.cs" />
|
||||
<Compile Include="Assets\Scripts\ToolsPackSceneManager.cs" />
|
||||
<Compile Include="Assets\Scripts\FaultRecords\FaultRecordManager.cs" />
|
||||
<Compile Include="Assets\Scripts\CharacterEquipWindow\CharacterEquipWindowManager.cs" />
|
||||
|
@ -126,6 +126,7 @@
|
|||
<Compile Include="Assets\Standard Assets 1\Utility\ForcedReset.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Utility\DynamicShadowSettings.cs" />
|
||||
<Compile Include="Assets\Standard Assets 1\Vehicles\Aircraft\Scripts\JetParticleEffect.cs" />
|
||||
<Compile Include="Assets\Scripts\Anima\TweenExtensions.cs" />
|
||||
<Compile Include="Assets\concentrator.cs" />
|
||||
<Compile Include="Assets\Model\Fantastic City Generator\Traffic_Light\Scripts\TrafficLight.cs" />
|
||||
<Compile Include="Assets\StandaloneFileBrowser\IStandaloneFileBrowser.cs" />
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ceb44719256443d389248630d4b6ee72
|
||||
timeCreated: 1719299048
|
|
@ -0,0 +1,138 @@
|
|||
using System.Collections.Generic;
|
||||
using DefaultNamespace.Anima;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace.ProcessMode
|
||||
{
|
||||
public class AnimationManager : MonoBehaviour
|
||||
{
|
||||
// 使用字典存储动画组,以便根据名称查询
|
||||
private Dictionary<string, Sequence> animationGroupsByName = new Dictionary<string, Sequence>();
|
||||
private List<Sequence> animationGroups = new List<Sequence>(); // 存储动画组的列表
|
||||
private int currentGroupIndex = -1; // 当前播放的动画组索引
|
||||
private bool isPlaying = false; // 是否正在播放动画
|
||||
|
||||
// 添加动画组并指定组名,接受带回调的 Lambda 表达式
|
||||
public void AddAnimationGroup(string groupName, System.Action<Sequence> sequenceCallback)
|
||||
{
|
||||
Sequence group = DOTween.Sequence(); // 创建一个新的Sequence
|
||||
|
||||
// 调用传入的 Lambda 表达式,允许用户定义序列的内容
|
||||
sequenceCallback?.Invoke(group);
|
||||
|
||||
group.Pause(); // 初始状态暂停
|
||||
animationGroups.Add(group); // 将Sequence添加到列表中
|
||||
animationGroupsByName[groupName] = group; // 将Sequence添加到字典中,以组名为键
|
||||
}
|
||||
|
||||
// 根据名称播放动画组
|
||||
public void PlayAnimationGroup(string groupName)
|
||||
{
|
||||
// 检查是否存在该名称的动画组
|
||||
if (!animationGroupsByName.ContainsKey(groupName))
|
||||
{
|
||||
Debug.LogError($"找不到动画组 '{groupName}'");
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果正在播放其他动画组,先完成当前组
|
||||
if (isPlaying)
|
||||
{
|
||||
Debug.Log("当前正在播放,将先完成当前组。");
|
||||
CompleteCurrentGroup();
|
||||
}
|
||||
|
||||
currentGroupIndex = -1; // 重置当前组索引(因为是按名称播放)
|
||||
isPlaying = true; // 设置正在播放标志
|
||||
PlayCurrentGroup(groupName); // 播放指定名称的动画组
|
||||
}
|
||||
|
||||
// 根据索引播放动画组
|
||||
public void PlayAnimationGroup(int groupIndex)
|
||||
{
|
||||
// 检查索引是否有效
|
||||
if (groupIndex < 0 || groupIndex >= animationGroups.Count)
|
||||
{
|
||||
Debug.LogError($"无效的组索引: {groupIndex}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果正在播放其他动画组,先完成当前组
|
||||
if (isPlaying)
|
||||
{
|
||||
Debug.Log("当前正在播放,将先完成当前组。");
|
||||
CompleteCurrentGroup();
|
||||
}
|
||||
|
||||
currentGroupIndex = groupIndex; // 设置当前播放的组索引
|
||||
isPlaying = true; // 设置正在播放标志
|
||||
PlayCurrentGroup(); // 播放当前组
|
||||
}
|
||||
|
||||
// 播放指定名称的动画组
|
||||
private void PlayCurrentGroup(string groupName)
|
||||
{
|
||||
Sequence currentGroup = animationGroupsByName[groupName]; // 获取指定名称的动画组
|
||||
Debug.Log($"正在播放动画组 '{groupName}'");
|
||||
currentGroup.OnComplete(OnGroupComplete).Restart(); // 在完成时触发回调,并重新播放动画组
|
||||
}
|
||||
|
||||
// 播放当前索引指定的动画组
|
||||
private void PlayCurrentGroup()
|
||||
{
|
||||
Sequence currentGroup = animationGroups[currentGroupIndex]; // 获取当前索引的动画组
|
||||
Debug.Log($"正在播放动画组 {currentGroupIndex}");
|
||||
currentGroup.OnComplete(OnGroupComplete).Restart(); // 在完成时触发回调,并重新播放动画组
|
||||
}
|
||||
|
||||
// 动画组播放完成时的回调
|
||||
private void OnGroupComplete()
|
||||
{
|
||||
if (currentGroupIndex >= 0 && currentGroupIndex < animationGroups.Count)
|
||||
{
|
||||
Debug.Log($"动画组 {currentGroupIndex} 播放完成");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("动画组播放完成");
|
||||
}
|
||||
|
||||
isPlaying = false; // 设置播放完成标志
|
||||
}
|
||||
|
||||
// 完成当前正在播放的动画组
|
||||
private void CompleteCurrentGroup()
|
||||
{
|
||||
if (currentGroupIndex >= 0 && currentGroupIndex < animationGroups.Count)
|
||||
{
|
||||
Sequence currentGroup = animationGroups[currentGroupIndex]; // 获取当前组
|
||||
currentGroup.Complete(true); // 完成当前组的播放
|
||||
|
||||
currentGroupIndex = -1; // 重置当前组索引
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("没有有效的组可以完成。");
|
||||
}
|
||||
|
||||
isPlaying = false; // 设置播放完成标志
|
||||
}
|
||||
|
||||
// 重置当前正在播放的动画组
|
||||
private void ResetCurrentGroup()
|
||||
{
|
||||
if (currentGroupIndex >= 0 && currentGroupIndex < animationGroups.Count)
|
||||
{
|
||||
Sequence currentGroup = animationGroups[currentGroupIndex]; // 获取当前组
|
||||
currentGroup.ResetSequence(); // 重置当前组的播放状态
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("没有有效的组可以重置。");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
|
||||
namespace DefaultNamespace.Anima
|
||||
{
|
||||
public static class TweenExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 添加一个Tween到Sequence中,并返回自身以支持链式调用
|
||||
/// </summary>
|
||||
/// <param name="sequence">要添加到的Sequence</param>
|
||||
/// <param name="tween">要添加的Tween</param>
|
||||
/// <returns>返回自身以支持链式调用</returns>
|
||||
public static Sequence AppendTween(this Sequence sequence, Tween tween)
|
||||
{
|
||||
return sequence.Append(tween);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加入一个Tween到Sequence中,并返回自身以支持链式调用
|
||||
/// </summary>
|
||||
/// <param name="sequence">要添加到的Sequence</param>
|
||||
/// <param name="tween">要添加的Tween</param>
|
||||
/// <returns>返回自身以支持链式调用</returns>
|
||||
public static Sequence JoinTween(this Sequence sequence, Tween tween)
|
||||
{
|
||||
return sequence.Join(tween);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将多个Tween依次加入Sequence中,并返回自身以支持链式调用
|
||||
/// </summary>
|
||||
/// <param name="sequence">要添加到的Sequence</param>
|
||||
/// <param name="tweens">要添加的Tween数组</param>
|
||||
/// <returns>返回自身以支持链式调用</returns>
|
||||
public static Sequence AppendTweens(this Sequence sequence, params Tween[] tweens)
|
||||
{
|
||||
foreach (var tween in tweens)
|
||||
{
|
||||
sequence.Append(tween);
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将多个Tween依次加入Sequence中,并返回自身以支持链式调用
|
||||
/// </summary>
|
||||
/// <param name="sequence">要添加到的Sequence</param>
|
||||
/// <param name="tweens">要添加的Tween列表</param>
|
||||
/// <returns>返回自身以支持链式调用</returns>
|
||||
public static Sequence AppendTweens(this Sequence sequence, List<Tween> tweens)
|
||||
{
|
||||
foreach (var tween in tweens)
|
||||
{
|
||||
sequence.Append(tween);
|
||||
}
|
||||
return sequence;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置Sequence并返回自身以支持链式调用
|
||||
/// </summary>
|
||||
/// <param name="sequence">要重置的Sequence</param>
|
||||
/// <returns>返回自身以支持链式调用</returns>
|
||||
public static Sequence ResetSequence(this Sequence sequence)
|
||||
{
|
||||
sequence.Rewind();
|
||||
return sequence;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 75ea2db5a2804847aa39c948efeec118
|
||||
timeCreated: 1719299055
|
|
@ -1,170 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace.ProcessMode
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace.ProcessMode
|
||||
{
|
||||
// public class TweenWrapper
|
||||
// {
|
||||
// public Tween Tween { get; private set; }
|
||||
// public Action OnCompleteAction { get; private set; }
|
||||
//
|
||||
// public TweenWrapper(Tween tween, Action onCompleteAction)
|
||||
// {
|
||||
// Tween = tween;
|
||||
// OnCompleteAction = onCompleteAction;
|
||||
// }
|
||||
//
|
||||
// public void Play()
|
||||
// {
|
||||
// Tween.Restart();
|
||||
// Tween.OnComplete(() => OnCompleteAction?.Invoke());
|
||||
// }
|
||||
//
|
||||
// public void Complete(bool withCallbacks = false)
|
||||
// {
|
||||
// if (withCallbacks && OnCompleteAction != null)
|
||||
// {
|
||||
// OnCompleteAction.Invoke();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsCompleted()
|
||||
// {
|
||||
// return Tween.IsComplete();
|
||||
// }
|
||||
//
|
||||
// public void Reset()
|
||||
// {
|
||||
// Tween.Rewind();
|
||||
// }
|
||||
// }
|
||||
|
||||
public class AnimationManager : MonoBehaviour
|
||||
{
|
||||
private List<List<Tween>> animationGroups = new List<List<Tween>>();
|
||||
private int currentGroupIndex = -1;
|
||||
private int currentTweenIndex = -1;
|
||||
private bool isPlaying = false;
|
||||
|
||||
public void AddAnimationGroup(List<Tween> group)
|
||||
{
|
||||
animationGroups.Add(group);
|
||||
}
|
||||
|
||||
public void PlayAnimationGroup(int groupIndex)
|
||||
{
|
||||
Debug.Log($"尝试播放动画组 {groupIndex}");
|
||||
|
||||
if (groupIndex < 0 || groupIndex >= animationGroups.Count)
|
||||
{
|
||||
Debug.LogError("无效的组索引");
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.Log("PlayAnimationGroup 调用的索引: " + groupIndex);
|
||||
|
||||
if (isPlaying)
|
||||
{
|
||||
Debug.Log("当前正在播放,将先完成当前组。");
|
||||
CompleteCurrentGroup();
|
||||
}
|
||||
|
||||
if (groupIndex == currentGroupIndex && animationGroups[currentGroupIndex][0].IsComplete())
|
||||
{
|
||||
Debug.Log("动画已完成,重新播放。");
|
||||
ResetCurrentGroup();
|
||||
}
|
||||
|
||||
currentGroupIndex = groupIndex;
|
||||
currentTweenIndex = 0;
|
||||
isPlaying = true;
|
||||
PlayNextTween();
|
||||
}
|
||||
|
||||
private void PlayNextTween()
|
||||
{
|
||||
if (currentGroupIndex < 0 || currentGroupIndex >= animationGroups.Count)
|
||||
{
|
||||
Debug.LogWarning("没有有效的组可播放。");
|
||||
isPlaying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
List<Tween> currentGroup = animationGroups[currentGroupIndex];
|
||||
|
||||
if (currentTweenIndex < 0 || currentTweenIndex >= currentGroup.Count)
|
||||
{
|
||||
Debug.LogWarning("当前组中没有有效的动画可播放。");
|
||||
isPlaying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Tween tweenWrapper = currentGroup[currentTweenIndex];
|
||||
Debug.Log($"正在播放组 {currentGroupIndex} 中的动画 {currentTweenIndex}");
|
||||
tweenWrapper.OnComplete(OnTweenComplete).Play();
|
||||
}
|
||||
|
||||
private void OnTweenComplete()
|
||||
{
|
||||
Debug.Log($"动画 {currentTweenIndex} 完成");
|
||||
animationGroups[currentGroupIndex][currentTweenIndex].onComplete.Invoke();
|
||||
currentTweenIndex++;
|
||||
|
||||
if (currentTweenIndex >= animationGroups[currentGroupIndex].Count)
|
||||
{
|
||||
Debug.Log("已完成当前组中的所有动画。");
|
||||
isPlaying = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayNextTween();
|
||||
}
|
||||
}
|
||||
|
||||
private void CompleteCurrentGroup()
|
||||
{
|
||||
if (currentGroupIndex < 0 || currentGroupIndex >= animationGroups.Count)
|
||||
{
|
||||
Debug.LogWarning("没有有效的组可完成。");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Tween> currentGroup = animationGroups[currentGroupIndex];
|
||||
for (int i = currentTweenIndex; i < currentGroup.Count; i++)
|
||||
{
|
||||
Debug.Log($"正在完成组 {currentGroupIndex} 中的动画 {i}");
|
||||
currentGroup[i].Complete(true);
|
||||
// currentGroup[i].OnCompleteAction?.Invoke(); // 手动触发 OnCompleteAction
|
||||
}
|
||||
|
||||
currentGroupIndex = -1;
|
||||
currentTweenIndex = -1;
|
||||
isPlaying = false;
|
||||
}
|
||||
|
||||
private void ResetCurrentGroup()
|
||||
{
|
||||
if (currentGroupIndex < 0 || currentGroupIndex >= animationGroups.Count)
|
||||
{
|
||||
Debug.LogWarning("没有有效的组可重置。");
|
||||
return;
|
||||
}
|
||||
|
||||
List<Tween> currentGroup = animationGroups[currentGroupIndex];
|
||||
foreach (var tweenWrapper in currentGroup)
|
||||
{
|
||||
tweenWrapper.Rewind();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using DefaultNamespace.ProcessMode;
|
||||
using DefaultNamespace.ProcessMode.DefaultNamespace.ProcessMode;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -10,21 +8,24 @@ namespace DefaultNamespace
|
|||
{
|
||||
private AnimationManager animationManager;
|
||||
|
||||
public GameObject[] ggg;
|
||||
|
||||
void Start()
|
||||
{
|
||||
animationManager = gameObject.AddComponent<AnimationManager>();
|
||||
|
||||
List<Tween> group3 = new List<Tween>
|
||||
// 创建并添加动画组 "Group1"
|
||||
animationManager.AddAnimationGroup("123", seq =>
|
||||
{
|
||||
transform.DOMove(new Vector3(7, 2, 0), 1).SetAutoKill(false).Pause().OnComplete(() => Debug.Log("3_1")),
|
||||
transform.DOMove(new Vector3(7, 2, 0), 1).SetAutoKill(false).Pause().OnComplete(() => Debug.Log("3_1")),
|
||||
transform.DOMove(new Vector3(7, 2, 0), 1).SetAutoKill(false).Pause().OnComplete(() => Debug.Log("3_1")),
|
||||
};
|
||||
animationManager.AddAnimationGroup(group3);
|
||||
seq.Append(transform.DOMove(new Vector3(3, 0, 0), 1))
|
||||
.Join(transform.DORotate(new Vector3(0, 90, 0), 1))
|
||||
.Join(transform.DOScale(new Vector3(3, 3, 3), 1));
|
||||
|
||||
Debug.Log("开始播放第一个动画组");
|
||||
seq.Append(transform.DOMove(new Vector3(6, 0, 0), 1));
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Debug.Log("动画组已添加");
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
@ -32,7 +33,7 @@ namespace DefaultNamespace
|
|||
if (Input.GetKeyDown(KeyCode.A))
|
||||
{
|
||||
Debug.Log("按下A");
|
||||
animationManager.PlayAnimationGroup(0);
|
||||
animationManager.PlayAnimationGroup("123");
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.B))
|
||||
|
@ -40,12 +41,6 @@ namespace DefaultNamespace
|
|||
Debug.Log("按下B");
|
||||
animationManager.PlayAnimationGroup(1);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C))
|
||||
{
|
||||
Debug.Log("按下空格键");
|
||||
animationManager.PlayAnimationGroup(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,5 +4,14 @@
|
|||
EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes: []
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/Start.unity
|
||||
guid: a16f959528dc20c439c9a8f5f7065755
|
||||
- enabled: 1
|
||||
path: "Assets/Scenes/\u73B0\u573A _Test.unity"
|
||||
guid: 4108ee5a75cc45f4dbd6f2342a9936e0
|
||||
- enabled: 1
|
||||
path: "Assets/Scenes/\u5DE5\u5177\u95F4Scenes/\u5DE5\u5177\u95F4.unity"
|
||||
guid: a69e8c26c38855643a35005a2b9dcb4e
|
||||
m_configObjects: {}
|
||||
|
|
|
@ -644,7 +644,24 @@ PlayerSettings:
|
|||
webGLMemoryGeometricGrowthStep: 0.2
|
||||
webGLMemoryGeometricGrowthCap: 96
|
||||
webGLPowerPreference: 2
|
||||
scriptingDefineSymbols: {}
|
||||
scriptingDefineSymbols:
|
||||
Android: CROSS_PLATFORM_INPUT;MOBILE_INPUT;DOTWEEN
|
||||
EmbeddedLinux: DOTWEEN
|
||||
GameCoreScarlett: DOTWEEN
|
||||
GameCoreXboxOne: DOTWEEN
|
||||
LinuxHeadlessSimulation: DOTWEEN
|
||||
Nintendo Switch: DOTWEEN
|
||||
PS4: DOTWEEN
|
||||
PS5: DOTWEEN
|
||||
QNX: DOTWEEN
|
||||
Stadia: DOTWEEN
|
||||
Standalone: CROSS_PLATFORM_INPUT;DOTWEEN
|
||||
VisionOS: DOTWEEN
|
||||
WebGL: DOTWEEN
|
||||
Windows Store Apps: DOTWEEN
|
||||
XboxOne: DOTWEEN
|
||||
iPhone: CROSS_PLATFORM_INPUT;MOBILE_INPUT;DOTWEEN
|
||||
tvOS: DOTWEEN
|
||||
additionalCompilerArguments: {}
|
||||
platformArchitecture: {}
|
||||
scriptingBackend: {}
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
{
|
||||
"templatePinStates": [],
|
||||
"dependencyTypeInfos": [
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.AnimationClip",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.Animations.AnimatorController",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.AnimatorOverrideController",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.Audio.AudioMixerController",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.ComputeShader",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Cubemap",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.GameObject",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.LightingDataAsset",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.LightingSettings",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Material",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.MonoScript",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.PhysicMaterial",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.PhysicsMaterial2D",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Rendering.VolumeProfile",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEditor.SceneAsset",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Shader",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.ShaderVariantCollection",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Texture",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Texture2D",
|
||||
"defaultInstantiationMode": 0
|
||||
},
|
||||
{
|
||||
"userAdded": false,
|
||||
"type": "UnityEngine.Timeline.TimelineAsset",
|
||||
"defaultInstantiationMode": 0
|
||||
}
|
||||
],
|
||||
"defaultDependencyTypeInfo": {
|
||||
"userAdded": false,
|
||||
"type": "<default_scene_template_dependencies>",
|
||||
"defaultInstantiationMode": 1
|
||||
},
|
||||
"newSceneOverride": 0
|
||||
}
|
|
@ -8,6 +8,12 @@ EditorUserSettings:
|
|||
RecentlyUsedSceneGuid-0:
|
||||
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-1:
|
||||
value: 020002005c00500e5f56082142735c44454e1b732d7020652b7e4d65b7b7616d
|
||||
flags: 0
|
||||
RecentlyUsedSceneGuid-2:
|
||||
value: 5700045e00505c5a5a5b0f214476594412151c7c2a7a75647f28446ab1b63168
|
||||
flags: 0
|
||||
vcSharedLogLevel:
|
||||
value: 0d5e400f0650
|
||||
flags: 0
|
||||
|
|
Loading…
Reference in New Issue