./main_sl_settings.lua

  1. local ID_CHANGE_PASSWORD	= 1 
  2. local ID_CHANGE_EMAIL		= 2 
  3. local ID_DISCONNECT			= 3 
  4.  
  5. local Menu = { 
  6. 	[1] = { 
  7. 		type = TYPE_BUTTON, 
  8. 		label = "SL_MENU_CHANGE_PASSWORD", 
  9. 		id = ID_CHANGE_PASSWORD, 
  10. 	}, 
  11. 	[2] = { 
  12. 		type = TYPE_BUTTON, 
  13. 		label = "SL_MENU_CHANGE_EMAIL", 
  14. 		id = ID_CHANGE_EMAIL, 
  15. 	}, 
  16. 	[3] = { 
  17. 		type = TYPE_BUTTON, 
  18. 		label = "SL_MENU_DISCONNECT", 
  19. 		id = ID_DISCONNECT, 
  20. 	}, 
  21. } 
  22. function main_sl_settings_init() 
  23. end 
  24.  
  25. function main_sl_settings_cleanup() 
  26. end 
  27.  
  28. local Input_tracker 
  29. local Mouse_input_tracker 
  30.  
  31. local Screen_width 
  32. if vint_is_std_res() then 
  33. 	Screen_width = 750 
  34. else 
  35. 	Screen_width = 840 
  36. end 
  37.  
  38. ---------------------------------------------------------------------------  
  39. -- Initialize Pause Options Menu. 
  40. --------------------------------------------------------------------------- 
  41. function main_sl_settings_init() 
  42. 	-- Subscribe to the button presses we need 
  43. 		 
  44. 	Input_tracker = Vdo_input_tracker:new() 
  45. 	Input_tracker:add_input("select", 		"main_sl_settings_button_a", 50) 
  46. 	Input_tracker:add_input("back", 			"main_sl_settings_button_b", 50) 
  47. 	Input_tracker:add_input("nav_up", 		"main_sl_settings_nav_up", 50) 
  48. 	Input_tracker:add_input("nav_down", 	"main_sl_settings_nav_down", 50) 
  49. 	Input_tracker:add_input("nav_left", 	"main_sl_settings_nav_left", 50) 
  50. 	Input_tracker:add_input("nav_right",	"main_sl_settings_nav_right", 50) 
  51. 	Input_tracker:subscribe(false) 
  52.  
  53. 	--Initialize Header 
  54. 	Header_obj:show_me(false) 
  55. 	Header_mini_obj:set_text("SL_TITLE_SETTINGS") 
  56. 	Header_mini_obj:set_visible(true) 
  57. 	 
  58. 	--Setup Button Hints 
  59. 	local hint_data = { 
  60. 		{CTRL_MENU_BUTTON_B, "MENU_BACK"}, 
  61. 	} 
  62. 	Menu_hint_bar:set_hints(hint_data)   
  63.  
  64. 	List:set_visible(true) 
  65. 	List:draw_items(Menu, 1, Screen_width) 
  66. 	 
  67. 	--Store some locals to the pause menu common for screen processing. 
  68. 	menu_common_set_list_style(List, Header_obj, Screen_width) 
  69. 	 
  70. 	bg_saints_show(true) 
  71. 	menu_common_set_screen_data(List, Header_obj, Input_tracker, Screen_back_out_anim, Screen_slide_out_anim)	 
  72. 	 
  73. 	--Show silverlink Login 
  74. 	main_menu_silverlink_login_show(true) 
  75. 	 
  76. 	--Some stuff i'm not sure what it does yet (JMH- 4/30/2013) 
  77. 	if First_time then 
  78. 		Screen_in_anim:play(0) 
  79. 		bg_saints_slide_in(Screen_width) 
  80. 		First_time = false 
  81. 	end 
  82. 	 
  83. 	-- Add mouse inputs for the PC 
  84. 	if game_get_platform() == "PC" then 
  85. 		Menu_hint_bar:set_highlight(0) 
  86. 		 
  87. 		Mouse_input_tracker = Vdo_input_tracker:new() 
  88. 		List:add_mouse_inputs("main_sl_settings", Mouse_input_tracker) 
  89. 		Menu_hint_bar:add_mouse_inputs("main_sl_settings", Mouse_input_tracker) 
  90. 		Mouse_input_tracker:subscribe(true) 
  91. 	end 
  92. end 
  93.  
  94. function main_sl_settings_cleanup() 
  95. 	-- Nuke all button subscriptions 
  96. 	Input_tracker:subscribe(false) 
  97. 	if Mouse_input_tracker ~= nil then 
  98. 		Mouse_input_tracker:subscribe(false) 
  99. 	end 
  100. 	List:enable_toggle_input(false) 
  101. 	 
  102. 	Header_obj:show_me(true) 
  103. 	Header_mini_obj:set_visible(false) 
  104. end 
  105.  
  106. function main_sl_settings_nav_up(event, acceleration) 
  107. 	-- Move highlight up 
  108. 	List:move_cursor(-1) 
  109. end 
  110.  
  111. function main_sl_settings_nav_down(event, acceleration) 
  112. 	-- Move highlight down 
  113. 	List:move_cursor(1) 
  114. end 
  115.  
  116. function main_sl_settings_nav_left(event, acceleration) 
  117. 	-- Move highlight left 
  118. 	List:move_slider(-1) 
  119. end 
  120.  
  121. function main_sl_settings_nav_right(event, acceleration) 
  122. 	-- Move highlight right 
  123. 	List:move_slider(1) 
  124. end 
  125.  
  126. function main_sl_settings_button_a(event, acceleration) 
  127. 	local current_id = List:get_id() 
  128. 	 
  129. 	--Add current selection to the stack to store the selected position on the menu 
  130. 	menu_common_stack_add(current_id) 
  131. 	 
  132. 	--pass off the input to the list 
  133. 	List:button_a() 
  134.  
  135. 	if current_id == ID_CHANGE_PASSWORD then 
  136. 		silverlink_dlg_change_password() 
  137. 	elseif current_id == ID_CHANGE_EMAIL then  
  138. 		silverlink_dlg_change_email() 
  139. 	elseif current_id == ID_DISCONNECT then  
  140. 		silverlink_disconnect() 
  141. 		main_sl_settings_button_b() 
  142. 	end 
  143. end 
  144.  
  145.  
  146. function main_sl_settings_button_b(event, acceleration) 
  147. 	List:button_b() 
  148.  
  149. 	Input_tracker:subscribe(false) 
  150. 	if Mouse_input_tracker ~= nil then 
  151. 		Mouse_input_tracker:subscribe(false) 
  152. 	end 
  153. 	 
  154. 	--Hide silverlink Login 
  155. 	main_menu_silverlink_login_show(false) 
  156. 	 
  157. 	-- final pop... 
  158. 	--Remove current menu from the stack 
  159. 	menu_common_stack_remove() 
  160. 	 
  161. 	--Pop Screen off the list 
  162. 	menu_common_transition_pop(1) 
  163. 		 
  164. 	bg_saints_slide_out() 
  165. end 
  166.  
  167. function main_sl_settings_mouse_click(event, target_handle) 
  168. 	local hint_index = Menu_hint_bar:get_hint_index(target_handle) 
  169. 	if hint_index == 1 then 
  170. 		main_sl_settings_button_b() 
  171. 	end 
  172.  
  173. 	local new_index = List:get_button_index(target_handle) 
  174. 	if new_index ~= 0 then 
  175. 		List:set_selection(new_index) 
  176. 		main_sl_settings_button_a() 
  177. 	end 
  178. end 
  179.  
  180. function main_sl_settings_mouse_move(event, target_handle) 
  181. 	Menu_hint_bar:set_highlight(0) 
  182. 	 
  183. 	local hint_index = Menu_hint_bar:get_hint_index(target_handle) 
  184. 	if hint_index ~= 0 then 
  185. 		Menu_hint_bar:set_highlight(hint_index) 
  186. 	end 
  187. 	 
  188. 	local new_index = List:get_button_index(target_handle) 
  189. 	if new_index ~= 0 then 
  190. 		List:set_selection(new_index) 
  191. 		List:move_cursor(0, true) 
  192. 	end 
  193. end 
  194.  
  195. -- Calls form C 
  196.  
  197. function silverlink_connection_changed() 
  198. 	-- Jeff do stuff here 
  199. end 
  200.  
  201.  
  202. function silverlink_all_dialogs_closed() 
  203. 	--Show the cursor 
  204. 	List:move_cursor(0) 
  205. end 
  206.  
  207.