-----------------------------------------------------------------------------------------------
-- Vdo_gsi_lite
--
-- description: A light weight version of the gsi to be used in interface tutorials.
-----------------------------------------------------------------------------------------------
function vdo_gsi_lite_init()
end
Vdo_gsi_lite = Vdo_base_object:new_base()
function Vdo_gsi_lite:init()
self.black_bar_img_h = vint_object_find("black_bar_img", self.handle, self.doc_handle)
self.icon_img_h = vint_object_find("icon_img", self.handle, self.doc_handle)
self.obj_txt_h = vint_object_find("obj_txt", self.handle, self.doc_handle)
self.new_obj_anim_h = vint_object_find("new_obj_anim", self.handle, self.doc_handle)
self.updated_called = false
self:set_visible(false)
end
function Vdo_gsi_lite:update(new_obj_txt, new_icon_img)
--Update text and icon
vint_set_property(self.obj_txt_h, "text_tag", new_obj_txt)
vint_set_property(self.icon_img_h, "image", new_icon_img)
--Resize bar
local new_txt_width, new_txt_height = element_get_actual_size(self.obj_txt_h)
local obj_txt_x, obj_txt_y = vint_get_property(self.obj_txt_h, "anchor")
local bar_width, bar_height = element_get_actual_size(self.black_bar_img_h)
bar_width = obj_txt_x + new_txt_width + 10
element_set_actual_size(self.black_bar_img_h, bar_width, bar_height)
--Color icons
if new_icon_img == "ui_target_icon_use" then
vint_set_property(self.icon_img_h, "tint", COLOR_TARGET_USE.R, COLOR_TARGET_USE.G, COLOR_TARGET_USE.B)
elseif new_icon_img == "ui_target_icon_location" then
vint_set_property(self.icon_img_h, "tint", COLOR_TARGET_LOCATION.R, COLOR_TARGET_LOCATION.G, COLOR_TARGET_LOCATION.B)
end
--POLISH: Color and position small bars for fancy intro anim
--[[local bars = {}
for i=1,3 do
bars[i] = {
img_h = vint_object_find("bar_img_"..i, self.handle, self.doc_handle),
twn_h = vint_object_find("bar_twn_"..i, self.new_obj_anim_h),
}
local small_bar_width, small_bar_height = element_get_actual_size(bars[i].img_h)
element_set_actual_size(bars[i].img_h, bar_width, small_bar_height)
vint_set_property(bars[i].img_h, "anchor", bar_width * 0.5, (i-1) * small_bar_height)
end]]
--Center grp in middle of screen and play new objective anim
local anchor_twn_h = vint_object_find("new_obj_anchor_twn", self.new_obj_anim_h)
local gsi_x = 0
if vint_is_std_res() == true then
gsi_x = (320 * 1.5) - (bar_width * .75)
else
gsi_x = 640 - (bar_width * .75)
end
vint_set_property(anchor_twn_h, "start_value", gsi_x, 200)
vint_apply_start_values(self.new_obj_anim_h)
local delay = 0
if self.updated_called == true then
delay = -1
end
lua_play_anim(self.new_obj_anim_h, delay, self.doc_handle)
self:set_visible(true)
self.updated_called = true
end