Repository navigation
Expand file tree
/
Copy pathEditorReplaceable.cs
More file actions
71 lines (57 loc) · 1.72 KB
/
Copy pathEditorReplaceable.cs
File metadata and controls
71 lines (57 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using RPGCore.DataEditor.Manifest;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
namespace RPGCore.DataEditor;
/// <summary>
/// An editable data structure that allows for the type contained within it to be changed.
/// </summary>
public class EditorReplaceable : IEditorToken
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private readonly List<string> comments;
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
private TypeName type;
/// <inheritdoc/>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
public EditorSession Session { get; }
/// <summary>
/// The value contained within this <see cref="EditorReplaceable"/>.
/// </summary>
public IEditorValue Value { get; set; }
/// <summary>
/// A collection of <see cref="IEditorFeature"/>s associated with this <see cref="EditorReplaceable"/>.
/// </summary>
public FeatureCollection<EditorReplaceable> Features { get; }
/// <inheritdoc/>
public IList<string> Comments => comments;
/// <summary>
/// The type that this value can be described with.
/// </summary>
public TypeName Type
{
get => type;
set
{
type = value;
// If our value is no longer valid for the new type.
if (!Session.IsValueOfType(Value, type))
{
}
}
}
/// <inheritdoc/>
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
FeatureCollection IEditorToken.Features => Features;
/// <inheritdoc/>
public event PropertyChangedEventHandler PropertyChanged;
internal EditorReplaceable(EditorSession session, TypeName type, IEditorValue value)
{
Session = session;
Type = type;
Value = value;
comments = new List<string>();
Features = new FeatureCollection<EditorReplaceable>(this);
PropertyChanged = delegate { };
}
}