game: some usability tweaks in trade ui

This commit is contained in:
Crypto City 2020-01-18 12:14:27 +00:00
parent d6200512fd
commit 8ae7f04e93

View File

@ -310,6 +310,9 @@ void UITradeDialog::Refresh(const std::shared_ptr<GameWallet> &w)
continue;
add_order(order, false);
}
sellOrders->SetValue(-1);
buyOrders->SetValue(-1);
}
void UITradeDialog::Update(const std::shared_ptr<GameWallet> &w)
@ -606,7 +609,10 @@ void UITradeDialog::HandleSellOrderSelected(StringHash eventType, VariantMap& ev
{
int sel = sellOrders->GetValue();
if (sel < 0 || sel >= sellOrderSource.GetNumItems())
{
sellOrders->SetValue(-1);
return;
}
const OrderItem *item = sellOrderSource.GetItem(sel);
const auto &order = item->order;
buyPriceWidget->SetText(cryptonote::print_money(order.price).c_str());
@ -620,14 +626,19 @@ void UITradeDialog::HandleSellOrderSelected(StringHash eventType, VariantMap& ev
}
amount += offers[i].amount;
}
buyAmountWidget->SetText(String(amount).CString());
if (amount)
buyAmountWidget->SetText(String(amount).CString());
sellOrders->SetValue(-1);
}
void UITradeDialog::HandleBuyOrderSelected(StringHash eventType, VariantMap& eventData)
{
int sel = buyOrders->GetValue();
if (sel < 0 || (size_t)sel >= bids.size())
{
buyOrders->SetValue(-1);
return;
}
const OrderItem *item = buyOrderSource.GetItem(sel);
const auto &order = item->order;
sellPriceWidget->SetText(cryptonote::print_money(order.price).c_str());
@ -641,7 +652,9 @@ void UITradeDialog::HandleBuyOrderSelected(StringHash eventType, VariantMap& eve
}
amount += bids[i].amount;
}
sellAmountWidget->SetText(String(amount).CString());
if (amount)
sellAmountWidget->SetText(String(amount).CString());
buyOrders->SetValue(-1);
}
void UITradeDialog::HandleCheckExpiration(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData)