sr2lua/mp_leaderboards.lua

  1. -- Variable section 
  2. Mp_leaderboards_data = { 
  3. 	handles = { 
  4. 					buttons = {}, 
  5. 					button_shine = {}, 
  6. 					button_fade_in = {}, 
  7. 					button_fade_out = {}, 
  8. 					}, 
  9. 	input_subscriptions = {}, 
  10. 	current_tab = 1, 
  11. 	is_360 = false, 
  12. } 
  13.  
  14. Mp_leaderboards_colors = { 
  15. 	yellow = { r = 229/255, g = 191/255, b = 13/255} 
  16. } 
  17.  
  18. -- Init and cleanup functions 
  19. function mp_leaderboards_init() 
  20.  
  21. 	-- Set up object handles 
  22. 	Mp_leaderboards_data.handles.tab_group_h = vint_object_find("tab_group") 
  23. 	Mp_leaderboards_data.handles.tab_text_h = vint_object_find("tab_text") 
  24. 	Mp_leaderboards_data.handles.stat_headings_h = vint_object_find("stat_headings") 
  25. 	Mp_leaderboards_data.handles.user_row_h = vint_object_find("user_row") 
  26. 	Mp_leaderboards_data.handles.spreadsheet_row_h = vint_object_find("spreadsheet_row") 
  27. 	Mp_leaderboards_data.heading_stat1_h = vint_object_find("heading_stat1") 
  28. 	Mp_leaderboards_data.heading_stat2_h = vint_object_find("heading_stat2") 
  29. 	Mp_leaderboards_data.heading_stat3_h = vint_object_find("heading_stat3") 
  30. 	Mp_leaderboards_data.scroll_group_h = vint_object_find("scroll_group") 
  31. 	Mp_leaderboards_data.scroll_bar_h = vint_object_find("scroll_bar") 
  32. 	 
  33. 	-- Set player name tab 
  34. 	if get_platform() == "XBOX360" then 
  35. 		Mp_leaderboards_data.is_360 = true 
  36. 		Mp_leaderboards_btn_tips.x_button = { label = "CONTROL_SELECT", enabled = mp_leaderboards_btn_x_is_active} 
  37. 		vint_set_property(vint_object_find("heading_player"), "text_tag", "MP_LB_GAMERTAG") 
  38. 	end 
  39. 	 
  40. 	-- Set up animation handles 
  41. 	Mp_leaderboards_data.handles.tab_slide_h = vint_object_find("tab_slide") 
  42. 	vint_set_property(Mp_leaderboards_data.handles.tab_slide_h, "is_paused", true) 
  43. 	 
  44. 	Mp_leaderboards_data.handles.highlight_shine_anim_h = vint_object_find("highlight_shine_anim") 
  45. 	vint_set_property(Mp_leaderboards_data.handles.highlight_shine_anim_h, "is_paused", true) 
  46. 	 
  47. 	Mp_leaderboards_data.handles.columns_fade_h = vint_object_find("columns_fade") 
  48. 	vint_set_property(Mp_leaderboards_data.handles.columns_fade_h, "is_paused", true) 
  49.  
  50. 	Mp_leaderboards_data.visible_row = {} 
  51. 	Mp_leaderboards_data.current_tab = 1 
  52. 	 
  53. 	local left_trigger_h = vint_object_find("left_trigger") 
  54. 	vint_set_property(left_trigger_h, "image", get_left_trigger()) 
  55. 	local right_trigger_h = vint_object_find("right_trigger") 
  56. 	vint_set_property(right_trigger_h, "image", get_right_trigger()) 
  57. 	 
  58. 	Mp_leaderboards_data.top100 = true 
  59. 	Mp_leaderboards_data.num_tabs = 0 
  60. 	Mp_leaderboards_data.current_column = 3 
  61. 	Mp_leaderboards_data.can_move = true 
  62. 	 
  63. 	-- All the data for the tab columns and headings 
  64. 	Mp_leaderboards_data.tabs = {	[1] =	{ 	title = "MULTI_MODE_13", -- Gangsta Brawl 
  65. 														column_1 = "MP_STATS_WINS", -- Wins 
  66. 														column_2 = "MP_STATS_LOSSES", -- Losses 
  67. 														column_3 = "+/-", -- +/- 
  68. 														num_columns = 0, 
  69. 														data = {[3] = "MP_GB"}, 
  70. 														conversion = mp_leaderboards_format_commas, 
  71. 														default_column = 3, 
  72. 														show_badge = true, 
  73. 													}, 
  74. 											 
  75. 											[2] =	{ 	title = "MULTI_MODE_14",  -- Team Gangsta Brawl 
  76. 														column_1 = "MP_STATS_WINS", -- Wins 
  77. 														column_2 = "MP_STATS_LOSSES", -- Losses 
  78. 														column_3 = "+/-", -- +/- 
  79. 														num_columns = 0, 
  80. 														data = {[3] = "MP_TGB"}, 
  81. 														conversion = mp_leaderboards_format_commas, 
  82. 														default_column = 3, 
  83. 														show_badge = true, 
  84. 													}, 
  85. 													 
  86. 											[3] =	{	title = "MULTI_MODE_STRONGARM", -- Strong Arm 
  87. 														column_1 = "MP_STATS_WINS", -- Wins 
  88. 														column_2 = "MP_STATS_LOSSES", -- Losses 
  89. 														column_3 = "+/-", -- +/- 
  90. 														num_columns = 0, 
  91. 														data = {[3] = "MP_SA"}, 
  92. 														conversion = mp_leaderboards_format_commas, 
  93. 														default_column = 3, 
  94. 														show_badge = true, 
  95. 													}, 
  96. 											 
  97. 											[4] =	{ 	title = "MP_LB_MP_KILLS", -- Multiplayer Kills 
  98. 														column_1 = "STAT_MP_KILLS", -- Kills 
  99. 														column_2 = "STAT_MP_DEATHS", -- Deaths 
  100. 														column_3 = "+/-", -- +/- 
  101. 														num_columns = 0, 
  102. 														data = {[3] = "MP_KILLS"}, 
  103. 														conversion = mp_leaderboards_format_commas, 
  104. 														default_column = 3, 
  105. 														show_badge = true, 
  106. 													}, 
  107. 											 
  108. 											[5] =	{ 	title = "LEADERBOARDS_MP_EARNINGS", -- Multiplayer Earnings 
  109. 														column_1 = "ACT_VANDAL_SUMMARY_TOTAL", -- Total 
  110. 														num_columns = 0, 
  111. 														data = {[1] = "MP_MONEY"}, 
  112. 														conversion = mp_leaderboards_format_money, 
  113. 														default_column = 1, 
  114. 														show_badge = true, 
  115. 													}, 
  116. 											 
  117. 											[6] =	{ 	title = "MULTI_LOBBY_GAME_TIME", -- Game Time 
  118. 														column_1 = "LEADERBOARDS_SP", -- Single Player 
  119. 														column_2 = "MULTI_MODE_17", -- Co-op 
  120. 														num_columns = 2, 
  121. 														data = "SP_TIME", 
  122. 														data = {[1] = "SP_COL1_TIME", [2] = "SP_COL2_TIME"}, 
  123. 														conversion = mp_leaderboards_format_time, 
  124. 														default_column = 1, 
  125. 														show_badge = false, 
  126. 													}, 
  127. 											 
  128. 											[7] =	{ 	title = "MULTI_MODE_17", -- Co-op 
  129. 														column_1 = "STAT_MP_KILLS", -- Kills 
  130. 														num_columns = 0, 
  131. 														data = {[1] = "SP_COL1_COOP"}, 
  132. 														conversion = mp_leaderboards_format_commas, 
  133. 														default_column = 1, 
  134. 														show_badge = false, 
  135. 													}, 
  136. 											 
  137. 											[8] =	{ 	title = "MP_Leaderboard_Diversion_Stars", -- Diversion Stars 
  138. 														column_1 = "DIVERSION_SURVIVAL_GOAL_NAME_GOLD", -- Gold 
  139. 														column_2 = "DIVERSION_SURVIVAL_GOAL_NAME_SILVER", -- Silver 
  140. 														column_3 = "DIVERSION_SURVIVAL_GOAL_NAME_BRONZE", -- Bronze 
  141. 														num_columns = 3, 
  142. 														data = {[1] = "SP_COL1_DIVERSIONS", [2] = "SP_COL2_DIVERSIONS", [3] = "SP_COL3_DIVERSIONS"}, 
  143. 														conversion = mp_leaderboards_format_commas, 
  144. 														default_column = 1, 
  145. 														show_badge = false, 
  146. 													}, 
  147. 											[9]=	{ 	title = "KILLING_SPREE", -- Killing Spree 
  148. 														column_1 = "MP_GANGS_STATS_GANG", -- Gang 
  149. 														column_2 = "MULTI_TAG_NAME_POLICE", -- Police 
  150. 														column_3 = "MP_Leaderboard_Ped", -- Ped 
  151. 														num_columns = 3, 
  152. 														data = {[1] = "SP_COL1_KILLS", [2] = "SP_COL2_KILLS", [3] = "SP_COL3_KILLS"}, 
  153. 														conversion = mp_leaderboards_format_commas, 
  154. 														default_column = 1, 
  155. 														show_badge = false, 
  156. 													}, 
  157. 													 
  158. 											[10] =	{ 	title = "MP_Leaderboard_Max_Notoriety", -- Max Notoriety 
  159. 														column_1 = "MP_GANGS_STATS_GANG", -- Gang 
  160. 														column_2 = "MULTI_TAG_NAME_POLICE", -- Police 
  161. 														num_columns = 2, 
  162. 														data = {[1] = "SP_COL1_MAX_NOTORIETY", [2] = "SP_COL2_MAX_NOTORIETY"}, 
  163. 														conversion = mp_leaderboards_format_time, 
  164. 														default_column = 1, 
  165. 														show_badge = false, 
  166. 													}, 
  167. 											 
  168. 											[11]=	{ 	title = "MP_Leaderboard_Vehicle_Jumping", -- Vehicle Jumping 
  169. 														column_1 = "MP_Leaderboard_Distance", -- Distance 
  170. 														column_2 = "MP_Leaderboard_Height", -- Height 
  171. 														column_3 = "MP_Leaderboard_Spin", -- Spin 
  172. 														num_columns = 3, 
  173. 														data = {[1] = "SP_COL1_JUMPS", [2] = "SP_COL2_JUMPS", [3] = "SP_COL3_JUMPS"}, 
  174. 														conversion = mp_leaderboards_format_distance, 
  175. 														default_column = 1, 
  176. 														show_badge = false, 
  177. 													}, 
  178. 											 
  179. 											[12]=	{ 	title = "DIVERSION_COMBAT_TRICKS_THROWING", -- Throwing 
  180. 														column_1 = "MP_Leaderboard_Distance", -- Distance 
  181. 														num_columns = 0, 
  182. 														data = {[1] = "SP_THROW_DISTANCE"}, 
  183. 														conversion = mp_leaderboards_format_distance, 
  184. 														default_column = 1, 
  185. 														show_badge = false, 
  186. 													}, 
  187. 										} 
  188. 	 
  189. 	local tab_divider = 20 
  190. 	local tab_left_placer = 0 
  191. 	 
  192. 	for idx, val in Mp_leaderboards_data.tabs do 
  193. 		-- Make a  clone of the tab heading 
  194. 		Mp_leaderboards_data.tabs[idx].heading_h = vint_object_clone(Mp_leaderboards_data.handles.tab_text_h) 
  195. 		 
  196. 		-- Put the title name in the tab 
  197. 		vint_set_property(Mp_leaderboards_data.tabs[idx].heading_h, "text_tag", Mp_leaderboards_data.tabs[idx].title) 
  198. 		 
  199. 		-- Get the size of the tab 
  200. 		local x_size, y_size, x_anchor, y_anchor 
  201. 		x_size, y_size = element_get_actual_size(Mp_leaderboards_data.tabs[idx].heading_h) 
  202. 		Mp_leaderboards_data.tabs[idx].center = tab_left_placer + x_size/2 
  203. 	 
  204. 		-- Move the tab to the end of the list 
  205. 		x_anchor, y_anchor = vint_get_property(Mp_leaderboards_data.tabs[idx].heading_h, "anchor") 
  206. 		vint_set_property(Mp_leaderboards_data.tabs[idx].heading_h, "anchor", tab_left_placer, y_anchor) 
  207. 		vint_set_property(Mp_leaderboards_data.tabs[idx].heading_h, "visible", true) 
  208. 		 
  209. 		-- Save the full size of the whole list of tabs 
  210. 		Mp_leaderboards_data.tab_range = tab_left_placer + x_size 
  211. 		 
  212. 		-- Set up the positioning for the next space 
  213. 		tab_left_placer = tab_left_placer + x_size + tab_divider 
  214. 		Mp_leaderboards_data.num_tabs = Mp_leaderboards_data.num_tabs + 1 
  215. 	end 
  216. 	 
  217. 	--Subscribe to input 
  218. 	Mp_leaderboards_data.input_subscriptions = {	 
  219. 		vint_subscribe_to_input_event(nil, "nav_up",				"mp_leaderboards_input", 50), 
  220. 		vint_subscribe_to_input_event(nil, "nav_down",			"mp_leaderboards_input", 50), 
  221. 		vint_subscribe_to_input_event(nil, "nav_left",			"mp_leaderboards_input", 50), 
  222. 		vint_subscribe_to_input_event(nil, "nav_right",			"mp_leaderboards_input", 50), 
  223. 		vint_subscribe_to_input_event(nil, "scroll_left",		"mp_leaderboards_input", 50), 
  224. 		vint_subscribe_to_input_event(nil, "scroll_right",		"mp_leaderboards_input", 50), 
  225. 		vint_subscribe_to_input_event(nil, "select",				"mp_leaderboards_input", 50), 
  226. 		vint_subscribe_to_input_event(nil, "back",				"mp_leaderboards_input", 50), 
  227. 		vint_subscribe_to_input_event(nil, "alt_select",		"mp_leaderboards_input", 50), 
  228. 		vint_subscribe_to_input_event(nil, "exit",				"mp_leaderboards_input", 50), 
  229. 		vint_subscribe_to_input_event(nil, "map",					"mp_leaderboards_input", 50), 
  230. 		vint_subscribe_to_input_event(nil, "pause",				"mp_leaderboards_input", 50), 
  231. 	} 
  232. 	 
  233. 	-- Start first spreadsheet lookup 
  234. 	mp_leaderboards_change_spreadsheet(0) 
  235. 	 
  236. 	--Hijack button tips from previous menu 
  237. 	if vint_document_find("main_menu") ~= 0 then 
  238. 		--Hide previous menu 
  239. 		vint_set_property(Menu_option_labels.frame, "visible", false) 
  240. 		 
  241. 		--Set button tips previous menu and update tips 
  242. 		Menu_active.btn_tips = Mp_leaderboards_btn_tips 
  243. 		mp_leaderboards_update_btn_tips() 
  244. 	end 
  245. end 
  246.  
  247. function mp_leaderboards_cleanup() 
  248.  
  249. 	-- Blow away all the objects and animations 
  250. 	for idx, val in Mp_leaderboards_data.visible_row do 
  251. 		vint_object_destroy(Mp_leaderboards_data.visible_row[idx].pulsate) 
  252. 		vint_object_destroy(Mp_leaderboards_data.visible_row[idx].line_h) 
  253. 	end 
  254. 	 
  255. 	-- Blow away all the data 
  256. 	for idx, val in Mp_leaderboards_data.list_data do 
  257. 		Mp_leaderboards_data.list_data[idx] = nil 
  258. 	end 
  259. 	 
  260. 	-- Kill subscriptions 
  261. 	for idx, val in Mp_leaderboards_data.input_subscriptions do 
  262. 		vint_unsubscribe_to_input_event(idx) 
  263. 	end 
  264. 	Mp_leaderboards_data.input_subscriptions = nil 
  265. 	 
  266. 	 
  267. 	--Show button tips on main menu 
  268. 	if vint_document_find("main_menu") ~= 0 and Menu_active ~= 0 then 
  269. 		--reset button tips 
  270. 		Menu_active.btn_tips = nil 
  271. 		btn_tips_update() 
  272. 		vint_set_property(Menu_option_labels.frame, "visible", true) 
  273. 	end	 
  274. end 
  275.  
  276. function mp_leaderboards_input(target, event, accelleration) 
  277.  
  278. 	-- Make sure button presses are ok first 
  279. 	if Mp_leaderboards_data.can_move == true then 
  280. 	 
  281. 		if event == "nav_up" then 
  282. 			-- Up button pressed 
  283. 			audio_play(Menu_sound_item_nav) 
  284. 			mp_leaderboards_change_row(-1) 
  285. 			 
  286. 		elseif event == "nav_down" then 
  287. 			-- Down button presses 
  288. 			audio_play(Menu_sound_item_nav) 
  289. 			mp_leaderboards_change_row(1) 
  290. 			 
  291. 		elseif event == "scroll_left" then 
  292. 			-- Left button pressed 
  293. 			audio_play(Menu_sound_scroll) 
  294. 			mp_leaderboards_change_spreadsheet(-1) 
  295. 			 
  296. 		elseif event == "scroll_right" then 
  297. 			-- Right button presses 
  298. 			audio_play(Menu_sound_scroll) 
  299. 			mp_leaderboards_change_spreadsheet(1) 
  300. 			 
  301. 		elseif event == "nav_left" then 
  302. 			-- Resort 
  303. 			if Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].num_columns > 1 then 
  304. 				audio_play(Menu_sound_value_nav) 
  305. 				mp_leaderboards_change_column(-1) 
  306. 			end 
  307. 			 
  308. 		elseif event == "nav_right" then 
  309. 			-- Resort 
  310. 			if Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].num_columns > 1 then 
  311. 				audio_play(Menu_sound_value_nav) 
  312. 				mp_leaderboards_change_column(1) 
  313. 			end 
  314. 			 
  315. 		elseif event == "select" then 
  316. 			if Mp_leaderboards_data.list_data[Mp_leaderboards_data.current_virtual_row] ~= nil then 
  317. 				-- Bring up player info 
  318. 				mp_popup_open(Mp_leaderboards_data.list_data[Mp_leaderboards_data.current_virtual_row].index, 2) 
  319. 			end 
  320. 			 
  321. 		elseif event == "back" then 
  322. 			-- Animate out 
  323. 			vint_document_unload(vint_document_find("mp_leaderboards")) 
  324. 			audio_play(Menu_sound_back) 
  325. 			menu_input_block(false) 
  326. 		 
  327. 		elseif event == "alt_select" then 
  328. 			if Mp_leaderboards_data.is_360 then 
  329. 				-- Toggle friends 
  330. 				if Mp_leaderboards_data.top100 then 
  331. 					Mp_leaderboards_data.top100 = false 
  332. 				else 
  333. 					Mp_leaderboards_data.top100 = true 
  334. 				end 
  335. 				audio_play(Menu_sound_select) 
  336. 				 
  337. 				--Update hints 
  338. 				mp_leaderboards_update_btn_tips() 
  339.  
  340. 				-- Refresh the leaderboard 
  341. 				thread_new("mp_leaderboards_refresh_data") 
  342. 			end 
  343. 		 
  344. 		elseif event == "exit" then 
  345. 			-- Do nothing, just block menu base from seeing this 
  346. 		end 
  347. 	end 
  348. end 
  349.  
  350. function mp_leaderboards_cleanup_hints() 
  351. 	local bx = 17 
  352. 	local gap = 36 
  353. 	 
  354. 	-- Clean up their positions (lots of nasty magic numbers here because I copy/pasted it - jhg) 
  355. 	local t1a, t1b = vint_get_property(Mp_leaderboards_data.handles.A_text_h, "anchor") 
  356. 	local t1x, t1y = element_get_actual_size(Mp_leaderboards_data.handles.A_text_h) 
  357. 	vint_set_property(Mp_leaderboards_data.handles.X_btn_h, "anchor", t1a + t1x + gap, 498.0) 
  358. 	 
  359. 	local b2a, b2b = vint_get_property(Mp_leaderboards_data.handles.X_btn_h, "anchor") 
  360. 	vint_set_property(Mp_leaderboards_data.handles.X_text_h, "anchor", bx + b2a + 16, t1b) 
  361. 	 
  362. 	local t2x, t2y = element_get_actual_size(Mp_leaderboards_data.handles.X_text_h) 
  363. 	local t2a, t2b = vint_get_property(Mp_leaderboards_data.handles.X_text_h, "anchor") 
  364. 	vint_set_property(Mp_leaderboards_data.handles.B_btn_h, "anchor", t2a + t2x + gap, 498.0)	 
  365.  
  366. 	local b3a, b3b = vint_get_property(Mp_leaderboards_data.handles.B_btn_h, "anchor") 
  367. 	vint_set_property(Mp_leaderboards_data.handles.B_text_h, "anchor", b3a + bx + 16, t1b) 
  368. 	 
  369. end 
  370.  
  371. function mp_leaderboards_change_spreadsheet(idir) 
  372.  
  373. 	-- Set up new tab index 
  374. 	Mp_leaderboards_data.current_tab = Mp_leaderboards_data.current_tab + idir 
  375. 	 
  376. 	-- Wrap index if necessary 
  377. 	if Mp_leaderboards_data.current_tab < 1 then 
  378. 		Mp_leaderboards_data.current_tab = Mp_leaderboards_data.num_tabs 
  379. 		 
  380. 	elseif Mp_leaderboards_data.current_tab > Mp_leaderboards_data.num_tabs then 
  381. 		Mp_leaderboards_data.current_tab = 1 
  382. 	end 
  383.  
  384. 	-- Blank out colors on all tabs 
  385. 	for idx, val in Mp_leaderboards_data.tabs do 
  386. 		local clear_tab = Mp_leaderboards_data.tabs[idx].heading_h 
  387. 		vint_set_property(clear_tab, "tint",95/255,95/255,95/255) 
  388. 	end 
  389. 	 
  390. 	-- Make new tab yellow 
  391. 	local new_tab_h = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].heading_h 
  392. 	vint_set_property(new_tab_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  393.  
  394. 	-- Set up animation to move the tabs 
  395. 	local tab_tween_h = vint_object_find("tab_text_translate",Mp_leaderboards_data.handles.tab_slide_h) 
  396. 	local x, y = vint_get_property(Mp_leaderboards_data.handles.tab_group_h,"anchor") 
  397. 	vint_set_property(tab_tween_h, "start_value", x, 0.0) 
  398. 	vint_set_property(Mp_leaderboards_data.handles.stat_headings_h, "alpha", 0.0) 
  399. 	 
  400. 	if Mp_leaderboards_data.num_tabs == 0 then 
  401. 		debug_print("vint", "Should not be changing the spreadsheet when there are no tabs set!\n") 
  402. 	else 
  403. 		local frame_size = vint_get_property(vint_object_find("tab_clip"),"clip_size") 
  404. 		frame_size = frame_size - 4 -- Safety buffer to make sure we don't accidentally cut the edges of any text 
  405. 		local destination = 0 
  406. 		 
  407. 		-- Are we already showing all options to the left? 
  408. 		if Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].center < frame_size/2 then 
  409. 			destination = 0 
  410. 		-- Are we already showing all options to the right? 
  411. 		elseif Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].center > Mp_leaderboards_data.tab_range - frame_size/2 then 
  412. 			destination = - Mp_leaderboards_data.tab_range + frame_size 
  413. 		-- We're somewhere in the middle, just peg the current selection in the center 
  414. 		else 
  415. 			destination = - Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].center + frame_size/2 
  416. 		end 
  417.  
  418. 		vint_set_property(tab_tween_h, "end_value", destination, 0.0) 
  419. 	end 
  420. 	 
  421. 	-- Move the tabs 
  422. 	lua_play_anim(Mp_leaderboards_data.handles.tab_slide_h,0) 
  423. 	lua_play_anim(Mp_leaderboards_data.handles.columns_fade_h,0) 
  424. 	 
  425. 	-- Set the column texts 
  426. 	local heading_1 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].column_1 
  427. 	local heading_2 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].column_2 
  428. 	local heading_3 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].column_3 
  429. 	 
  430. 	if heading_2 == nil then 
  431. 		heading_2 = " " 
  432. 	end 
  433. 	 
  434. 	if heading_3 == nil then 
  435. 		heading_3 = " " 
  436. 	end 
  437. 	 
  438. 	vint_set_property(Mp_leaderboards_data.heading_stat1_h, "text_tag", heading_1) 
  439. 	vint_set_property(Mp_leaderboards_data.heading_stat2_h, "text_tag", heading_2) 
  440. 	vint_set_property(Mp_leaderboards_data.heading_stat3_h, "text_tag", heading_3) 
  441.  
  442. 	-- Zero out the spreadsheet cursors 
  443. 	Mp_leaderboards_data.current_virtual_row = 1 
  444. 	Mp_leaderboards_data.current_column = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].default_column 
  445. 	 
  446. 	-- Refresh the column (which automatically refreshes the spreadsheet) 
  447. 	mp_leaderboards_change_column(0) 
  448. end 
  449.  
  450. function mp_leaderboards_change_row(idir) 
  451.  
  452. 	-- Set up virtual row 
  453. 	Mp_leaderboards_data.current_virtual_row = Mp_leaderboards_data.current_virtual_row + idir 
  454. 	 
  455. 	-- Wrap virtual row 
  456. 	if Mp_leaderboards_data.current_virtual_row < 1 then 
  457. 		Mp_leaderboards_data.current_virtual_row = Mp_leaderboards_data.num_virtual_rows 
  458. 	elseif Mp_leaderboards_data.current_virtual_row > Mp_leaderboards_data.num_virtual_rows then 
  459. 		Mp_leaderboards_data.current_virtual_row = 1 
  460. 	end 
  461. 	 
  462. 	-- Set up visible row 
  463. 	if Mp_leaderboards_data.num_virtual_rows > 10 then 
  464.  
  465. 		-- If we're at the top of the list, clamp things down and move the highlight toward the top 
  466. 		if Mp_leaderboards_data.current_virtual_row <= 5 then 
  467. 			Mp_leaderboards_data.top_virtual_row = 1 
  468. 			Mp_leaderboards_data.current_visible_row = Mp_leaderboards_data.current_virtual_row 
  469. 			 
  470. 		-- If we're at the bottom of the list, clamp things and move the highlight toward the bottom 
  471. 		elseif Mp_leaderboards_data.current_virtual_row > Mp_leaderboards_data.num_virtual_rows - 5 then 
  472. 			Mp_leaderboards_data.top_virtual_row = Mp_leaderboards_data.num_virtual_rows - 9 
  473. 			Mp_leaderboards_data.current_visible_row = Mp_leaderboards_data.current_virtual_row - Mp_leaderboards_data.num_virtual_rows + 10 
  474. 			 
  475. 		-- We're scrolling somewhere in the middle, clamp the highlight and move the virtual list around it 
  476. 		else 
  477. 			Mp_leaderboards_data.top_virtual_row = Mp_leaderboards_data.current_virtual_row - 4 
  478. 			Mp_leaderboards_data.current_visible_row = 5 
  479. 		end 
  480. 		 
  481. 		-- Redraw the row text 
  482. 		mp_leaderboards_redraw_rows() 
  483. 	 
  484. 	else 
  485. 		-- No chance of scrolling, so just modify the highlight 
  486. 		Mp_leaderboards_data.current_visible_row = Mp_leaderboards_data.current_virtual_row 
  487. 	end 
  488. 	 
  489. 	-- Draw in the highlight 
  490. 	for i = 1, Mp_leaderboards_data.num_visible_rows do 
  491. 		if i == Mp_leaderboards_data.current_visible_row then 
  492. 			vint_set_property(Mp_leaderboards_data.visible_row[i].highlight_h, "visible", true) 
  493. 		else 
  494. 			vint_set_property(Mp_leaderboards_data.visible_row[i].highlight_h, "visible", false) 
  495. 		end 
  496. 	end 
  497. 	 
  498. end 
  499.  
  500. function mp_leaderboards_change_column(idir) 
  501.  
  502. 	local num_columns = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].num_columns 
  503.  
  504. 	-- Blank out old column 
  505. 	vint_set_property(Mp_leaderboards_data.heading_stat1_h, "tint",160/255,160/255,160/255) 
  506. 	vint_set_property(Mp_leaderboards_data.heading_stat2_h, "tint",160/255,160/255,160/255) 
  507. 	vint_set_property(Mp_leaderboards_data.heading_stat3_h, "tint",160/255,160/255,160/255) 
  508. 	 
  509. 	if num_columns ~= 0 then 
  510. 		-- Set up new column index 
  511. 		Mp_leaderboards_data.current_column = Mp_leaderboards_data.current_column + idir 
  512. 		 
  513. 		-- Wrap if necessary 
  514. 		if Mp_leaderboards_data.current_column < 1 then 
  515. 			Mp_leaderboards_data.current_column = num_columns 
  516. 		elseif Mp_leaderboards_data.current_column > num_columns then 
  517. 			Mp_leaderboards_data.current_column = 1 
  518. 		end 
  519. 		 
  520. 		-- Color in new column 
  521. 		if Mp_leaderboards_data.current_column == 1 then 
  522. 			vint_set_property(Mp_leaderboards_data.heading_stat1_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  523. 		elseif Mp_leaderboards_data.current_column == 2 then 
  524. 			vint_set_property(Mp_leaderboards_data.heading_stat2_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  525. 		elseif Mp_leaderboards_data.current_column == 3 then 
  526. 			vint_set_property(Mp_leaderboards_data.heading_stat3_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  527. 		end 
  528. 	end 
  529. 	 
  530. 	-- Refresh all the stuff inside the spreadsheet 
  531. 	thread_new("mp_leaderboards_refresh_data") 
  532. end 
  533.  
  534. function mp_leaderboards_new_record(rank, badge, name, stat1, stat2, stat3, is_friend, is_player, index) 
  535.  
  536. 	-- Increment the virtual row 
  537. 	local i = Mp_leaderboards_data.num_virtual_rows + 1 
  538. 	 
  539. 	-- Format the values (commas, $, distance) 
  540. 	stat1 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].conversion(stat1) 
  541. 	 
  542. 	if stat2 ~= nil then 
  543. 		stat2 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].conversion(stat2) 
  544. 	else 
  545. 		stat2 = " " 
  546. 	end 
  547. 	 
  548. 	-- HACK TO ADD ° TO SPINS 
  549. 	if Mp_leaderboards_data.current_tab == 11 then 
  550. 		stat3 = stat3 .. "°" 
  551. 	else 
  552. 	 
  553. 		-- END HACK 
  554. 		if stat3 ~= nil then 
  555. 			stat3 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].conversion(stat3) 
  556. 		else 
  557. 			stat3 = " " 
  558. 		end 
  559. 	end 
  560. 	 
  561. 	-- Format data 
  562. 	local d = { 
  563. 		rank = rank, 
  564. 		badge = badge, 
  565. 		name = name, 
  566. 		stat1 = stat1, 
  567. 		stat2 = stat2, 
  568. 		stat3 = stat3, 
  569. 		is_friend = 0, -- Throw away friend variable because we couldn't use it the way we wanted to 
  570. 		is_player = is_player, 
  571. 		index = index, 
  572. 	} 
  573. 	 
  574. 	-- Assign the data to the local variable 
  575. 	Mp_leaderboards_data.list_data[i] = d 
  576. 	Mp_leaderboards_data.num_virtual_rows = i 
  577. end 
  578.  
  579. -- Formats a distance string given an initial value in meters 
  580. function mp_leaderboards_format_distance(value) 
  581.  
  582. 	if use_imperial_units() then 
  583. 		-- Convert to feet 
  584. 		value = floor(value * 3.2808399) 
  585. 		 
  586. 		-- Format the feet string and display 
  587. 		value = mp_leaderboards_format_commas(value) 
  588. 		value = {[0] = value} 
  589. 		return vint_insert_values_in_string("LUA_DISTANCE_FEET", value) 
  590. 	else 
  591. 		-- Format the meters string and display 
  592. 		value = mp_leaderboards_format_commas(value) 
  593. 		value = {[0] = value} 
  594. 		return vint_insert_values_in_string("LUA_DISTANCE_METERS", value) 
  595. 	end 
  596. end 
  597.  
  598. -- Formats a time string given an intial value in seconds 
  599. function mp_leaderboards_format_time(time_in_seconds) 
  600. 	 
  601. 	-- Pull out hours, minutes, and seconds 
  602. 	local hours = floor(time_in_seconds / 3600) 
  603. 	local minutes = floor(time_in_seconds / 60) - (hours * 60) 
  604. 	local seconds =  mod(time_in_seconds, 60) 
  605.  
  606. 	-- Pad minutes if less than 10 and there are hours 
  607. 	if hours > 0 and minutes < 10 then 
  608. 		minutes = "0" .. minutes 
  609. 	end 
  610. 	 
  611. 	-- Pad seconds if needed 
  612. 	if seconds < 10 then 
  613. 		seconds = "0" .. seconds 
  614. 	end 
  615. 	 
  616. 	-- Build the string 
  617. 	if hours > 0 then 
  618. 		return hours .. ":" .. minutes .. ":" .. seconds 
  619. 	else 
  620. 		return minutes .. ":" .. seconds 
  621. 	end 
  622. end 
  623.  
  624. -- Formats a given value into money with commas 
  625. function mp_leaderboards_format_money(value) 
  626. 	return "$" .. format_cash(value) 
  627. end 
  628.  
  629. -- Adds commas to a numerical value 
  630. function mp_leaderboards_format_commas(value) 
  631. 	return format_cash(value) 
  632. end 
  633.  
  634. function mp_leaderboards_my_record(rank, badge, name, stat1, stat2, stat3, is_friend, is_player, index) 
  635.  
  636. 	local user_rank_h = vint_object_find("user_rank", Mp_leaderboards_data.handles.user_row_h) 
  637. 	local user_badge_h = vint_object_find("user_badge", Mp_leaderboards_data.handles.user_row_h) 
  638. 	local user_name_h = vint_object_find("user_name", Mp_leaderboards_data.handles.user_row_h) 
  639. 	local user_stat1_h = vint_object_find("user_stat1", Mp_leaderboards_data.handles.user_row_h) 
  640. 	local user_stat2_h = vint_object_find("user_stat2", Mp_leaderboards_data.handles.user_row_h) 
  641. 	local user_stat3_h = vint_object_find("user_stat3", Mp_leaderboards_data.handles.user_row_h) 
  642.  
  643. 	-- Format the values (commas, $, distance) 
  644. 	stat1 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].conversion(stat1) 
  645. 	 
  646. 	if stat2 ~= nil then 
  647. 		stat2 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].conversion(stat2) 
  648. 	else 
  649. 		stat2 = " " 
  650. 	end 
  651. 	 
  652. 	-- HACK TO ADD ° TO SPINS 
  653. 	if Mp_leaderboards_data.current_tab == 11 then 
  654. 		stat3 = stat3 .. "°" 
  655. 	else 
  656. 	 
  657. 		if stat3 ~= nil then 
  658. 			stat3 = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].conversion(stat3) 
  659. 		else 
  660. 			stat3 = " " 
  661. 		end 
  662. 	end 
  663. 	 
  664. 	if rank ~= 0 then 
  665. 		vint_set_property(user_rank_h, "text_tag", rank) 
  666. 		vint_set_property(user_badge_h, "image", badge) 
  667. 		vint_set_property(user_name_h, "text_tag", name) 
  668. 		vint_set_property(user_stat1_h, "text_tag", stat1) 
  669. 		vint_set_property(user_stat2_h, "text_tag", stat2) 
  670. 		vint_set_property(user_stat3_h, "text_tag", stat3) 
  671.  
  672. 		vint_set_property(user_badge_h, "visible", Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].show_badge) 
  673. 		vint_set_property(Mp_leaderboards_data.handles.user_row_h, "visible", true) 
  674. 	end 
  675. end 
  676.  
  677. function mp_leaderboards_refresh_data() 
  678. 	-- Lock out changing 
  679. 	Mp_leaderboards_data.can_move = false 
  680.  
  681. 	-- Blow away old physical lines 
  682. 	for idx, val in Mp_leaderboards_data.visible_row do 
  683. 		vint_object_destroy(Mp_leaderboards_data.visible_row[idx].pulsate) 
  684. 		vint_object_destroy(Mp_leaderboards_data.visible_row[idx].line_h) 
  685. 	end 
  686. 	 
  687. 	-- Hide the player data 
  688. 	vint_set_property(Mp_leaderboards_data.handles.user_row_h, "visible", false) 
  689. 	 
  690. 	-- Get rid of the scroll bar 
  691. 	vint_set_property(Mp_leaderboards_data.scroll_group_h, "visible", false) 
  692. 	 
  693. 	-- Show the spinner 
  694. 	local spinner = vint_object_find("spinner") 
  695. 	vint_set_property(spinner, "visible", true) 
  696. 	 
  697. 	-- Blow away any old player data 
  698. 	-- Zero out the number of vitual rows 
  699. 	Mp_leaderboards_data.top_virtual_row = 1 
  700. 	Mp_leaderboards_data.current_virtual_row = 1 
  701. 	Mp_leaderboards_data.current_visible_row = 1 
  702. 	Mp_leaderboards_data.num_virtual_rows = 0 
  703. 	Mp_leaderboards_data.list_data = { } 
  704. 	 
  705. 	-- Get the data name we're using 
  706. 	local data = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].data[Mp_leaderboards_data.current_column] 
  707.  
  708. 	-- Show either to 100 players or friends 
  709. 	if Mp_leaderboards_data.top100 then 
  710. 		vint_dataresponder_request("leaderboards", "mp_leaderboards_new_record", 100, "general", data, 1) 
  711. 	else 
  712. 		vint_dataresponder_request("leaderboards", "mp_leaderboards_new_record", 100, "friends", data, 1)  
  713. 	end 
  714. 	 
  715. 	-- Show player data no matter where they are in the main list 
  716. 	vint_dataresponder_request("leaderboards", "mp_leaderboards_my_record", 1, "player", data, 1) 
  717.  
  718. 	-- Set up number of visible rows 
  719. 	Mp_leaderboards_data.num_visible_rows = Mp_leaderboards_data.num_virtual_rows 
  720. 	 
  721. 	-- We have more virtual rows than we can display 
  722. 	if Mp_leaderboards_data.num_visible_rows > 10 then 
  723. 	 
  724. 		-- Clamp visible rows to 10 
  725. 		Mp_leaderboards_data.num_visible_rows = 10 
  726. 		 
  727. 		-- Set up scroll bar translation scaler 
  728. 		Mp_leaderboards_data.scroll_bar_scaler =  18 + 185 * ((Mp_leaderboards_data.num_virtual_rows - 11)/89) 
  729. 		 
  730. 		-- Set up scroll bar size 
  731. 		local scale_y = 65 + 185 * ((100 - Mp_leaderboards_data.num_virtual_rows)/89) 
  732. 		local bar_h = vint_object_find("scroll_bar", Mp_leaderboards_data.scroll_group_h) 
  733. 		local bottom_h = vint_object_find("scroll_bar_bottom", bar_h) 
  734. 		vint_set_property(bar_h, "source_se", 32.0, scale_y) 
  735. 		vint_set_property(bottom_h, "anchor", 0.0, scale_y) 
  736.  
  737. 		-- Display the scroll bar 
  738. 		vint_set_property(Mp_leaderboards_data.scroll_group_h, "visible", true) 
  739. 	else 
  740. 		-- Declare anyway just in case 
  741. 		Mp_leaderboards_data.scroll_bar_scaler =  0 
  742. 	end 
  743. 	 
  744. 	-- Hang on to position of top row 
  745. 	local x,y = vint_get_property(Mp_leaderboards_data.handles.spreadsheet_row_h, "anchor") 
  746.  
  747. 	-- Make all the new visible rows and set them up for code reference 
  748. 	for i = 1, Mp_leaderboards_data.num_visible_rows do 
  749. 	 
  750. 		-- Clone row and animation 
  751. 		local line_h = vint_object_clone(Mp_leaderboards_data.handles.spreadsheet_row_h) 
  752. 		local pulsate = vint_object_clone(Mp_leaderboards_data.handles.highlight_shine_anim_h) 
  753. 		 
  754. 		-- Apply animation 
  755. 		local pulsate_tween = vint_object_find("highlight_shine_fade", pulsate) 
  756. 		vint_set_property(pulsate_tween, "target_handle", vint_object_find("highlight_back_shine", line_h)) 
  757. 		 
  758. 		-- Set all new handles 
  759. 		local highlight_h = vint_object_find("highlight", line_h) 
  760. 		local highlight_name_h = vint_object_find("highlight_name", line_h) 
  761. 		local highlight_stat1_h = vint_object_find("highlight_stat1", line_h) 
  762. 		local highlight_stat2_h = vint_object_find("highlight_stat2", line_h) 
  763. 		local highlight_stat3_h = vint_object_find("highlight_stat3", line_h) 
  764. 		local normal_rank_h = vint_object_find("normal_rank", line_h) 
  765. 		local normal_badge_h = vint_object_find("normal_badge", line_h) 
  766. 		local normal_name_h = vint_object_find("normal_name", line_h) 
  767. 		local normal_stat1_h = vint_object_find("normal_stat1", line_h) 
  768. 		local normal_stat2_h = vint_object_find("normal_stat2", line_h) 
  769. 		local normal_stat3_h = vint_object_find("normal_stat3", line_h) 
  770. 		 
  771. 		-- Save everything in a nice table 
  772. 		Mp_leaderboards_data.visible_row[i] = {line_h = line_h, 
  773. 															pulsate = pulsate, 
  774. 															highlight_h = highlight_h, 
  775. 															highlight_name_h = highlight_name_h, 
  776. 															highlight_stat1_h = highlight_stat1_h, 
  777. 															highlight_stat2_h = highlight_stat2_h, 
  778. 															highlight_stat3_h = highlight_stat3_h, 
  779. 															normal_rank_h = normal_rank_h, 
  780. 															normal_badge_h = normal_badge_h, 
  781. 															normal_name_h = normal_name_h, 
  782. 															normal_stat1_h = normal_stat1_h, 
  783. 															normal_stat2_h = normal_stat2_h, 
  784. 															normal_stat3_h = normal_stat3_h, 
  785. 															} 
  786. 		 
  787. 		-- Draw the row 
  788. 		vint_set_property(Mp_leaderboards_data.visible_row[i].line_h, "anchor", x, y + (32 * (i - 1))) 
  789. 		vint_set_property(Mp_leaderboards_data.visible_row[i].line_h, "visible", true) 
  790. 	end 
  791. 	 
  792. 	-- Hide the spinner 
  793. 	vint_set_property(spinner, "visible", false) 
  794. 	 
  795. 	-- Fill in the lines based on position 
  796. 	mp_leaderboards_redraw_rows() 
  797. 	 
  798. 	-- Return the cursor 
  799. 	mp_leaderboards_change_row(0) 
  800. 	 
  801. 	-- Unlock changing 
  802. 	Mp_leaderboards_data.can_move = true 
  803. end 
  804.  
  805. function mp_leaderboards_redraw_rows() 
  806.  
  807. 	-- Fill data into all the spreadsheet based on how many visible rows there are 
  808. 	for i = 1, Mp_leaderboards_data.num_visible_rows do 
  809. 		-- Hang on to virtualized number of the row 
  810. 		local virtual = Mp_leaderboards_data.top_virtual_row + i - 1 
  811. 	 
  812. 		-- Set all the graphics 
  813. 		vint_set_property(Mp_leaderboards_data.visible_row[i].highlight_name_h, "text_tag", Mp_leaderboards_data.list_data[virtual].name) 
  814. 		vint_set_property(Mp_leaderboards_data.visible_row[i].highlight_stat1_h, "text_tag", Mp_leaderboards_data.list_data[virtual].stat1) 
  815. 		vint_set_property(Mp_leaderboards_data.visible_row[i].highlight_stat2_h, "text_tag", Mp_leaderboards_data.list_data[virtual].stat2) 
  816. 		vint_set_property(Mp_leaderboards_data.visible_row[i].highlight_stat3_h, "text_tag", Mp_leaderboards_data.list_data[virtual].stat3) 
  817. 		vint_set_property(Mp_leaderboards_data.visible_row[i].normal_rank_h, "text_tag", Mp_leaderboards_data.list_data[virtual].rank) 
  818. 		vint_set_property(Mp_leaderboards_data.visible_row[i].normal_badge_h, "image", Mp_leaderboards_data.list_data[virtual].badge) 
  819. 		vint_set_property(Mp_leaderboards_data.visible_row[i].normal_name_h, "text_tag", Mp_leaderboards_data.list_data[virtual].name) 
  820. 		vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat1_h, "text_tag", Mp_leaderboards_data.list_data[virtual].stat1) 
  821. 		vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat2_h, "text_tag", Mp_leaderboards_data.list_data[virtual].stat2) 
  822. 		vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat3_h, "text_tag", Mp_leaderboards_data.list_data[virtual].stat3) 
  823. 		 
  824. 		-- Set badge visibility 
  825. 		vint_set_property(Mp_leaderboards_data.visible_row[i].normal_badge_h, "visible", Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].show_badge) 
  826. 		 
  827. 		-- Set name and badge colors 
  828. 		if Mp_leaderboards_data.list_data[virtual].is_player == true then 
  829. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_rank_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  830. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_name_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  831. 		else 
  832. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_rank_h, "tint", 95/255,95/255,95/255) 
  833. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_name_h, "tint", 95/255,95/255,95/255) 
  834. 		end 
  835. 		 
  836. 		-- Start with blank column colors 
  837. 		if Mp_leaderboards_data.list_data[virtual].is_player == true then 
  838. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat1_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  839. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat2_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  840. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat3_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  841. 			 
  842. 		else 
  843. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat1_h, "tint", 95/255,95/255,95/255) 
  844. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat2_h, "tint", 95/255,95/255,95/255) 
  845. 			vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat3_h, "tint", 95/255,95/255,95/255) 
  846. 		end 
  847. 	 
  848. 		local num_columns = Mp_leaderboards_data.tabs[Mp_leaderboards_data.current_tab].num_columns 
  849. 		 
  850. 		if num_columns > 0 then 
  851. 			-- Add column highlight color 
  852. 			if Mp_leaderboards_data.current_column == 1 then 
  853. 				vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat1_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  854. 			elseif Mp_leaderboards_data.current_column == 2 then 
  855. 				vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat2_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b) 
  856. 			elseif Mp_leaderboards_data.current_column == 3 then 
  857. 				vint_set_property(Mp_leaderboards_data.visible_row[i].normal_stat3_h, "tint", Mp_leaderboards_colors.yellow.r, Mp_leaderboards_colors.yellow.g, Mp_leaderboards_colors.yellow.b 
  858. ) 
  859. 			end 
  860. 		end 
  861. 	end 
  862. 	 
  863. 	-- Set up destination for scroll bar 
  864. 	local bar_y = 202 + (Mp_leaderboards_data.scroll_bar_scaler * (Mp_leaderboards_data.current_virtual_row - 1)/(Mp_leaderboards_data.num_virtual_rows - 1)) 
  865. 	vint_set_property(Mp_leaderboards_data.scroll_bar_h, "anchor", 991.0, bar_y) 
  866. end 
  867.  
  868.  
  869. function mp_leaderboards_update_btn_tips() 
  870.  
  871. 	-- Set hint text 
  872. 	if Mp_leaderboards_data.is_360 then 
  873. 		if Mp_leaderboards_data.top100 then 
  874. 			Mp_leaderboards_btn_tips.x_button.label = "MULTI_LOBBY_FRIENDS_ONLY" 
  875. 		else 
  876. 			Mp_leaderboards_btn_tips.x_button.label = "LEADERBOARDS_TOP100" 
  877. 		end 
  878. 	end 
  879. 	 
  880. 	--Call to menubase to update the button tips 
  881. 	btn_tips_update() 
  882. end 
  883.  
  884. function mp_leaderboards_btn_x_is_active() 
  885. 	return true 
  886. end 
  887.  
  888. Mp_leaderboards_btn_tips = { 
  889. 	a_button 	= 	{ label = "CONTROL_SELECT", 	enabled = mp_leaderboards_btn_x_is_active}, 
  890. 	b_button 	= 	{ label = "MENU_BACK", 			enabled = mp_leaderboards_btn_x_is_active}, 
  891. } 
  892.  
  893. Mp_leaderboards_btn_temp_tips = {}