protected virtual void OnEnable() { if (target == null) { DestroyImmediate(this); return; } _evt = (Flux.FEvent)target; Type evtType = _evt.GetType(); for (int i = 0; i != targets.Length; ++i) { FEvent evt = (FEvent)targets[i]; if (evtType != evt.GetType()) { _allEventsSameType = false; break; } } // _script = serializedObject.FindProperty("m_Script"); if (_allEventsSameType) { _triggerOnSkip = serializedObject.FindProperty("_triggerOnSkip"); } }
protected virtual void OnEnable() { if (target == null) { DestroyImmediate(this); return; } _evt = (Flux.FEvent)target; Type evtType = _evt.GetType(); for (int i = 0; i != targets.Length; ++i) { FEvent evt = (FEvent)targets[i]; if (evtType != evt.GetType()) { _allEventsSameType = false; break; } } }
protected virtual void OnEnable() { if (target == null) { DestroyImmediate(this); return; } _evt = (Flux.FEvent)target; Type evtType = _evt.GetType(); for (int i = 0; i != targets.Length; ++i) { FEvent evt = (FEvent)targets[i]; if (evtType != evt.GetType()) { _allEventsSameType = false; break; } } // _script = serializedObject.FindProperty("m_Script"); _singleFrame = serializedObject.FindProperty("_singleFrame"); if (_allEventsSameType) { _triggerOnSkip = serializedObject.FindProperty("_triggerOnSkip"); } _fields.Clear(); var fields = evtType.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); foreach (var f in fields) { //if (!f.DeclaringType.Equals(evtType)) continue; if (!typeof(FEvent).IsAssignableFrom(evtType)) { continue; } var attributes0 = f.GetCustomAttributes(typeof(FEventField), false); if (attributes0 != null && attributes0.Length > 0) { string alias = (attributes0[0] as FEventField).Name; string tip = (attributes0[0] as FEventField).Tip; SerializedProperty property = serializedObject.FindProperty(f.Name); bool needAddBtn = false; var attributes1 = f.GetCustomAttributes(typeof(FFindPathBtn), false); if (attributes1 != null && attributes1.Length > 0) { needAddBtn = true; } _fields.Add(new FieldDraw() { DisplayName = new GUIContent(alias, tip), Property = property, AddFindBtn = needAddBtn }); } } object[] customAttributes = evtType.GetCustomAttributes(typeof(FEventAttribute), false); if (customAttributes.Length > 0) { _isSingleFrame = ((FEventAttribute)customAttributes[0]).isSingleFrame; } }