using System; using System.Collections.Generic; using UnityEngine; namespace MU3 { // Token: 0x0200073B RID: 1851 public class MotionEffectManager : MonoBehaviour { // Token: 0x06002FC3 RID: 12227 RVA: 0x000FE8E8 File Offset: 0x000FE8E8 public void copyFrom(MotionEffectManager src) { this._effectDefines = new MotionEffectDefine[src._effectDefines.Length]; for (int i = 0; i < src._effectDefines.Length; i++) { this._effectDefines[i] = new MotionEffectDefine(); this._effectDefines[i].copyFrom(src._effectDefines[i]); } this._attachmentEffectDefinesList = new MotionEffectDefineList[src._attachmentEffectDefinesList.Length]; for (int j = 0; j < src._attachmentEffectDefinesList.Length; j++) { MotionEffectDefine[] effectDefines = src._attachmentEffectDefinesList[j].EffectDefines; for (int k = 0; k < effectDefines.Length; k++) { this._attachmentEffectDefinesList[j].EffectDefines[k] = new MotionEffectDefine(); this._attachmentEffectDefinesList[j].EffectDefines[k].copyFrom(effectDefines[k]); } } } // Token: 0x17000706 RID: 1798 // (set) Token: 0x06002FC4 RID: 12228 RVA: 0x000FE9BC File Offset: 0x000FE9BC public bool isAttached { set { this._isAttached = value; } } // Token: 0x17000707 RID: 1799 // (set) Token: 0x06002FC5 RID: 12229 RVA: 0x000FE9C8 File Offset: 0x000FE9C8 public int attachmentMotionIndex { set { this._attachmentMotionIndex = value; } } // Token: 0x06002FC6 RID: 12230 RVA: 0x000FE9D4 File Offset: 0x000FE9D4 private void Start() { this.initialize(); } // Token: 0x06002FC7 RID: 12231 RVA: 0x000FE9DC File Offset: 0x000FE9DC private void LateUpdate() { this._removeInstanceNameList.Clear(); foreach (KeyValuePair keyValuePair in this._effectInstanceDictionary) { keyValuePair.Value.execute(); if (keyValuePair.Value.isDestroyed) { this._removeInstanceNameList.Add(keyValuePair.Key); } } foreach (string key in this._removeInstanceNameList) { this._effectInstanceDictionary.Remove(key); } } // Token: 0x06002FC8 RID: 12232 RVA: 0x000FEABC File Offset: 0x000FEABC public void TriggerEffect(string text) { if (text.StartsWith("Start")) { string name = text.Substring(this.CommandStartLength); this.startEffect(name); } else if (text.StartsWith("End")) { string key = text.Substring(this.CommandEndLength); MotionEffectInstance motionEffectInstance; if (this._effectInstanceDictionary.TryGetValue(key, out motionEffectInstance)) { motionEffectInstance.stop(); } } else if (text.StartsWith("Destroy")) { string key2 = text.Substring(this.CommandDestroyLength); MotionEffectInstance motionEffectInstance2; if (this._effectInstanceDictionary.TryGetValue(key2, out motionEffectInstance2)) { motionEffectInstance2.destroy(); } } else { this.startEffect(text); } } // Token: 0x06002FC9 RID: 12233 RVA: 0x000FEB70 File Offset: 0x000FEB70 public void initialize() { this._effectDefineDictionary = new Dictionary(); MotionEffectDefine[] array; if (!this._isAttached) { array = this._effectDefines; } else { MotionEffectDefine[] array2 = (this._attachmentEffectDefinesList.Length <= 0) ? null : this._attachmentEffectDefinesList[this._attachmentMotionIndex].EffectDefines; if (array2 == null || array2.Length < 1) { array = this._effectDefines; } else { array = array2; } } if (array == null) { array = new MotionEffectDefine[0]; } foreach (MotionEffectDefine motionEffectDefine in array) { motionEffectDefine.initialize(); if (!string.IsNullOrEmpty(motionEffectDefine.name)) { this._effectDefineDictionary.Add(motionEffectDefine.name, motionEffectDefine); } } this._effectInstanceDictionary = new Dictionary(); this._removeInstanceNameList = new List(); } // Token: 0x06002FCA RID: 12234 RVA: 0x000FEC54 File Offset: 0x000FEC54 private MotionEffectInstance createEffect(MotionEffectDefine effectDefine) { MotionEffectInstance motionEffectInstance = MotionEffectInstance.create(effectDefine); if (motionEffectInstance != null) { if (effectDefine.isSingleton) { foreach (KeyValuePair keyValuePair in this._effectInstanceDictionary) { if (keyValuePair.Value != null && keyValuePair.Value.effectDefine.isSingleton) { keyValuePair.Value.destroy(); } } } if (effectDefine.isSingletonName) { foreach (KeyValuePair keyValuePair2 in this._effectInstanceDictionary) { if (keyValuePair2.Value != null && keyValuePair2.Value.effectDefine.nameHash == effectDefine.nameHash) { keyValuePair2.Value.destroy(); } } } MotionEffectInstance value; if (this._effectInstanceDictionary.TryGetValue(effectDefine.name, out value)) { this._effectInstanceDictionary.Remove(effectDefine.name); string key = effectDefine.name + this._copyIndex.ToString("000"); this._effectInstanceDictionary.Add(key, value); this._copyIndex++; } this._effectInstanceDictionary.Add(effectDefine.name, motionEffectInstance); } return motionEffectInstance; } // Token: 0x06002FCB RID: 12235 RVA: 0x000FEDEC File Offset: 0x000FEDEC private void startEffect(string name) { MotionEffectDefine effectDefine; if (this._effectDefineDictionary.TryGetValue(name, out effectDefine)) { MotionEffectInstance motionEffectInstance = this.createEffect(effectDefine); if (motionEffectInstance != null) { motionEffectInstance.play(); } } } // Token: 0x0400553F RID: 21823 [SerializeField] private MotionEffectDefine[] _effectDefines; // Token: 0x04005540 RID: 21824 [SerializeField] private MotionEffectDefineList[] _attachmentEffectDefinesList; // Token: 0x04005541 RID: 21825 private const string CommandStart = "Start"; // Token: 0x04005542 RID: 21826 private const string CommandEnd = "End"; // Token: 0x04005543 RID: 21827 private const string CommandDestroy = "Destroy"; // Token: 0x04005544 RID: 21828 private int CommandStartLength = "Start".Length; // Token: 0x04005545 RID: 21829 private int CommandEndLength = "End".Length; // Token: 0x04005546 RID: 21830 private int CommandDestroyLength = "Destroy".Length; // Token: 0x04005547 RID: 21831 private Dictionary _effectDefineDictionary; // Token: 0x04005548 RID: 21832 private Dictionary _effectInstanceDictionary; // Token: 0x04005549 RID: 21833 private List _removeInstanceNameList; // Token: 0x0400554A RID: 21834 private int _copyIndex; // Token: 0x0400554B RID: 21835 private bool _isAttached; // Token: 0x0400554C RID: 21836 private int _attachmentMotionIndex = -1; } }