View difference between Paste ID: xQfWf08E and nKkDLDRi
SHOW: | | - or go back to the newest paste.
1
#==============================================================================
2
# • Menu Simples Icon
3
#==============================================================================
4
# Autor: Dax
5-
# Versão: 2.0
5+
# Versão: 2.5
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")
13+
Dax.register(:scene_menu_mouse_teste, "Dax", 2.5, "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
20+
      bitmap = Cache.face(face_name)
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
26+
# • MenuSampleIcon
27
#==============================================================================
28-
class << Rpg::Menu
28+
module MenuSampleIcon
29
  extend self
30
  #----------------------------------------------------------------------------
31
  # • Configurações do Menu Simples Icon.
32
  #----------------------------------------------------------------------------
33
  def simple_icon
34
    return {
35
      # Configuração da descrição das opções.
36
      desc: {
37
       0 => "Mostra o inventário de itens.",
38
       1 => "Mostra as habilidades dos personagens.",
39
       2 => "Mostra os equipamentos dos personagens.",
40
       3 => "Mostra os status dos personagens.",
41
       4 => "Mostra o menu de save.",
42
       5 => "Mostra a opção de sair do jogo.",
43
       6 => "Clique para mudar de personagem.",
44
       7 => "Você tem %d de ouro."
45
      },
46
      # Configuração das scenes.
47
      scene: [
48
       "Scene_Item", "Scene_Skill", "Scene_Equip", "Scene_Status",
49
       "Scene_Save", "Scene_End"
50
      ],
51
      # Configuração dos ícones.
52
      icon: [
53
       260, 232, 270, 233, 230, 121
54
      ]
55
    }
56
  end
57
end
58
#==============================================================================
59
# • Scene_Menu.
60
#==============================================================================
61
class Scene_Menu < Scene_Base
62
  #----------------------------------------------------------------------------
63
  # • Inicialização dos objetos.
64
  #----------------------------------------------------------------------------
65
  def start
66
    super
67
    Background.default
68
    @actor_id = 0
69
    @menu_background = []
70-
    Rpg::Menu.simple_icon[:icon].each_with_index do |value, index|
70+
71
    MenuSampleIcon.simple_icon[:icon].each_with_index do |value, index|
72
      @menu_background[index] = Window_Base.new(0, 0, 48, 48)
73
      @menu_background[index].x = 544/1.50 - (50 * index)
74
      @menu_background[index].y = DMath.get_y_center_screen(26)
75
      @menu_background[index].draw_icon(value, 0, 0)
76
      @menu_background[index].opacity = 128
77
    end
78
    @menu_status[0] = Window_Base.new(@menu_background[5].x + 4,
79
    @menu_background[5].y - 104, 108, 98)
80
    @menu_status[0].draw_actor_face($game_party.members[@actor_id],0,0)
81
    @menu_status[1] = Window_Base.new(@menu_status[0].x + 112, @menu_status[0].y,
82
     176, 98)
83
    @info = Window_Base.new(@menu_background[5].x,@menu_background[0].y + 54,
84
     296, 44)
85
    @menu_status[0].opacity = 128
86
    @gold = Sprite.new([24,24])
87
    @gold.x = @info.x + 260
88
    @gold.y = @info.y + 8
89
    @gold.z = 200
90
    @gold.opacity = 128
91
    @gold.bitmap.draw_icon(262, 0, 0)
92
  end
93
  #----------------------------------------------------------------------------
94
  # • Renovação dos objetos.
95
  #----------------------------------------------------------------------------
96
  def terminate
97
    @menu_background.each(&:dispose)
98
    @menu_status.each(&:dispose)
99
    [@gold, @info].each(&:dispose)
100
    Background.default_dispose
101
  end
102
  #----------------------------------------------------------------------------
103
  # • Atualização dos objetos.
104
  #----------------------------------------------------------------------------
105
  def update
106
    super
107
    @info.contents.clear
108
    @menu_status.each { |i| i.contents.clear }
109
    trigger?(:B) {SceneManager.return}
110
    @gold.if_mouse_over { |over|
111-
     @info.draw_text_ex(0, 0, sprintf(Rpg::Menu.simple_icon[:desc][7], $game_party.gold)) if over
111+
112
     @info.draw_text_ex(0, 0, sprintf(MenuSampleIcon.simple_icon[:desc][7], $game_party.gold)) if over
113
    }
114
    @menu_status[0].if_mouse_over { |over|
115-
     @info.draw_text_ex(0, 0, Rpg::Menu.simple_icon[:desc][6]) if over
115+
116
     @info.draw_text_ex(0, 0, MenuSampleIcon.simple_icon[:desc][6]) if over
117
    }
118
    @menu_status[0].if_mouse_click { @actor_id += 1; @actor_id = 0 if @actor_id >= $game_party.members.size}
119
    @menu_status[1].draw_actor_hp($game_party.members[@actor_id], 4, 4, 124)
120
    @menu_status[1].draw_actor_mp($game_party.members[@actor_id], 4, 26, 124)
121
    @menu_status[1].draw_actor_name($game_party.members[@actor_id], 4, 48, 112)
122
    @menu_status[0].draw_actor_face($game_party.members[@actor_id],0,0)
123
    (0..@menu_background.size-1).each do |i|
124
      @menu_background[i].if_mouse_over { |over|
125
       if over
126-
         @info.draw_text_ex(0, 0,Rpg::Menu.simple_icon[:desc][i]) if @menu_background[i].opacity == 255
126+
127-
         @menu_background[i].if_mouse_click { SceneManager.symbol(Rpg::Menu.simple_icon[:scene][i]) }
127+
         @info.draw_text_ex(0, 0,MenuSampleIcon.simple_icon[:desc][i]) if @menu_background[i].opacity == 255
128
         @menu_background[i].if_mouse_click { SceneManager.symbol(MenuSampleIcon.simple_icon[:scene][i]) }
129
       else
130
         @info.draw_text_ex(0, 0, "")
131
         @menu_background[i].opacity = 128
132
       end
133
      }
134
    end
135
  end
136
end