./tutorial.lua

  1.  
  2. local TUTORIAL_HINT_PADDING = 5 
  3. local TUTORIAL_HINT_SPACING = -1 
  4. local TUTORIAL_HEADER_PADDING = 14 
  5. Tutorial = {} 
  6. Tutorial_content = {} 
  7. Outline_anims = {} 
  8. Max_outlines = 5 
  9.  
  10. Tutorial_first_time = true 
  11. Tutorial_show_scanimate = true 
  12.  
  13. Tutorial_frame_values = -1 
  14.  
  15. Tutorial_current_window = 1		--id to control the current content frame... 
  16.  
  17. local Input_tracker 
  18.  
  19. function tutorial_init() 
  20. 	--Find Objects 
  21. 	Tutorial.window_h 		= vint_object_find("tutorial")	--Main window 
  22. 	Tutorial.bg_body_h 		= vint_object_find("bg_body")	--Body Element... 
  23. 	Tutorial.bg_top 			= vint_object_find("bg_top")			--background for title bar 
  24. 	Tutorial.bg_top_small	= vint_object_find("bg_top_small") 
  25. 	Tutorial.bg_top_small_trim	= vint_object_find("bg_top_small_trim") 
  26. 	Tutorial.content_clip_h = vint_object_find("content_clip")			--background for title bar 
  27. 	 
  28. 	local hint_data = { 
  29. 		{CTRL_MENU_BUTTON_BACK, "TUT_DISMISS"}, 
  30. 	} 
  31. 	 
  32. 	--Content Elements 
  33. 	local h = vint_object_find("content_1") 
  34. 	Tutorial_content[1] = { 
  35. 		h = h, 
  36. 		hint_bar = Vdo_hint_bar:new("tutorial_hint", h),	 
  37. 		header_text_h = vint_object_find("tutorial_header_text", h), 
  38. 		body_text_h = vint_object_find("tutorial_body_text", h), 
  39. 		illustration_h = vint_object_find("illustration", h), 
  40. 	} 
  41.  
  42. 	Tutorial_content[1].hint_bar:set_hints(hint_data) 
  43. 	Tutorial_content[1].hint_bar:set_visible(false) 
  44. 	Tutorial_content[1].hint_bar:enable_text_shadow(true) 
  45.  
  46. 	local h = vint_object_find("content_2") 
  47. 	Tutorial_content[2] = { 
  48. 		h = h, 
  49. 		hint_bar = Vdo_hint_bar:new("tutorial_hint", h), 
  50. 		header_text_h = vint_object_find("tutorial_header_text", h), 
  51. 		body_text_h = vint_object_find("tutorial_body_text", h), 
  52. 		illustration_h = vint_object_find("illustration", h), 
  53. 	} 
  54. 	 
  55. 	Tutorial_content[2].hint_bar:set_hints(hint_data) 
  56. 	Tutorial_content[2].hint_bar:set_visible(false) 
  57. 	Tutorial_content[2].hint_bar:enable_text_shadow(true) 
  58.  
  59. 	--Initialize Frame size 
  60. 	Tutorial.start_x, Tutorial.start_y = vint_get_property(Tutorial.window_h, "anchor") 
  61. 	Tutorial.scaler = vint_get_property(Tutorial.window_h, "scale") 
  62. 	Tutorial.scaler = 1 * Tutorial.scaler 
  63. 	Tutorial.body_text_x, Tutorial.body_text_y = vint_get_property(Tutorial_content[1].body_text_h, "anchor") 
  64.  
  65. 	--Fade out tween callback... 
  66. 	local anim_h = vint_object_find("fade_out_anim") 
  67. 	local twn_h = vint_object_find("tutorial_alpha_twn", anim_h) 
  68. 	vint_set_property(twn_h, "end_event", "tutorial_wipe_old_values") 
  69. 	 
  70. 	Input_tracker = Vdo_input_tracker:new() 
  71. 	Input_tracker:add_input("map", "tutorial_advance", 500) 
  72. 	Input_tracker:subscribe(false) 
  73. 	 
  74. 	--Hide frame 
  75. 	vint_set_property(Tutorial.window_h, "alpha", 0) 
  76. end 
  77.  
  78. --Standard Cleanup function... 
  79. function tutorial_cleanup() 
  80. 	Input_tracker:subscribe(false) 
  81. end 
  82.  
  83. -- Opens the tutorisl 
  84. function tutorial_open() 
  85. 	--Populate and show the tutorial window 
  86. 	vint_dataresponder_request("tutorial_responder", "tutorial_update", 0, 1) 
  87. end 
  88.  
  89. --	Advances the tutorial... This is called by c when we want to show the next tutorial in sequence... 
  90. function tutorial_advance() -- called from c when it is time to request more data 
  91. 	-- Find out if there are any more tutorials 
  92. 	vint_dataresponder_request("tutorial_responder", "tutorial_update", 0) 
  93. end 
  94.  
  95. --	Closes the tutorial... This is called by c when the game wants the tutorial to die. 
  96. function tutorial_close(force) 
  97. 	Input_tracker:subscribe(false) 
  98. 	 
  99. 	--Stop Fadein 
  100. 	local fade_in_anim_h = vint_object_find("fade_in_anim")		 
  101. 	vint_set_property(fade_in_anim_h, "is_paused", true) 
  102. 	 
  103. 	if Outline_anims ~= nil and Max_outlines > 0 then 
  104. 		for i=1,Max_outlines do 
  105. 			if  Outline_anims[i] ~= nil and Outline_anims[i].anim ~= nil then 
  106. 				vint_set_property( Outline_anims[i].anim.handle, "is_paused", true) 
  107. 				vint_object_destroy( Outline_anims[i].anim.handle ) 
  108. 				Outline_anims[i].outlines_clone:object_destroy()				 
  109. 			end 
  110. 		end 
  111. 	end 
  112. 	 
  113. 	local drop_in_anim_h = vint_object_find("drop_in")	 
  114. 	vint_set_property( drop_in_anim_h, "is_paused", true) 
  115. 	 
  116. 	local outlines_h = vint_object_find( "outlines" ) 
  117. 	vint_set_property( outlines_h, "visible", false) 
  118. 	 
  119. 	Tutorial_first_time = true 
  120. 	Tutorial_show_scanimate = true 
  121. 	 
  122. 	if force == true then 
  123. 		tutorial_set_hud_help_closing(false) 
  124. 	 
  125. 		-- Stop fade out in case its playing 
  126. 		local fade_out_anim_h = vint_object_find("fade_out_anim") 
  127. 		vint_set_property(fade_out_anim_h, "is_paused", true) 
  128. 		 
  129. 		vint_set_property(Tutorial.window_h, "alpha", 0)	 
  130. 	else  
  131. 		-- Reset the fade out's start value 
  132. 		local alpha = vint_get_property(Tutorial.window_h, "alpha") 
  133. 		 
  134. 		-- If the window's already at 0, then we don't need to fade out 
  135. 		if alpha > 0 then 
  136. 			tutorial_set_hud_help_closing(true) 
  137. 			local fade_out_anim_h = vint_object_find("fade_out_anim") 
  138. 			local twn_h = vint_object_find("tutorial_alpha_twn", fade_out_anim_h) 
  139. 			vint_set_property(twn_h, "start_value", alpha) 
  140. 		 
  141. 			--Fade out window 
  142. 			lua_play_anim(fade_out_anim_h) 
  143. 		else 
  144. 			tutorial_set_hud_help_closing(false) 
  145. 		end 
  146. 	end 
  147. end 
  148.  
  149. --Update callback function for the tutorial responder... 
  150. -- 
  151. -- @param 	tutorial_ready 	true, if there is another tutorial and false, if we close.; 
  152. -- @param	header_txt			Title of tutorial 
  153. -- @param	body_txt				Body of the tutorial 
  154. -- @param	tutorial_type		Enum of the tutorial 
  155. -- @param	image_name			Name of the image that should load with the tutorial...		 
  156. function tutorial_update(tutorial_ready, header_txt, body_txt, tutorial_type, image_name, use_back_button) 
  157. 	--	We don't have any tutorials left to display so exit. 
  158. 	if tutorial_ready == false then 
  159. 		tutorial_close() 
  160. 		return 
  161. 	end 
  162. 		 
  163. 	--Get next window content... 
  164. 	local tutorial_content_id = tutorial_advance_window() 
  165. 	local content = Tutorial_content[tutorial_content_id] 
  166. 	 
  167. 	--Update the window Text Elements... 
  168. 	vint_set_property(content.body_text_h, "text_tag", body_txt) 
  169.  
  170. 	--Some tutorials should not have headers 
  171. 	if header_txt == "" or header_txt == nil then 
  172. 		vint_set_property(Tutorial.bg_top, "visible", false) 
  173. 		vint_set_property(content.header_text_h, "visible", false) 
  174. 		vint_set_property(Tutorial.bg_top_small, "visible", false) 
  175. 		vint_set_property(Tutorial.bg_top_small_trim, "visible", false) 
  176. 		Tutorial_show_scanimate = false 
  177. 		 
  178. 		tutorial_enable_text_shadow(true, content.body_text_h) 
  179. 	else 
  180. 		vint_set_property(content.header_text_h, "text_tag", header_txt) 
  181. 		vint_set_property(Tutorial.bg_top, "visible", false) 
  182. 		vint_set_property(content.header_text_h, "visible", true) 
  183. 		vint_set_property(Tutorial.bg_top_small, "visible", true) 
  184. 		vint_set_property(Tutorial.bg_top_small_trim, "visible", true) 
  185. 		 
  186. 		tutorial_enable_text_shadow(false, content.body_text_h) 
  187. 		 
  188. 		--Reset scale of header text... 
  189. 		vint_set_property(content.header_text_h, "scale", 1, 1) 
  190. 		 
  191. 		--Test sizes and scale if needed. 
  192. 		local bg_top_w, bg_top_h = element_get_actual_size(Tutorial.bg_top) 
  193. 		local text_width, text_height = element_get_actual_size(content.header_text_h) 
  194. 		local max_width = bg_top_w - TUTORIAL_HEADER_PADDING 
  195. 		local scale_x, scale_y = 1, 1	--Scale defaults 
  196. 		 
  197. 		 
  198. 		 
  199. 		if text_width > max_width then 
  200. 			--need to scale down header text to fit... 
  201. 			scale_x =  max_width / text_width --only scale the x direction(text is squished but otherwise too small!) 
  202. 		end 
  203. 		 
  204. 		--Set scale... ( 
  205. 		vint_set_property(content.header_text_h, "scale", scale_x, scale_y) 
  206. 		 
  207. 		--Small header bg 
  208. 		text_width, text_height = element_get_actual_size(content.header_text_h) 
  209. 		local bg_top_small_w, bg_top_small_h = element_get_actual_size(Tutorial.bg_top_small) 
  210. 		local new_bg_top_small_w = text_width + (TUTORIAL_HEADER_PADDING * 1.5) 
  211. 		if new_bg_top_small_w > bg_top_w then 
  212. 			new_bg_top_small_w = bg_top_w 
  213. 		end 
  214. 		element_set_actual_size(Tutorial.bg_top_small, new_bg_top_small_w, bg_top_small_h) 
  215. 	end 
  216. 	 
  217. 	--Set image if it exists... 
  218. 	local image_width = 0 
  219. 	local image_height = 0 
  220. 	if image_name == "" or image_name == nil then 
  221. 		--No Image... 
  222. 		vint_set_property(content.illustration_h, "visible", false) 
  223. 		 
  224. 		--Reset text position to default... 
  225. 		vint_set_property(content.body_text_h, "anchor", Tutorial.body_text_x, Tutorial.body_text_y) 
  226. 	else 
  227. 		--Show image and set name... 
  228. 		vint_set_property(content.illustration_h, "visible", true) 
  229. 		vint_set_property(content.illustration_h, "image", image_name) 
  230. 		 
  231. 		--Reposition text below the image... 
  232. 		image_width, image_height = element_get_actual_size(content.illustration_h) 
  233. 		vint_set_property(content.body_text_h, "anchor", Tutorial.body_text_x, Tutorial.body_text_y + image_height) 
  234. 	end 
  235. 	 
  236. 	--Resize tutorial frame and prepare animations... 
  237. 	--Prepare some numbers to resize the window below... 
  238. 	local clip_offset_y = 25 --the distance from the groups origin to the body text box... 
  239.  
  240. 	local width, height = element_get_actual_size(content.body_text_h) 
  241. 	height = (height) + (image_height) + 12 --	Height of tutorial window... 
  242.  
  243. 	-- Show back button 
  244. 	if use_back_button == true then  
  245. 		content.hint_bar:set_visible(true) 
  246. 		Input_tracker:subscribe(true) 
  247. 		local hint_width, hint_height = content.hint_bar:get_size() 
  248. 		height = height + hint_height + TUTORIAL_HINT_PADDING 
  249. 		content.hint_bar:set_anchor(24,height + (hint_height / 2) + TUTORIAL_HINT_SPACING) 
  250. 	else 
  251. 		content.hint_bar:set_visible(false) 
  252. 	end 
  253. 	 
  254. 	--Target box scale... 
  255. 	local body_bg_width, body_bg_height = element_get_actual_size(Tutorial.bg_body_h) 
  256. 	local scale_x, scale_y = element_get_scale_from_size(Tutorial.bg_body_h, body_bg_width, height) 
  257. 	 
  258. 	--Target Clip Size 
  259. 	local clip_width = body_bg_width  
  260. 	local clip_height = 	height + clip_offset_y 
  261. 	 
  262. 	--Target positions 
  263. 	local x = Tutorial.start_x 
  264. 	local y = Tutorial.start_y - (height * Tutorial.scaler)	--The scaler is used for translation... 
  265.  
  266. 	--Resize Clip Tween 
  267.  
  268. 	--Do Alpha Transitions 
  269. 	local content_1_alpha_twn_h 		= vint_object_find("content_1_alpha_twn") 
  270. 	local content_2_alpha_twn_h		= vint_object_find("content_2_alpha_twn") 
  271. 	local clip_size_twn_h				= vint_object_find("clip_size_twn") 
  272. 	local body_scale_twn_h				= vint_object_find("body_scale_twn") 
  273. 	local window_anchor_twn_h			= vint_object_find("window_anchor_twn") 
  274. 	 
  275. 	--Reset values if the tutorial box is new... 
  276. 	local previous_content_alpha = 1		--Value for fading the previous content out... gets set to zero if there was no previous content...  
  277. 	local next_frame_values = { 
  278. 		clip_size_x = clip_width, 
  279. 		clip_size_y = clip_height, 
  280. 		scale_x = scale_x, 
  281. 		scale_y = scale_y, 
  282. 		start_x = Tutorial.start_x, 
  283. 		start_y = y, 
  284. 	} 
  285. 	 
  286. 	if Tutorial_frame_values == -1 then 
  287. 		--Start values same as next values... 
  288. 		Tutorial_frame_values = table_clone(next_frame_values) 
  289. 		 
  290. 		--Have clip mask fade in from left... 
  291. 		Tutorial_frame_values.clip_size_x = 10		 
  292. 		 
  293. 		--Do not allow previous content in view... 
  294. 		previous_content_alpha = 0 						 
  295. 	end 
  296. 	 
  297. 	if tutorial_content_id == 1 then 
  298. 		--Set alpha fades 
  299. 		vint_set_property(content_1_alpha_twn_h, "start_value", 0) 
  300. 		vint_set_property(content_1_alpha_twn_h, "end_value", 1) 
  301. 		vint_set_property(content_2_alpha_twn_h, "start_value", previous_content_alpha) 
  302. 		vint_set_property(content_2_alpha_twn_h, "end_value", 0) 
  303. 	elseif tutorial_content_id == 2 then 
  304. 		--Set alpha fades 
  305. 		vint_set_property(content_1_alpha_twn_h, "start_value", previous_content_alpha) 
  306. 		vint_set_property(content_1_alpha_twn_h, "end_value", 0) 
  307. 		vint_set_property(content_2_alpha_twn_h, "start_value", 0) 
  308. 		vint_set_property(content_2_alpha_twn_h, "end_value", 1)	 
  309. 	end	 
  310. 	 
  311. 	--Animate Clip 
  312. 	vint_set_property(clip_size_twn_h, "start_value", Tutorial_frame_values.clip_size_x, Tutorial_frame_values.clip_size_y) 
  313. 	vint_set_property(clip_size_twn_h, "end_value",  next_frame_values.clip_size_x, next_frame_values.clip_size_y) 
  314. 	 
  315. 	--Animate Body Scale 
  316. 	vint_set_property(body_scale_twn_h, "start_value", Tutorial_frame_values.scale_x, Tutorial_frame_values.scale_y) 
  317. 	vint_set_property(body_scale_twn_h, "end_value", next_frame_values.scale_x, next_frame_values.scale_y) 
  318. 	 
  319. 	--Animate window position 
  320. 	vint_set_property(window_anchor_twn_h, "start_value", Tutorial_frame_values.start_x, Tutorial_frame_values.start_y) 
  321. 	vint_set_property(window_anchor_twn_h, "end_value", Tutorial_frame_values.start_x, next_frame_values.start_y) 
  322. 	 
  323. 	Tutorial_frame_values = next_frame_values 
  324. 	 
  325. 	--play animation 
  326. 	local box_morph_anim_h = vint_object_find("box_morph_anim") 
  327. 	lua_play_anim(box_morph_anim_h)	 
  328. 	 
  329. 	--Stop Fadeout 
  330. 	local fade_out_anim_h = vint_object_find("fade_out_anim") 
  331. 	vint_set_property(fade_out_anim_h, "is_paused", true) 
  332.  
  333. 	--if the tutorial is not already visible then do a seperate/different animation 
  334. 	--and if it's really a tutorial and not help text (DAD 3/21/11) 
  335. 	if Tutorial_first_time and Tutorial_show_scanimate then 
  336. 		local drop_in_anim_h = vint_object_find("drop_in") 
  337. 		--start the frame x far to the right so it animates in centered 
  338. 		--Tutorial_frame_values.start_x = 76 
  339. 		--set the outlines up, they are only used for the first tutorial 
  340. 		tutorial_set_outlines(height, next_frame_values.start_y) 
  341.  
  342. 		--loop through, offset and play the scanimations 
  343. 		for i=1,Max_outlines do 
  344. 			lua_play_anim( Outline_anims[i].anim.handle, (i-1) * 0.06 ) 
  345. 		end 
  346. 		 
  347. 		--play audio for scanimate type 
  348. 		game_UI_audio_play("UI_HUD_Tutorial") 
  349. 		 
  350. 		lua_play_anim(drop_in_anim_h) 
  351. 		--until tutorial_wipe_old_values() or tutorial_close(true) happen we have an open tutorial  
  352. 		Tutorial_first_time = false 
  353. 	elseif Tutorial_first_time then 
  354. 		--play audio for help type 
  355. 		game_UI_audio_play("UI_HUD_Help") 
  356. 	end 
  357. 	 
  358. 	-- tutorial may already be up (or it's a hud help message) attempt to fade in 
  359. 	local	fade_in_anim_h = vint_object_find("fade_in_anim") 
  360. 	local twn_h = vint_object_find("tutorial_alpha_twn") 
  361. 	local alpha = vint_get_property(Tutorial.window_h, "alpha") 
  362. 	vint_set_property(twn_h, "start_value", alpha) 
  363.  
  364. 	lua_play_anim(fade_in_anim_h) 
  365. end 
  366.  
  367. --Setup all the outlines for the scanimation spectacular... 
  368. -- 
  369. -- @param 	height 				height of the black bg box calculated in tutorial_update() 
  370. -- @param	window_end_y		new tutorial window y value calculated in tutorial_update() 
  371. function tutorial_set_outlines( height, window_end_y ) 
  372.  
  373. 	--clear out the clones if we have any 
  374. 	if #Outline_anims > 1 then 
  375. 		for i = 1,Max_outlines do 
  376. 			Outline_anims[i].anim:object_destroy() 
  377. 			Outline_anims[i].outlines_clone:object_destroy()	 
  378. 		end 
  379. 	end 
  380. 	Outline_anims = {} 
  381.  
  382. 	local outlines = Vdo_base_object:new( "outlines" ) 
  383. 	outlines:set_visible(false) 
  384.  
  385. 	local bg_top_w, bg_top_h = element_get_actual_size( Tutorial.bg_top ) 
  386. 	local total_h = height + bg_top_h 
  387. 	--how big the outlines start out at 
  388. 	local scale_amount = 4.0  
  389. 	--base size of the square image the outlines are made of 
  390. 	local base_square_root_scale = 16  
  391. 	--pixel thickness of the lines, if you change this you must change magic_x_offset and magic_y_offset 
  392. 	local line_thickness = 3  
  393. 	--creates a scale value out of a pixel size 
  394. 	local line_scale = line_thickness / base_square_root_scale  
  395. 	--center y value for the outline group 
  396. 	local outline_y_center = window_end_y - line_thickness + (total_h * 0.5) + 1 -- +1 is becuase i removed the space between header and body box 
  397. 	--center x value for the outline group 
  398. 	local outline_x_center = Tutorial.start_x + (bg_top_w * 0.5) 
  399. 	--how many pixels we want the lines to stop at before/after they reach the tutorial box 
  400. 	local end_position_offset = 10 
  401. 	 
  402. 	--these numbers adjust the line widths so that their tips do not overlap 
  403. 	local magic_x_offset = 13 
  404. 	local magic_y_offset = 7 
  405. 	 
  406. 	--set up the anchor tweens 
  407. 	local outline_start_y = total_h * scale_amount  
  408. 	local outline_end_y = (total_h + end_position_offset) * 0.5 
  409. 	local outline_start_x = bg_top_w * scale_amount  
  410. 	local outline_end_x = (bg_top_w + end_position_offset) * 0.5  
  411. 	 
  412. 	vint_set_property( outlines, "anchor", outline_x_center, outline_y_center ) 
  413. 		 
  414. 	local tween = Vdo_tween_object:new( "top_line_anchor") 
  415. 	vint_set_property(tween.handle, "start_value", 0, -1 * outline_start_y) 
  416. 	vint_set_property(tween.handle, "end_value", 0, -1 * outline_end_y) 
  417. 	 
  418. 	tween = Vdo_tween_object:new( "bottom_line_anchor"  ) 
  419. 	vint_set_property(tween.handle, "start_value", 0, outline_start_y) 
  420. 	vint_set_property(tween.handle, "end_value", 0, outline_end_y) 
  421. 	 
  422. 	tween = Vdo_tween_object:new( "left_line_anchor"  ) 
  423. 	vint_set_property(tween.handle, "start_value", -1 * outline_start_x, 0 ) 
  424. 	vint_set_property(tween.handle, "end_value", -1 * outline_end_x, 0 ) 
  425. 	 
  426. 	tween = Vdo_tween_object:new( "right_line_anchor"  ) 
  427. 	vint_set_property(tween.handle, "start_value", outline_start_x, 0 ) 
  428. 	vint_set_property(tween.handle, "end_value", outline_end_x, 0 ) 
  429. 	 
  430. 	--set up the scale tweens 
  431. 	local start_scale_x = line_scale 
  432. 	local start_scale_y = ((total_h) / base_square_root_scale) * ( scale_amount * 2 ) 
  433. 	local end_scale_x = start_scale_x 
  434. 	local end_scale_y = ((total_h + magic_y_offset) / base_square_root_scale) 
  435. 	 
  436. 	tween = Vdo_tween_object:new( "left_line_scale"  ) 
  437. 	vint_set_property(tween.handle, "start_value", start_scale_x, start_scale_y) 
  438. 	vint_set_property(tween.handle, "end_value", end_scale_x, end_scale_y) 
  439. 	 
  440. 	tween = Vdo_tween_object:new( "right_line_scale" ) 
  441. 	vint_set_property(tween.handle, "start_value", start_scale_x, start_scale_y) 
  442. 	vint_set_property(tween.handle, "end_value", end_scale_x, end_scale_y) 
  443. 	 
  444. 	start_scale_x = ((bg_top_w) / base_square_root_scale) * ( scale_amount * 2 ) 
  445. 	start_scale_y = line_scale 
  446. 	end_scale_x = ((bg_top_w + magic_x_offset) / base_square_root_scale) 
  447. 	end_scale_y = start_scale_y 
  448. 	 
  449. 	tween = Vdo_tween_object:new( "top_line_scale" ) 
  450. 	vint_set_property(tween.handle, "start_value", start_scale_x, start_scale_y) 
  451. 	vint_set_property(tween.handle, "end_value", end_scale_x, end_scale_y) 
  452. 	 
  453. 	tween = Vdo_tween_object:new( "bottom_line_scale"  ) 
  454. 	vint_set_property(tween.handle, "start_value", start_scale_x, start_scale_y) 
  455. 	vint_set_property(tween.handle, "end_value", end_scale_x, end_scale_y) 
  456. 		 
  457.  
  458. 	 
  459. 	-- Clone outline animation and group. Then Retarget and store handles for later... 
  460. 	local outline_anim = Vdo_anim_object:new("scanimation") 
  461. 	for index = 1, Max_outlines do 
  462. 		local outlines_clone = Vdo_base_object:clone(outlines.handle) 
  463. 		outlines_clone:set_visible(true) 
  464. 		outlines_clone:set_alpha(0) 
  465. 		local anim = Vdo_anim_object:clone(outline_anim.handle) 
  466. 		anim:set_target_handle(outlines_clone.handle) 
  467. 		anim:stop() 
  468. 		Outline_anims[index] = { 
  469. 			anim = anim, 
  470. 			outlines_clone = outlines_clone, 
  471. 		}  
  472. 		vint_set_property( outlines_clone.handle, "anchor", outline_x_center, outline_y_center ) 
  473. 	end 
  474. 	 
  475. end 
  476.  
  477. -- Callback function for wiping any stagnant window position and size values. 
  478. -- This is used only when the window fully fades out so it is tied as a callback 
  479. -- to the window fadout animation. 
  480. function tutorial_wipe_old_values() 
  481. 	Tutorial_frame_values = -1 
  482. 	-- DAD - 2/22/11 - For the hud help region that uses the tutorial box, need to notify it the fade is done 
  483. 	tutorial_set_hud_help_closing(false) 
  484. 	--reset the flag for checking whether the popup is up or not 
  485. 	Tutorial_first_time = true 
  486. 	Tutorial_show_scanimate = true 
  487. end 
  488.  
  489. -- Advances window id saftely. 
  490. -- 
  491. --@return id of next window... 
  492. function tutorial_advance_window() 
  493. 	Tutorial_current_window = Tutorial_current_window + 1 
  494. 	if Tutorial_current_window == 3 then 
  495. 		Tutorial_current_window = 1 
  496. 	end 
  497. 	return Tutorial_current_window 
  498. end 
  499.  
  500. ----------------------------------------------------------------------------- 
  501. -- Enables super text shadow on  
  502. ----------------------------------------------------------------------------- 
  503. function tutorial_enable_text_shadow(enabled, text_object_h) 
  504. 	if enabled then 
  505. 		vint_set_property(text_object_h, "line_frame_w", "ui_fnt_body_s_w") 
  506. 		vint_set_property(text_object_h, "line_frame_m", "ui_fnt_body_s_m") 
  507. 		vint_set_property(text_object_h, "line_frame_e", "ui_fnt_body_s_e") 
  508. 		vint_set_property(text_object_h, "line_frame_enable", true) 
  509. 		vint_set_property(Tutorial.bg_body_h, "visible", false) 
  510. 		vint_set_property(Tutorial.content_clip_h, "clip_enabled", false) 
  511. 	else 
  512. 		vint_set_property(text_object_h, "line_frame_enable", false) 
  513. 		vint_set_property(Tutorial.bg_body_h, "visible", true) 
  514. 		vint_set_property(Tutorial.content_clip_h, "clip_enabled", true) 
  515. 	end 
  516. end