diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 1f1c4f5e..4d321b16 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -2017,6 +2017,14 @@ namespace Nuake { Nuake::ScriptingEngineNet::Get().GenerateSolution(FileSystem::Root, Engine::GetProject()->Name); Nuake::Logger::Log("Generated Solution."); } + +#ifdef NK_DEBUG + if (ImGui::MenuItem("Copy Nuake.NET", NULL)) + { + Nuake::ScriptingEngineNet::Get().CopyNuakeNETAssemblies(FileSystem::Root); + Nuake::Logger::Log("Copied Nuake.Net Assemblies."); + } +#endif // NK_DEBUG ImGui::EndMenu(); } diff --git a/Editor/src/Windows/FileSystemUI.cpp b/Editor/src/Windows/FileSystemUI.cpp index 60c5e558..a62bde55 100644 --- a/Editor/src/Windows/FileSystemUI.cpp +++ b/Editor/src/Windows/FileSystemUI.cpp @@ -247,16 +247,23 @@ namespace Nuake if (selected) { if (ImGui::IsMouseDoubleClicked(0)) - { - if (file->GetFileType() == FileType::Map) + { + switch (file->GetFileType()) { - OS::OpenTrenchbroomMap(file->GetAbsolutePath()); - } - - if (file->GetFileType() == FileType::Scene) - { - shouldOpenScene = true; + case FileType::Map: + OS::OpenTrenchbroomMap(file->GetAbsolutePath()); + break; + case FileType::NetScript: + OS::OpenIn(file->GetAbsolutePath()); + break; + case FileType::Scene: + shouldOpenScene = true; + break; + case FileType::Solution: + OS::OpenIn(file->GetAbsolutePath()); + break; } + } Editor->Selection = EditorSelection(file); @@ -402,9 +409,6 @@ namespace Nuake //} ImGui::PopStyleVar(); - - - const std::string openSceneId = "Open Scene" + std::string("##") + hoverMenuId; @@ -632,7 +636,7 @@ namespace Nuake } else { - Logger::Log("[FileSystem] Cannot create script files that starts with a number.", "editor", CRITICAL); + Logger::Log("Cannot create script files that starts with a number.", "filesystem", CRITICAL); } } } @@ -749,7 +753,10 @@ namespace Nuake const auto buttonWidth = cursorEnd - cursorStart; if (ImGui::Button((std::string(ICON_FA_ANGLE_RIGHT)).c_str(), buttonSize)) { - // TODO + if (Editor->Selection.Type == EditorSelectionType::Directory) + { + m_CurrentDirectory = Editor->Selection.Directory; + } } const uint32_t numButtonAfterPathBrowser = 2; @@ -808,13 +815,6 @@ namespace Nuake OS::OpenIn(m_CurrentDirectory->FullPath); } - ImGui::SameLine(); - - if (ImGui::Button((std::string(ICON_FA_ELLIPSIS_V)).c_str(), buttonSize)) - { - // TODO - } - ImGui::PopStyleColor(); // Button color ImGui::SameLine(); diff --git a/Nuake/src/Core/FileSystem.h b/Nuake/src/Core/FileSystem.h index 4c067684..3b3b3862 100644 --- a/Nuake/src/Core/FileSystem.h +++ b/Nuake/src/Core/FileSystem.h @@ -65,7 +65,8 @@ namespace Nuake Scene, Wad, Map, - Assembly + Assembly, + Solution }; class File @@ -135,6 +136,10 @@ namespace Nuake { return FileType::NetScript; } + if (ext == ".sln") + { + return FileType::Solution; + } return FileType::Unkown; } diff --git a/Nuake/src/Scene/EditorCamera.cpp b/Nuake/src/Scene/EditorCamera.cpp index 03c51a73..6f007b0c 100644 --- a/Nuake/src/Scene/EditorCamera.cpp +++ b/Nuake/src/Scene/EditorCamera.cpp @@ -161,27 +161,29 @@ namespace Nuake Right = glm::normalize(glm::cross(Up, Direction)); - if (Input::IsMouseButtonDown(2)) + if (controlled) { - Vector3 movement = Vector3(0); - const float deltaX = x - mouseLastX; - const float deltaY = y - mouseLastY; - movement += Right * (deltaX * ts); - movement += Up * (deltaY * ts); - Translation += Vector3(movement) * 0.5f; + if (Input::IsMouseButtonDown(2)) + { + Vector3 movement = Vector3(0); + const float deltaX = x - mouseLastX; + const float deltaY = y - mouseLastY; + movement += Right * (deltaX * ts); + movement += Up * (deltaY * ts); + Translation += Vector3(movement) * 0.5f; - mouseLastX = x; - mouseLastY = y; - controlled = true; + mouseLastX = x; + mouseLastY = y; + controlled = true; - SetDirection(glm::normalize(Direction)); + SetDirection(glm::normalize(Direction)); + } + else if (Input::YScroll != 0) + { + Translation += Vector3(Direction) * Input::YScroll; + Input::YScroll = 0.0f; + } } - else if (Input::YScroll != 0) - { - Translation += Vector3(Direction) * Input::YScroll; - Input::YScroll = 0.0f; - } - SetDirection(glm::normalize(Direction)); diff --git a/Nuake/src/Scripting/ScriptingEngineNet.cpp b/Nuake/src/Scripting/ScriptingEngineNet.cpp index d24fcb8d..0a8cbf6f 100644 --- a/Nuake/src/Scripting/ScriptingEngineNet.cpp +++ b/Nuake/src/Scripting/ScriptingEngineNet.cpp @@ -216,7 +216,7 @@ namespace Nuake return m_EntityToManagedObjects.find(entity.GetID()) != m_EntityToManagedObjects.end(); } - void ScriptingEngineNet::GenerateSolution(const std::string& path, const std::string& projectName) + void ScriptingEngineNet::CopyNuakeNETAssemblies(const std::string& path) { // Create .Net directory in projects folder. const auto netDirectionPath = '/' + m_NetDirectory + '/'; @@ -236,6 +236,11 @@ namespace Nuake { std::filesystem::copy_file(fileToCopy, netDir + fileToCopy, std::filesystem::copy_options::overwrite_existing); } + } + + void ScriptingEngineNet::GenerateSolution(const std::string& path, const std::string& projectName) + { + CopyNuakeNETAssemblies(path); // Generate premake5 templates // ---------------------------------------- diff --git a/Nuake/src/Scripting/ScriptingEngineNet.h b/Nuake/src/Scripting/ScriptingEngineNet.h index 9ada2409..a7954692 100644 --- a/Nuake/src/Scripting/ScriptingEngineNet.h +++ b/Nuake/src/Scripting/ScriptingEngineNet.h @@ -55,6 +55,7 @@ namespace Nuake { Coral::ManagedObject GetEntityScript(const Entity& entity); bool HasEntityScriptInstance(const Entity& entity); + void CopyNuakeNETAssemblies(const std::string& path); void GenerateSolution(const std::string& path, const std::string& projectName); void CreateEntityScript(const std::string& path, const std::string& entityName); };