Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local comms = {"stalker", "bandit", "military", "dolg", "freedom", "ecolog",
- "killer", "monolith", "csky", "trader", "zombied", "arena_enemy"}
- class "ui_faction" (CUIScriptWnd)
- function ui_faction:__init() super()
- self.tex = nil
- self:InitControls()
- end
- function ui_faction:Update()
- CUIScriptWnd.Update(self)
- if db.actor and treasure_manager and xr_motivator then
- if has_alife_info("ui_car_body") then
- if treasure_manager.npc_comm then self.tex = treasure_manager.npc_comm end
- if self.tex then
- self.textures[self.tex]:Show(true) end
- elseif db.actor:is_talking() then
- if xr_motivator.npc_community and self.tex ~= xr_motivator.npc_community then
- self.tex = xr_motivator.npc_community
- end
- if self.tex then self.textures[self.tex]:Show(true) end
- else
- if self.tex then
- self.tex = nil
- for i = 1, #comms do
- self.textures[comms[i]]:Show(false)
- end
- end
- end
- end
- end
- function ui_faction:InitControls()
- self:Init(0, 0, device().width, device().height)
- local xml = CScriptXmlInit()
- xml:ParseFile("ui_faction.xml")
- self.textures = {}
- for i = 1, #comms do
- self.textures[comms[i]] = xml:InitStatic("ui_faction_"..comms[i], self)
- self.textures[comms[i]]:Show(false)
- end
- end
- local HUD = nil
- function add_custom_inv()
- if HUD == nil then
- HUD = ui_faction()
- get_hud():AddDialogToRender(HUD)
- end
- end
- function remove_custom_inv()
- if HUD ~= nil then
- get_hud():RemoveDialogToRender(HUD)
- HUD = nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement