static public void BindCustomProperties(Type dialogueNodeType, string customPropertiesName, Type customPropertiesType, Type formType) { CustomPropertiesSlot slot = new CustomPropertiesSlot(); slot.DialogueNodeType = dialogueNodeType; slot.CustomPropertiesName = customPropertiesName; slot.CustomPropertiesType = customPropertiesType; slot.FormType = formType; slot.AddOnEveryNode = true; BindCustomProperties(slot); }
static public void BindCustomProperties(CustomPropertiesSlot slot) { if (!slot.DialogueNodeType.IsSubclassOf(typeof(DialogueNode))) { System.Diagnostics.Debug.Fail("BindCustomProperties : Invalid dialogue node type provided, please use a subclass of DialogueNode."); return; } if (slot.CustomPropertiesType != null && !slot.CustomPropertiesType.IsSubclassOf(typeof(NodeCustomProperties))) { System.Diagnostics.Debug.Fail("BindCustomProperties : Invalid custom properties type provided, please use a subclass of NodeCustomProperties."); return; } if (slot.FormType != null && (!typeof(IFormProperties).IsAssignableFrom(slot.FormType) || !slot.FormType.IsSubclassOf(typeof(UserControl)))) { System.Diagnostics.Debug.Fail("BindCustomProperties : Invalid properties form type provided, please use a subclass of IFormProperties + UserControl."); return; } if (slot.CustomPropertiesType == null && slot.FormType == null) { System.Diagnostics.Debug.Fail("BindCustomProperties : Please provide either a CustomProperties type or a Form type."); return; } if (EditorCore.CustomProperties == null) { EditorCore.CustomProperties = new PanelCustomProperties(); } if (slot.CustomPropertiesType != null) { SerializationBinder.AddBinding(slot.CustomPropertiesName, slot.CustomPropertiesType); } CustomPropertiesSlots.Add(slot); }