/// <summary> /// Initializes the control with the inspector property it is for and the current value. /// </summary> /// <param name="inspectorProperty">Inspector property the control is for.</param> /// <param name="editorContext">Editor context this control lives in.</param> /// <param name="localizationContext">Context used for showing and changing localized attribute values.</param> /// <param name="currentValue">Current value.</param> /// <param name="valueInherited">Indicates if the current value was inherited.</param> public virtual void Init(InspectorPropertyAttribute inspectorProperty, EditorContext editorContext, LocalizationContext localizationContext, object currentValue, bool valueInherited) { // Setup data context of control. this.dataContext = new InspectorPropertyData(inspectorProperty, localizationContext) { EditorContext = editorContext, Value = currentValue, ValueInherited = valueInherited }; this.dataContext.ValueChanged += this.OnValueChanged; this.DataContext = this.dataContext; }
/// <summary> /// Constructor. /// </summary> public EditorContext() { this.blueprintManagerSerializer = new XmlSerializer(typeof(BlueprintManager)); this.projectSettingsSerializer = new XmlSerializer(typeof(ProjectSettings)); this.editorSettingsSerializer = new XmlSerializer(typeof(EditorSettings)); this.localizationContext = new LocalizationContext(this); this.AvailableLanguages = new ObservableCollection <string>(); this.editorSettings = new EditorSettings(); this.SetAvailableLanguages(new List <string>()); this.LoadEditorSettings(); }
public override void Init( InspectorPropertyAttribute inspectorProperty, EditorContext editorContext, LocalizationContext localizationContext, object currentValue, bool valueInherited) { base.Init(inspectorProperty, editorContext, localizationContext, currentValue, valueInherited); // Disable for localized strings. // TODO(np): Enable editing while not showing RAW values. var stringProperty = inspectorProperty as InspectorStringAttribute; if (stringProperty != null && stringProperty.Localized) { this.IsEnabled = false; } }
public InspectorPropertyData( InspectorPropertyAttribute inspectorProperty, LocalizationContext localizationContext) { this.inspectorProperty = inspectorProperty; // Check for localized attribute. var stringProperty = this.inspectorProperty as InspectorStringAttribute; if (stringProperty != null && stringProperty.Localized) { this.localizationContext = localizationContext; if (this.localizationContext != null) { this.localizationContext.ProjectLanguageChanged += this.OnProjectLanguageChanged; } } }
/// <summary> /// Constructor. /// </summary> public EditorContext() { this.blueprintManagerSerializer = new XmlSerializer(typeof(BlueprintManager)); this.projectSettingsSerializer = new XmlSerializer(typeof(ProjectSettings)); this.editorSettingsSerializer = new XmlSerializer(typeof(EditorSettings)); this.localizationContext = new LocalizationContext(this); this.AvailableLanguages = new ObservableCollection<string>(); this.editorSettings = new EditorSettings(); this.SetAvailableLanguages(new List<string>()); this.LoadEditorSettings(); }
/// <summary> /// Constructs a new factory for creating inspector controls. /// </summary> /// <param name="editorContext">Editor context the controls live in.</param> /// <param name="localizationContext">Context for localizing inspector values. <c>null</c> renders created controls unable to localize values.</param> public InspectorFactory(EditorContext editorContext, LocalizationContext localizationContext) { this.editorContext = editorContext; this.localizationContext = localizationContext; }