|
|
@ -135,12 +135,12 @@ namespace gui { |
|
|
|
case LOOT_SELECT: { |
|
|
|
case LOOT_SELECT: { |
|
|
|
$grab_source = std::any_cast<DinkyECS::Entity>(data); |
|
|
|
$grab_source = std::any_cast<DinkyECS::Entity>(data); |
|
|
|
|
|
|
|
|
|
|
|
if(auto world_entity = $loot_ui.select_slot(*$grab_source)) { |
|
|
|
if(auto world_entity = $loot_ui.start_grab(*$grab_source)) { |
|
|
|
auto& source = $loot_ui.get_grabber(*$grab_source); |
|
|
|
auto& source = $loot_ui.get_grab_source(*$grab_source); |
|
|
|
source.grab($window); |
|
|
|
source.grab($window); |
|
|
|
source.move($router.position); |
|
|
|
source.move($router.position); |
|
|
|
|
|
|
|
|
|
|
|
$status_ui.select_slot(*world_entity); |
|
|
|
$status_ui.start_drop(*world_entity); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// BUG: need a cancel operation here
|
|
|
|
// BUG: need a cancel operation here
|
|
|
|
$window.setMouseCursorVisible(true); |
|
|
|
$window.setMouseCursorVisible(true); |
|
|
@ -149,14 +149,11 @@ namespace gui { |
|
|
|
} break; |
|
|
|
} break; |
|
|
|
case INV_SELECT: { |
|
|
|
case INV_SELECT: { |
|
|
|
auto gui_id = std::any_cast<DinkyECS::Entity>(data); |
|
|
|
auto gui_id = std::any_cast<DinkyECS::Entity>(data); |
|
|
|
dbc::log(fmt::format("INV_SELECT $grab_source null? {} gui_id {}", |
|
|
|
|
|
|
|
$grab_source == std::nullopt, gui_id)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($grab_source) { |
|
|
|
if($grab_source) { |
|
|
|
auto& drop = $status_ui.$gui.get<guecs::DropTarget>(gui_id); |
|
|
|
auto& drop = $status_ui.get_drop_target(gui_id); |
|
|
|
|
|
|
|
|
|
|
|
if(drop.action()) { |
|
|
|
if(drop.commit()) { |
|
|
|
$loot_ui.remove_slot(*$grab_source); |
|
|
|
$loot_ui.commit_drop(*$grab_source); |
|
|
|
$grab_source = std::nullopt; |
|
|
|
$grab_source = std::nullopt; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -171,7 +168,7 @@ namespace gui { |
|
|
|
case MOUSE_DRAG: |
|
|
|
case MOUSE_DRAG: |
|
|
|
case MOUSE_MOVE: { |
|
|
|
case MOUSE_MOVE: { |
|
|
|
if($grab_source) { |
|
|
|
if($grab_source) { |
|
|
|
auto& source = $loot_ui.get_grabber(*$grab_source); |
|
|
|
auto& source = $loot_ui.get_grab_source(*$grab_source); |
|
|
|
source.move($router.position); |
|
|
|
source.move($router.position); |
|
|
|
} |
|
|
|
} |
|
|
|
mouse_action(true); |
|
|
|
mouse_action(true); |
|
|
|