./vdo_grid_button_layered.lua

  1.  
  2. -- Defines for specially handled finish/palettes 
  3. -- 
  4. STORE_VEHICLE_HERO_MATTE							= 0 
  5. STORE_VEHICLE_HERO_GLOSS							= 1 
  6. STORE_VEHICLE_IRIDESCENT							= 2 
  7. STORE_VEHICLE_PEARLESCENT							= 3 
  8. STORE_VEHICLE_CANDY									= 4 
  9.  
  10. function vdo_grid_button_layered_init() 
  11. end 
  12.  
  13. function vdo_grid_button_layered_cleanup() 
  14. end 
  15.  
  16. -- Inherited from Vdo_base_object 
  17. Vdo_grid_button_layered = Vdo_base_object:new_base() 
  18.  
  19. -- Sets the check box 
  20. function Vdo_grid_button_layered:set_check_box(is_checked,is_locked) 
  21. end 
  22.  
  23. --sets the icon for the grid button 
  24. function Vdo_grid_button_layered:set_icon(swatch) 
  25.  
  26. 	local base_h = Vdo_base_object:new("base", self.handle) 
  27. 	local fres_h = Vdo_base_object:new("fres", self.handle) 
  28. 	local irr_h  = Vdo_base_object:new("irr", self.handle) 
  29. 	local refl_h = Vdo_base_object:new("refl", self.handle) 
  30. 	local sky_h  = Vdo_base_object:new("sky", self.handle) 
  31. 	local spec_h = Vdo_base_object:new("spec", self.handle) 
  32. 	 
  33. 	-- Hide everything except base until we need it 
  34. 	fres_h:set_visible(false) 
  35. 	irr_h:set_visible(false) 
  36. 	refl_h:set_visible(false) 
  37. 	sky_h:set_visible(false) 
  38. 	spec_h:set_visible(false) 
  39. 		 
  40. 	-- Common: every color hase a base color 
  41. 	base_h:set_color(swatch.base_r, swatch.base_g, swatch.base_b) 
  42. 	 
  43. 	-- Are we a color type other than matte? 
  44. 	if swatch.palette_type == STORE_VEHICLE_HERO_GLOSS then 
  45. 		-- Gloss = spec, reflection 
  46. 		spec_h:set_visible(true) 
  47. 		spec_h:set_color(swatch.spec_col_r, swatch.spec_col_g, swatch.spec_col_b) 
  48. 		spec_h:set_alpha(swatch.spec_alpha) 
  49.  
  50. 		refl_h:set_visible(true) 
  51. 		refl_h:set_color(swatch.base_r, swatch.base_g, swatch.base_b) 
  52. 		refl_h:set_alpha(.2)--swatch.refl_alpha)				 
  53. 		 
  54. 	elseif swatch.palette_type == STORE_VEHICLE_PEARLESCENT then 
  55. 		-- Pearlescent = spec, reflection, fresnel 
  56. 		spec_h:set_visible(true) 
  57. 		spec_h:set_color(swatch.spec_col_r, swatch.spec_col_g, swatch.spec_col_b) 
  58. 		spec_h:set_alpha(swatch.spec_alpha) 
  59. 		 
  60. 		refl_h:set_visible(true) 
  61. 		refl_h:set_color(swatch.base_r, swatch.base_g, swatch.base_b) 
  62. 		refl_h:set_alpha(.6)--swatch.refl_alpha) 
  63. 		 
  64. 		fres_h:set_visible(true) 
  65. 		fres_h:set_color(swatch.fres_col_r, swatch.fres_col_g, swatch.fres_col_b) 
  66. 		fres_h:set_alpha(1)		 
  67. 		 
  68. 	elseif swatch.palette_type == STORE_VEHICLE_IRIDESCENT then 
  69. 		-- Irridescent = spec, reflection, fresnel, irridescence 
  70. 		spec_h:set_visible(true) 
  71. 		spec_h:set_color(swatch.spec_col_r, swatch.spec_col_g, swatch.spec_col_b) 
  72. 		spec_h:set_alpha(swatch.spec_alpha) 
  73. 		 
  74. 		refl_h:set_visible(true) 
  75. 		refl_h:set_color(swatch.base_r, swatch.base_g, swatch.base_b) 
  76. 		refl_h:set_alpha(.4)--swatch.refl_alpha) 
  77. 		 
  78. 		fres_h:set_visible(true) 
  79. 		fres_h:set_color(swatch.fres_col_r, swatch.fres_col_g, swatch.fres_col_b) 
  80. 		fres_h:set_alpha(1)		 
  81.  
  82. 		irr_h:set_visible(true) 
  83. 		irr_h:set_color(swatch.spec_col_r, swatch.spec_col_g, swatch.spec_col_b) 
  84. 	 
  85. 	elseif swatch.palette_type == STORE_VEHICLE_CANDY then 
  86. 		spec_h:set_visible(true) 
  87. 		spec_h:set_color(swatch.spec_col_r, swatch.spec_col_g, swatch.spec_col_b) 
  88. 		spec_h:set_alpha(swatch.spec_alpha) 
  89.  
  90. 		refl_h:set_visible(true) 
  91. 		refl_h:set_color(swatch.base_r, swatch.base_g, swatch.base_b) 
  92. 		refl_h:set_alpha(.3)--swatch.refl_alpha)						 
  93. 	end 
  94. 	 
  95. 	 
  96. 	--[[--base_h:set_image(swatch.icon) 
  97. 	 
  98. 	local base_adj = 1.5	 
  99. 	 
  100. 	-- Setup the colors 
  101. 	base_h:set_color(swatch.base_r * base_adj, swatch.base_g * base_adj, swatch.base_b * base_adj) 
  102. 	 
  103. 	-- if swatch.is_glass == true then 
  104. 		-- base_h:set_image("ui_bms_veh_glass") 
  105. 		-- fresh_h:set_visible(false) 
  106. 		-- irr_h:set_visible(false) 
  107. 		-- refl_h:set_visible(false) 
  108. 		-- sky_h:set_visible(false) 
  109. 		-- spec_h:set_visible(false) 
  110. 		-- return 
  111. 	-- end 
  112. 	 
  113. 	if swatch.is_glass == true then 
  114. 		--vint_set_property(icon_h, "scale", 0.86, 0.86) 
  115. 		--vint_set_property(icon_h, "anchor", -1, -1) 
  116. 		--base, make this dark 
  117. 		base_h:set_image("ui_menu_veh_glass")  -- dark 
  118. 		base_h:set_alpha(0.4) 
  119. 		base_h:set_color(0,0,0) 
  120. 		base_h:set_anchor(3,3) 
  121. 		--make the irr channel be the tinted color of glass 
  122. 		irr_h:set_image("ui_menu_veh_glass") --normal 
  123. 		irr_h:set_alpha(1) 
  124. 		irr_h:set_color(swatch.base_r * base_adj, swatch.base_g * base_adj, swatch.base_b * base_adj) 
  125. 		--make reflection turn on, be normal color to simulate real reflection 
  126. 		refl_h:set_image("ui_menu_veh_glass") 
  127. 		refl_h:set_alpha(0.62) 
  128. 		refl_h:set_color(1,1,1) 
  129. 		--turn off other shit 
  130. 		fres_h:set_visible(false) 
  131. 		sky_h:set_visible(false) 
  132. 		spec_h:set_visible(false)		 
  133. 		return 
  134. 	end	 
  135. 	 
  136. 	base_h:set_image("ui_menu_veh_pnt_base") 
  137. 	irr_h:set_image("ui_menu_veh_pnt_base") 
  138. 	refl_h:set_image("ui_menu_veh_pnt_base")	 
  139. 	 
  140. 	--Setup the alphas 
  141. 	if swatch.spec_alpha ~= nil then 
  142. 		spec_h:set_alpha(swatch.spec_alpha) --* 0.8) 
  143. 		spec_h:set_color(swatch.spec_col_r, swatch.spec_col_g, swatch.spec_col_b) 
  144. 		irr_h:set_color(swatch.spec_col_r, swatch.spec_col_g, swatch.spec_col_b) 
  145. 	else 
  146. 		spec_h:set_alpha(0) 
  147. 	end 
  148. 	 
  149. 	if swatch.refl ~= nil then 
  150. 		refl_h:set_alpha(swatch.refl) 
  151. 	else 
  152. 		refl_h:set_alpha(0) 
  153. 	end 
  154. 	 
  155. 	if swatch.sky_h ~= nil then 
  156. 		sky_h:set_alpha(swatch.refl)-- * 0.2) 
  157. 	else 
  158. 		sky_h:set_alpha(0) 
  159. 	end 
  160. 	 
  161. 	if swatch.fres_con ~= nil then 
  162. 		fres_h:set_alpha(swatch.fres_con)-- * 0.5) 
  163. 		fres_h:set_color(swatch.fres_col_r, swatch.fres_col_g, swatch.fres_col_b) 
  164. 		sky_h:set_color(swatch.fres_col_r, swatch.fres_col_g, swatch.fres_col_b) 
  165. 		refl_h:set_color(swatch.fres_col_r, swatch.fres_col_g, swatch.fres_col_b) 
  166. 	else 
  167. 		fres_h:set_alpha(0) 
  168. 	end	 
  169. 	 
  170. 	if swatch.fres_con == 0 then 
  171. 		irr_h:set_visible(false) 
  172. 	else 
  173. 		irr_h:set_alpha(0) 
  174. 	end	]]-- 
  175. 	 
  176. end 
  177.  
  178. --sets the icon for the grid button using a crc of the image name 
  179. --Used by the mp badge selection screen 
  180. function Vdo_grid_button_layered:set_icon_crc(new_icon_crc) 
  181. 	local icon = Vdo_base_object:new("grid_icon", self.handle) 
  182. 	icon:set_property("image_crc", new_icon_crc) 
  183. end 
  184.  
  185. -- Sets the width of the grid button 
  186. function Vdo_grid_button_layered:set_size(width,height) 
  187. 	 
  188. 	local button_grp = Vdo_base_object:new("button_grp", self.handle)	 
  189. 	local button_grp_w, button_grp_h = button_grp:get_screen_size() 
  190. 	button_grp:set_scale(width/button_grp_w, height/button_grp_h)	 
  191. 	 
  192. end 
  193.  
  194. -- Sets the highlighted state of the grid button to on or off 
  195. function Vdo_grid_button_layered:set_highlight(is_highlighted) 
  196. end 
  197.  
  198. function Vdo_grid_button_layered:set_highlight_color() 
  199. end 
  200.