protected override void OnRegisterClass(System.Object container, Type type) { if (container == null) { return; } if (!type.IsSubclassOf(typeof(EWMsgBoxCustomDrawer))) { return; } System.Object[] atts = type.GetCustomAttributes(typeof(EWMsgBoxHandleAttribute), false); for (int i = 0; i < atts.Length; i++) { EWMsgBoxHandleAttribute att = (EWMsgBoxHandleAttribute)atts[i]; if (att == null) { continue; } if (att.targetType != container.GetType()) { continue; } EWMsgBoxCustomDrawer drawer = (EWMsgBoxCustomDrawer)System.Activator.CreateInstance(type); if (drawer == null) { continue; } drawer.SetContainer(container); drawer.closeAction = HideMsgBox; AddMsgBox(att.id, drawer); } }
public EWMsgBoxObjectDrawer(EWMsgBoxCustomDrawer drawer) { m_Drawer = drawer; if (m_Drawer == null) { return; } string id = GetID(); if (EditorPrefsEx.HasKey(id)) { var obj = EditorPrefsEx.GetObject(id, drawer.GetType()); if (obj != null) { drawer = (EWMsgBoxCustomDrawer)obj; drawer.SetContainer(this.m_Drawer.Container); drawer.closeAction = this.m_Drawer.closeAction; this.m_Drawer = drawer; } } }