-- Inherited from Vdo_base_object
Vdo_weapon_pips = Vdo_base_object:new_base()
local MAX_PIPS = 5
COLOR_PIPS_FULLY_UPGRADED = {R=255/255, G=207/255, B=42/255}
COLOR_PIPS_NOT_FULLY_UPGRADED = {R=255/255, G=147/255, B=42/255}
---------------------------------------------------------------------------
-- Initialize pips
---------------------------------------------------------------------------
function vdo_weapon_pips_init()
end
function Vdo_weapon_pips:init()
--Member Variables
self.full_pips = {}
self.empty_pips= {}
self.upgrade_text_pos_grp_h = vint_object_find("upgrade_text_pos_grp", self.handle, self.doc_handle)
vint_set_property(self.upgrade_text_pos_grp_h, "visible", false)
self.upgrade_text_h = Vdo_base_object:new("upgrade_text", self.handle, self.doc_handle)
self.upgrade_text_h:set_text("")
self.pips_grp_h = vint_object_find("pips", self.handle, self.doc_handle)
vint_set_property(self.pips_grp_h, "visible", false)
--find reference base icons (amount of flaps may change)
for i = 1, MAX_PIPS do
-- full pips
local full_pip_h = vint_object_find("full_" .. i, self.handle, self.doc_handle)
self.full_pips[i] = full_pip_h
vint_set_property(self.full_pips[i], "visible", false)
-- down pips
local empty_pip_h = vint_object_find("empty_" .. i, self.handle, self.doc_handle)
self.empty_pips[i] = empty_pip_h
vint_set_property(self.empty_pips[i], "visible", false)
end
end
function Vdo_weapon_pips:cleanup()
vint_object_destroy(self.upgrade_text_pos_grp_h)
vint_object_destroy(self.pips_grp_h)
end
function Vdo_weapon_pips:show_upgrade_info( upgrade_name, upgrade_level_max, upgrade_level_cur, is_ultimate, fully_upgraded )
vint_set_property(self.upgrade_text_pos_grp_h, "visible", true)
local base_weapon_string = "{0:text_tag_crc}"
local values = {[0] = upgrade_name}
local upgrade_name_tag = vint_insert_values_in_string(base_weapon_string, values)
self.upgrade_text_h:set_text(upgrade_name_tag)
--vint_set_property(self.upgrade_text_h, "text_tag_crc", upgrade_name)
vint_set_property(self.pips_grp_h, "visible", true)
if is_ultimate == false then
for i = 1, MAX_PIPS do
if i <= upgrade_level_cur then
vint_set_property(self.full_pips[i], "visible", true)
vint_set_property(self.empty_pips[i], "visible", false)
else
vint_set_property(self.full_pips[i], "visible", false)
vint_set_property(self.empty_pips[i], "visible", true)
end
end
else
for i = 1, MAX_PIPS do
if i == 3 then
if upgrade_level_cur > 0 then
vint_set_property(self.full_pips[i], "visible", true)
vint_set_property(self.empty_pips[i], "visible", false)
else
vint_set_property(self.full_pips[i], "visible", false)
vint_set_property(self.empty_pips[i], "visible", true)
end
else
vint_set_property(self.full_pips[i], "visible", false)
vint_set_property(self.empty_pips[i], "visible", false)
end
end
end
if fully_upgraded then
vint_set_property(self.pips_grp_h, "tint", COLOR_PIPS_FULLY_UPGRADED.R, COLOR_PIPS_FULLY_UPGRADED.G, COLOR_PIPS_FULLY_UPGRADED.B)
else
vint_set_property(self.pips_grp_h, "tint", COLOR_PIPS_NOT_FULLY_UPGRADED.R, COLOR_PIPS_NOT_FULLY_UPGRADED.G, COLOR_PIPS_NOT_FULLY_UPGRADED.B)
end
end
function Vdo_weapon_pips:hide_upgrade_info()
vint_set_property(self.upgrade_text_pos_grp_h, "visible", false)
vint_set_property(self.pips_grp_h, "visible", false)
end