Advertisement
DaxSoft

Menu Simples 2.1

May 20th, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. # • Menu Simples Icon
  3. #==============================================================================
  4. # Autor: Dax
  5. # Versão: 2.0
  6. # Site: www.dax-soft.weebly.com
  7. # Requerimento: Dax Core
  8. #==============================================================================
  9. # • Descrição:
  10. #------------------------------------------------------------------------------
  11. # Menu simples que funciona com o Mouse.
  12. #==============================================================================
  13. Dax.register(:scene_menu_mouse_teste, "Dax", 2.0, "07/09/13")
  14. Dax.remove(:Scene_Menu)
  15. #==============================================================================
  16. # • Bug : Correção;
  17. #==============================================================================
  18. class Window_Base < Window
  19. def draw_face(face_name, face_index, x, y, enabled = true)
  20. bitmap = "C:F:#{face_name}".script
  21. rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
  22. contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  23. end
  24. end
  25. #==============================================================================
  26. # • Rpg::Menu
  27. #==============================================================================
  28. class << Rpg::Menu
  29. #----------------------------------------------------------------------------
  30. # • Configurações do Menu Simples Icon.
  31. #----------------------------------------------------------------------------
  32. def simple_icon
  33. return {
  34. # Configuração da descrição das opções.
  35. desc: {
  36. 0 => "Mostra o inventário de itens.",
  37. 1 => "Mostra as habilidades dos personagens.",
  38. 2 => "Mostra os equipamentos dos personagens.",
  39. 3 => "Mostra os status dos personagens.",
  40. 4 => "Mostra o menu de save.",
  41. 5 => "Mostra a opção de sair do jogo.",
  42. 6 => "Clique para mudar de personagem.",
  43. 7 => "Você tem %d de ouro."
  44. },
  45. # Configuração das scenes.
  46. scene: [
  47. "Scene_Item", "Scene_Skill", "Scene_Equip", "Scene_Status",
  48. "Scene_Save", "Scene_End"
  49. ],
  50. # Configuração dos ícones.
  51. icon: [
  52. 260, 232, 270, 233, 230, 121
  53. ]
  54. }
  55. end
  56. end
  57. #==============================================================================
  58. # • Scene_Menu.
  59. #==============================================================================
  60. class Scene_Menu < Scene_Base
  61. #----------------------------------------------------------------------------
  62. # • Inicialização dos objetos.
  63. #----------------------------------------------------------------------------
  64. def start
  65. super
  66. Background.default
  67. @actor_id = 0
  68. @menu_background = []
  69. @menu_status = []
  70. Rpg::Menu.simple_icon[:icon].each_with_index do |value, index|
  71. @menu_background[index] = Window_Base.new(0, 0, 48, 48)
  72. @menu_background[index].x = 544/1.50 - (50 * index)
  73. @menu_background[index].y = DMath.get_y_center_screen(26)
  74. @menu_background[index].draw_icon(value, 0, 0)
  75. @menu_background[index].opacity = 128
  76. end
  77. @menu_status[0] = Window_Base.new(@menu_background[5].x + 4,
  78. @menu_background[5].y - 104, 108, 98)
  79. @menu_status[0].draw_actor_face($game_party.members[@actor_id],0,0)
  80. @menu_status[1] = Window_Base.new(@menu_status[0].x + 112, @menu_status[0].y,
  81. 176, 98)
  82. @info = Window_Base.new(@menu_background[5].x,@menu_background[0].y + 54,
  83. 296, 44)
  84. @menu_status[0].opacity = 128
  85. @gold = Sprite.new([24,24])
  86. @gold.x = @info.x + 260
  87. @gold.y = @info.y + 8
  88. @gold.z = 200
  89. @gold.opacity = 128
  90. @gold.bitmap.draw_icon(262, 0, 0)
  91. end
  92. #----------------------------------------------------------------------------
  93. # • Renovação dos objetos.
  94. #----------------------------------------------------------------------------
  95. def terminate
  96. @menu_background.each(&:dispose)
  97. @menu_status.each(&:dispose)
  98. [@gold, @info].each(&:dispose)
  99. Background.default_dispose
  100. end
  101. #----------------------------------------------------------------------------
  102. # • Atualização dos objetos.
  103. #----------------------------------------------------------------------------
  104. def update
  105. super
  106. @info.contents.clear
  107. @menu_status.each { |i| i.contents.clear }
  108. trigger?(:B) {SceneManager.return}
  109. @gold.if_mouse_over { |over|
  110. @gold.opacity = over ? 255 : 128
  111. @info.draw_text_ex(0, 0, sprintf(Rpg::Menu.simple_icon[:desc][7], $game_party.gold)) if over
  112. }
  113. @menu_status[0].if_mouse_over { |over|
  114. @menu_status[0].opacity = over ? 255 : 128
  115. @info.draw_text_ex(0, 0, Rpg::Menu.simple_icon[:desc][6]) if over
  116. }
  117. @menu_status[0].if_mouse_click { @actor_id += 1; @actor_id = 0 if @actor_id >= $game_party.members.size}
  118. @menu_status[1].draw_actor_hp($game_party.members[@actor_id], 4, 4, 124)
  119. @menu_status[1].draw_actor_mp($game_party.members[@actor_id], 4, 26, 124)
  120. @menu_status[1].draw_actor_name($game_party.members[@actor_id], 4, 48, 112)
  121. @menu_status[0].draw_actor_face($game_party.members[@actor_id],0,0)
  122. (0..@menu_background.size-1).each do |i|
  123. @menu_background[i].if_mouse_over { |over|
  124. if over
  125. @menu_background[i].opacity = 255
  126. @info.draw_text_ex(0, 0,Rpg::Menu.simple_icon[:desc][i]) if @menu_background[i].opacity == 255
  127. @menu_background[i].if_mouse_click { SceneManager.symbol(Rpg::Menu.simple_icon[:scene][i]) }
  128. else
  129. @info.draw_text_ex(0, 0, "")
  130. @menu_background[i].opacity = 128
  131. end
  132. }
  133. end
  134. end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement