Assets/Editor/ScriptEditor/TestSkillActionEditorWindow.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/Launch/Common/LogicEngine.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Assets/Editor/ScriptEditor/TestSkillActionEditorWindow.cs
@@ -7,6 +7,10 @@ protected int skillId = 1; protected int hurtIndex = 0; protected int effectId = 0; protected BattleEffectPlayer effectPlayer; [MenuItem("Battle/TestSkillAction生成器")] public static void ShowWindow() { @@ -19,6 +23,8 @@ skillId = EditorGUILayout.IntField("Skill ID", skillId); hurtIndex = EditorGUILayout.IntField("Hurt Index", hurtIndex); effectId = EditorGUILayout.IntField("Effect ID", effectId); if (GUILayout.Button("生成并播放 TestSkillAction")) { @@ -29,6 +35,41 @@ { ResetRecordPlayer(); } if (GUILayout.Button("展示特效")) { } } protected void ShowEffect() { if (effectId <= 0) { Debug.LogWarning("Effect ID 必须大于0"); return; } if (EffectConfig.Get(effectId) == null) { Debug.LogWarning($"Effect ID {effectId} 在配置表中不存在"); return; } HomeWin homeWin = UIManager.Instance.GetUI<HomeWin>(); effectPlayer = BattleEffectPlayer.Create(effectId, homeWin.transform); effectPlayer.Play(); } protected void DestroyEffect() { if (effectPlayer != null) { effectPlayer.Stop(); GameObject.DestroyImmediate(effectPlayer.gameObject); effectPlayer = null; } } private void PlayTestSkillAction() Assets/Launch/Common/LogicEngine.cs
@@ -1,49 +1,64 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using System; public class LogicEngine : SingletonMonobehaviour<LogicEngine> { public Action OnUpdate; public class LogicEngine : SingletonMonobehaviour<LogicEngine> List<LogicUpdate> logicUpdates = new List<LogicUpdate>(); public void Register(LogicUpdate logicUpdate) { List<LogicUpdate> logicUpdates = new List<LogicUpdate>(); public void Register(LogicUpdate logicUpdate) if (!logicUpdates.Contains(logicUpdate)) { if (!logicUpdates.Contains(logicUpdate)) logicUpdates.Add(logicUpdate); } } public void UnRegister(LogicUpdate logicUpdate) { if (logicUpdates.Contains(logicUpdate)) { logicUpdates.Remove(logicUpdate); } } void Update() { if (null != OnUpdate) { try { logicUpdates.Add(logicUpdate); OnUpdate(); } catch (System.Exception ex) { Debug.LogError(ex); } } public void UnRegister(LogicUpdate logicUpdate) for (var i = logicUpdates.Count - 1; i >= 0; i--) { if (logicUpdates.Contains(logicUpdate)) var item = logicUpdates[i]; if (item.destroyDirty) { logicUpdates.Remove(logicUpdate); logicUpdates.RemoveAt(i); } } void Update() { for (var i = logicUpdates.Count - 1; i >= 0; i--) else { var item = logicUpdates[i]; if (item.destroyDirty) try { logicUpdates.RemoveAt(i); item.Update(); } else catch (System.Exception ex) { try { item.Update(); } catch (System.Exception ex) { Debug.LogError(ex); } Debug.LogError(ex); } } } } } }