12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #include"module_area_entry_forbid.h"
- #include<memory>
- #include "event.h"
- #include "area.h"
- #include"area_business.h"
- #include"log.h"
- #include"common_tool.h"
- struct forbid_data:business_data
- {
- forbid_data()
- {
- }
- };
- void module_area_entry_forbid::on_enter(std::shared_ptr<card_location_base> card_ptr, int index)
- {
- auto area_hover_ptr = card_ptr->get_area_hover();
- if(!area_hover_ptr)
- {
- log_error("if(!area_hover_ptr)==true");
- return;
- }
- area_hover_ptr->m_data[index] = std::make_shared<forbid_data>();
- EVENT_TYPE ev_type = ET_CARD_AREA_FORBIDDEN_PERSON;
- if(card_ptr->is_vehicle())
- {
- ev_type = ET_CARD_AREA_FORBIDDEN_VEHICLE;
- }
- uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
- event_tool::instance()->handle_event(OT_CARD, ev_type, id, 0, 0, true);
- }
- void module_area_entry_forbid::on_hover(std::shared_ptr<card_location_base> card_ptr, int index)
- {
- }
- void module_area_entry_forbid::on_leave(std::shared_ptr<card_location_base> card_ptr, int index)
- {
- auto area_hover_ptr = card_ptr->get_area_hover();
- if(!area_hover_ptr)
- {
- log_error("if(!area_hover_ptr)==true");
- return;
- }
- EVENT_TYPE ev_type = ET_CARD_AREA_FORBIDDEN_PERSON;
- if(card_ptr->is_vehicle())
- {
- ev_type = ET_CARD_AREA_FORBIDDEN_VEHICLE;
- }
- uint64_t id = tool_other::type_id_to_u64(card_ptr->m_type, card_ptr->m_id);
- event_tool::instance()->handle_event(OT_CARD, ev_type, id, 0, 0, false);
- area_hover_ptr->m_data[index] = std::make_shared<forbid_data>();
- }
|