money input changes

This commit is contained in:
Manuel Simon Hirsig
2016-08-29 19:08:35 +02:00
parent 542162439f
commit 54b641fb2c
3 changed files with 15 additions and 10 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ do
function declarator_mt:__newindex(key, value) self=state[self]
local name, event = self.declaration_name, nil
if name then
event = EVENT[key] or declaration_error()
event = EVENT[key] or error(name)
else
name, event = key, type(value) == 'function' and CALL or INDEX
end
+10 -8
View File
@@ -226,6 +226,7 @@ function create_frames()
unit_buyout_price:SetFocus()
end
end)
editbox.colorizer = function(text) return gsub(text, '[gsc]', function(str) return str == 'g' and aux.money.GOLD_TEXT or str == 's' and aux.money.SILVER_TEXT or str == 'c' and aux.money.COPPER_TEXT end) end
editbox.formatter = function() return money.to_string(get_unit_start_price(), true, nil, 3) end
editbox.change = function() refresh = true end
editbox.enter = function() this:ClearFocus() end
@@ -233,13 +234,13 @@ function create_frames()
this:SetText(money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
end
do
local label = gui.label(frame, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
local label = gui.label(editbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Starting Price')
end
do
local label = gui.label(frame, 14)
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
local label = gui.label(editbox, 14)
label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
start_price_percentage = label
@@ -260,6 +261,7 @@ function create_frames()
stack_size_slider.editbox:SetFocus()
end
end)
editbox.colorizer = function(text) return gsub(text, '[gsc]', function(str) return str == 'g' and aux.money.GOLD_TEXT or str == 's' and aux.money.SILVER_TEXT or str == 'c' and aux.money.COPPER_TEXT end) end
editbox.formatter = function() return money.to_string(get_unit_buyout_price(), true, nil, 3) end
editbox.change = function() refresh = true end
editbox.enter = function() this:ClearFocus() end
@@ -267,13 +269,13 @@ function create_frames()
this:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
end
do
local label = gui.label(frame, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
local label = gui.label(editbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Buyout Price')
end
do
local label = gui.label(frame, 14)
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
local label = gui.label(editbox, 14)
label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
buyout_price_percentage = label
+4 -1
View File
@@ -1,9 +1,12 @@
aux 'money'
public()
GOLD_TEXT = '|cffffd70ag|r'
SILVER_TEXT = '|cffc7c7cfs|r'
COPPER_TEXT = '|cffeda55fc|r'
private()
--a = nil
----log(a)
COPPER_PER_SILVER = 100
COPPER_PER_GOLD = 10000