4832B1251D54495A9FA205793DC109C1.png (1.06 MB, 下载次数: 38)
class Scene_SpriteChoice < Scene_MenuBase def start super @index = 0 @sprite_choice = [] @sprite_method = [] create_sprites create_method end def create_method @sprite_method.each do |m| eval <<-end_eval def #{m} p @index end end_eval end end def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap end def create_sprites $sprite_choice.each_value do |i| sprite = Sprite.new sprite.bitmap = Cache.picture(i[0]) sprite.x = i[1] sprite.y = i[2] @sprite_choice << sprite @sprite_method << i[3] sprite.bitmap.draw_text(i[1],i[2]+100,200,24,$sprite_choice.index([i[0],i[1],i[2],i[3]])) end end def update super update_sprite_choice input_sprite update_choice end def update_sprite_choice @sprite_choice.each {|i|i.update} end def input_sprite return unless Input.dir4 > 0 case Input.dir4 when 2,6 @index += 1 when 4,8 @index -= 1 end @index = 0 if @index > @sprite_choice.size - 1 @index = @sprite_choice.size - 1 if @index < 0 @sprite_choice.each {|i|i.zoom_x,i.zoom_y=1,1} @sprite_choice[@index].zoom_x = 1.2 @sprite_choice[@index].zoom_y = 1.2 end def update_choice if Input.trigger?(:C) method(@sprite_method[@index]).call end return_scene if Input.trigger?(:B) end def dispose super dispose_sprite_choice end def dispose_sprite_choice @sprite_choice.each {|i|i.dispose} end end
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |