Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class "ui_faction" (CUIScriptWnd)
- function ui_faction:__init() super()
- self:InitControls()
- end
- function ui_faction:InitControls()
- self:Init(0, 0, device().width, device().height)
- self.overlay = CUIStatic()
- self.overlay:SetAutoDelete(true)
- -- replace x, y with position of overlay texture (position on hud)
- -- and w, h with overlay texture's width and height, respectively
- -- you can use device().width instead of w if you want to set screen's
- -- width as a texture width
- self.overlay:Init(510, 673, 60, 60)
- self.overlay:InitTexture("ui\\ui_faction_empty")
- self.overlay:SetStretchTexture(true) -- to stretch texture based on w, h
- self.overlay:Show(false)
- self:AttachChild(self.overlay)
- self.hud_stage = "no"
- end
- --initialize and display overlay textures
- function ui_faction:display_texture(idx)
- if self.hud_stage ~= idx then
- self.overlay:InitTexture("ui\\ui_faction_" .. idx)
- self.overlay:Show(true)
- self.hud_stage = idx
- end
- end
- function ui_faction:Update()
- CUIScriptWnd.Update(self)
- local faction = "none"
- if db.actor then
- if has_alife_info("ui_car_body") then
- if treasure_manager and treasure_manager.npc_community_loot then
- faction = treasure_manager.npc_community_loot
- else
- faction = "none"
- end
- elseif db.actor:is_talking() then
- if xr_motivator and xr_motivator.npc_talks then
- faction = xr_motivator.npc_community_trade or "none"
- else
- faction = "none"
- end
- else
- faction = "none"
- end
- end
- if faction == "stalker" then
- self:display_texture("stalker")
- elseif faction == "trader" then
- self:display_texture("stalker")
- elseif faction == "bandit" then
- self:display_texture("bandit")
- elseif faction == "military" then
- self:display_texture("military")
- elseif faction == "dolg" then
- self:display_texture("dolg")
- elseif faction == "freedom" then
- self:display_texture("freedom")
- elseif faction == "ecolog" then
- self:display_texture("ecolog")
- elseif faction == "killer" then
- self:display_texture("killer")
- elseif faction == "monolith" then
- self:display_texture("monolith")
- elseif faction == "csky" then
- self:display_texture("csky")
- else
- self:display_texture("empty")
- 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