Added, Updated and Removed Mods; Removed Backups
This commit is contained in:
@@ -30,48 +30,50 @@ function start()
|
||||
end
|
||||
end
|
||||
|
||||
function ui_inventory.UIInventory:InitBarterButton()
|
||||
self.npc_barter_btn = self.xml:Init3tButton("npc:trade_delimiter:trade_buy_button", self.npc_trade)
|
||||
local weight = self.npc_trade_weight:GetWndPos()
|
||||
-- printf("trade button at %s %s, delimter at %s %s", pos.x, pos.y, rcoord.x, rcoord.y)
|
||||
local pos = self.npc_barter_btn:GetWndPos()
|
||||
|
||||
self.npc_barter_btn:SetWndPos(vector2():set(
|
||||
weight.x + 20 , -- TODO: Add sliders in MCM to adjust button position
|
||||
pos.y
|
||||
))
|
||||
|
||||
self.npc_barter_btn:TextControl():SetText(game.translate_string("st_ui_mm_barter"))
|
||||
|
||||
self:Register(self.npc_barter_btn, "barter")
|
||||
|
||||
self:InitBarterButtonCallback()
|
||||
|
||||
local npc = mob_trade.GetTalkingNpc()
|
||||
local enable = npc_has_barter(npc)
|
||||
self.npc_barter_btn:Enable(enable)
|
||||
|
||||
end
|
||||
|
||||
function ui_inventory.UIInventory:InitBarterButtonCallback()
|
||||
self:AddCallback("barter", ui_events.BUTTON_CLICKED, start, self)
|
||||
end
|
||||
|
||||
function GUI_on_show(name, path)
|
||||
local instance = ui_inventory.GUI
|
||||
if name ~= "UIInventory" or (not instance ) then return end
|
||||
|
||||
if (not instance.npc_barter_btn) then
|
||||
instance:InitBarterButton()
|
||||
end
|
||||
local partner = instance:GetPartner()
|
||||
instance.npc_barter_btn:Show(partner and npc_has_barter(partner))
|
||||
end
|
||||
|
||||
function on_game_start()
|
||||
RegisterScriptCallback("GUI_on_show", GUI_on_show)
|
||||
RegisterScriptCallback("on_specific_character_dialog_list", function(character_id, dialog_list)
|
||||
if npc_has_barter(character_id) then
|
||||
local res = dialog_list:add("dm_init_barter", 2)
|
||||
end
|
||||
end)
|
||||
end
|
||||
-- function ui_inventory.UIInventory:InitBarterButton()
|
||||
-- self.npc_barter_btn = self.xml:Init3tButton("npc:trade_delimiter:trade_buy_button", self.npc_trade)
|
||||
-- local weight = self.npc_trade_weight:GetWndPos()
|
||||
-- -- printf("trade button at %s %s, delimter at %s %s", pos.x, pos.y, rcoord.x, rcoord.y)
|
||||
-- local pos = self.npc_barter_btn:GetWndPos()
|
||||
|
||||
-- self.npc_barter_btn:SetWndPos(vector2():set(
|
||||
-- weight.x + 20 , -- TODO: Add sliders in MCM to adjust button position
|
||||
-- pos.y
|
||||
-- ))
|
||||
|
||||
-- self.npc_barter_btn:TextControl():SetText(game.translate_string("st_ui_mm_barter"))
|
||||
|
||||
-- self:Register(self.npc_barter_btn, "barter")
|
||||
|
||||
-- self:InitBarterButtonCallback()
|
||||
|
||||
-- local npc = mob_trade.GetTalkingNpc()
|
||||
-- local enable = npc_has_barter(npc)
|
||||
-- self.npc_barter_btn:Enable(enable)
|
||||
|
||||
-- end
|
||||
|
||||
-- function ui_inventory.UIInventory:InitBarterButtonCallback()
|
||||
-- self:AddCallback("barter", ui_events.BUTTON_CLICKED, start, self)
|
||||
-- end
|
||||
|
||||
-- function GUI_on_show(name, path)
|
||||
-- local instance = ui_inventory.GUI
|
||||
-- if name ~= "UIInventory" or (not instance ) then return end
|
||||
|
||||
-- if (not instance.npc_barter_btn) then
|
||||
-- instance:InitBarterButton()
|
||||
-- end
|
||||
-- local partner = instance:GetPartner()
|
||||
-- instance.npc_barter_btn:Show(partner and npc_has_barter(partner))
|
||||
-- end
|
||||
----------------------------------------------------------------------
|
||||
-- UI
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user