Transformer card UX tweaks
This commit is contained in:
parent
a468e57034
commit
58dcfb1173
1 changed files with 82 additions and 42 deletions
|
|
@ -562,53 +562,74 @@ namespace gmtk
|
|||
else if (acc.contains<zoomer>())
|
||||
{
|
||||
map.put_card(card_type::zoomer);
|
||||
// TODO: CLEAR ZOOMER
|
||||
|
||||
for (int y = 0; y < 3; ++y)
|
||||
{
|
||||
for (int x = 0; x < 3; ++x)
|
||||
{
|
||||
location p{l.level + 1, {3 * l.coords[0] + x, 3 * l.coords[1] + y}};
|
||||
clear_tile(map, p);
|
||||
}
|
||||
}
|
||||
|
||||
auto & index = map.world->index<path_index>();
|
||||
|
||||
for (int y = 0; y < 9; ++y)
|
||||
{
|
||||
for (int x = 0; x < 9; ++x)
|
||||
{
|
||||
location p{l.level + 2, {9 * l.coords[0] + x, 9 * l.coords[1] + y}};
|
||||
|
||||
if (auto e = index.find(p))
|
||||
{
|
||||
auto & v = map.world->get(*e).get<path_vertex>();
|
||||
|
||||
for (auto to : v.belts_to)
|
||||
{
|
||||
auto & tv = map.world->get(to).get<path_vertex>();
|
||||
if (!within_tile(l, tv.location))
|
||||
remove_belt(*map.world, to, *tv.belts_to.begin());
|
||||
remove_belt(*map.world, *e, to);
|
||||
}
|
||||
|
||||
for (auto from : v.belts_from)
|
||||
{
|
||||
auto & fv = map.world->get(from).get<path_vertex>();
|
||||
if (!within_tile(l, fv.location))
|
||||
remove_belt(*map.world, *fv.belts_from.begin(), from);
|
||||
remove_belt(*map.world, from, *e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (auto t = acc.get_if<transformer>())
|
||||
{
|
||||
map.put_card(transformer_to_card(t->type));
|
||||
}
|
||||
|
||||
auto & index = map.world->index<path_index>();
|
||||
|
||||
for (int y = 0; y < 3; ++y)
|
||||
{
|
||||
for (int x = 0; x < 3; ++x)
|
||||
{
|
||||
location p{l.level + 1, {3 * l.coords[0] + x, 3 * l.coords[1] + y}};
|
||||
|
||||
clear_tile(map, p);
|
||||
|
||||
if (auto e = index.find(p))
|
||||
{
|
||||
auto & v = map.world->get(*e).get<path_vertex>();
|
||||
|
||||
for (auto to : v.belts_to)
|
||||
{
|
||||
auto & tv = map.world->get(to).get<path_vertex>();
|
||||
if (!within_tile(l, tv.location))
|
||||
remove_belt(*map.world, to, *tv.belts_to.begin());
|
||||
remove_belt(*map.world, *e, to);
|
||||
}
|
||||
|
||||
for (auto from : v.belts_from)
|
||||
{
|
||||
auto & fv = map.world->get(from).get<path_vertex>();
|
||||
if (!within_tile(l, fv.location))
|
||||
remove_belt(*map.world, *fv.belts_from.begin(), from);
|
||||
remove_belt(*map.world, from, *e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = 0; y < 9; ++y)
|
||||
{
|
||||
for (int x = 0; x < 9; ++x)
|
||||
{
|
||||
location p{l.level + 2, {9 * l.coords[0] + x, 9 * l.coords[1] + y}};
|
||||
|
||||
if (auto e = index.find(p))
|
||||
{
|
||||
auto & v = map.world->get(*e).get<path_vertex>();
|
||||
|
||||
for (auto to : v.belts_to)
|
||||
{
|
||||
auto & tv = map.world->get(to).get<path_vertex>();
|
||||
if (!within_tile(l, tv.location))
|
||||
remove_belt(*map.world, to, *tv.belts_to.begin());
|
||||
remove_belt(*map.world, *e, to);
|
||||
}
|
||||
|
||||
for (auto from : v.belts_from)
|
||||
{
|
||||
auto & fv = map.world->get(from).get<path_vertex>();
|
||||
if (!within_tile(l, fv.location))
|
||||
remove_belt(*map.world, *fv.belts_from.begin(), from);
|
||||
remove_belt(*map.world, from, *e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
map.world->destroy(*entity);
|
||||
}
|
||||
|
||||
|
|
@ -1378,6 +1399,18 @@ namespace gmtk
|
|||
{
|
||||
clear_tile(map_, *selected_);
|
||||
}
|
||||
else if (auto t = map_.world->get(*entity).get_if<transformer>())
|
||||
{
|
||||
if (auto n = card_to_transformer(*active_card_); n && n != t->type)
|
||||
{
|
||||
if (map_.take_card(*active_card_))
|
||||
{
|
||||
map_.put_card(transformer_to_card(t->type));
|
||||
t->type = *n;
|
||||
active_card_ = std::nullopt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1952,8 +1985,15 @@ namespace gmtk
|
|||
{
|
||||
if (auto entity = map_.world->index<index>().find(*selected_))
|
||||
{
|
||||
auto n = card_to_transformer(*active_card_);
|
||||
auto acc = map_.world->get(*entity);
|
||||
if (*active_card_ != card_type::eraser || (!acc.contains<source>() && !acc.contains<lab>()))
|
||||
auto t = acc.get_if<transformer>();
|
||||
if (n && t && n != t->type)
|
||||
{
|
||||
gfx::color_rgba color = {64, 64, 64, 255};
|
||||
draw_selection(selected_->bbox(), painter_, color, true);
|
||||
}
|
||||
else if (*active_card_ != card_type::eraser || (!acc.contains<source>() && !acc.contains<lab>()))
|
||||
{
|
||||
gfx::color_rgba color = {255, 128, 128, 255};
|
||||
draw_selection(selected_->bbox(), painter_, color, true);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue