using AX.MessageSystem; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; [Serializable] public class SmokeRecordData : RecordObjectBase { public string name; public int value;//浓度 } public class SmokeControl : ObjDoubleClick { public ParticleSystem.MainModule MySmokeMain; private void Awake() { MySmokeMain = GetComponentInChildren().main; } public void Start() { MessageDispatcher.AddListener("ReplayEvent", ReplayEventNongDu); } private void OnDestroy() { MessageDispatcher.RemoveListener("ReplayEvent", ReplayEventNongDu); } private void ReplayEventNongDu(IMessage obj) { var eventData = (EventData)obj.Data; if (eventData.eventType == RecordEventType.SmokeNormal || eventData.eventType == RecordEventType.SmokeInside) { SmokeSettingData data = JsonUtility.FromJson(eventData.json); if (data.name == gameObject.name) { MySmokeMain.maxParticles = data.value * 10; } } } public override void ClickFunc() { base.ClickFunc(); SmokePanel.GetActiveInstance.SetNongDu(gameObject, MySmokeMain.maxParticles / 10); } }