mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Added double, bool string
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <src/Scene/Components/NetScriptComponent.h>
|
||||
#include <src/Core/FileSystem.h>
|
||||
#include <src/Scripting/ScriptingEngineNet.h>
|
||||
#include <src/Scene/Entities/ImGuiHelper.h>
|
||||
|
||||
void NetScriptPanel::Draw(Nuake::Entity entity)
|
||||
{
|
||||
@@ -138,6 +139,46 @@ void NetScriptPanel::Draw(Nuake::Entity entity)
|
||||
field.Value = currentValue;
|
||||
}
|
||||
|
||||
if (field.Type == Nuake::NetScriptExposedVarType::Double)
|
||||
{
|
||||
if (!field.Value.has_value())
|
||||
{
|
||||
field.Value = field.DefaultValue;
|
||||
}
|
||||
|
||||
float currentValue = (float)std::any_cast<double>(field.Value);
|
||||
const std::string sliderName = "##" + field.Name + "slider";
|
||||
ImGui::DragFloat(sliderName.c_str(), ¤tValue);
|
||||
field.Value = (double)currentValue;
|
||||
}
|
||||
|
||||
if (field.Type == Nuake::NetScriptExposedVarType::Bool)
|
||||
{
|
||||
if (!field.Value.has_value())
|
||||
{
|
||||
field.Value = field.DefaultValue;
|
||||
}
|
||||
|
||||
bool currentValue = std::any_cast<bool>(field.Value);
|
||||
const std::string sliderName = "##" + field.Name + "slider";
|
||||
ImGui::Checkbox(sliderName.c_str(), ¤tValue);
|
||||
field.Value = currentValue;
|
||||
}
|
||||
|
||||
if (field.Type == Nuake::NetScriptExposedVarType::String)
|
||||
{
|
||||
if (!field.Value.has_value())
|
||||
{
|
||||
field.Value = field.DefaultValue;
|
||||
}
|
||||
|
||||
std::string currentValue = std::any_cast<std::string>(field.Value);
|
||||
const std::string sliderName = "##" + field.Name + "slider";
|
||||
ImGui::InputText(sliderName.c_str(), ¤tValue);
|
||||
|
||||
field.Value = currentValue;
|
||||
}
|
||||
|
||||
ImGui::TableNextColumn();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user