mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Added bool operator and isvalid function to .Net API
This commit is contained in:
@@ -210,19 +210,23 @@ void NetScriptPanel::Draw(Nuake::Entity entity)
|
||||
|
||||
if (field.Type == Nuake::NetScriptExposedVarType::Entity)
|
||||
{
|
||||
if (!field.Value.has_value())
|
||||
if (!field.Value.has_value() && field.DefaultValue.has_value())
|
||||
{
|
||||
field.Value = field.DefaultValue;
|
||||
}
|
||||
|
||||
int entityId = -1;
|
||||
if (field.Value.has_value())
|
||||
{
|
||||
entityId = std::any_cast<int>(field.Value);
|
||||
}
|
||||
|
||||
int entityId = std::any_cast<int>(field.Value);
|
||||
auto entity = Nuake::Engine::GetCurrentScene()->GetEntityByID(entityId);
|
||||
bool invalid = !entity.IsValid();
|
||||
std::string buttonLabel;
|
||||
if (invalid)
|
||||
{
|
||||
buttonLabel = "Invalid Entity*";
|
||||
buttonLabel = "Invalid Entity";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user