Example #1
0
        /// <summary>
        /// Called when this editor is open.
        /// </summary>
        private void OnEnable()
        {
            // Cleans the registered custom editor extensions of the removed settings.
            MultipleEditorsManager.Clean();

            // Load settings lists, grouped by target name
            foreach (CustomEditorExtensionSettings settings in Target.Settings)
            {
                CustomEditorListGroup group = m_CustomEditors.Find(currentGroup => { return(currentGroup.TargetTypeName == settings.TargetTypeName); });
                if (group == null)
                {
                    group = new CustomEditorListGroup(settings.TargetTypeName);
                    m_CustomEditors.Add(group);
                }
                group.List.Settings.Add(settings);
            }

            // Initialize settings lists
            foreach (CustomEditorListGroup group in m_CustomEditors)
            {
                group.List.Init();
            }

            m_ExpandHelpAnimBool = new AnimBool(m_CustomEditors.Count == 0);
            m_ExpandHelpAnimBool.valueChanged.AddListener(() => { m_RequiresRepaintEvent.Invoke(); });
            m_RequiresRepaintEvent.AddListener(Repaint);
        }
        private void UEventRegisterTest()
        {
            //Register non param
            UEventsManager.Instance.PutUEventInVoidDic(m_VoidEvent, "uv0");
            m_VoidEvent.AddListener(new UnityAction(NonParamInScript));

            //Register one param
            UEventsManager.Instance.PutUEventInVoidDic <string>(m_StringEvent, "uv1");
            m_StringEvent.AddListener(new UnityAction <string>(OneParamInScript));

            print("OLiOUEvent注册成功!!!");
        }
 public static void AddOnce(this VoidEvent thisEvent, UnityAction reciever)
 {
     thisEvent.RemoveListener(reciever);
     thisEvent.AddListener(reciever);
 }