#include "stdafx.h" #include "V8DataModel/StudioTool.h" #include "V8DataModel/StudioToolMouseCommand.h" #include "V8DataModel/Mouse.h" #include "V8DataModel/DataModel.h" #include "V8DataModel/Workspace.h" #include "Network/Players.h" namespace RBX { const char *const sStudioTool = "StudioTool"; REFLECTION_BEGIN(); static Reflection::EventDesc)> event_Equipped(&StudioTool::equippedSignal, "Equipped", "mouse"); static Reflection::EventDesc event_Unequipped(&StudioTool::unequippedSignal, "Unequipped"); static Reflection::EventDesc event_Activated(&StudioTool::activatedSignal, "Activated"); static Reflection::EventDesc event_Deactivated(&StudioTool::deactivatedSignal, "Deactivated"); static Reflection::PropDescriptor prop_Enabled("Enabled", "State", &StudioTool::getEnabled, &StudioTool::setEnabled); REFLECTION_END(); StudioTool::StudioTool() :DescribedNonCreatable(sStudioTool) ,enabled(false) {} void StudioTool::setEnabled(bool value) { if(enabled != value){ enabled = value; raisePropertyChanged(prop_Enabled); } } void StudioTool::activate() { activatedSignal(); } void StudioTool::deactivate() { deactivatedSignal(); } shared_ptr StudioTool::onEquipping(Workspace* workspace) { shared_ptr studioToolMouseCommand = Creatable::create(workspace, shared_from(this)); workspace->setMouseCommand(studioToolMouseCommand); return studioToolMouseCommand->getMouse(); } void StudioTool::equip(Workspace* workspace) { equippedSignal(onEquipping(workspace)); } void StudioTool::unequip() { unequippedSignal(); } }