设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1404|回复: 5
打印 上一主题 下一主题

[已经过期] 使用的菜单背景美化如何把新加入的菜单选项包括进去?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2014-7-19
帖子
25
跳转到指定楼层
1
发表于 2014-9-25 20:26:47 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 yuziming 于 2014-9-25 20:49 编辑

脚本是下面这个,具体是ACE_Master_Demo这个样本里面的,脚本能把物品,状态,装备,结束等加入进去,使得选择这些选项后背景是指定的图片,请问如果我自己在菜单加入的选项,如任务,加点这些,如何也使得在选择这些选项进去后,背景也换成指定的图片?请教各位大师!
RUBY 代码复制下载
  1. #==============================================================================
  2. # +++ MOG - Wallpaper EX (V1.1) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com[/url]
  6. #==============================================================================
  7. # - Adiciona um papel de parede e adiciona alguns efeitos animados.
  8. #==============================================================================
  9. # Para mudar de papel de parede no meio do jogo basta usar o código abaixo.
  10. #
  11. # $game_system.wallpaper = "FILE_NAME"
  12. #
  13. #==============================================================================
  14. # E para mudar de velocidade de scroll use o código abaixo.
  15. #
  16. # $game_system.wallpaper_scroll = [ SPEED_X, SPEED_Y]
  17. #
  18. #==============================================================================
  19. # Serão necessários os seguintes arquivos na pasta GRAPHICS/SYSTEM.
  20. #
  21. # Menu_Particles.png
  22. # wallpaper
  23. #
  24. #==============================================================================
  25. # ● Histórico (Version History)
  26. #==============================================================================
  27. # v 1.1 - Melhoria no sistema de dispose de imagens.
  28. #==============================================================================
  29. module MOG_WALLPAPER_EX
  30.   #Ativar Particulas animadas.
  31.   PARTICLES = true
  32.   #Numero de particulas.
  33.   NUMBER_OF_PARTICLES = 10
  34.   #Deslizar a imagem de fundo.
  35.   BACKGROUND_SCROLL_SPEED = [0,0]
  36.   #Definição da opacidade das janelas.
  37.   WINDOW_OPACITY = 32
  38. end
  39.  
  40. #==============================================================================
  41. # ■ Game_System
  42. #==============================================================================
  43. class Game_System
  44.  
  45.   attr_accessor :wallpaper
  46.   attr_accessor :wallpaper_scroll
  47.  
  48. #--------------------------------------------------------------------------
  49. # ● Initialize
  50. #--------------------------------------------------------------------------  
  51.   alias mog_wallpaper_initialize initialize
  52.   def initialize
  53.       mog_wallpaper_initialize
  54.       @wallpaper = "Wallpaper"   
  55.       @wallpaper_scroll = MOG_WALLPAPER_EX::BACKGROUND_SCROLL_SPEED
  56.   end
  57.  
  58. end  
  59.  
  60. #==============================================================================
  61. # ■ Menu Particles
  62. #==============================================================================
  63. class Menu_Particles < Sprite
  64.  
  65. #--------------------------------------------------------------------------
  66. # ● Initialize
  67. #--------------------------------------------------------------------------            
  68.   def initialize(viewport = nil)
  69.       super(viewport)
  70.       self.bitmap = Cache.system("Menu_Particles")
  71.       reset_setting(true)
  72.   end  
  73.  
  74. #--------------------------------------------------------------------------
  75. # ● Reset Setting
  76. #--------------------------------------------------------------------------               
  77.   def reset_setting(start)
  78.       zoom = (50 + rand(100)) / 100.1
  79.       self.zoom_x = zoom
  80.       self.zoom_y = zoom
  81.       self.x = rand(544)
  82.       if start
  83.          self.y = rand(416 + self.bitmap.height)
  84.       else
  85.          self.y = 416 + rand(32 + self.bitmap.height)
  86.       end        
  87.       self.opacity = 0
  88.       self.blend_type = 1
  89.       @speed_x = 0
  90.       @speed_y = [[rand(3), 3].min, 1].max
  91.       @speed_a = 0#rand(3)
  92.   end
  93.  
  94. #--------------------------------------------------------------------------
  95. # ● Dispose
  96. #--------------------------------------------------------------------------               
  97.   def dispose
  98.       super
  99.       self.bitmap.dispose
  100.   end  
  101.  
  102. #--------------------------------------------------------------------------
  103. # ● Update
  104. #--------------------------------------------------------------------------               
  105.   def update
  106.       super
  107.       self.x += @speed_x
  108.       self.y -= @speed_y
  109.       self.angle += @speed_a      
  110.       self.opacity += 5
  111.       reset_setting(false) if self.y < 0
  112.   end  
  113.  
  114. end
  115.  
  116.  
  117. #==============================================================================
  118. # ■ LAYOUT_EX
  119. #==============================================================================
  120. module WALLPAPER_EX
  121.  
  122.   include MOG_WALLPAPER_EX
  123.  
  124.   #--------------------------------------------------------------------------
  125.   # ● Start
  126.   #--------------------------------------------------------------------------         
  127.   def start
  128.       super
  129.       create_particles
  130.   end   
  131.  
  132.   #--------------------------------------------------------------------------
  133.   # ● Set Window OPACITY
  134.   #--------------------------------------------------------------------------            
  135.   def set_window_opacity   
  136.       instance_variables.each do |varname|
  137.           ivar = instance_variable_get(varname)
  138.            if ivar.is_a?(Window)
  139.               ivar.opacity = WINDOW_OPACITY  
  140.           end
  141.       end
  142.   end
  143.  
  144.   #--------------------------------------------------------------------------
  145.   # ● Create Particles
  146.   #--------------------------------------------------------------------------  
  147.   def create_particles
  148.       return unless PARTICLES
  149.       dispose_menu_particles
  150.       @particle_viewport = Viewport.new(-32, -32, 576, 448)
  151.       @particle_bitmap =[]
  152.       for i in 0...NUMBER_OF_PARTICLES
  153.           @particle_bitmap.push(Menu_Particles.new(@particle_viewport))
  154.       end  
  155.   end  
  156.  
  157.   #--------------------------------------------------------------------------
  158.   # ● Create Background
  159.   #--------------------------------------------------------------------------
  160.   def create_background
  161.       @background_sprite = Plane.new
  162.       @background_sprite.bitmap = Cache.system($game_system.wallpaper) rescue nil
  163.       @background_sprite.bitmap = SceneManager.background_bitmap if @background_sprite.bitmap == nil
  164.   end
  165.  
  166. #--------------------------------------------------------------------------
  167. # ● Dispose Light
  168. #--------------------------------------------------------------------------              
  169.   def dispose_menu_particles
  170.       return unless PARTICLES
  171.       if @particle_bitmap != nil
  172.          @particle_bitmap.each {|sprite| sprite.dispose}
  173.          @particle_viewport.dispose
  174.          @particle_bitmap = nil
  175.       end      
  176.   end     
  177.  
  178.   #--------------------------------------------------------------------------
  179.   # ● Dispose Background
  180.   #--------------------------------------------------------------------------
  181.   def dispose_background
  182.       return if @background_sprite == nil
  183.       @background_sprite.bitmap.dispose
  184.       @background_sprite.dispose
  185.       @background_sprite = nil
  186.   end
  187.  
  188.   #--------------------------------------------------------------------------
  189.   # ● Terminate
  190.   #--------------------------------------------------------------------------  
  191.   def terminate
  192.       super
  193.       dispose_menu_particles
  194.   end   
  195.  
  196.   #--------------------------------------------------------------------------
  197.   # ● Update
  198.   #--------------------------------------------------------------------------  
  199.   def update
  200.       super
  201.       update_background
  202.       update_particle
  203.   end
  204.  
  205.   #--------------------------------------------------------------------------
  206.   # ● Update Background
  207.   #--------------------------------------------------------------------------   
  208.   def update_background
  209.       @background_sprite.ox += $game_system.wallpaper_scroll[0]
  210.       @background_sprite.oy += $game_system.wallpaper_scroll[1]
  211.   end
  212.  
  213. #--------------------------------------------------------------------------
  214. # ● Update Particle
  215. #--------------------------------------------------------------------------              
  216. def update_particle
  217.      return unless PARTICLES
  218.      @particle_bitmap.each {|sprite| sprite.update }
  219. end  
  220.  
  221. end
  222.  
  223. #==============================================================================
  224. # ● Scene Menu
  225. #==============================================================================
  226. class Scene_Menu < Scene_MenuBase
  227.   include WALLPAPER_EX
  228.  
  229. #--------------------------------------------------------------------------
  230. # ● Start
  231. #--------------------------------------------------------------------------               
  232.   alias mog_layout_ex_start start
  233.   def start
  234.       mog_layout_ex_start
  235.       set_window_opacity
  236.   end  
  237. end
  238.  
  239. #==============================================================================
  240. # ● Scene Item
  241. #==============================================================================
  242. class Scene_Item < Scene_ItemBase
  243.   include WALLPAPER_EX
  244.  
  245. #--------------------------------------------------------------------------
  246. # ● Start
  247. #--------------------------------------------------------------------------               
  248.   alias mog_layout_ex_start start
  249.   def start
  250.       mog_layout_ex_start
  251.       set_window_opacity
  252.   end  
  253. end
  254.  
  255. #==============================================================================
  256. # ● Scene Skill
  257. #==============================================================================
  258. class Scene_Skill < Scene_ItemBase
  259.   include WALLPAPER_EX
  260.  
  261. #--------------------------------------------------------------------------
  262. # ● Start
  263. #--------------------------------------------------------------------------               
  264.   alias mog_layout_ex_start start
  265.   def start
  266.       mog_layout_ex_start
  267.       set_window_opacity
  268.   end  
  269. end
  270.  
  271. #==============================================================================
  272. # ● Scene Equip
  273. #==============================================================================
  274. class Scene_Equip < Scene_MenuBase
  275.   include WALLPAPER_EX
  276.  
  277. #--------------------------------------------------------------------------
  278. # ● Start
  279. #--------------------------------------------------------------------------               
  280.   alias mog_layout_ex_start start
  281.   def start
  282.       mog_layout_ex_start
  283.       set_window_opacity
  284.   end  
  285. end
  286.  
  287. #==============================================================================
  288. # ● Scene Status
  289. #==============================================================================
  290. class Scene_Status < Scene_MenuBase
  291.   include WALLPAPER_EX
  292.  
  293. #--------------------------------------------------------------------------
  294. # ● Start
  295. #--------------------------------------------------------------------------               
  296.   alias mog_layout_ex_start start
  297.   def start
  298.       mog_layout_ex_start
  299.       set_window_opacity
  300.   end  
  301. end
  302.  
  303. #==============================================================================
  304. # ● Scene File
  305. #==============================================================================
  306. class Scene_File < Scene_MenuBase
  307.   include WALLPAPER_EX
  308.  
  309. #--------------------------------------------------------------------------
  310. # ● Start
  311. #--------------------------------------------------------------------------               
  312.   alias mog_layout_ex_start start
  313.   def start
  314.       mog_layout_ex_start
  315.       set_window_opacity
  316.   end  
  317. end
  318.  
  319. #==============================================================================
  320. # ● Scene End
  321. #==============================================================================
  322. class Scene_End < Scene_MenuBase
  323.   include WALLPAPER_EX
  324.  
  325. #--------------------------------------------------------------------------
  326. # ● Start
  327. #--------------------------------------------------------------------------               
  328.   alias mog_layout_ex_start start
  329.   def start
  330.       mog_layout_ex_start
  331.       set_window_opacity
  332.   end  
  333. end
  334.  
  335. #==============================================================================
  336. # ● Window SaveFile
  337. #==============================================================================
  338. class Window_SaveFile < Window_Base
  339.  
  340. #--------------------------------------------------------------------------
  341. # ● Initialize
  342. #--------------------------------------------------------------------------                  
  343.   alias mog_wallpaper_initialize initialize
  344.   def initialize(height, index)
  345.       mog_wallpaper_initialize(height, index)
  346.       self.opacity = WALLPAPER_EX::WINDOW_OPACITY if can_opacity_window?
  347.   end
  348.  
  349. #--------------------------------------------------------------------------
  350. # ● Can Opacity Window
  351. #--------------------------------------------------------------------------                    
  352.   def can_opacity_window?
  353.       return true
  354.   end  
  355. end
  356.  
  357. $mog_rgss3_wallpaper_ex = true

Lv3.寻梦者

爪子

梦石
0
星屑
1565
在线时间
866 小时
注册时间
2014-8-28
帖子
1111
2
发表于 2014-9-25 20:33:13 | 只看该作者
脚本为何不用代码发....
个人坑《凝聚的祈愿》更新日记
网瘾少女的领域-Lofter
一时骂人一时爽,一直骂人一直爽^o^
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2014-7-19
帖子
25
3
 楼主| 发表于 2014-9-25 20:47:10 | 只看该作者
莫言别离 发表于 2014-9-25 20:33
脚本为何不用代码发....

额 ,大哥,我确实不知道代码怎么发
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2014-7-19
帖子
25
4
 楼主| 发表于 2014-9-25 20:50:31 | 只看该作者
莫言别离 发表于 2014-9-25 20:33
脚本为何不用代码发....

已改,请大师指点!

点评

……  发表于 2014-9-25 21:23
我不是大师...我是酱油...  发表于 2014-9-25 20:58
回复 支持 反对

使用道具 举报

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10074
在线时间
5020 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

5
发表于 2014-9-25 23:28:04 | 只看该作者
本帖最后由 VIPArcher 于 2014-9-26 14:32 编辑

模仿该脚本226到最后的形式自己改一改吧。
  1. class 要加背景的场景名 < Scene_MenuBase
  2.   include WALLPAPER_EX

  3. #--------------------------------------------------------------------------
  4. # ● Start
  5. #--------------------------------------------------------------------------               
  6.   alias mog_layout_ex_start start
  7.   def start
  8.       mog_layout_ex_start
  9.       set_window_opacity
  10.   end  
  11. end
复制代码
对新加入的菜单场景模仿这个加一段在下面试试,
未测试

点评

把你的工程范例或者另外的菜单界面脚本发上来吧。  发表于 2014-9-26 17:33
应该没错啊  发表于 2014-9-26 17:25
你确定你做的没错?  发表于 2014-9-26 14:32
之前我的确是这样想的,但是我加进去后,和之前没什么变化,不知道是何原因?  发表于 2014-9-25 23:35
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
47 小时
注册时间
2014-7-19
帖子
25
6
 楼主| 发表于 2014-9-26 17:45:07 | 只看该作者
VIPArcher 发表于 2014-9-25 23:28
模仿该脚本226到最后的形式自己改一改吧。对新加入的菜单场景模仿这个加一段在下面试试,
未测试 ...

这是第一个:MOG_Adv_Load_Bar
  1. #===============================================================================
  2. # +++ MOG - Advanced Load Bar (v1.1) +++
  3. #===============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com  
  6. #===============================================================================
  7. # Apresenta uma barra de carregar entre as cenas de Save e Load.
  8. #
  9. # O propósito deste Script é apresentar alguns artworks de seu jogo
  10. # enquanto o jogador espera a barra de leitura.
  11. #
  12. #===============================================================================
  13. # Você pode adpatar esse script em alguma outra Scene ou ativar pelo evento.
  14. # Basta usar este código.
  15. #
  16. # SceneManager.call(Scene_Load_Bar)
  17. #
  18. #==============================================================================
  19. # ● Histórico (Version History)
  20. #==============================================================================
  21. # v 1.1 - Melhoria no sistema de dispose de imagens.
  22. #==============================================================================

  23. module MOG_LOAD_BAR
  24.    # Tempo para fazer load.(Segundos)
  25.    LOAD_DURATION = 3
  26.    # Ativar o sistema ao carregar o jogo.
  27.    ENABLE_LOAD_BAR_FOR_SCENE_LOAD = true
  28.    # Ativar o sistema ao salvar o jogo.
  29.    ENABLE_LOAD_BAR_FOR_SCENE_SAVE = true   
  30.    # Definição das imagens que ficarão no plano de fundo.
  31.    LOAD_BACKGROUND_PICTURES = [
  32.    "Background_1",
  33.    "Background_2",
  34.    "Background_3",
  35.    "Background_4",
  36.    "Background_5",
  37.    "Background_6"
  38.    #"Background_7",
  39.    #"Background_8",
  40.    #"Background_9",
  41.    #"Background_10",
  42.    # ...
  43.    ]
  44.    # Ativar ordem aleatória ou sequencial.
  45.    PICTURE_RANDOM_SELECTION = true   
  46.    # Posição do geral da Hud.
  47.    LOAD_BAR_POSITION = [30,350]
  48.    # Posição do medidor.
  49.    LOAD_BAR_METER_POSITION = [11,27]
  50.    # Posição do Texto.
  51.    LOAD_BAR_TEXT_POSITION = [ 10, -3]
  52.    # Som ao carregar o arquivo.
  53.    LOAD_SE = "Decision2"
  54.    # Velocidade da animação do medidor.
  55.    LOAD_BAR_FLOW_SPEED = 25
  56.    # Definição da Cena que será ativada após salvar via menu.
  57.    # Caso o save seja feito pelo evento, a cena será o Mapa.
  58.    RETURN_TO_SCENE = Scene_Menu.new(4)
  59.    # Ativar a animação de levitação do texto.
  60.    ENABLE_FLOAT_TEXT_ANIMATION = true
  61.    # Apresentar o sprite do personagem.
  62.    ENABLE_CHARACTER_SPRITE = true
  63.    # Ativar barras laterais.
  64.    ENABLE_STRIPE_SPRITE = true
  65.    # Velocidade das barras laterais.
  66.    STRIPE_SPEED = 1
  67. end

  68. #=============================================================================
  69. # ■ Game_Temp
  70. #=============================================================================
  71. class Game_Temp
  72.   attr_accessor :load_bar_pre_index
  73.   attr_accessor :loadbar_type
  74.   attr_accessor :load_pre_bgm
  75.   attr_accessor :load_pre_bgs

  76. #--------------------------------------------------------------------------
  77. # ● Initialize
  78. #--------------------------------------------------------------------------              
  79. alias load_bar_initialize initialize
  80. def initialize
  81.      @load_bar_pre_index = -1
  82.      @loadbar_type = 0   
  83.      load_bar_initialize
  84. end
  85.    
  86. end

  87. #=============================================================================
  88. # ■ Game_System
  89. #=============================================================================
  90. class Game_System
  91.   attr_accessor :load_bar_pre_index
  92.   
  93. #--------------------------------------------------------------------------
  94. # ● Initialize
  95. #--------------------------------------------------------------------------              
  96. alias load_bar_initialize initialize
  97. def initialize
  98.      load_bar_initialize
  99.      @load_bar_pre_index = 0
  100. end

  101. #--------------------------------------------------------------------------
  102. # ● BGS Stop
  103. #--------------------------------------------------------------------------            
  104. def bgs_stop
  105.      Audio.bgs_stop
  106. end
  107. end

  108. #=============================================================================
  109. # ■ Scene Load Bar
  110. #=============================================================================
  111. class Scene_Load_Bar
  112. include MOG_LOAD_BAR
  113.   
  114. #--------------------------------------------------------------------------
  115. # ● Initialize
  116. #--------------------------------------------------------------------------            
  117. def initialize
  118.      execute_dispose
  119.      @bar_type = $game_temp.loadbar_type
  120.      @load_duration_max = 60 * LOAD_DURATION
  121.      @load_duration_max = 60 if @load_duration_max < 60  
  122.      @load_duration = 0
  123.      @pictures = LOAD_BACKGROUND_PICTURES
  124.      create_background
  125.      create_layout  
  126.      create_load_bar
  127.      create_text
  128.      create_side_strip
  129. end
  130.    
  131. #--------------------------------------------------------------------------
  132. # ● Create Background
  133. #--------------------------------------------------------------------------           
  134. def create_background  
  135.      @background = Sprite.new
  136.      if PICTURE_RANDOM_SELECTION
  137.         $game_system.load_bar_pre_index = rand(@pictures.size)
  138.         no_repeat_picture
  139.      end
  140.      image_name = @pictures[$game_system.load_bar_pre_index]   
  141.      image_name = "" if image_name == nil     
  142.      @background.bitmap = Cache.picture(image_name)
  143.      $game_temp.load_bar_pre_index = $game_system.load_bar_pre_index
  144.      unless PICTURE_RANDOM_SELECTION
  145.         $game_system.load_bar_pre_index += 1
  146.         $game_system.load_bar_pre_index = 0 if $game_system.load_bar_pre_index > @pictures.size - 1
  147.      end   
  148. end
  149.    
  150. #--------------------------------------------------------------------------
  151. # ● No Repeat Picture
  152. #--------------------------------------------------------------------------            
  153. def no_repeat_picture
  154.      if $game_system.load_bar_pre_index == $game_temp.load_bar_pre_index
  155.         $game_system.load_bar_pre_index += 1
  156.         $game_system.load_bar_pre_index = 0 if $game_system.load_bar_pre_index > @pictures.size - 1
  157.      end  
  158. end

  159. #--------------------------------------------------------------------------
  160. # ● Create Layout
  161. #--------------------------------------------------------------------------           
  162. def create_layout  
  163.      @hud = Sprite.new
  164.      @hud.bitmap = Cache.system("Load_Bar_Layout")
  165.      @hud.x = LOAD_BAR_POSITION[0]
  166.      @hud.y = LOAD_BAR_POSITION[1]
  167.      @hud.z = 10
  168. end

  169. #--------------------------------------------------------------------------
  170. # ● Create Side Strip
  171. #--------------------------------------------------------------------------           
  172. def create_side_strip
  173.      @stripe1 = Plane.new
  174.      @stripe2 = Plane.new     
  175.      if @bar_type == 0
  176.         @stripe1.bitmap = Cache.system("Load_Bar_Stripe1_L")
  177.         @stripe2.bitmap = Cache.system("Load_Bar_Stripe2_L")
  178.      else  
  179.         @stripe1.bitmap = Cache.system("Load_Bar_Stripe1_S")
  180.         @stripe2.bitmap = Cache.system("Load_Bar_Stripe2_S")
  181.      end  
  182.      @stripe1.z = 1
  183.      @stripe2.z = 1         
  184.      @stripe1.visible = ENABLE_STRIPE_SPRITE
  185.      @stripe2.visible = ENABLE_STRIPE_SPRITE
  186. end

  187. #--------------------------------------------------------------------------
  188. # ● Create Load Bar
  189. #--------------------------------------------------------------------------            
  190. def create_load_bar
  191.      @bar_flow = 0
  192.      @bar_image = Cache.system("Load_Bar_Meter")
  193.      @bar_bitmap = Bitmap.new(@bar_image.width,@bar_image.height)
  194.      @bar_range = @bar_image.width / 3
  195.      @bar_width = @bar_range  * @load_duration / @load_duration_max
  196.      @bar_height = @bar_image.height
  197.      @bar_width_old = @bar_width
  198.      @bar_src_rect = Rect.new(@bar_flow, 0, @bar_width, @bar_height)
  199.      @bar_bitmap.blt(0,0, @bar_image, @bar_src_rect)
  200.      @bar_sprite = Sprite.new
  201.      @bar_sprite.bitmap = @bar_bitmap
  202.      @bar_sprite.z = 11
  203.      @bar_sprite.x = LOAD_BAR_POSITION[0] + LOAD_BAR_METER_POSITION[0]
  204.      @bar_sprite.y = LOAD_BAR_POSITION[1] + LOAD_BAR_METER_POSITION[1]
  205.      update_bar_flow
  206. end

  207. #--------------------------------------------------------------------------
  208. # ● Create Text
  209. #--------------------------------------------------------------------------            
  210. def create_text
  211.      @text_float_time = 0
  212.      @text_float_y = 0
  213.      @text_image = Cache.system("Load_Bar_Text")
  214.      @text_bitmap = Bitmap.new(@text_image.width,@text_image.height)
  215.      @text_width = @text_image.width
  216.      @text_height = @text_image.height / 2
  217.      @text_src_rect = Rect.new(0, @text_height * @bar_type, @text_width, @text_height)
  218.      @text_bitmap.blt(0,0, @text_image, @text_src_rect)   
  219.      @text_sprite = Sprite.new
  220.      @text_sprite.bitmap = @text_bitmap   
  221.      @text_fy = LOAD_BAR_POSITION[1] + LOAD_BAR_TEXT_POSITION[1]
  222.      @text_sprite.x = LOAD_BAR_POSITION[0] + LOAD_BAR_TEXT_POSITION[0]
  223.      @text_sprite.y = @text_fy
  224.      @text_sprite.z = 12
  225. end

  226. #--------------------------------------------------------------------------
  227. # ● Main
  228. #--------------------------------------------------------------------------         
  229. def main
  230.      Graphics.transition
  231.      execute_loop
  232.      execute_dispose
  233. end   

  234. #--------------------------------------------------------------------------
  235. # ● Execute Loop
  236. #--------------------------------------------------------------------------           
  237. def execute_loop
  238.      loop do
  239.           update
  240.           Graphics.update         
  241.           if SceneManager.scene != self
  242.               break
  243.           end
  244.      end
  245. end

  246. #--------------------------------------------------------------------------
  247. # ● Execute Dispose
  248. #--------------------------------------------------------------------------            
  249. def execute_dispose
  250.      return if @hud == nil
  251.      @hud.bitmap.dispose
  252.      @hud.dispose
  253.      @stripe1.bitmap.dispose
  254.      @stripe1.dispose     
  255.      @stripe2.bitmap.dispose
  256.      @stripe2.dispose        
  257.      @bar_image.dispose
  258.      @bar_bitmap.dispose
  259.      @bar_sprite.bitmap.dispose
  260.      @bar_sprite.dispose     
  261.      @background.bitmap.dispose
  262.      @background.dispose
  263.      @text_image.dispose
  264.      @text_bitmap.dispose
  265.      @text_sprite.bitmap.dispose
  266.      @text_sprite.dispose
  267.      Graphics.transition
  268.      Graphics.freeze
  269. end  

  270. #--------------------------------------------------------------------------
  271. # ● Update
  272. #--------------------------------------------------------------------------            
  273. def update
  274.      update_bar_flow
  275.      update_bar_duration
  276.      update_float_text
  277.      update_slide_stripe
  278. end

  279. #--------------------------------------------------------------------------
  280. # ● Update Slide Stripe
  281. #--------------------------------------------------------------------------              
  282. def update_slide_stripe
  283.      @stripe1.oy += STRIPE_SPEED
  284.      @stripe2.ox += STRIPE_SPEED
  285. end   
  286.    
  287. #--------------------------------------------------------------------------
  288. # ● update_float_text
  289. #--------------------------------------------------------------------------            
  290. def update_float_text
  291.      return unless ENABLE_FLOAT_TEXT_ANIMATION
  292.      @text_float_time += 1
  293.      case @text_float_time
  294.         when 1..10
  295.            @text_float_y += 1
  296.         when 11..20
  297.            @text_float_y -= 1
  298.         else
  299.           @text_float_y = 0
  300.           @text_float_time = 0
  301.      end
  302.      @text_sprite.y = @text_fy + @text_float_y
  303. end

  304. #--------------------------------------------------------------------------
  305. # ● Update Bar Flow
  306. #--------------------------------------------------------------------------            
  307. def update_bar_flow
  308.      @bar_sprite.bitmap.clear
  309.      @bar_width = @bar_range  * @load_duration / @load_duration_max
  310.      @bar_width = @bar_range if @load_duration > @load_duration_max
  311.      @bar_src_rect = Rect.new(@bar_flow, 0,@bar_width, @bar_height)
  312.      @bar_bitmap.blt(0,0, @bar_image, @bar_src_rect)
  313.      @bar_flow += LOAD_BAR_FLOW_SPEED
  314.      if @bar_flow >= @bar_image.width - @bar_range
  315.         @bar_flow = 0     
  316.      end
  317. end   
  318.    
  319. #--------------------------------------------------------------------------
  320. # ● Update Bar Duration
  321. #--------------------------------------------------------------------------              
  322. def update_bar_duration
  323.      @load_duration += 1
  324.      if @load_duration == @load_duration_max
  325.         Audio.se_play("Audio/SE/" + LOAD_SE,100,100) rescue nil
  326.      elsif @load_duration == @load_duration_max + 10
  327.         if @bar_type == 0
  328.             SceneManager.return
  329.             $game_system.replay_bgm
  330.          else   
  331.             SceneManager.return   
  332.         end  
  333.         $game_temp.loadbar_type = false
  334.      end
  335. end  

  336. end

  337. #=============================================================================
  338. # ■ Scene Save
  339. #=============================================================================
  340. class Scene_Save < Scene_File
  341.   
  342. #--------------------------------------------------------------------------
  343. # ● On Save Sucess
  344. #--------------------------------------------------------------------------               
  345.   alias mog_advloadbar_on_save_success on_save_success
  346.   def on_save_success
  347.       mog_advloadbar_on_save_success
  348.       $game_temp.loadbar_type = 1
  349.       SceneManager.call(Scene_Load_Bar)   
  350.   end
  351.   
  352. end

  353. #=============================================================================
  354. # ■ Scene Load
  355. #=============================================================================
  356. class Scene_Load < Scene_File
  357.   
  358.   #--------------------------------------------------------------------------
  359.   # ● On Load Success
  360.   #--------------------------------------------------------------------------
  361.   alias mog_advloadbar_on_load_success on_load_success
  362.   def on_load_success
  363.       mog_advloadbar_on_load_success
  364.       $game_system.save_bgm      
  365.       RPG::BGM.stop
  366.       $game_temp.loadbar_type = 0
  367.       SceneManager.call(Scene_Load_Bar)              
  368.   end
  369. end

  370. $mog_rgss3_advanced_load_bar = true
复制代码
这是第二个MOG_Animated_Title_A
  1. #==============================================================================
  2. # +++ MOG - Animated Title A (v2.1) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Tela de titulo animado, com logo, imagens aleatórias e outros efeitos visuais.
  8. #==============================================================================

  9. #==============================================================================
  10. # IMAGENS NECESSÁRIAS
  11. #==============================================================================
  12. # Serão necessários as seguintes imagens na pasta Graphics/Titles2/
  13. #
  14. # Cursor.png   
  15. # Commmand_Name.png (image filename = name of command)
  16. # Particle.png   (Opcional)
  17. # Logo.jpg       (Opcional)
  18. # Animated.png   (Opcional)
  19. #==============================================================================

  20. #==============================================================================
  21. # NOTA 1 - Para definir a imagem de texto basta selecionar no banco de dados
  22. # a imagem do titulo numero 2 (Segunda camada)
  23. #==============================================================================

  24. #==============================================================================
  25. # NOTA 2 - O nome da imagem de comando é iguál ao nome do comando definido
  26. # no banco de dados do Rpg Maker.
  27. #==============================================================================


  28. #==============================================================================
  29. # ● Histórico (Version History)
  30. #==============================================================================
  31. # v 2.1 - Correção do Bug quando a quantidade de imagens aleatórias é definida
  32. #         com a quantidade menor  que 1.
  33. # v 2.0 - Adição do Sprite Animado. (Opcional)
  34. #       - Adição de cores aleatórias nas partículas.
  35. #       - Adição do multiplas camadas de imagens. (Opcional)
  36. #       - Adição do efeito Wave no texto do titulo.  
  37. #       - Opção de definir a velocidade de movimento das partículas.
  38. #       - Opção de ativar ou não o tremor na seleção de comando.
  39. #
  40. # v 1.2 - Melhoria no sistema de dispose de imagens.
  41. #
  42. # v 1.1 - Opção de pular o logo ao apertar alguma tecla.
  43. #       - Adição de comandos em pictures.
  44. #       - Adição de cursor de comando.
  45. #==============================================================================

  46. module MOG_SCENE_TITLE_A

  47.   #--------------------------------------------------------------------------
  48.   # ▼ LOGO ▼
  49.   #--------------------------------------------------------------------------
  50.   # Apresenta um Logo ao começar a tela de titulo.
  51.   # Será necessário ter a imagem LOGO.jpg (png) na pasta Graphics/Title2
  52.   #--------------------------------------------------------------------------
  53.   # Ativar Logo
  54.   LOGO = true
  55.   # Duração do logo.
  56.   LOGO_DURATION = 2 #(Sec)
  57.   
  58.   #--------------------------------------------------------------------------
  59.   # ▼ RANDOM BACKGROUND ▼
  60.   #--------------------------------------------------------------------------  
  61.   #Definição das pictures.
  62.   #--------------------------------------------------------------------------
  63.   RANDOM_PICTURES = [
  64.   "Title0", "Title1", "Title2", "Title3"  
  65.   #"Title4","Title5","Title6","Title7"
  66.   ]
  67.   #Tempo de duração para ativar a troca de imagens.
  68.   RANDOM_PICTURES_DURATION = 10#(sec)
  69.   #Seleção aleatória.
  70.   RAMDOM_SELECTION = true
  71.   #Velocidade de Scrolling. (Speed X , Speed Y)
  72.   RANDOM_PICTURES_SCROLL_SPEED = [0,0]
  73.   
  74.   #--------------------------------------------------------------------------
  75.   # ▼ MULTIPLE LAYERS ▼
  76.   #--------------------------------------------------------------------------
  77.   # Definição de multiplas camadas. * (não há limíte na quantidade de camadas
  78.   # usadas)
  79.   #--------------------------------------------------------------------------
  80.   # MULTIPLE_LAYERS = [  ["A",B,C,D], ["A",B,C,D], ["A",B,C D], ["A",B,C,D ], ....]
  81.   #
  82.   # A - Nome da imagem.
  83.   # B - Velocidade de scroll na horizontal.
  84.   # C - Velocidade de scroll na vertical.
  85.   # D - Tipo de Blend. (0 - Normal / 2 - Add / 3 - Substract)
  86.   #
  87.   MULTIPLE_LAYERS = [
  88.   ["Layer1",1,0,1],
  89.   ["Layer2",3,0,1],   
  90.   ["Layer3",0,0,0]
  91. #  ["Layer4",0,0,0],
  92. #  ["Layer5",0,0,0],
  93. #  ["Layer6",0,0,0]
  94.   ]  
  95.   
  96.   #--------------------------------------------------------------------------
  97.   # ▼ PARTICLES ▼
  98.   #--------------------------------------------------------------------------
  99.   # Adiciona partículas animadas na tela do titulo.
  100.   # Será necessário ter a imagem PARTICLE.png na pasta Graphics/Title2
  101.   #--------------------------------------------------------------------------
  102.   # Ativar Partículas.
  103.   PARTICLE = true
  104.   # Ativar Cores Aleatórias.
  105.   PARTICLE_RANDOM_COLOR = true  
  106.   # Definição do tipo de blend. (0,1,2)
  107.   PARTICLE_BLEND_TYPE = 1
  108.   #Definição do limite de velocidade das partículas.
  109.   PARTICLE_MOVEMENT_RANGE_X = 3
  110.   PARTICLE_MOVEMENT_RANGE_Y = 3
  111.   PARTICLE_ANGLE_RANGE = 3
  112.   
  113.   #--------------------------------------------------------------------------
  114.   # ▼ WAVE TITLE ▼
  115.   #--------------------------------------------------------------------------  
  116.   # Ativa o efeito  WAVE no texto do titulo, o Texto do titulo é definido
  117.   # na camada do titulo 2, que pode ser definido através do banco de dados
  118.   #--------------------------------------------------------------------------   
  119.   #Ativar o efeito do titulo com efeito WAVE.
  120.   TITLE_WAVE = true
  121.   #Configuração do efeito WAVE
  122.   #
  123.   # TITLE_WAVE_CONFIG = [ AMP, LENGTH , SPEED]
  124.   #
  125.   TITLE_WAVE_CONFIG = [6 , 232 , 360]
  126.   
  127.   #--------------------------------------------------------------------------
  128.   # ▼ ANIMATED_SPRITE ▼ (Opcional)
  129.   #--------------------------------------------------------------------------
  130.   # Adiciona um sprite animado no titulo.
  131.   # A quantidade de frames é proporcional a largura dividido pela altura
  132.   # da imagem, ou seja, não há limite de quantidade de frames e nem de
  133.   # tamanho da imagem.
  134.   # Será necessário ter a imagem ANIMATED.png (Jpg) na pasta Graphics/Title2
  135.   #--------------------------------------------------------------------------
  136.   # Ativar Sprite animado.
  137.   ANIMATED_SPRITE = true
  138.   # Posição do Sprite animado.
  139.   ANIMATED_SPRITE_POSITION = [130,150]
  140.   # Velocidade da animação
  141.   ANIMATED_SPRITE_SPEED = 10
  142.   # Tipo de Blend. (0 - Normal / 2 - Add / 3 - Substract)
  143.   ANIMATED_SPRITE_BLEND_TYPE = 1
  144.   # Definição do zoom,
  145.   ANIMATED_SPRITE_ZOOM = 1.5
  146.   
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # ▼ COMMANDS / SELECTION ▼
  150.   #--------------------------------------------------------------------------
  151.   # Configuração extras da tela de titulo.
  152.   #--------------------------------------------------------------------------
  153.   # Posição do comando.
  154.   COMMANDS_POS = [220 , 280]
  155.   # Ativar o efeito de tremor ao selecionar o comando.
  156.   COMMAND_SHAKE = true
  157.   # Definição da posição do cursor.(Para ajustes)
  158.   CURSOR_POS = [-42,-7]
  159.   # Ativar flash ao mover o comando.
  160.   CURSOR_FLASH_SELECTION = true
  161.   # Definição da posição do flash.
  162.   CURSOR_FLASH_SLECTION_POS = [-180,0]
  163.   # Tipo de Blend. (0 - Normal / 2 - Add / 3 - Substract)
  164.   CURSOR_FLASH_SLECTION_BLEND_TYPE = 1
  165.   
  166. end

  167. #==============================================================================
  168. # ■ Window TitleCommand
  169. #==============================================================================
  170. class Window_TitleCommand < Window_Command
  171.   attr_reader :list
  172. end

  173. #==============================================================================
  174. # ■ Particle Title
  175. #==============================================================================
  176. class Particle_Title < Sprite
  177.   
  178.   include MOG_SCENE_TITLE_A
  179.   
  180. #--------------------------------------------------------------------------
  181. # ● Initialize
  182. #--------------------------------------------------------------------------            
  183.   def initialize(viewport = nil)
  184.       super(viewport)
  185.       self.bitmap = Cache.title2("Particle")
  186.       self.tone.set(rand(255),rand(255), rand(255), 255) if PARTICLE_RANDOM_COLOR
  187.       self.blend_type = PARTICLE_BLEND_TYPE
  188.       reset_setting
  189.   end  
  190.   
  191. #--------------------------------------------------------------------------
  192. # ● Reset Setting
  193. #--------------------------------------------------------------------------               
  194.   def reset_setting
  195.       zoom = (50 + rand(100)) / 100.1
  196.       self.zoom_x = zoom
  197.       self.zoom_y = zoom
  198.       self.x = rand(576) -32
  199.       self.y = rand(448 + self.bitmap.height)
  200.       self.opacity = 0
  201.       self.angle = rand(360)
  202.       @speed_x = [[rand(PARTICLE_MOVEMENT_RANGE_X), PARTICLE_MOVEMENT_RANGE_X].min, 1].max
  203.       @speed_x = 0 if PARTICLE_MOVEMENT_RANGE_X < 1
  204.       @speed_y = [[rand(PARTICLE_MOVEMENT_RANGE_Y), PARTICLE_MOVEMENT_RANGE_Y].min, 1].max
  205.       @speed_y = 0 if PARTICLE_MOVEMENT_RANGE_Y < 1
  206.       @speed_a = [[rand(PARTICLE_ANGLE_RANGE), PARTICLE_ANGLE_RANGE].min, 0].max
  207.   end
  208.   
  209. #--------------------------------------------------------------------------
  210. # ● Dispose
  211. #--------------------------------------------------------------------------               
  212.   def dispose
  213.       super
  214.       self.bitmap.dispose
  215.   end  
  216.   
  217. #--------------------------------------------------------------------------
  218. # ● Update
  219. #--------------------------------------------------------------------------               
  220.   def update
  221.       super
  222.       self.x += @speed_x
  223.       self.y -= @speed_y
  224.       self.angle += @speed_a      
  225.       self.opacity += 5
  226.       reset_setting if can_reset_setting?
  227.   end  
  228.   
  229. #--------------------------------------------------------------------------
  230. # ● Can Reset Setting
  231. #--------------------------------------------------------------------------                 
  232.   def can_reset_setting?
  233.       return true if (self.x < -64 or self.x > 600)   
  234.       return true if (self.y < -64 or self.y > 500)
  235.       return false
  236.   end  
  237. end

  238. #==============================================================================
  239. # ■ Multiple Layers Title
  240. #==============================================================================
  241. class Multiple_Layers_Title
  242.   
  243.   #--------------------------------------------------------------------------
  244.   # ● Initialize
  245.   #--------------------------------------------------------------------------  
  246.   def initialize(name = "", scroll_x = 0, scroll_y = 0, blend = 0, index = 0)
  247.       @layer = Plane.new
  248.       @layer.bitmap = Cache.title1(name.to_s) rescue nil
  249.       @layer.bitmap = Bitmap.new(32,32) if @layer.bitmap == nil
  250.       @layer.z = 10 + index
  251.       @layer.opacity = 0
  252.       @layer.blend_type = blend
  253.       @scroll_speed = [scroll_x, scroll_y]
  254.   end
  255.   
  256.   #--------------------------------------------------------------------------
  257.   # ● Dispose
  258.   #--------------------------------------------------------------------------  
  259.   def dispose
  260.       @layer.bitmap.dispose
  261.       @layer.bitmap = nil
  262.       @layer.dispose
  263.   end
  264.   
  265.   #--------------------------------------------------------------------------
  266.   # ● Update
  267.   #--------------------------------------------------------------------------  
  268.   def update
  269.       @layer.opacity += 2
  270.       @layer.ox += @scroll_speed[0]
  271.       @layer.oy += @scroll_speed[1]
  272.   end
  273.   
  274. end

  275. #==============================================================================
  276. # ■ Scene Title
  277. #==============================================================================
  278. class Scene_Title < Scene_Base
  279. include MOG_SCENE_TITLE_A

  280. #--------------------------------------------------------------------------
  281. # ● Start
  282. #--------------------------------------------------------------------------         
  283. def start
  284.      super
  285.      RPG::BGM.fade(2000)
  286.      @logo_active = LOGO
  287.      SceneManager.clear
  288.      @phase = 1
  289.      @phase_time = -1
  290.      dispose_title_sprites
  291.      create_logo if @logo_active
  292.      create_command_window
  293.      create_commands
  294.      create_background
  295.      create_light
  296.      create_cursor
  297.      create_animated_object
  298.      create_flash_select
  299.      create_multiple_layers
  300.      play_title_music unless @logo_active
  301. end
  302.    
  303. #--------------------------------------------------------------------------
  304. # ● Create Multiple Layers
  305. #--------------------------------------------------------------------------
  306. def create_flash_select
  307.      return if !CURSOR_FLASH_SELECTION
  308.      @flash_select = Sprite.new
  309.      @flash_select.bitmap = Cache.title2("Cursor2")
  310.      @flash_select.z = 99
  311.      @flash_select.opacity = 0
  312.      @flash_select.blend_type = CURSOR_FLASH_SLECTION_BLEND_TYPE
  313. end  

  314. #--------------------------------------------------------------------------
  315. # ● Create Multiple Layers
  316. #--------------------------------------------------------------------------           
  317. def create_multiple_layers
  318.      @m_layers = []
  319.      index = 0
  320.      for i in MULTIPLE_LAYERS
  321.          @m_layers.push(Multiple_Layers_Title.new(i[0],i[1],i[2],i[3],index))
  322.          index += 1
  323.      end  
  324. end

  325. #--------------------------------------------------------------------------
  326. # ● Create_Logo
  327. #--------------------------------------------------------------------------            
  328. def create_animated_object
  329.       return if !ANIMATED_SPRITE
  330.       @object_index = 0
  331.       @object_animation_speed = 0
  332.       @object = Sprite.new
  333.       @object.z = 98
  334.       @object.opacity = 0
  335.       @object.blend_type = ANIMATED_SPRITE_BLEND_TYPE
  336.       @object.zoom_x = ANIMATED_SPRITE_ZOOM
  337.       @object.zoom_y = ANIMATED_SPRITE_ZOOM
  338.       @object_image = Cache.title2("Animated")
  339.       @object_frame_max = @object_image.width / @object_image.height
  340.       @object_width = @object_image.width / @object_frame_max  
  341.       @object.bitmap = Bitmap.new(@object_width,@object_image.height)
  342.       @object.x = ANIMATED_SPRITE_POSITION[0]
  343.       @object.y = ANIMATED_SPRITE_POSITION[1]     
  344.       make_object_bitmap
  345. end  

  346. #--------------------------------------------------------------------------
  347. # ● Create_Logo
  348. #--------------------------------------------------------------------------           
  349. def create_cursor
  350.      @cursor = Sprite.new
  351.      @cursor.bitmap = Cache.title2("Cursor")
  352.      @cursor.opacity = 0
  353.      @cursor.z = 130
  354.      @cursor_position = [0,0]
  355.      @mx = [0,0,0]
  356. end

  357. #--------------------------------------------------------------------------
  358. # ● Create_Logo
  359. #--------------------------------------------------------------------------           
  360. def create_logo
  361.      @phase = 0
  362.      @logo = Sprite.new
  363.      @logo.bitmap = Cache.title2("Logo")
  364.      @logo.opacity = 0
  365.      @logo_duration = 180 + (LOGO_DURATION * 60)
  366.      @logo.z = 200
  367. end

  368. #--------------------------------------------------------------------------
  369. # ● Create Commands
  370. #--------------------------------------------------------------------------           
  371. def create_commands
  372.      @command_window.visible = false
  373.      @commands_index_old = -1
  374.      @commands = []
  375.      @commands_shake_duration = 0
  376.      index = 0
  377.      for com in @command_window.list
  378.          sprite = Sprite.new
  379.          sprite.bitmap = Cache.title2(com[:name].to_s) rescue nil
  380.          if sprite.bitmap == nil
  381.             sprite.bitmap = Bitmap.new(200,32)
  382.             sprite.bitmap.font.size = 24
  383.             sprite.bitmap.font.bold = true
  384.             sprite.bitmap.font.italic = true
  385.             sprite.bitmap.draw_text(0, 0, 200, 32, com[:name].to_s,1)
  386.          end
  387.          sprite.x = COMMANDS_POS[0] - 100 - (index * 20)
  388.          sprite.y = index * sprite.bitmap.height + COMMANDS_POS[1]
  389.          sprite.z = 100 + index
  390.          sprite.opacity = 0
  391.          index += 1
  392.          @commands.push(sprite)
  393.      end
  394.      @command_max = index  
  395. end
  396.   
  397.   #--------------------------------------------------------------------------
  398.   # ● create_background
  399.   #--------------------------------------------------------------------------
  400.   def create_background
  401.       @rand_title_duration = 120
  402.       @old_back_index = 0
  403.       @sprite1 = Plane.new
  404.       @sprite1.opacity = 0
  405.       @sprite1.z = 1
  406.       if RAMDOM_SELECTION
  407.          execute_random_picture(false)
  408.       else
  409.          execute_random_picture(true)
  410.       end
  411.       @sprite2 = Sprite.new
  412.       @sprite2.bitmap = Cache.title2($data_system.title2_name)
  413.       @sprite2.z = 140
  414.       @sprite2.opacity = 0
  415.       if TITLE_WAVE
  416.           @sprite2.wave_amp = TITLE_WAVE_CONFIG[0]
  417.           @sprite2.wave_length = TITLE_WAVE_CONFIG[1]
  418.           @sprite2.wave_speed = TITLE_WAVE_CONFIG[2]
  419.       end   
  420.   end
  421.   
  422.   #--------------------------------------------------------------------------
  423.   # ● Create Light
  424.   #--------------------------------------------------------------------------  
  425.   def create_light
  426.       return unless PARTICLE
  427.       @viewport_light = Viewport.new(-32, -32, 576, 448)
  428.       @viewport_light.z = 50
  429.       @light_bitmap =[]
  430.       for i in 0...20
  431.           @light_bitmap.push(Particle_Title.new(@viewport_light))
  432.       end  
  433.   end
  434.    
  435.   #--------------------------------------------------------------------------
  436.   # ● dispose Background1
  437.   #--------------------------------------------------------------------------
  438.   def dispose_background1
  439.       @sprite1.bitmap.dispose
  440.       @sprite1.bitmap = nil
  441.       @sprite1.dispose
  442.       @sprite1 = nil
  443.   end
  444.   
  445. #--------------------------------------------------------------------------
  446. # ● Dispose Background2
  447. #--------------------------------------------------------------------------               
  448.   def dispose_background2
  449.       if @sprite2.bitmap != nil
  450.          @sprite2.bitmap.dispose
  451.          @sprite2.bitmap = nil
  452.          @sprite2.dispose
  453.          @sprite2 = nil
  454.       end
  455.   end
  456.    
  457. #--------------------------------------------------------------------------
  458. # ● Dispose Light
  459. #--------------------------------------------------------------------------              
  460.   def dispose_light
  461.       return unless PARTICLE
  462.       if @light_bitmap != nil
  463.          for i in @light_bitmap
  464.              i.dispose
  465.          end
  466.          @light_bitmap = nil
  467.       end
  468.       @viewport_light.dispose
  469.   end   
  470.   
  471. #--------------------------------------------------------------------------
  472. # ● Dispose Logo
  473. #--------------------------------------------------------------------------            
  474. def dispose_logo
  475.      return unless @logo_active
  476.      @logo.bitmap.dispose
  477.      @logo.dispose
  478. end  
  479.   
  480. #--------------------------------------------------------------------------
  481. # ● Dispose Multiple Layers
  482. #--------------------------------------------------------------------------                          
  483. def dispose_multiple_layers
  484.      return if @m_layers == nil
  485.      @m_layers.each {|layer| layer.dispose }
  486. end

  487. #--------------------------------------------------------------------------
  488. # ● Terminate
  489. #--------------------------------------------------------------------------            
  490. def terminate
  491.      super
  492.      dispose_title_sprites     
  493. end  

  494. #--------------------------------------------------------------------------
  495. # ● Dispose Title Sprites
  496. #--------------------------------------------------------------------------            
  497. def dispose_title_sprites
  498.      return if @cursor == nil
  499.      dispose_background1
  500.      dispose_background2
  501.      dispose_light
  502.      dispose_logo
  503.      dispose_multiple_layers
  504.      @cursor.bitmap.dispose
  505.      @cursor.dispose
  506.      @cursor = nil
  507.      if @flash_select != nil
  508.         @flash_select.bitmap.dispose
  509.         @flash_select.dispose
  510.      end   
  511.      for com in @commands
  512.          com.bitmap.dispose
  513.          com.dispose
  514.      end
  515.      if ANIMATED_SPRITE
  516.         @object.bitmap.dispose
  517.         @object.dispose
  518.         @object_image.dispose
  519.      end         
  520. end
  521.    
  522. #--------------------------------------------------------------------------
  523. # ● Update
  524. #--------------------------------------------------------------------------            
  525. def update
  526.      super
  527.      update_logo
  528.      update_initial_animation
  529.      update_command
  530.      update_background
  531.      update_light
  532.      update_object_animation
  533.      update_multiple_layers
  534. end

  535. #--------------------------------------------------------------------------
  536. # ● Update Multiple Layers
  537. #--------------------------------------------------------------------------                          
  538. def update_multiple_layers
  539.      return if @m_layers == nil
  540.      @m_layers.each {|layer| layer.update }
  541. end
  542.    
  543. #--------------------------------------------------------------------------
  544. # ● Make Object bitmap
  545. #--------------------------------------------------------------------------                        
  546.   def make_object_bitmap
  547.       @object.bitmap.clear
  548.       src_rect_back = Rect.new(@object_width * @object_index, 0,@object_width,@object_image.height)
  549.       @object.bitmap.blt(0,0, @object_image, src_rect_back)  
  550.   end
  551.    
  552. #--------------------------------------------------------------------------
  553. # ● Update Object Animation
  554. #--------------------------------------------------------------------------                       
  555.   def update_object_animation
  556.       return if !ANIMATED_SPRITE
  557.       @object.opacity += 2
  558.       @object_animation_speed += 1
  559.       if @object_animation_speed > ANIMATED_SPRITE_SPEED
  560.          @object_animation_speed = 0
  561.          @object_index += 1
  562.          @object_index = 0 if @object_index >= @object_frame_max
  563.          make_object_bitmap   
  564.       end
  565.   end  
  566.   
  567. #--------------------------------------------------------------------------
  568. # ● Update Cursor Position
  569. #--------------------------------------------------------------------------            
  570. def update_cursor_position
  571.      @cursor.opacity += 5
  572.      execute_animation_s
  573.      execute_cursor_move(0,@cursor.x,@cursor_position[0] + @mx[1])
  574.      execute_cursor_move(1,@cursor.y,@cursor_position[1])
  575. end  

  576.   #--------------------------------------------------------------------------
  577.   # ● Execute Animation S
  578.   #--------------------------------------------------------------------------      
  579.   def execute_animation_s
  580.       @mx[2] += 1
  581.       return if @mx[2] < 4
  582.       @mx[2] = 0
  583.       @mx[0] += 1
  584.       case @mx[0]
  585.          when 1..7;  @mx[1] += 1            
  586.          when 8..14; @mx[1] -= 1
  587.          else
  588.            @mx[0] = 0
  589.            @mx[1] = 0
  590.       end
  591.   end
  592.    
  593.   #--------------------------------------------------------------------------
  594.   # ● Execute Cursor Move
  595.   #--------------------------------------------------------------------------      
  596.   def execute_cursor_move(type,cp,np)
  597.       sp = 5 + ((cp - np).abs / 5)
  598.       if cp > np
  599.          cp -= sp
  600.          cp = np if cp < np
  601.       elsif cp < np
  602.          cp += sp
  603.          cp = np if cp > np
  604.       end     
  605.       @cursor.x = cp if type == 0
  606.       @cursor.y = cp if type == 1
  607.   end   

  608. #--------------------------------------------------------------------------
  609. # ● Update Logo
  610. #--------------------------------------------------------------------------            
  611. def update_logo
  612.      return if @phase != 0
  613.      loop do
  614.         break if  @logo_duration == 0
  615.         execute_logo
  616.         Graphics.update
  617.         Input.update
  618.      end
  619.      play_title_music
  620. end

  621. #--------------------------------------------------------------------------
  622. # ● Execute Logo
  623. #--------------------------------------------------------------------------            
  624. def execute_logo
  625.      if @logo_duration > 120 and (Input.trigger?(:C) or Input.trigger?(:B))
  626.         @logo_duration = 120
  627.      end  
  628.      @logo_duration -= 1
  629.      if @logo_duration > 120
  630.         @logo.opacity += 5
  631.      else
  632.         @logo.opacity -= 5
  633.      end
  634.      if @logo.opacity <= 0
  635.         @logo_duration = 0
  636.         @phase = 1
  637.      end     
  638. end
  639.    
  640. #--------------------------------------------------------------------------
  641. # ● Update Background
  642. #--------------------------------------------------------------------------              
  643. def update_background
  644.      @sprite1.ox += RANDOM_PICTURES_SCROLL_SPEED[0]
  645.      @sprite1.oy += RANDOM_PICTURES_SCROLL_SPEED[1]
  646.      @sprite2.opacity += 2
  647.      @sprite2.update
  648.      return if RANDOM_PICTURES.size < 1
  649.      @rand_title_duration -= 1
  650.      if @rand_title_duration <= 0
  651.         @sprite1.opacity -= 5 unless RANDOM_PICTURES.size < 2
  652.      else
  653.         @sprite1.opacity += 5
  654.      end   
  655.      return if @sprite1.opacity != 0
  656.      execute_random_picture
  657. end

  658. #--------------------------------------------------------------------------
  659. # ● Execute Random Picture
  660. #--------------------------------------------------------------------------              
  661. def execute_random_picture(initial = false)
  662.      @rand_title_duration = [[60 * RANDOM_PICTURES_DURATION, 9999].min, 60].max
  663.      if @sprite1.bitmap != nil
  664.         @sprite1.bitmap.dispose
  665.         @sprite1.bitmap = nil
  666.      end
  667.      if RAMDOM_SELECTION
  668.          rand_pic = rand(RANDOM_PICTURES.size)
  669.          if rand_pic == @old_back_index
  670.             rand_pic += 1
  671.             rand_pic = 0 if rand_pic >= RANDOM_PICTURES.size
  672.          end
  673.          @old_back_index = rand_pic   
  674.      else
  675.          @old_back_index += 1 unless initial
  676.          @old_back_index = 0 if @old_back_index >= RANDOM_PICTURES.size
  677.      end
  678.      pic = RANDOM_PICTURES[@old_back_index]
  679.      @sprite1.bitmap = Cache.title1(pic) rescue nil
  680.      @sprite1.bitmap = Cache.title1("") if @sprite1.bitmap == nil
  681. end
  682.    
  683. #--------------------------------------------------------------------------
  684. # ● Update Light
  685. #--------------------------------------------------------------------------              
  686. def update_light
  687.      return unless PARTICLE
  688.      if @light_bitmap != nil
  689.         for i in @light_bitmap
  690.             i.update
  691.         end  
  692.      end   
  693. end
  694.    
  695. #--------------------------------------------------------------------------
  696. # ● Update Initial Animation
  697. #--------------------------------------------------------------------------               
  698. def update_initial_animation
  699.      return if @phase != 1
  700.      @phase_time -= 1 if @phase_time > 0
  701.      if @phase_time == 0
  702.         @phase = 2
  703.         @phase_time = 30
  704.      end   
  705.      for i in @commands
  706.         index = 0
  707.         if i.x < COMMANDS_POS[0]
  708.            i.x += 5 + (2 * index)
  709.            i.opacity += 10
  710.            if i.x >= COMMANDS_POS[0]
  711.               i.x = COMMANDS_POS[0]
  712.               i.opacity = 255
  713.               if @phase_time < 15 / 2
  714.                  @phase_time = 15
  715.               end   
  716.            end  
  717.          end
  718.          index += 1
  719.      end  
  720. end  

  721. #--------------------------------------------------------------------------
  722. # ● Update Command
  723. #--------------------------------------------------------------------------              
  724. def update_command
  725.      return if @phase != 2   
  726.      update_command_slide
  727.      update_cursor_position
  728.      update_flash_select
  729. end

  730. #--------------------------------------------------------------------------
  731. # ● Update Command Slide
  732. #--------------------------------------------------------------------------               
  733. def update_command_slide
  734.      if @commands_index_old != @command_window.index
  735.         @commands_index_old = @command_window.index
  736.         @commands_shake_duration = 30
  737.         if @flash_select != nil
  738.            @flash_select.opacity = 255
  739.         end   
  740.      end
  741.      return if @commands_shake_duration == 0
  742.      @commands_shake_duration -= 1 if @commands_shake_duration > 0  
  743.      @commands_shake_duration = 0 if !COMMAND_SHAKE
  744.      for i in @commands
  745.        if (i.z - 100) == @command_window.index
  746.           i.opacity += 10
  747.           @cursor_position = [COMMANDS_POS[0] + CURSOR_POS[0],i.y + CURSOR_POS[1]]
  748.           i.x = COMMANDS_POS[0] + rand(@commands_shake_duration)
  749.        else  
  750.           i.opacity -= 7 if i.opacity > 100
  751.           i.x = COMMANDS_POS[0]
  752.        end
  753.      end  
  754.    end
  755.    
  756. #--------------------------------------------------------------------------
  757. # ● Update Flash Select
  758. #--------------------------------------------------------------------------                  
  759. def update_flash_select
  760.      return if !CURSOR_FLASH_SELECTION
  761.      @flash_select.opacity -= 8
  762.      @flash_select.x = @cursor_position[0] + CURSOR_FLASH_SLECTION_POS[0]
  763.      @flash_select.y = @cursor_position[1] + CURSOR_FLASH_SLECTION_POS[1]
  764.      
  765. end
  766.    
  767. end

  768. $mog_rgss3_animated_title_a = true
复制代码
这是第三个:MOG_Character_Select
  1. #==============================================================================
  2. # +++ MOG - Scene Character Select V1.1 +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Tela de seleção de personagens.
  8. #==============================================================================
  9. # 1 - Deverão conter as seguintes imagens na pasta GRAPHICS/SYSTEM.
  10. #
  11. # Background
  12. # Char_Layout01
  13. # Char_Layout02
  14. # Char_Status_Layout
  15. # Number_Char
  16. #
  17. # 2 - Imagem de pose. (Opcional)
  18. # Para ativar a imagem de pose dos personagens, basta ter os arquivos de pose
  19. # gravados na pasta (GRAPHICS/PICTURES)
  20. # Você deverá nomear as imagens da seguinte forma.
  21. #
  22. # Character + ID_DO_PERSONAGEM
  23. #
  24. # Exemplo:
  25. #
  26. # Character1.png
  27. #
  28. #==============================================================================
  29. # Para chamar o script use o seguinte comando.
  30. #
  31. # SceneManager.call(Scene_Character_Select)
  32. #
  33. #==============================================================================
  34. #==============================================================================
  35. # ● Histórico (Version History)
  36. #==============================================================================
  37. # v 1.1 - Melhoria no sistema de dispose de imagens.
  38. #==============================================================================
  39. module MOG_CHARACTER_SELECT_SCREEN

  40.   HIDE_ACTORS_ID = [1]
  41.   
  42. end

  43. #==============================================================================
  44. # ■ Window_Base
  45. #==============================================================================
  46. class Window_Base < Window
  47.   
  48.   #--------------------------------------------------------------------------
  49.   # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)     
  50.   #--------------------------------------------------------------------------
  51.   # X - Posição na horizontal
  52.   # Y - Posição na vertical
  53.   # VALUE - Valor Numérico
  54.   # FILE_NAME - Nome do arquivo
  55.   # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita  
  56.   # SPACE - Espaço entre os números.
  57.   # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
  58.   # FRAME_INDEX - Definição do quadro a ser utilizado.
  59.   #--------------------------------------------------------------------------  
  60.   def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)     
  61.       number_image = Cache.system(file_name)
  62.       frame_max = 1 if frame_max < 1
  63.       frame_index = frame_max -1 if frame_index > frame_max -1
  64.       align = 2 if align > 2
  65.       cw = number_image.width / 10
  66.       ch = number_image.height / frame_max
  67.       h = ch * frame_index
  68.       number = value.abs.to_s.split(//)
  69.       case align
  70.           when 0
  71.              plus_x = (-cw + space) * number.size
  72.           when 1
  73.              plus_x = (-cw + space) * number.size
  74.              plus_x /= 2
  75.           when 2  
  76.              plus_x = 0
  77.       end
  78.       for r in 0..number.size - 1      
  79.           number_abs = number[r].to_i
  80.           number_rect = Rect.new(cw * number_abs, h, cw, ch)
  81.           self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)        
  82.       end
  83.       number_image.dispose  
  84.    end
  85.   #--------------------------------------------------------------------------
  86.   # ● draw_char_window_status  
  87.   #--------------------------------------------------------------------------  
  88.   def draw_char_window_status(x,y)
  89.       image = Cache.system("Char_Status_Layout")   
  90.       cw = image.width  
  91.       ch = image.height
  92.       src_rect = Rect.new(0, 0, cw, ch)   
  93.       self.contents.blt(x , y , image, src_rect)
  94.       image.dispose
  95.   end     
  96. end  

  97. #===============================================================================
  98. # ■ RPG_FileTest
  99. #===============================================================================
  100. module RPG_FileTest
  101.   
  102.   #--------------------------------------------------------------------------
  103.   # ● RPG_FileTest.system_exist?
  104.   #--------------------------------------------------------------------------
  105.   def RPG_FileTest.system_exist?(filename)
  106.       return Cache.system(filename) rescue return false
  107.   end  
  108.   
  109.   #--------------------------------------------------------------------------
  110.   # ● RPG_FileTest.picture_exist?
  111.   #--------------------------------------------------------------------------
  112.   def RPG_FileTest.picture_exist?(filename)
  113.       return Cache.picture(filename) rescue return false
  114.   end   
  115.   
  116. end

  117. #==============================================================================
  118. # ** Window_Character_Status
  119. #==============================================================================
  120. class Window_Character_Status < Window_Base
  121.   attr_accessor :index
  122.   #--------------------------------------------------------------------------
  123.   # ● initialize
  124.   #--------------------------------------------------------------------------
  125.   def initialize(actor)
  126.       super(0, 0, 400, 130)
  127.       self.opacity = 0
  128.       actor_id = []
  129.       @index = actor
  130.       for i in 1...$data_actors.size
  131.         actor_id.push($game_actors[i])
  132.       end
  133.       @actor = actor_id[actor -1]
  134.       refresh
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● Refresh
  138.   #--------------------------------------------------------------------------
  139.   def refresh
  140.       self.contents.clear
  141.       self.contents.font.bold = true
  142.       self.contents.font.italic = true
  143.       draw_char_window_status(0, 6)   
  144.       draw_actor_face(@actor, 0, 0)
  145.       draw_actor_name(@actor, 140, -5)
  146.       draw_actor_class(@actor, 60, 70)   
  147.       draw_picture_number(155,20,@actor.mhp, "Number_char",1)   
  148.       draw_picture_number(145,48,@actor.mmp, "Number_char",1)   
  149.       draw_picture_number(228,28,@actor.atk, "Number_char",1)   
  150.       draw_picture_number(297,28,@actor.def, "Number_char",1)  
  151.       draw_picture_number(207,68,@actor.mat, "Number_char",1)  
  152.       draw_picture_number(277,68,@actor.agi, "Number_char",1)  
  153.   end
  154. end


  155. #==============================================================================
  156. # ■ Scene Character Select
  157. #==============================================================================
  158. class Scene_Character_Select
  159. include MOG_CHARACTER_SELECT_SCREEN
  160. #--------------------------------------------------------------------------
  161. # ● Initialize
  162. #--------------------------------------------------------------------------
  163. def initialize
  164.      setup
  165.      dispose_windows
  166.      create_layout
  167.      create_window_status
  168.      create_char_image
  169.      reset_position(0)      
  170. end
  171.    
  172. #--------------------------------------------------------------------------
  173. # ● Setup
  174. #--------------------------------------------------------------------------
  175. def setup
  176.      @char_index = 1
  177.      @char_max = $data_actors.size - 1
  178.      @pw_x = 300
  179.      @aw_x = 200     
  180.      @nw_x = 100         
  181. end  

  182. #--------------------------------------------------------------------------
  183. # ● Main
  184. #--------------------------------------------------------------------------         
  185. def main
  186.      Graphics.transition
  187.      execute_loop
  188.      execute_dispose
  189. end   

  190. #--------------------------------------------------------------------------
  191. # ● Execute Loop
  192. #--------------------------------------------------------------------------           
  193. def execute_loop
  194.      loop do
  195.           Graphics.update
  196.           Input.update
  197.           update
  198.           if SceneManager.scene != self
  199.               break
  200.           end
  201.      end
  202. end
  203.   
  204. #--------------------------------------------------------------------------
  205. # ● create_background
  206. #--------------------------------------------------------------------------   
  207. def create_layout
  208.       @background = Plane.new  
  209.       @background.bitmap = Cache.system("Background")
  210.       @background.z = 0
  211.       @layout_01 = Sprite.new  
  212.       @layout_01.bitmap = Cache.system("Char_Layout01")
  213.       @layout_01.z = 10      
  214.       @layout_02 = Sprite.new  
  215.       @layout_02.bitmap = Cache.system("Char_Layout02")
  216.       @layout_02.blend_type = 1
  217.       @layout_02.z = 1  
  218.   end  
  219.   
  220.   #--------------------------------------------------------------------------
  221.   # ● create_window_status
  222.   #--------------------------------------------------------------------------  
  223.   def create_window_status
  224.       @window_status = []
  225.       for i in 1...$data_actors.size
  226.           @window_status[i] = Window_Character_Status.new(i)
  227.           @window_status[i].z = 7
  228.       end
  229.       check_active_window
  230.   end  
  231.   
  232.   #--------------------------------------------------------------------------
  233.   # ● create_window_status
  234.   #--------------------------------------------------------------------------  
  235.   def create_char_image   
  236.       @actor_picture = []
  237.       actor_id = []
  238.       for i in 1...$data_actors.size
  239.           actor_id.push($game_actors[i])
  240.           actor = actor_id[i - 1]
  241.           @actor_picture[i] = Sprite.new
  242.           file_name = "Character" + i.to_s
  243.           file_name = "" unless RPG_FileTest.picture_exist?(file_name)
  244.           @actor_picture[i].bitmap = Cache.picture(file_name)
  245.       end   
  246.       check_active_picture
  247.   end
  248.   #--------------------------------------------------------------------------
  249.   # ● check_active_window
  250.   #--------------------------------------------------------------------------   
  251.   def check_active_window
  252.      for i in 1...$data_actors.size
  253.         @pw = @char_index - 1
  254.         @pw = 1 if @pw > @char_max
  255.         @pw_y = 32
  256.         @pw = @char_max if @pw < 1
  257.         @aw = @char_index
  258.         @aw_y = 160
  259.         @nw = @char_index + 1
  260.         @nw = 1 if @nw > @char_max
  261.         @nw = @char_max if @nw < 1
  262.         @nw_y = 288
  263.         case @window_status[i].index
  264.             when @pw,@aw,@nw
  265.                  @window_status[i].visible = true
  266.             else
  267.                  @window_status[i].visible = false
  268.         end
  269.       end  
  270.   end
  271.    
  272.   #--------------------------------------------------------------------------
  273.   # ● check_active_picture  
  274.   #--------------------------------------------------------------------------   
  275.   def check_active_picture  
  276.       for i in 1...$data_actors.size     
  277.         case @window_status[i].index
  278.             when @pw,@aw,@nw
  279.                  @actor_picture[i].visible = true
  280.                  @actor_picture[@pw].z = 4
  281.                  @actor_picture[@aw].z = 6   
  282.                  @actor_picture[@nw].z = 4      
  283.                  @actor_picture[@pw].opacity = 120
  284.                  @actor_picture[@aw].opacity = 255
  285.                  @actor_picture[@nw].opacity = 120            
  286.             else
  287.                  @actor_picture[i].visible = false
  288.         end     
  289.       end
  290.   end      
  291.   
  292.   #--------------------------------------------------------------------------
  293.   # ● terminate
  294.   #--------------------------------------------------------------------------
  295.   def execute_dispose
  296.       RPG::BGM.fade(2500)
  297.       Graphics.fadeout(60)
  298.       Graphics.wait(40)
  299.       RPG::BGM.stop      
  300.       dispose_windows
  301.   end
  302.    
  303.   #--------------------------------------------------------------------------
  304.   # ● Dispose Windows
  305.   #--------------------------------------------------------------------------  
  306.   def dispose_windows
  307.       return if @background == nil
  308.       for i in 1...$data_actors.size
  309.           @window_status[i].dispose
  310.           @actor_picture[i].bitmap.dispose
  311.           @actor_picture[i].dispose        
  312.       end   
  313.       @background.bitmap.dispose
  314.       @background.dispose
  315.       @background = nil
  316.       @layout_01.bitmap.dispose   
  317.       @layout_01.dispose
  318.       @layout_02.bitmap.dispose   
  319.       @layout_02.dispose      
  320.   end  
  321.    
  322.   #--------------------------------------------------------------------------
  323.   # ● update
  324.   #--------------------------------------------------------------------------
  325.   def update
  326.       @background.ox += 1
  327.       update_select
  328.       update_slide_window
  329.       update_slide_image
  330.   end
  331.   
  332.   #--------------------------------------------------------------------------
  333.   # ● update_slide_window
  334.   #--------------------------------------------------------------------------  
  335.   def update_slide_window
  336.       @window_status[@aw].x += 1 if @window_status[@aw].x < 0
  337.       @window_status[@nw].x -= 2 if @window_status[@nw].x > -30
  338.       @window_status[@pw].x -= 2 if @window_status[@pw].x > -30
  339.       slide_window_y(@pw,@pw_y)
  340.       slide_window_y(@aw,@aw_y)
  341.       slide_window_y(@nw,@nw_y)
  342.   end
  343.   
  344.   #--------------------------------------------------------------------------
  345.   # ● update_slide_image   
  346.   #--------------------------------------------------------------------------  
  347.   def update_slide_image   
  348.       slide_picture_x(@pw,@pw_x,15)
  349.       slide_picture_x(@aw,@aw_x,5)
  350.       slide_picture_x(@nw,@nw_x,15)
  351.   end
  352.   
  353.   #--------------------------------------------------------------------------
  354.   # ● slide_picture_x
  355.   #--------------------------------------------------------------------------   
  356.   def slide_picture_x(i,x_pos,speed)
  357.       if @actor_picture[i].x < x_pos
  358.          @actor_picture[i].x += speed
  359.          @actor_picture[i].x = x_pos if @actor_picture[i].x > x_pos
  360.       end  
  361.       if @actor_picture[i].x > x_pos
  362.          @actor_picture[i].x -= speed
  363.          @actor_picture[i].x = x_pos if @actor_picture[i].x < x_pos        
  364.        end            
  365.   end     
  366.   
  367.   #--------------------------------------------------------------------------
  368.   # ● slide_window_y
  369.   #--------------------------------------------------------------------------   
  370.   def slide_window_y(i,y_pos)
  371.       if @window_status[i].y < y_pos
  372.          @window_status[i].y += 15
  373.          @window_status[i].y = y_pos if @window_status[i].y > y_pos
  374.       end  
  375.       if @window_status[i].y > y_pos
  376.          @window_status[i].y -= 15
  377.          @window_status[i].y = y_pos if @window_status[i].y < y_pos        
  378.        end            
  379.   end   
  380.   
  381.   #--------------------------------------------------------------------------
  382.   # ● reset_position
  383.   #--------------------------------------------------------------------------     
  384.   def reset_position(diretion)
  385.       check_active_window
  386.       check_active_picture
  387.       case diretion
  388.          when 0
  389.             @window_status[@pw].y = -64
  390.             @actor_picture[@pw].x = 100
  391.          when 1  
  392.             @window_status[@nw].y = 440
  393.             @actor_picture[@nw].x = 400
  394.       end        
  395.   end  
  396.   
  397.   #--------------------------------------------------------------------------
  398.   # ● update_select
  399.   #--------------------------------------------------------------------------
  400.   def update_select
  401.        if Input.trigger?(Input::DOWN) or Input.trigger?(Input::LEFT)
  402.           Sound.play_cursor
  403.           @char_index += 1
  404.           @char_index = 1 if @char_index > @char_max
  405.           if @char_max < 3         
  406.              reset_position(0)
  407.           else  
  408.              reset_position(1)
  409.           end   
  410.        elsif Input.trigger?(Input::UP) or Input.trigger?(Input::RIGHT)
  411.           Sound.play_cursor
  412.           @char_index -= 1
  413.           @char_index = @char_max if @char_index < 1
  414.           reset_position(0)
  415.        elsif Input.trigger?(Input::C)     
  416.           Sound.play_ok
  417.           $game_party.add_actor(@char_index)
  418.           SceneManager.return
  419.        end
  420.   end
  421. end  

  422. $mog_rgss3_scene_character_select = true
复制代码
这是第四个:MOG_Menu_Cursor
  1. #==============================================================================
  2. # +++ MOG - Animated Cursor (V1.1) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Adiciona um cursor animado nos menus de comandos.
  8. #==============================================================================
  9. # Será necessário ter a imagem
  10. #
  11. # Menu_Cursor.png
  12. #
  13. # gravado na pasta GRAPHICS/SYSTEM/
  14. #==============================================================================
  15. # Ativando a animação do cursor
  16. #
  17. # Basta criar uma imagem que tenha a largura com no minimo o dobro de altura da
  18. # imagem do cursor.
  19. #
  20. # EX
  21. # largura 32 pixel (width) altura 32 pixel = 1 frames de animação.(Sem animação)
  22. # largura 64 pixel (width) altura 32 pixel = 2 frames de animação.
  23. # largura 128 pixel (width) altura 32 pixel = 4 frames de animação.
  24. # largura 256 pixel (width) altura 32 pixel = 8 frames de animação
  25. # Etc...
  26. #
  27. # NOTA
  28. # Não há limite para quantidade de frames de animação, se não quiser a animação
  29. # basta criar uma imagem com a altura proporcional a largura da imagem.
  30. #
  31. #==============================================================================
  32. # ● Histórico (Version History)
  33. #==============================================================================
  34. # v 1.1 - Correção da posição do cursor na cena de batalha.
  35. #==============================================================================

  36. module MOG_MENU_CURSOR
  37.   #Ativar animação do cursor se movimentando para os lados.
  38.   SIDE_ANIMATION = true
  39.   #Definição da posição do cursor. (Ajustes na posição)
  40.   CURSOR_POSITION = [0,0]
  41.   #Definição da velocidade da animação de frames.
  42.   CURSOR_ANIMATION_SPEED = 6
  43. end

  44. #==============================================================================
  45. # ■ Game_System
  46. #==============================================================================
  47. class Game_System
  48.   
  49.   attr_accessor :menu_cursor_name
  50.   
  51.   #--------------------------------------------------------------------------
  52.   # ● Initialize
  53.   #--------------------------------------------------------------------------      
  54.   alias mog_menu_cursor_initialize initialize
  55.   def initialize
  56.       mog_menu_cursor_initialize
  57.       @menu_cursor_name = "Menu_Cursor"
  58.   end  
  59.   
  60. end  

  61. #==============================================================================
  62. # ■ Game_Temp
  63. #==============================================================================
  64. class Game_Temp
  65.   
  66.   attr_accessor :menu_cursor   
  67.    
  68.   #--------------------------------------------------------------------------
  69.   # ● Initialize
  70.   #--------------------------------------------------------------------------      
  71.   alias mog_cursor_sprite_initialize initialize
  72.   def initialize
  73.       mog_cursor_sprite_initialize
  74.       @menu_cursor = [false,0,0,0]
  75.   end  
  76.   
  77. end  

  78. #==============================================================================
  79. # ■ Sprite Cursor
  80. #==============================================================================
  81. class Sprite_Cursor < Sprite
  82.   
  83.   include MOG_MENU_CURSOR
  84.   
  85.   #--------------------------------------------------------------------------
  86.   # ● Initialize
  87.   #--------------------------------------------------------------------------   
  88.   def initialize(viewport = nil , x , y)
  89.       super(viewport)
  90.       @cursor_image = Cache.system($game_system.menu_cursor_name.to_s)
  91.       @frame_max = (@cursor_image.width / @cursor_image.height) rescue 1
  92.       @frame_range = @frame_max > 0 ? (@cursor_image.width  / @frame_max) : 1
  93.       @frame = 0
  94.       @ca_speed = CURSOR_ANIMATION_SPEED
  95.       self.bitmap = Bitmap.new(@frame_range,@frame_range)
  96.       self.z = 10000
  97.       self.opacity = 0
  98.       @cw = self.bitmap.width / 2
  99.       @c_p = [-@cw + CURSOR_POSITION[0],CURSOR_POSITION[1]]
  100.       @mx = [0,0,0]
  101.       refresh_animation(true)
  102.       update_move
  103.   end
  104.   
  105.   #--------------------------------------------------------------------------
  106.   # ● Dispose
  107.   #--------------------------------------------------------------------------   
  108.   def dispose
  109.       self.bitmap.dispose
  110.       self.bitmap = nil
  111.       @cursor_image.dispose
  112.   end  
  113.   
  114.   #--------------------------------------------------------------------------
  115.   # ● Update
  116.   #--------------------------------------------------------------------------  
  117.   def update
  118.       if cursor_visible?
  119.          self.visible = true
  120.          update_move
  121.          refresh_animation(false)
  122.       else   
  123.          self.visible = false
  124.       end  
  125.   end

  126.   #--------------------------------------------------------------------------
  127.   # ● Initialize
  128.   #--------------------------------------------------------------------------      
  129.   def refresh_animation(start = false)
  130.       @ca_speed += 1
  131.       return if @frame_max == 1 and !start
  132.       return if @ca_speed < CURSOR_ANIMATION_SPEED
  133.       @ca_speed = 0
  134.       self.bitmap.clear
  135.       scr_rect = Rect.new(@frame_range * @frame,0,@frame_range,@frame_range)
  136.       self.bitmap.blt(0,0,@cursor_image, scr_rect)
  137.       @frame += 1
  138.       @frame = 0 if @frame >= @frame_max
  139.   end  
  140.    
  141.   #--------------------------------------------------------------------------
  142.   # ● Cursor Visible?
  143.   #--------------------------------------------------------------------------   
  144.   def cursor_visible?
  145.       px = $game_temp.menu_cursor[2]
  146.       py = $game_temp.menu_cursor[3]
  147.       return false if $game_temp.menu_cursor[1] == 0
  148.       return false if px < 0 or py < 0 or (px == 0 and py == 0)
  149.       return true
  150.   end  
  151.   
  152.   #--------------------------------------------------------------------------
  153.   # ● Update Move
  154.   #--------------------------------------------------------------------------   
  155.   def update_move
  156.       self.opacity += 25
  157.       @new_pos = [$game_temp.menu_cursor[2],$game_temp.menu_cursor[3]]
  158.       execute_animation_s
  159.       execute_move(0,self.x, @new_pos[0] + @mx[1] + @c_p[0])
  160.       execute_move(1,self.y, @new_pos[1] + @c_p[1])
  161.   end  
  162.   
  163.   #--------------------------------------------------------------------------
  164.   # ● Execute Animation S
  165.   #--------------------------------------------------------------------------      
  166.   def execute_animation_s
  167.       return if !SIDE_ANIMATION
  168.       @mx[2] += 1
  169.       return if @mx[2] < 4
  170.       @mx[2] = 0
  171.       @mx[0] += 1
  172.       case @mx[0]
  173.          when 1..7;  @mx[1] += 1            
  174.          when 8..14; @mx[1] -= 1
  175.          else
  176.            @mx[0] = 0
  177.            @mx[1] = 0
  178.       end
  179.   end
  180.   
  181.   #--------------------------------------------------------------------------
  182.   # ● Execute Move
  183.   #--------------------------------------------------------------------------      
  184.   def execute_move(type,cp,np)
  185.       sp = 5 + ((cp - np).abs / 5)
  186.       if cp > np
  187.          cp -= sp
  188.          cp = np if cp < np
  189.       elsif cp < np
  190.          cp += sp
  191.          cp = np if cp > np
  192.       end     
  193.       self.x = cp if type == 0
  194.       self.y = cp if type == 1
  195.   end  
  196.   
  197. end

  198. #==============================================================================
  199. # ■ CURSOR_MENU SPRITE
  200. #==============================================================================
  201. module CURSOR_MENU_SPRITE
  202.   
  203.   #--------------------------------------------------------------------------
  204.   # ● Cursor Sprite Enable
  205.   #--------------------------------------------------------------------------      
  206.   def cursor_sprite_enable
  207.       return if self.index == nil rescue return
  208.       create_cursor_sprite
  209.       update_cursor_sprite
  210.       update_cusor_position
  211.       if !self.active
  212.          $game_temp.menu_cursor[1] -= 1 if $game_temp.menu_cursor[1] > 0
  213.       end
  214.   end
  215.    
  216.   #--------------------------------------------------------------------------
  217.   # ● Create Cursor Sprite
  218.   #--------------------------------------------------------------------------   
  219.   def create_cursor_sprite
  220.       return if @cursor != nil
  221.       return if $game_temp.menu_cursor[0]
  222.       $game_temp.menu_cursor[0] = true
  223.       reset_cursor_position
  224.       @cursor = Sprite_Cursor.new(nil,x,y)
  225.       @cursor_name = $game_system.menu_cursor_name
  226.   end   
  227.   
  228.   #--------------------------------------------------------------------------
  229.   # ● Dispose Cursor Sprite
  230.   #--------------------------------------------------------------------------      
  231.   def dispose_cursor_sprite
  232.       return if @cursor == nil
  233.       $game_temp.menu_cursor[0] = false
  234.       reset_cursor_position
  235.       @cursor.dispose
  236.       @cursor = nil
  237.   end  

  238.   #--------------------------------------------------------------------------
  239.   # ● Reset Cursor Position
  240.   #--------------------------------------------------------------------------        
  241.   def reset_cursor_position
  242.       $game_temp.menu_cursor[1] = 0
  243.       $game_temp.menu_cursor[2] = -32
  244.       $game_temp.menu_cursor[3] = -32
  245.   end  
  246.   
  247.   #--------------------------------------------------------------------------
  248.   # ● Update Cursor
  249.   #--------------------------------------------------------------------------         
  250.   def update_cursor_sprite
  251.       return if @cursor == nil
  252.       @cursor.update
  253.       refresh_cursor_sprite if @cursor_name != $game_system.menu_cursor_name
  254.   end
  255.   
  256.   #--------------------------------------------------------------------------
  257.   # ● Refresh Cursor Sprite
  258.   #--------------------------------------------------------------------------            
  259.   def refresh_cursor_sprite
  260.       @cursor_name = $game_system.menu_cursor_name
  261.       dispose_cursor_sprite
  262.       create_cursor_sprite
  263.   end  
  264.   
  265.   #--------------------------------------------------------------------------
  266.   # ● Update Cursor Position
  267.   #--------------------------------------------------------------------------         
  268.   def update_cusor_position
  269.       return if !can_update_cursor_position?
  270.       x_v = [0,0]
  271.       if SceneManager.scene_is?(Scene_Battle)
  272.           if self.viewport != nil
  273.              x_v = [-self.viewport.ox, self.viewport.rect.y]
  274.           end
  275.       end      
  276.       x_e = (self.cursor_rect.x + self.x) - self.ox
  277.       $game_temp.menu_cursor[2] = x_e + x_v[0]
  278.       y_e = (self.cursor_rect.y + self.y + self.cursor_rect.height / 2) - self.oy
  279.       $game_temp.menu_cursor[3] = y_e + x_v[1]
  280.       $game_temp.menu_cursor[1] = 13
  281.    end
  282.    
  283.   #--------------------------------------------------------------------------
  284.   # ● Can Update Cursor
  285.   #--------------------------------------------------------------------------            
  286.    def can_update_cursor_position?
  287.        return false if !self.active     
  288.        return false if self.index < 0
  289.        return false if !self.visible
  290.        return true
  291.    end  

  292. end

  293. #==============================================================================
  294. # ■ Window Base
  295. #==============================================================================
  296. class Window_Base < Window
  297.   include CURSOR_MENU_SPRITE
  298.   
  299.   #--------------------------------------------------------------------------
  300.   # ● Dispose
  301.   #--------------------------------------------------------------------------              
  302.   alias mog_menu_cursor_base_dispose dispose
  303.   def dispose
  304.       mog_menu_cursor_base_dispose
  305.       dispose_cursor_sprite
  306.   end  

  307.   #--------------------------------------------------------------------------
  308.   # ● Update
  309.   #--------------------------------------------------------------------------              
  310.   alias mog_cursor_update update
  311.   def update
  312.       mog_cursor_update
  313.       cursor_sprite_enable
  314.   end   
  315.   
  316. end

  317. $mog_rgss3_animated_cursor = true
复制代码
这是第五个:MOG_Scene_File_A
  1. #==============================================================================
  2. # +++ MOG - Scene File A (V1.3) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com/
  6. #==============================================================================
  7. # Tela de salvar e carregar animado versão A.
  8. #==============================================================================
  9. # Serão necessários as seguintes imagens na pasta Graphics/System
  10. #
  11. # Save_Number.png
  12. # Save_Background.png
  13. # Save_Character_Floor.png
  14. # Save_Layout01.png
  15. # Save_Layout02.png
  16. # Save_Window01.png
  17. # Save_Window02.png
  18. #
  19. #==============================================================================
  20. #
  21. #==============================================================================
  22. # ● Histórico (Version History)
  23. #==============================================================================
  24. # v 1.3 - Melhor codificação.
  25. # v 1.1 - Melhoria no sistema de dispose de imagens.
  26. #==============================================================================
  27. module MOG_SCENE_FILE
  28.   #Quantidade de slots de saves.
  29.   FILES_MAX = 9
  30. end

  31. #==============================================================================
  32. # ■ Game Temp
  33. #==============================================================================
  34. class Game_Temp

  35.   attr_accessor :scene_save
  36.   #--------------------------------------------------------------------------
  37.   # ● Initialize
  38.   #--------------------------------------------------------------------------
  39.   alias mog_scene_file_initialize initialize
  40.   def initialize
  41.       mog_scene_file_initialize
  42.       @scene_save = false  
  43.   end
  44.   
  45. end
  46. #==============================================================================
  47. # ■ Window_Base
  48. #==============================================================================
  49. class Window_Base < Window
  50.   
  51.   #--------------------------------------------------------------------------
  52.   # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)     
  53.   #--------------------------------------------------------------------------
  54.   # X - Posição na horizontal
  55.   # Y - Posição na vertical
  56.   # VALUE - Valor Numérico
  57.   # FILE_NAME - Nome do arquivo
  58.   # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita  
  59.   # SPACE - Espaço entre os números.
  60.   # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
  61.   # FRAME_INDEX - Definição do quadro a ser utilizado.
  62.   #--------------------------------------------------------------------------  
  63.   def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)     
  64.       number_image = Cache.system(file_name)
  65.       frame_max = 1 if frame_max < 1
  66.       frame_index = frame_max -1 if frame_index > frame_max -1
  67.       align = 2 if align > 2
  68.       cw = number_image.width / 10
  69.       ch = number_image.height / frame_max
  70.       h = ch * frame_index
  71.       number = value.abs.to_s.split(//)
  72.       case align
  73.          when 0
  74.             plus_x = (-cw + space) * number.size
  75.          when 1
  76.             plus_x = (-cw + space) * number.size
  77.             plus_x /= 2
  78.          when 2  
  79.             plus_x = 0
  80.       end
  81.       for r in 0..number.size - 1      
  82.           number_abs = number[r].to_i
  83.           number_rect = Rect.new(cw * number_abs, h, cw, ch)
  84.           self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)        
  85.       end   
  86.       number_image.dispose  
  87.   end
  88.    
  89.   #--------------------------------------------------------------------------
  90.   # ● Draw Help Layout
  91.   #--------------------------------------------------------------------------
  92.   def draw_face_save(name,x,y,type)
  93.       if type == 0
  94.          image_name = name + "_0"
  95.       elsif type == 1
  96.          image_name = name + "_1"         
  97.       else  
  98.          image_name = name + "_2"
  99.       end
  100.       image = Cache.face(image_name)   
  101.       cw = image.width  
  102.       ch = image.height
  103.       src_rect = Rect.new(0, 0, cw, ch)   
  104.       self.contents.blt(x , y , image, src_rect)  
  105.       image.dispose
  106.   end   
  107.    
  108.   #--------------------------------------------------------------------------
  109.   # ● draw_parameter_layout
  110.   #--------------------------------------------------------------------------  
  111.   def draw_parameter_layout(x,y)
  112.       image = Cache.system("Save_Window01")   
  113.       cw = image.width  
  114.       ch = image.height
  115.       src_rect = Rect.new(0, 0, cw, ch)   
  116.       self.contents.blt(x , y , image, src_rect)     
  117.       image.dispose
  118.   end   
  119.   
  120.   #--------------------------------------------------------------------------
  121.   # ● draw_parameter_layout2
  122.   #--------------------------------------------------------------------------  
  123.   def draw_parameter_layout2(x,y,type)
  124.       if type == 0
  125.          image = Cache.system("Save_Window02")   
  126.       else   
  127.          image = Cache.system("Save_Window03")  
  128.       end  
  129.       cw = image.width  
  130.       ch = image.height
  131.       src_rect = Rect.new(0, 0, cw, ch)   
  132.       self.contents.blt(x , y , image, src_rect)     
  133.       image.dispose
  134.   end      
  135.   
  136.   #--------------------------------------------------------------------------
  137.   # ● draw_character_floor
  138.   #--------------------------------------------------------------------------  
  139.   def draw_character_floor(x,y)
  140.       image = Cache.system("Save_Character_Floor")   
  141.       cw = image.width  
  142.       ch = image.height
  143.       src_rect = Rect.new(0, 0, cw, ch)   
  144.       self.contents.blt(x , y , image, src_rect)   
  145.       image.dispose
  146.   end
  147.   
  148. end  
  149.    
  150. #==============================================================================
  151. # ■ DataManager
  152. #==============================================================================
  153. module DataManager

  154.   #--------------------------------------------------------------------------
  155.   # ● Make Save Header
  156.   #--------------------------------------------------------------------------  
  157.   def self.make_save_header
  158.       header = {}
  159.       header[:characters] = $game_party.characters_for_savefile
  160.       header[:playtime_s] = $game_system.playtime_s
  161.       header[:playtime] = $game_system.playtime
  162.       header[:map_name] = $game_map.display_name
  163.       header[:members] = $game_party.members
  164.       header
  165.   end  
  166. end  

  167. #==============================================================================
  168. # ■ Window_SaveFile
  169. #==============================================================================
  170. class Window_SaveFile_A < Window_Base
  171.   attr_reader   :filename               
  172.   attr_reader   :file_exist               
  173.   attr_reader   :time_stamp              
  174.   attr_reader   :selected                 
  175.   attr_reader   :file_index
  176.   
  177.   #--------------------------------------------------------------------------
  178.   # ● Initialize
  179.   #--------------------------------------------------------------------------
  180.   def initialize(file_index, filename)
  181.       super(0, 0,720, 140)
  182.       self.opacity = 0
  183.       @file_index = file_index
  184.       @filename = filename
  185.       load_gamedata
  186.       refresh
  187.       @selected = false
  188.   end
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # ● load_gamedata
  192.   #--------------------------------------------------------------------------
  193.   def load_gamedata
  194.     @time_stamp = Time.at(0)
  195.     @file_exist = FileTest.exist?(@filename)
  196.     if @file_exist
  197.        header = DataManager.load_header(@file_index)
  198.        if header == nil
  199.           @file_exist = false
  200.           return
  201.        end  
  202.        @characters = header[:characters]
  203.        @total_sec = header[:playtime]
  204.        @mapname = header[:map_name]
  205.        @members = header[:members]
  206.     end
  207.   end
  208.   
  209.   #--------------------------------------------------------------------------
  210.   # ● Refresh
  211.   #--------------------------------------------------------------------------
  212.   def refresh
  213.       self.contents.clear
  214.       self.contents.font.color = normal_color
  215.       xp = 96
  216.       ex = 60   
  217.       if @file_exist
  218.          if @total_sec == nil
  219.             draw_parameter_layout2(0,50,0)
  220.             draw_parameter_layout(-10 + xp,0)
  221.             value = @file_index + 1
  222.             draw_picture_number(13 + xp, 32,value, "Save_Number_01",1,0,3,0)           
  223.             self.contents.draw_text(140, 50, 450, 32, "Error! - Please, dont't use your old Save Files...", 0)
  224.             return
  225.         end  
  226.         draw_parameter_layout2(0,50,0)
  227.         draw_parameter_layout(-10 + xp,0)
  228.         value = @file_index + 1
  229.         draw_picture_number(13 + xp, 32,value, "Save_Number_01",1,0,3,0)
  230.         draw_party_characters(180 + xp, 75,ex)
  231.         draw_playtime(495, 20, contents.width - 4, 2)
  232.         draw_map_location( 400 + xp,64)
  233.         draw_level(185 + xp,85,ex)
  234.         draw_face_save(40 + xp,0)
  235.       else  
  236.         draw_parameter_layout2(0,50,1)
  237.         draw_parameter_layout(-10 + xp,0)
  238.         value = @file_index + 1
  239.         draw_picture_number(13 + xp, 32,value, "Save_Number_01",1,0,3,0)      
  240.          self.contents.draw_text(260, 50, 120, 32, "No Data", 1)
  241.       end
  242.     end
  243.    
  244.   #--------------------------------------------------------------------------
  245.   # ● draw_face
  246.   #--------------------------------------------------------------------------
  247.   def draw_face_save(x,y)
  248.      draw_actor_face(@members[0], x, y)
  249.   end
  250.   
  251.   #--------------------------------------------------------------------------
  252.   # ● draw_level
  253.   #--------------------------------------------------------------------------
  254.   def draw_level(x,y,ex)
  255.       self.contents.font.color = normal_color   
  256.       for i in [email protected]
  257.         break if i > 3
  258.         level = @members[i].level
  259.         draw_picture_number(x + (ex  * i) , y ,level, "Save_Number_01",1,0,3,1)
  260.       end        
  261.   end
  262.   
  263.   #--------------------------------------------------------------------------
  264.   # ● draw_map_location
  265.   #--------------------------------------------------------------------------
  266.   def draw_map_location(x,y)
  267.       self.contents.font.bold = true
  268.       self.contents.font.name = "Georgia"
  269.       self.contents.font.size = 20
  270.       self.contents.font.italic = true
  271.       self.contents.draw_text(x, y, 125, 32, @mapname.to_s, 0)
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● draw_party_characters
  275.   #--------------------------------------------------------------------------
  276.   def draw_party_characters(x, y,ex)
  277.       for i in [email protected]
  278.         break if i > 3
  279.         name = @characters[i][0]
  280.         index = @characters[i][1]
  281.         draw_character_floor(- 35 + x + i * ex,y - 20)      
  282.         draw_character(name, index, x + i * ex, y)
  283.       end
  284.   end
  285.   
  286.   #--------------------------------------------------------------------------
  287.   # ● draw_playtime
  288.   #--------------------------------------------------------------------------
  289.   def draw_playtime(x, y, width, align)
  290.       hour = @total_sec / 60 / 60
  291.       min = @total_sec / 60 % 60
  292.       sec = @total_sec % 60
  293.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  294.       draw_picture_number(x + 18 * 0, y ,0, "Save_Number_01",0,0,3,0) if hour < 10
  295.       draw_picture_number(x + 18 * 1, y ,hour, "Save_Number_01",0,0,3,0)
  296.       draw_picture_number(x + 18 * 3, y ,0, "Save_Number_01",0,0,3,0) if min < 10
  297.       draw_picture_number(x + 18 * 4, y ,min, "Save_Number_01",0,0,3,0)
  298.       draw_picture_number(x + 18 * 6, y ,0, "Save_Number_01",0,0,3,0) if sec < 10
  299.       draw_picture_number(x + 18 * 7, y ,sec , "Save_Number_01",0,0,3,0)     
  300.   end

  301.   #--------------------------------------------------------------------------
  302.   # ● selected
  303.   #--------------------------------------------------------------------------
  304.   def selected=(selected)
  305.       @selected = selected
  306.   end
  307. end

  308. #==============================================================================
  309. # ■ Scene Save
  310. #==============================================================================
  311. class Scene_Save < Scene_File
  312.   #--------------------------------------------------------------------------
  313.   # ● Initialize
  314.   #--------------------------------------------------------------------------
  315.   def initialize
  316.       $game_temp.scene_save = true
  317.       super
  318.   end  
  319. end  
  320. #==============================================================================
  321. # ■ Scene Load
  322. #==============================================================================
  323. class Scene_Load < Scene_File
  324.   #--------------------------------------------------------------------------
  325.   # ● Initialize
  326.   #--------------------------------------------------------------------------
  327.   def initialize
  328.       $game_temp.scene_save = false
  329.       super
  330.   end  
  331. end

  332. #==============================================================================
  333. # ■ Scene_File
  334. #==============================================================================
  335. class Scene_File
  336.   include MOG_SCENE_FILE
  337.   
  338.   
  339.   #--------------------------------------------------------------------------
  340.   # ● initialize
  341.   #--------------------------------------------------------------------------
  342.   def initialize
  343.       @saving = $game_temp.scene_save
  344.       @file_max = FILES_MAX
  345.       @file_max = 1 if FILES_MAX < 1
  346.       execute_dispose
  347.       create_layout
  348.       create_savefile_windows
  349.       @index = DataManager.last_savefile_index
  350.       @check_prev_index = true
  351.       @savefile_windows[@index].selected = true   
  352.   end
  353.   
  354. #--------------------------------------------------------------------------
  355. # ● Main
  356. #--------------------------------------------------------------------------         
  357. def main
  358.      Graphics.transition
  359.      execute_loop
  360.      execute_dispose
  361. end   

  362. #--------------------------------------------------------------------------
  363. # ● Execute Loop
  364. #--------------------------------------------------------------------------           
  365. def execute_loop
  366.      loop do
  367.           Graphics.update
  368.           Input.update
  369.           update
  370.           if SceneManager.scene != self
  371.               break
  372.           end
  373.      end
  374. end   
  375.   
  376.   #--------------------------------------------------------------------------
  377.   # ● Create_background
  378.   #--------------------------------------------------------------------------  
  379.   def create_layout
  380.       @background = Plane.new  
  381.       @background.bitmap = Cache.system("Save_Background")
  382.       @background.z = 0
  383.       @layout_01 = Sprite.new  
  384.       @layout_01.bitmap = Cache.system("Save_Layout01")
  385.       @layout_01.z = 1      
  386.       @layout_01.blend_type = 1
  387.       image = Cache.system("Save_Layout02")
  388.       @bitmap = Bitmap.new(image.width,image.height)
  389.       cw = image.width
  390.       ch = image.height / 2
  391.       if @saving
  392.          h = 0
  393.       else  
  394.          h = ch
  395.       end  
  396.       src_rect = Rect.new(0, h, cw, ch)
  397.       @bitmap.blt(0,0, image, src_rect)     
  398.       @layout_02 = Sprite.new  
  399.       @layout_02.bitmap = @bitmap
  400.       @layout_02.z = 3
  401.       @layout_02.y = 370
  402.       image.dispose
  403.   end
  404.   
  405.   #--------------------------------------------------------------------------
  406.   # ● Execute Dispose
  407.   #--------------------------------------------------------------------------
  408.   def execute_dispose
  409.       return if @background == nil
  410.       Graphics.freeze
  411.       @background.bitmap.dispose
  412.       @background.dispose
  413.       @background = nil
  414.       @layout_01.bitmap.dispose   
  415.       @layout_01.dispose      
  416.       @layout_02.bitmap.dispose
  417.       @layout_02.dispose
  418.       @bitmap.dispose
  419.       dispose_item_windows
  420.   end
  421.   
  422.   #--------------------------------------------------------------------------
  423.   # ● Frame Update
  424.   #--------------------------------------------------------------------------
  425.   def update
  426.       update_savefile_windows
  427.       update_savefile_selection
  428.       check_start_index
  429.   end
  430.   
  431.   #--------------------------------------------------------------------------
  432.   # ● check_start_index
  433.   #--------------------------------------------------------------------------
  434.   def check_start_index
  435.       return if @check_prev_index == false
  436.       @check_prev_index = false
  437.       check_active_window   
  438.   end  
  439.    
  440.   #--------------------------------------------------------------------------
  441.   # ● check_active_window   
  442.   #--------------------------------------------------------------------------
  443.   def check_active_window   
  444.       @index = 0 if @index == nil
  445.       for i in 0...@file_max  
  446.         @pw = @index - 1
  447.         @pw = 0 if @pw > @file_max - 1
  448.         @pw = @file_max- 1 if @pw < 0        
  449.         @aw = @index
  450.         @nw = @index + 1
  451.         @nw = 0 if @nw > @file_max - 1
  452.         @nw = @file_max - 1  if @nw < 0
  453.         case @savefile_windows[i].file_index
  454.            when @pw,@nw
  455.                 @savefile_windows[i].visible = true
  456.                 @savefile_windows[i].contents_opacity = 80
  457.            when @aw  
  458.                 @savefile_windows[i].visible = true
  459.                 @savefile_windows[i].contents_opacity = 255
  460.            else
  461.                 @savefile_windows[i].visible = false
  462.         end
  463.       end         
  464.   end
  465.    
  466.   #--------------------------------------------------------------------------
  467.   # ● Create Save File Window
  468.   #--------------------------------------------------------------------------
  469.   def create_savefile_windows
  470.     @pw_pos = [-160,32]
  471.     @aw_pos = [-96,160]
  472.     @nw_pos = [-32,288]      
  473.     @savefile_windows = []
  474.     for i in 0...@file_max
  475.         @savefile_windows[i] = Window_SaveFile_A.new(i, DataManager.make_filename(i))
  476.         @savefile_windows[i].z = 2
  477.         @savefile_windows[i].visible = false
  478.         @savefile_windows[i].x = 400
  479.     end
  480.     check_active_window
  481.     @item_max = @file_max
  482.   end
  483.   
  484.   #--------------------------------------------------------------------------
  485.   # ● Dispose of Save File Window
  486.   #--------------------------------------------------------------------------
  487.   def dispose_item_windows
  488.       for window in @savefile_windows
  489.           window.dispose
  490.       end
  491.   end
  492.   
  493.   #--------------------------------------------------------------------------
  494.   # ● Update Save File Window
  495.   #--------------------------------------------------------------------------
  496.   def update_savefile_windows
  497.       update_slide_window
  498.       for window in @savefile_windows
  499.         window.update
  500.       end
  501.   end
  502.   
  503.   #--------------------------------------------------------------------------
  504.   # ● update_slide_window
  505.   #--------------------------------------------------------------------------  
  506.   def update_slide_window
  507.       @background.ox += 1
  508.       slide_window_x(@pw,@pw_pos[0])
  509.       slide_window_x(@aw,@aw_pos[0])
  510.       slide_window_x(@nw,@nw_pos[0])
  511.       slide_window_y(@pw,@pw_pos[1])
  512.       slide_window_y(@aw,@aw_pos[1])
  513.       slide_window_y(@nw,@nw_pos[1])
  514.   end
  515.    
  516.   #--------------------------------------------------------------------------
  517.   # ● slide_window_x
  518.   #--------------------------------------------------------------------------   
  519.   def slide_window_x(i,x_pos)
  520.       if @savefile_windows[i].x < x_pos
  521.          @savefile_windows[i].x += 15
  522.          @savefile_windows[i].x = x_pos if @savefile_windows[i].x > x_pos
  523.       end  
  524.       if @savefile_windows[i].x > x_pos
  525.          @savefile_windows[i].x -= 15
  526.          @savefile_windows[i].x = x_pos if @savefile_windows[i].x < x_pos        
  527.        end            
  528.   end   
  529.      
  530.   #--------------------------------------------------------------------------
  531.   # ● slide_window_y
  532.   #--------------------------------------------------------------------------   
  533.   def slide_window_y(i,y_pos)
  534.       if @savefile_windows[i].y < y_pos
  535.          @savefile_windows[i].y += 15
  536.          @savefile_windows[i].y = y_pos if @savefile_windows[i].y > y_pos
  537.       end  
  538.       if @savefile_windows[i].y > y_pos
  539.          @savefile_windows[i].y -= 15
  540.          @savefile_windows[i].y = y_pos if @savefile_windows[i].y < y_pos        
  541.        end            
  542.   end   
  543.      
  544.   #--------------------------------------------------------------------------
  545.   # ● reset_position
  546.   #--------------------------------------------------------------------------     
  547.   def reset_position(diretion)
  548.       check_active_window      
  549.       case diretion
  550.          when 0
  551.             @savefile_windows[@pw].y = -64
  552.             @savefile_windows[@pw].x = 0
  553.          when 1  
  554.             @savefile_windows[@nw].y = 440
  555.             @savefile_windows[@nw].x = 0
  556.       end        
  557.   end
  558.    
  559.   #--------------------------------------------------------------------------
  560.   # ● Update Save File Selection
  561.   #--------------------------------------------------------------------------
  562.   def update_savefile_selection
  563.       if Input.trigger?(Input::C)
  564.          on_savefile_ok
  565.       elsif Input.trigger?(Input::B)
  566.          Sound.play_cancel
  567.          return_scene
  568.       else
  569.         last_index = @index
  570.         if Input.trigger?(Input::DOWN)
  571.            execute_index(1)
  572.            if @file_max > 2
  573.               reset_position(1)
  574.            else
  575.               reset_position(0)
  576.            end  
  577.         end
  578.         if Input.trigger?(Input::UP)
  579.            execute_index(-1)
  580.            reset_position(0)
  581.         end
  582.         if @index != last_index
  583.            Sound.play_cursor
  584.            @savefile_windows[last_index].selected = false
  585.            @savefile_windows[@index].selected = true
  586.         end      
  587.       end
  588.   end

  589.   #--------------------------------------------------------------------------
  590.   # ● Execute Index
  591.   #--------------------------------------------------------------------------  
  592.   def execute_index(value)
  593.       @index += value
  594.       @index = @index >= @file_max ? 0 : @index < 0 ? (@file_max - 1) : @index
  595.   end
  596.   
  597. end

  598. $mog_rgss3_scene_file = true
复制代码
最后一个是最开始发的那个
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-10-4 11:19

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表