diff --git a/Editor/src/Windows/EditorSelectionPanel.cpp b/Editor/src/Windows/EditorSelectionPanel.cpp index 0107e652..5054a483 100644 --- a/Editor/src/Windows/EditorSelectionPanel.cpp +++ b/Editor/src/Windows/EditorSelectionPanel.cpp @@ -209,6 +209,11 @@ void EditorSelectionPanel::DrawFile(Ref file) DrawWrenScriptPanel(CreateRef(file, true)); break; } + case FileType::NetScript: + { + DrawNetScriptPanel(file); + break; + } case FileType::Prefab: { //Ref prefab = CreateRef(file->GetRelativePath()); @@ -486,3 +491,23 @@ void EditorSelectionPanel::DrawWrenScriptPanel(Ref wrenFile) ImGui::PopTextWrapPos(); } +void EditorSelectionPanel::DrawNetScriptPanel(Ref file) +{ + auto filePath = file->GetRelativePath(); + std::string fileContent = Nuake::FileSystem::ReadFile(filePath); + + ImGui::Text("Content"); + ImGui::SameLine(ImGui::GetWindowWidth() - 90); + if (ImGui::Button("Open...")) + { + Nuake::OS::OpenIn(file->GetAbsolutePath()); + } + + ImGui::Separator(); + + ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + ImGui::GetWindowWidth()); + ImGui::Text(fileContent.c_str(), ImGui::GetWindowWidth()); + + ImGui::PopTextWrapPos(); +} + diff --git a/Editor/src/Windows/EditorSelectionPanel.h b/Editor/src/Windows/EditorSelectionPanel.h index a8c8586c..57499b47 100644 --- a/Editor/src/Windows/EditorSelectionPanel.h +++ b/Editor/src/Windows/EditorSelectionPanel.h @@ -70,4 +70,5 @@ private: void DrawMaterialPanel(Ref material); void DrawProjectPanel(Ref project); void DrawWrenScriptPanel(Ref wrenFile); + void DrawNetScriptPanel(Ref file); }; \ No newline at end of file