sr2lua/menu_style_dialog.lua

  1. Menu_style_dialog_flair_thread = 0 
  2.  
  3. function menu_style_dialog_init() 
  4. 	local inserts = {[0] = Style_cluster_player_style.level, [1] = Style_cluster_player_style.bonus} 
  5. 	local body = "MENU_STYLE_DIALOG_BODY" 
  6. 	local body_string = vint_insert_values_in_string(body, inserts) 
  7. 	local body_text_h = vint_object_find("body_text") 
  8. 	vint_set_property(body_text_h, "text_tag", body_string) 
  9. 	 
  10. 	vint_subscribe_to_input_event(nil, "select",				"menu_style_dialog_input", 50) 
  11. 	vint_subscribe_to_input_event(nil, "all_unassigned",	"menu_style_dialog_input", 50) 
  12. 	 
  13. 	--Resize textbox if the words get too big 
  14. 	local body_text_width, body_text_height = element_get_actual_size(body_text_h) 
  15. 	if body_text_height > 90 then 
  16. 		vint_set_property(body_text_h, "wrap_width", 345) 
  17. 	end 
  18. 	 
  19. 	vint_set_property(vint_object_find("style_flair_rotation_twn_1"), "end_event", "menu_style_dialog_flair") 
  20. 	audio_play(audio_get_audio_id("SYS_HUD_CONF_REWARD")) 
  21. end 
  22.  
  23. function menu_style_dialog_input(target, event, accelleration) 
  24. 	if event == "select" then 
  25. 		vint_document_unload() 
  26. 	end 
  27. end 
  28.  
  29. function menu_style_dialog_flair() 
  30. 	if Menu_style_dialog_flair_thread == 0 then 
  31. 		Menu_style_dialog_flair_thread = thread_new("menu_style_dialog_flair2") 
  32. 	end 
  33. end 
  34. 	 
  35. function menu_style_dialog_flair2() 
  36. 	delay(rand_float(2, 5)) 
  37. 	 
  38. 	vint_set_property(vint_object_find("style_flair_anim_0"), "start_time", vint_get_time_index()) 
  39. 	Menu_style_dialog_flair_thread = 0 
  40. end 
  41.