./vdo_weapon_pips.lua

  1. -- Inherited from Vdo_base_object 
  2. Vdo_weapon_pips = Vdo_base_object:new_base() 
  3.  
  4. local MAX_PIPS			= 5 
  5.  
  6. COLOR_PIPS_FULLY_UPGRADED = {R=255/255, G=207/255, B=42/255} 
  7. COLOR_PIPS_NOT_FULLY_UPGRADED = {R=255/255, G=147/255, B=42/255} 
  8.  
  9. ---------------------------------------------------------------------------  
  10. -- Initialize pips 
  11. --------------------------------------------------------------------------- 
  12. function vdo_weapon_pips_init() 
  13. 	 
  14. end 
  15.  
  16. function Vdo_weapon_pips:init() 
  17.  
  18. 	--Member Variables 
  19. 	self.full_pips = {} 
  20. 	self.empty_pips= {} 
  21.  
  22. 	self.upgrade_text_pos_grp_h = vint_object_find("upgrade_text_pos_grp", self.handle, self.doc_handle) 
  23. 	vint_set_property(self.upgrade_text_pos_grp_h, "visible", false) 
  24.  
  25. 	self.upgrade_text_h = Vdo_base_object:new("upgrade_text", self.handle, self.doc_handle) 
  26. 	self.upgrade_text_h:set_text("") 
  27.  
  28. 	self.pips_grp_h = vint_object_find("pips", self.handle, self.doc_handle) 
  29. 	vint_set_property(self.pips_grp_h, "visible", false) 
  30.  
  31. 	--find reference base icons (amount of flaps may change) 
  32. 	for i = 1, MAX_PIPS do 
  33. 		-- full pips 
  34. 		local full_pip_h = vint_object_find("full_" .. i, self.handle, self.doc_handle) 
  35. 		self.full_pips[i] = full_pip_h 
  36. 		vint_set_property(self.full_pips[i], "visible", false) 
  37. 		-- down pips 
  38. 		local empty_pip_h = vint_object_find("empty_" .. i, self.handle, self.doc_handle) 
  39. 		self.empty_pips[i] = empty_pip_h 
  40. 		vint_set_property(self.empty_pips[i], "visible", false) 
  41. 	end 
  42. end 
  43.  
  44. function Vdo_weapon_pips:cleanup() 
  45. 	 
  46. 	vint_object_destroy(self.upgrade_text_pos_grp_h) 
  47. 	vint_object_destroy(self.pips_grp_h) 
  48.  
  49. end 
  50.  
  51. function Vdo_weapon_pips:show_upgrade_info( upgrade_name, upgrade_level_max, upgrade_level_cur, is_ultimate, fully_upgraded ) 
  52. 	 
  53. 	vint_set_property(self.upgrade_text_pos_grp_h, "visible", true) 
  54.  
  55. 	local base_weapon_string = "{0:text_tag_crc}" 
  56. 	local values = {[0] = upgrade_name} 
  57. 	local upgrade_name_tag = vint_insert_values_in_string(base_weapon_string, values) 
  58.  
  59. 	self.upgrade_text_h:set_text(upgrade_name_tag) 
  60. 	--vint_set_property(self.upgrade_text_h, "text_tag_crc", upgrade_name) 
  61.  
  62. 	vint_set_property(self.pips_grp_h, "visible", true) 
  63.  
  64. 	if is_ultimate == false then 
  65.  
  66. 		for i = 1, MAX_PIPS do 
  67.  
  68. 			if i <= upgrade_level_cur then 
  69. 				vint_set_property(self.full_pips[i], "visible", true) 
  70. 				vint_set_property(self.empty_pips[i], "visible", false) 
  71. 			else 
  72. 				vint_set_property(self.full_pips[i], "visible", false) 
  73. 				vint_set_property(self.empty_pips[i], "visible", true) 
  74. 			end 
  75.  
  76. 		end  
  77.  
  78. 	else 
  79. 		 
  80. 		for i = 1, MAX_PIPS do 
  81.  
  82. 			if i == 3 then 
  83. 				if upgrade_level_cur > 0 then 
  84. 					vint_set_property(self.full_pips[i], "visible", true) 
  85. 					vint_set_property(self.empty_pips[i], "visible", false) 
  86. 				else 
  87. 					vint_set_property(self.full_pips[i], "visible", false) 
  88. 					vint_set_property(self.empty_pips[i], "visible", true) 
  89. 				end 
  90. 			else 
  91. 				vint_set_property(self.full_pips[i], "visible", false) 
  92. 				vint_set_property(self.empty_pips[i], "visible", false) 
  93. 			end 
  94.  
  95. 		end  
  96.  
  97. 	end 
  98.  
  99. 	if fully_upgraded then 
  100. 		vint_set_property(self.pips_grp_h, "tint", COLOR_PIPS_FULLY_UPGRADED.R, COLOR_PIPS_FULLY_UPGRADED.G, COLOR_PIPS_FULLY_UPGRADED.B) 
  101. 	else 
  102. 		vint_set_property(self.pips_grp_h, "tint", COLOR_PIPS_NOT_FULLY_UPGRADED.R, COLOR_PIPS_NOT_FULLY_UPGRADED.G, COLOR_PIPS_NOT_FULLY_UPGRADED.B) 
  103. 	end 
  104.  
  105. end 
  106.  
  107. function Vdo_weapon_pips:hide_upgrade_info() 
  108. 	vint_set_property(self.upgrade_text_pos_grp_h, "visible", false) 
  109. 	vint_set_property(self.pips_grp_h, "visible", false) 
  110. end 
  111.