Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #383 from Broken-Gem-Studio/ButtonFix
Browse files Browse the repository at this point in the history
solve button on click (Save&Load) error
  • Loading branch information
lucho1 authored May 28, 2020
2 parents bcd6927 + 5920a30 commit dbfde56
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Broken Engine/Source/ComponentButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,24 @@ void ComponentButton::Update()

if (to_delete)
this->GetContainerGameObject()->RemoveComponent(this);


if (func_list[func_pos] != func_name)
{
func_list.clear();
func_list.push_back("None");
for (uint i = 0; i < script->script_functions.size(); ++i)
func_list.push_back(script->script_functions[i].name.c_str());

for (uint i = 0; i < func_list.size(); ++i) //get function pos
{
if (strcmp(func_list[i], func_name.c_str()) == 0)
{
func_pos = i;
break;
}
}
}
}

void ComponentButton::Draw()
Expand Down Expand Up @@ -246,7 +264,7 @@ void ComponentButton::Load(json& node)
if (script_obj)
{
script = (ComponentScript*)script_obj->HasComponent(Component::ComponentType::Script);

if (script != nullptr)
{
func_name = function_str.c_str();
Expand Down

0 comments on commit dbfde56

Please sign in to comment.