Advertisement
Raizen

Untitled

Dec 26th, 2013
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.99 KB | None | 0 0
  1. #==============================================================================
  2. # ** Scene_Item
  3. #------------------------------------------------------------------------------
  4. # Esta classe executa o processamento da tela de item.
  5. #==============================================================================
  6.  
  7. class Scene_LuneCraft < Scene_ItemBase
  8. #--------------------------------------------------------------------------
  9. # * Inicialização do processo
  10. #--------------------------------------------------------------------------
  11. def start
  12. super
  13. @get_index = 0
  14. create_category_window
  15. create_item_window
  16. end
  17. #--------------------------------------------------------------------------
  18. # * Criação da janela de categorias
  19. #--------------------------------------------------------------------------
  20. def create_category_window
  21. @category_window = Window_CombineList.new
  22. @category_window.viewport = @viewport
  23. @help_window = Window_Help_Comb.new
  24. @help_window.viewport = @viewport
  25. @category_window.y = @help_window.height
  26. @category_window.set_handler(:cancel, method(:return_scene))
  27. end
  28. #--------------------------------------------------------------------------
  29. # * Criação da janela de itens
  30. #--------------------------------------------------------------------------
  31. def create_item_window
  32. @item_window = Window_ShowCombs.new
  33. @item_window.viewport = @viewport
  34. @category_window.item_window = @item_window
  35. end
  36. def update
  37. super
  38. unless @category_window.index == @get_index
  39. @item_window.refresh(@category_window.index)
  40. @get_index = @category_window.index
  41. end
  42. end
  43. #--------------------------------------------------------------------------
  44. # * Categoria [Confirmação]
  45. #--------------------------------------------------------------------------
  46. def on_category_ok
  47. @item_window.activate
  48. @item_window.select_last
  49. end
  50. #--------------------------------------------------------------------------
  51. # * Item [Confirmação]
  52. #--------------------------------------------------------------------------
  53. def on_item_ok
  54. $game_party.last_item.object = item
  55. determine_item
  56. end
  57. #--------------------------------------------------------------------------
  58. # * Item [Cancelamento]
  59. #--------------------------------------------------------------------------
  60. def on_item_cancel
  61. @item_window.unselect
  62. @category_window.activate
  63. end
  64. #--------------------------------------------------------------------------
  65. # * Execução de SE para o item
  66. #--------------------------------------------------------------------------
  67. def play_se_for_item
  68. Sound.play_use_item
  69. end
  70. #--------------------------------------------------------------------------
  71. # * Usando um item
  72. #--------------------------------------------------------------------------
  73. def use_item
  74. super
  75. @item_window.redraw_current_item
  76. end
  77. end
  78.  
  79.  
  80. #==============================================================================
  81. # ** Window_ItemCategory
  82. #------------------------------------------------------------------------------
  83. # Esta janela é usada para selecionar o tipo de item e equipamentos para
  84. # tela de itens ou lojas.
  85. #==============================================================================
  86.  
  87. class Window_CombineList < Window_Command
  88. include Lune_Combine
  89. #--------------------------------------------------------------------------
  90. # * Variáveis públicas
  91. #--------------------------------------------------------------------------
  92. attr_reader :item_window
  93. #--------------------------------------------------------------------------
  94. # * Inicialização do objeto
  95. #--------------------------------------------------------------------------
  96. def initialize
  97. super(0, 0)
  98. end
  99. #--------------------------------------------------------------------------
  100. # * Aquisição da largura da janela
  101. #--------------------------------------------------------------------------
  102. def window_width
  103. 150
  104. end
  105. def window_height
  106. Graphics.height - fitting_height(2)
  107. end
  108. #--------------------------------------------------------------------------
  109. # * Aquisição do número de colunas
  110. #--------------------------------------------------------------------------
  111. def col_max
  112. return 1
  113. end
  114. #--------------------------------------------------------------------------
  115. # * Atualização da tela
  116. #--------------------------------------------------------------------------
  117. def update
  118. super
  119. end
  120. #--------------------------------------------------------------------------
  121. # * Criação da lista de comandos
  122. #--------------------------------------------------------------------------
  123. def make_command_list
  124. for i in 0...Combination.size
  125. case Combination[i]['Res Type']
  126. when 1
  127. command = $data_items[Combination[i]['Result Item']]
  128. when 2
  129. command = $data_weapons[Combination[i]['Result Item']]
  130. when 3
  131. command = $data_armors[Combination[i]['Result Item']]
  132. end
  133. add_command(command.name, nil)
  134. end
  135. end
  136. #--------------------------------------------------------------------------
  137. # * Definição da janela de itens
  138. # item_window : janela de itens
  139. #--------------------------------------------------------------------------
  140. def item_window=(item_window)
  141. @item_window = item_window
  142. update
  143. end
  144. end
  145.  
  146. #==============================================================================
  147. # ** Window_ShowCombs
  148. #------------------------------------------------------------------------------
  149. # Esta janela exibe a quantia de dinheiro.
  150. #==============================================================================
  151.  
  152. class Window_ShowCombs < Window_Base
  153. include Lune_Combine
  154. #--------------------------------------------------------------------------
  155. # * Inicialização do objeto
  156. #--------------------------------------------------------------------------
  157. def initialize
  158. super(150, fitting_height(2), Graphics.width - 150, Graphics.height - fitting_height(2))
  159. refresh(0)
  160. end
  161. def draw_horz_line(y)
  162. line_y = y + line_height / 2 - 1
  163. contents.fill_rect(0, line_y, contents_width, 2, line_color)
  164. end
  165. #--------------------------------------------------------------------------
  166. # * Aquisição da largura da janela
  167. #--------------------------------------------------------------------------
  168. def window_width
  169. end
  170. def line_color
  171. color = normal_color
  172. color.alpha = 48
  173. color
  174. end
  175. #--------------------------------------------------------------------------
  176. # * Renovação
  177. #--------------------------------------------------------------------------
  178. def refresh(index)
  179. contents.clear
  180. contents.font.color.set(250, 55, 50)
  181. draw_text(0, 0, 140, 50, "Necessary", 0)
  182. draw_text(0, 30, 140, 50, "Items", 0)
  183. Combination[index]['Itens ID'].size == 1 ? (y = 30) : (y = 0)
  184. draw_horz_line(Combination[index]['Itens ID'].size * 30 + y)
  185. contents.font.color.set(normal_color)
  186. for i in 0...Combination[index]['Itens ID'].size
  187. case Combination[index]['Itens Types'][i]
  188. when 1
  189. command = $data_items[Combination[index]['Itens ID'][i]]
  190. when 2
  191. command = $data_weapons[Combination[index]['Itens ID'][i]]
  192. when 3
  193. command = $data_armors[Combination[index]['Itens ID'][i]]
  194. end
  195. draw_icon(command.icon_index, 150, i*30 + 10)
  196. draw_text(175, i * 30, 160, fitting_height(1), command.name, 0)
  197. draw_text(330, i * 30, 160, fitting_height(1), "X", 0)
  198. draw_text(350, i * 30, 160, fitting_height(1), Combination[index]['Quantity'][i], 0)
  199. end
  200. y = Combination[index]['Itens ID'].size * 30 + y + 20
  201. contents.font.color.set(50, 255, 50)
  202. draw_text(0, y, 140, 50, "Obtained", 0)
  203. draw_text(0, y + 30, 140, 50, "Items", 0)
  204. contents.font.color.set(normal_color)
  205. case Combination[index]['Res Type']
  206. when 1
  207. command = $data_items[Combination[index]['Result Item']]
  208. when 2
  209. command = $data_weapons[Combination[index]['Result Item']]
  210. when 3
  211. command = $data_armors[Combination[index]['Result Item']]
  212. end
  213. draw_icon(command.icon_index, 150, y + 10)
  214. draw_text(175, y, 160, fitting_height(1), command.name, 0)
  215. draw_text(330, y, 160, fitting_height(1), "X", 0)
  216. draw_text(350, y, 160, fitting_height(1), Combination[index]['ResQuantity'], 0)
  217. end
  218. def open
  219. refresh
  220. super
  221. end
  222. end
  223.  
  224. #==============================================================================
  225. # ** Window_Gold
  226. #------------------------------------------------------------------------------
  227. # Esta janela exibe a quantia de dinheiro.
  228. #==============================================================================
  229.  
  230. class Window_Help_Comb < Window_Base
  231. include Lune_Combine
  232. #--------------------------------------------------------------------------
  233. # * Inicialização do objeto
  234. #--------------------------------------------------------------------------
  235. def initialize
  236. super(0, 0, Graphics.width, fitting_height(2))
  237. draw_text(0, - 15, Graphics.width, fitting_height(1), Text_comb1, 0)
  238. draw_text(0, 15, Graphics.width, fitting_height(1), Text_comb2, 0)
  239. end
  240. end
  241.  
  242. #==============================================================================
  243. # ** Scene_Menu
  244. #------------------------------------------------------------------------------
  245. # Esta classe executa o processamento da tela de menu.
  246. #==============================================================================
  247. if Lune_Combine::Craft_Menu
  248. class Scene_Menu < Scene_MenuBase
  249. def create_command_window
  250. @command_window = Window_MenuCommand.new
  251. @command_window.set_handler(:item, method(:command_item))
  252. @command_window.set_handler(:skill, method(:command_personal))
  253. @command_window.set_handler(:equip, method(:command_personal))
  254. @command_window.set_handler(:status, method(:command_personal))
  255. @command_window.set_handler(:elements, method(:command_craft))
  256. @command_window.set_handler(:formation, method(:command_formation))
  257. @command_window.set_handler(:save, method(:command_save))
  258. @command_window.set_handler(:game_end, method(:command_game_end))
  259. @command_window.set_handler(:cancel, method(:return_scene))
  260. end
  261. def command_craft
  262. SceneManager.call(Scene_LuneCraft)
  263. end
  264. end
  265.  
  266. #==============================================================================
  267. # ** Window_MenuCommand
  268. #------------------------------------------------------------------------------
  269. # Esta janela exibe os comandos do menu.
  270. #==============================================================================
  271.  
  272. class Window_MenuCommand < Window_Command
  273. alias raizen_add_main_commands add_main_commands
  274. def add_main_commands
  275. raizen_add_main_commands
  276. add_command(Lune_Combine::Craft, :elements, main_commands_enabled)
  277. end
  278. end
  279. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement