мЭkяΘÐ ツVie Sep 28, 2012 11:23 pm
Usuario Nv10
hola que tal!, este es el menu A-S-D-F. un nuevo menu para sus proyectos, que te permite asignar algo a cada una de esas teclas para posteriormente usarlas en el mapa, bueno se los dejo:
preview:
script
creditos: Wecoc
preview:
script
- Spoiler:
- Código:
#==============================================================================
# ** Menú asdf by Wecoc
#==============================================================================
#==============================================================================
# ** Window_Menu_A (weapons)
#==============================================================================
class Window_Menu_A < Window_Selectable
def initialize
super(10, 64+32*0, 320, 160)
@column_max = 2
refresh
self.index = 0
self.z = 1000
self.back_opacity = 220
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
@data.push(nil)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
if item == nil
return
end
number = $game_party.weapon_number(item.id)
x = 4 + index % 2 * 160
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
# self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
# def update_help
# @help_window.set_text(self.item == nil ? "" : self.item.description)
# end
end
#==============================================================================
# ** Window_Menu_S (skills)
#==============================================================================
class Window_Menu_S < Window_Selectable
def initialize
super(10, 64+32*1, 320, 160)
@actor = $game_party.actors[0]
@column_max = 2
refresh
self.index = 0
self.z = 1000
self.back_opacity = 220
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@data.push(nil)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
skill = @data[index]
if skill == nil
return
end
x = 4 + index % 2 * 160
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
# self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
# def update_help
# @help_window.set_text(self.item == nil ? "" : self.item.description)
# end
end
#==============================================================================
# ** Window_Menu_D (shields)
#==============================================================================
class Window_Menu_D < Window_Selectable
def initialize
super(10, 64+32*2, 320, 160)
@column_max = 2
refresh
self.index = 0
self.z = 1000
self.back_opacity = 220
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
@data.push(nil)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
if item == nil
return
end
number = $game_party.armor_number(item.id)
x = 4 + index % 2 * 160
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
# self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
# def update_help
# @help_window.set_text(self.item == nil ? "" : self.item.description)
# end
end
#==============================================================================
# ** Window_Menu_F (items)
#==============================================================================
class Window_Menu_F < Window_Selectable
def initialize
super(10, 64+32*3, 320, 160)
@column_max = 2
refresh
self.index = 0
self.z = 1000
self.back_opacity = 220
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
@data.push(nil)
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
if item == nil
return
end
number = $game_party.item_number(item.id)
x = 4 + index % 2 * 160
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
# self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
# self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
# def update_help
# @help_window.set_text(self.item == nil ? "" : self.item.description)
# end
end
#==============================================================================
# ** Scene_Menu
#==============================================================================
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
@a_item = $a_item
@s_item = $s_item
@d_item = $d_item
@f_item = $f_item
end
def main
command_refresh
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
@status_window = Window_MenuStatus.new
@status_window.x = 200
@status_window.y = 0
@a_window = Window_Menu_A.new
@a_window.active = false
@a_window.visible = false
@s_window = Window_Menu_S.new
@s_window.active = false
@s_window.visible = false
@d_window = Window_Menu_D.new
@d_window.active = false
@d_window.visible = false
@f_window = Window_Menu_F.new
@f_window.active = false
@f_window.visible = false
# @help_window = Window_Help.new
# @help_window.visible = false
# @help_window.back_opacity = 220
# @help_window.z = 1000
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@gold_window.dispose
@status_window.dispose
@a_window.dispose
@s_window.dispose
@d_window.dispose
@f_window.dispose
$a_item = @a_item
$s_item = @s_item
$d_item = @d_item
$f_item = @f_item
# @help_window.dispose
end
def command_refresh
if @command_window != nil
c_index = @command_window.index
@command_window.dispose
else
c_index = @menu_index
end
if @a_item != nil
a = "A - " + @a_item.name
else
a = "A - Ninguno"
end
if @s_item != nil
s = "S - " + @s_item.name
else
s = "S - Ninguno"
end
if @d_item != nil
d = "D - " + @d_item.name
else
d = "D - Ninguno"
end
if @f_item != nil
f = "F - " + @f_item.name
else
f = "F - Ninguno"
end
s1 = "Guardar"
s2 = "Salir"
@command_window = Window_Command.new(200, [a, s, d, f, s1, s2])
@command_window.index = c_index
if $game_system.save_disabled
@command_window.disable_item(4)
end
if @a_item != nil
@x_a = 40
@y_a = 0
@rect1_a = Rect.new(@x_a, @y_a, 24, 24)
@rect2_a = Rect.new(0, 0, 24, 24)
@command_window.contents.fill_rect(@rect1_a, Color.new(0, 0, 0, 0))
bitmap1 = RPG::Cache.icon(@a_item.icon_name)
@command_window.contents.blt(@x_a, @y_a + 4, bitmap1, @rect2_a, 255)
end
if @s_item != nil
@x_s = 40
@y_s = 32
@rect1_s = Rect.new(@x_s, @y_s, 24, 24)
@rect2_s = Rect.new(0, 0, 24, 24)
@command_window.contents.fill_rect(@rect1_s, Color.new(0, 0, 0, 0))
bitmap2 = RPG::Cache.icon(@s_item.icon_name)
@command_window.contents.blt(@x_s, @y_s + 4, bitmap2, @rect2_s, 255)
end
if @d_item != nil
@x_d = 40
@y_d = 64
@rect1_d = Rect.new(@x_d, @y_d, 24, 24)
@rect2_d = Rect.new(0, 0, 24, 24)
@command_window.contents.fill_rect(@rect1_d, Color.new(0, 0, 0, 0))
bitmap3 = RPG::Cache.icon(@d_item.icon_name)
@command_window.contents.blt(@x_d, @y_d + 4, bitmap3, @rect2_d, 255)
end
if @f_item != nil
@x_f = 40
@y_f = 96
@rect1_f = Rect.new(@x_f, @y_f, 24, 24)
@rect2_f = Rect.new(0, 0, 24, 24)
@command_window.contents.fill_rect(@rect1_f, Color.new(0, 0, 0, 0))
bitmap4 = RPG::Cache.icon(@f_item.icon_name)
@command_window.contents.blt(@x_f, @y_f + 4, bitmap4, @rect2_f, 255)
end
end
def update
@command_window.update
@gold_window.update
@status_window.update
if @a_window.visible
a_update
return
end
if @s_window.visible
s_update
return
end
if @d_window.visible
d_update
return
end
if @f_window.visible
f_update
return
end
menu_update
end
def menu_update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 0 # A
$game_system.se_play($data_system.decision_se)
@a_window.visible = true
@a_window.active = true
# @a_window.help_window = @help_window
@command_window.active = false
when 1 # S
$game_system.se_play($data_system.decision_se)
@s_window.visible = true
@s_window.active = true
# @s_window.help_window = @help_window
@command_window.active = false
when 2 # D
$game_system.se_play($data_system.decision_se)
@d_window.visible = true
@d_window.active = true
# @d_window.help_window = @help_window
@command_window.active = false
when 3 # F
$game_system.se_play($data_system.decision_se)
@f_window.visible = true
@f_window.active = true
# @f_window.help_window = @help_window
@command_window.active = false
when 4 # save
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5 # end game
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
def a_update
@a_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@a_window.visible = false
@a_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@a_item = @a_window.item
@a_window.visible = false
@a_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
end
def s_update
@s_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@s_window.visible = false
@s_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@s_item = @s_window.item
@s_window.visible = false
@s_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
end
def d_update
@d_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@d_window.visible = false
@d_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@d_item = @d_window.item
@d_window.visible = false
@d_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
end
def f_update
@f_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@f_window.visible = false
@f_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@f_item = @f_window.item
@f_window.visible = false
@f_window.active = false
# @help_window.visible = false
@command_window.active = true
command_refresh
return
end
end
end
creditos: Wecoc
Última edición por мЭkяΘÐ ツ el Sáb Sep 29, 2012 10:55 pm, editado 1 vez