List Serialization and Editor for Scripts #193

Merged
Pycorax merged 21 commits from SP3-6-ArraySerialization into main 2022-11-13 11:58:06 +08:00
1 changed files with 23 additions and 0 deletions
Showing only changes of commit e8d2179d76 - Show all commits

View File

@ -302,6 +302,29 @@ namespace SHADE
registerUndoAction(object, field, newVal, gameObj); registerUndoAction(object, field, newVal, gameObj);
} }
} }
// Any List
else if (field->FieldType->IsGenericType && field->FieldType->GetGenericTypeDefinition() == System::Collections::Generic::List<int>::typeid->GetGenericTypeDefinition())
{
System::Type^ listType = field->FieldType->GenericTypeArguments[0];
System::Collections::IEnumerable^ listEnummerable = safe_cast<System::Collections::IEnumerable^>(field->GetValue(object));
SHEditorUI::Text(Convert::ToNative(field->Name));
SHEditorUI::SameLine();
SHEditorUI::Button("+");
SHEditorUI::Indent();
int i = 0;
for each (System::Object^ obj in listEnummerable)
{
int val = safe_cast<int>(obj);
SHEditorUI::InputInt(std::to_string(i), val, &isHovered);
SHEditorUI::SameLine();
SHEditorUI::Button("-");
++i;
}
SHEditorUI::Unindent();
}
else else
{ {
array<System::Type^>^ interfaces = field->FieldType->GetInterfaces(); array<System::Type^>^ interfaces = field->FieldType->GetInterfaces();