Implementation of inspection system
A mostly complete implementation of the inspection system.
See ExampleInspectable.cs
for an example.
Try it in-game by clicking on the sphere added for testing.
Features:
- Different types of properties (
string
,int
,float
atm, easily extendable for any type implementingIFormattable
andIConvertible
) - Properties can be editable (if
isEditable
is set to true).
In this case, a they will be displayed differently in-game, with appropriate restrictions on the entered value. (eg.: only digits for integers) - Any change in property values is reflected in the view.
- Commands put buttons on the inspector panel. They can have any number of
object
arguments and return anobject
.
Although this circumvents the type system, a method signature can be provided for run-time type checking. - A Command might not be available at any moment, this is implemented with the
CanExecute
property.
Notes:
- I choose objects for commands in order to significantly reduce code repetition. I don't think generics could help because of commands with different number of arguments.
- There are some
TODO: change sg. to internal
comments in the code.
I left those in because otherwise the example wouldn't compile.
We can change those access specifiers to internal in a future refactoring once the system is in place and working.