查看: 1236|回复: 1

[已经解决] 游戏加密后脚本无法保存壁纸的Bug。

[复制链接]
梦石
0
星屑
8498
在线时间
775 小时
注册时间
2017-11-10
回帖
1074
发表于 2018-1-28 23:22:52 | 显示全部楼层 |阅读模式

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

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

×
这是老前辈们喜欢用的CG壁纸功能。
[pre lang="ruby"]#==============================================================================
#作者 :Moghunter
#脚本提供 :笵妮拉·亚修 (6R ID)
#功能增强 :萧叶藏刀 (6R ID)
#修改 : リデル  (百度 ID)(6R ID) 美丽晨露 (6R ID)
#==============================================================================
#使用方法:
#$gallery[ID] = true
#sav = Scene_Picture_Gallery.new
#sav.save
#储存文件在12,13,21行修改
if FileTest.exist?("gallery.rxdata")
  file = File.open("gallery.rxdata", "rb")
  $gallery = Marshal.load(file)
  file.close
else
  $gallery = []
end
class Scene_Picture_Gallery
  def save
    file = File.open("gallery.rxdata", "wb")
    Marshal.dump($gallery, file)
    file.close
  end
end
#==============================================================================
# +++ MOG XP - Picture Gallery (v1.0) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Sistema de galeria de imagens.
#==============================================================================
# Para ativar o script use o comando abaixo através de um evento usando o
# comando chamar script. (Call Script)
#
# $scene = Scene_Picture_Gallery.new
#
#==============================================================================
# Para disponibilizar as imagens na galeria você deverá usar o seguinte
# código através do comando chamar script.
#
# $game_system.gallery[ID] = true
#
# EX   $game_system.gallery[10] = true
#
#==============================================================================
# Você deverá criar uma pasta com o nome "Gallery" onde as imagens deverão
# ser gravadas.
#
# Graphics/Gallery/
#
# A nomeação das imagens devem ser numéricas. (ID da imagem)
# 0.jpg    (Imagem não disponível.)
# 1.jpg
# 2.jpg
# 3.jpg
# ...
#
# Prefira usar imagens com resoluções igual ou maior a 640x480 pixels.
#
#==============================================================================
module MOG_PICTURE_GALLERY
       #Quantidade maxima de imagens na galeria.
       MAX_PICTURES = 25
end  

#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
  
attr_accessor :gallery

#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------   
alias art_picture_initialize initialize
def initialize
      art_picture_initialize
      @gallery = []
end  
end

#==============================================================================
# ■ RPG
#==============================================================================
module RPG
  module Cache
    def self.gallery(filename)
        self.load_bitmap("Graphics/Gallery/", filename)
    end
  end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # Draw_Thumbnail
  #--------------------------------------------------------------------------  
  def draw_thumbnail(x,y,id)
      image = RPG::Cache.gallery(id.to_s) rescue nil
      return if image == nil
      cw = image.width
      ch = image.height
      src_rect = Rect.new(0, 0, cw , ch)
      src_rect2 = Rect.new(x, y, 150, 80)  
      self.contents.stretch_blt(src_rect2, image, src_rect)
  end
end  

#==============================================================================
# ■ Window_Picture
#==============================================================================
class Window_Picture < Window_Selectable
  
#------------------------------------------------------------------------------
# ● Initialize
#------------------------------------------------------------------------------   
  def initialize(page)
      super(0, 64, 640, 365)
      self.opacity = 0
      @column_max = 3
      @page = page
      @pic_max = MOG_PICTURE_GALLERY::MAX_PICTURES
      @pic_max = 1 if @pic_max <= 0
      @pag_max = @pic_max / 9
      if @pag_max == page
         o = @pag_max * 9
         o2 =  @pic_max - o
         @item_max = o2
      else
         @item_max = 9
       end  
      refresh(page)
      self.index = 0
      
  end

#------------------------------------------------------------------------------
# ● Refresh
#------------------------------------------------------------------------------   
  def refresh(page = 0)
      if self.contents != nil
         self.contents.dispose
         self.contents = nil
      end
      if @item_max > 0
         self.contents = Bitmap.new(width - 32, row_max * 110)
         for i in 0...@item_max
            draw_item(i,page)
         end
      end
  end
  
#------------------------------------------------------------------------------
# ● draw_item
#------------------------------------------------------------------------------   
  def draw_item(index,page)
      np = 9 * page
      picture_number = index + 1 + np
      x = 15 + index % 3 * 215
      y = 12 + index / 3 *110
      s = picture_number
      s = 0 if $gallery[picture_number] == nil
      draw_thumbnail(x,y,s)
      self.contents.draw_text(x + 45,y + 70, 64, 32, "图片 - " + picture_number.to_s,1)
  end
  
#------------------------------------------------------------------------------
# ● update_cursor_rect
#------------------------------------------------------------------------------   
  def update_cursor_rect
      if @index < 0
         self.cursor_rect.empty
         return
      end
      row = @index / @column_max
      if row < self.top_row
         self.top_row = row
      end
      if row > self.top_row + (self.page_row_max - 1)
         self.top_row = row - (self.page_row_max - 1)
      end
      cursor_width = self.width / @column_max - 32
      x = index % 3 * 215
      y = index / 3 *110
      self.cursor_rect.set(x, y, cursor_width, 105)
  end   
end
#-----------------------------------------------------------------------------
#   DLL(修改)这个我不知道有没有更简单的
#-----------------------------------------------------------------------------
$copyfile = Win32API.new("kernel32","CopyFile","ppl","l")
#-----------------------------------------------------------------------------

#==============================================================================
# ■ Scene_ArtPictures
#==============================================================================
class Scene_Picture_Gallery
include MOG_PICTURE_GALLERY
  
#------------------------------------------------------------------------------
# ● Main
#------------------------------------------------------------------------------     
def main
     setup
     create_background
     create_window
     create_image
     create_cursor
     create_button
     #修改#
     @command_window = Window_Command.new(160, ["   保存壁纸","     取消"])
     @command_window.back_opacity = 160
     @command_window.x = 480
     @command_window.y = 384
     @command_window.active = false
     @command_window.visible  = false
     #####
     execute_loop
     execute_dispose
end

#------------------------------------------------------------------------------
# ● Setup
#------------------------------------------------------------------------------      
def setup
     @max_pictures = MAX_PICTURES
     @max_pictures = 1 if @max_pictures <= 0
     v = (@max_pictures / 9)
     v2 = (v - 1) * 9
     v3 = (@max_pictures - v2) - 9
     if v3 != 0
        @max_pages = (@max_pictures / 9) + 1
     else
        @max_pages = (@max_pictures / 9)
     end  
     @max_pages = 1 if @max_pages == 0
     @aw_center = 0
     @aw_left = 0
     @aw_right = 0
     @slide_type = 0
     @page_old = 0
     @picture_id = 0
     @image_active = false
     @old_index = 0
     @picures_enabled = 0
     @comp = 0
     @ex = 0
     @ey = 0
     @ex_max = 0
     @ey_max = 0
     @ex_max_zoom = 0
     @ey_max_zoom = 0
     for i in 0..MAX_PICTURES
         @picures_enabled += 1 if $gallery
     end  
end  
   
#------------------------------------------------------------------------------
# ● create_background
#------------------------------------------------------------------------------        
def create_background
     @background = Sprite.new
     @background.bitmap = RPG::Cache.gallery("Background")  
     @background.z = 0
     @background2 = Plane.new
     @background2.bitmap = RPG::Cache.gallery("Background2")      
     @background2.z = -1
end

#------------------------------------------------------------------------------
# ● Create Window
#------------------------------------------------------------------------------      
def create_window
     @info = Window_Help.new
     @info.y = 416
     @info.opacity = 0
     @wp_page = 0
     @wp_page_old = @wp_page
     @wp_index = 0
     @wp =[]
     for i in 0...@max_pages
         @wp = Window_Picture.new(i)
         @wp.x = 32 * i
     end  
     check_active_window(true)
     refresh_info_window(true)
end

#------------------------------------------------------------------------------
# ● Create_image
#------------------------------------------------------------------------------        
def create_image
     @picture = Sprite.new
     @picture.bitmap = RPG::Cache.gallery("")
     @picture.z = 100
     @picture.opacity = 0
end

#------------------------------------------------------------------------------
# ● Check Active Window
#------------------------------------------------------------------------------      
def check_active_window(starting = false)
     for i in 0...@max_pages
        if i == @wp_page
            @wp[@wp_page].active = true
            @wp[@wp_page].visible = true
            if @slide_type == 0   
               @wp[@wp_page].x = 640
            else
               @wp[@wp_page].x = -640
            end   
         elsif i == @page_old  and starting == false
            @wp[@page_old].active = false
            @wp[@page_old].visible = true
            @wp[@page_old].visible = false if starting
            @wp[@page_old].x = 0     
         else   
            @wp.active = false
            @wp.visible = false
         end   
     end  
end

#------------------------------------------------------------------------------
# ● Create Button
#------------------------------------------------------------------------------      
def create_button
     @button_image = RPG::Cache.gallery("Button")
     @button_bitmap =  Bitmap.new(@button_image.width, @button_image.height)
     @cw = @button_image.width
     @ch = @button_image.height / 2
     src_rect = Rect.new(0, 0, @cw, @ch)
     @button_bitmap .blt(0,0, @button_image, src_rect)           
     @button = Sprite.new
     @button.bitmap = @button_bitmap
     @button.y = 443
     @button.z = 250
     @button.opacity = 0
     @button_fade_time = 0
end

#------------------------------------------------------------------------------
# ● Create Cursor
#------------------------------------------------------------------------------      
def create_cursor
     @cx1 = 0
     @cx2 = 0
     @cursor_speed = 0
     image = RPG::Cache.gallery("Cursor")
     @bitmap = Bitmap.new(image.width, image.height)
     cw = image.width / 2
     ch = image.height
     src_rect = Rect.new(cw, 0, cw, ch)
     @bitmap.blt(0,0, image, src_rect)     
     @cursor1 = Sprite.new
     @cursor1.bitmap = @bitmap
     @cursor1.x = 0 + @cx1
     @cursor1.y = 220
     @cursor1.z = 200
     @bitmap2 = Bitmap.new(image.width, image.height)
     src_rect2 = Rect.new(0, 0, cw, ch)
     @bitmap2.blt(0,0, image, src_rect2)         
     @cursor2 = Sprite.new
     @cursor2.bitmap = @bitmap2
     @cursor2.x = 610 + @cx2
     @cursor2.y = 220
     @cursor2.z = 200
     image.dispose
     if @max_pages == 1
        @cursor1.visible = false
        @cursor2.visible = false
     end   
end

#------------------------------------------------------------------------------
# ● Execute Loop
#------------------------------------------------------------------------------     
def execute_loop
     Graphics.transition
     loop do
          Graphics.update
          Input.update
          update
          if $scene != self
              break
          end
     end
end

#------------------------------------------------------------------------------
# ● Execute Dispose
#------------------------------------------------------------------------------      
def execute_dispose
     Graphics.freeze
     for i in 0...@max_pages
         @wp.dispose
     end   
     @info.dispose
     if @picture.bitmap != nil
        @picture.bitmap.dispose
     end
     @picture.dispose
     @background.bitmap.dispose
     @background.dispose
     @background2.bitmap.dispose
     @background2.dispose     
     @bitmap.dispose
     @bitmap2.dispose
     @cursor1.bitmap.dispose
     @cursor1.dispose     
     @cursor2.bitmap.dispose
     @cursor2.dispose
     @button_bitmap.dispose
     @button.bitmap.dispose
     @button.dispose
     @button_image.dispose
end

#------------------------------------------------------------------------------
# ● Update
#------------------------------------------------------------------------------      
def update
     @wp[@wp_page].update
     @info.update
  #   if @image_active  
  #      update_command_image
  #   else   
  #      update_command
  #   end   
  #修改#
     if @command_window.visible
      @command_window.update
      if Input.trigger?(Input::C)
        if @command_window.index == 0
        $game_system.se_play($data_system.decision_se)
        $copyfile.call("Graphics/Gallery/#{@picture_id}.png","Gallery/#{@picture_id}.png",1)
        @command_window.active = false
        @command_window.visible = false
        end
        if @command_window.index == 1
        @command_window.active = false
        @command_window.visible = false
        $game_system.se_play($data_system.cancel_se)
        end
      end
      if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
        @command_window.active = false
        @command_window.visible = false
      end        
    elsif @image_active  
        update_command_image
     else   
        update_command
      end
      #####
     update_slide
     update_image_effect
     update_cursor_animation
     refresh_info_window
end  
  
#------------------------------------------------------------------------------
# ● update_cursor_animation
#------------------------------------------------------------------------------        
def update_cursor_animation
     @cursor_speed += 1
     case @cursor_speed
        when 1..20
           @cx1 += 1
           @cx2 -= 1
        when 21..40
           @cx1 -= 1
           @cx2 += 1         
        else  
        @cursor_speed = 0
        @cx1 = 0
        @cx2 = 0
     end
     @cursor1.x = 0 + @cx1
     @cursor2.x = 610 + @cx2
end
   
#------------------------------------------------------------------------------
# ● Update Image Effect
#------------------------------------------------------------------------------      
def update_image_effect
     return if @wp[@wp_page].x != 0
     @button_fade_time -= 1 if @button_fade_time > 0
     if @image_active
        @picture.opacity += 25
        if @button_fade_time != 0
           @button.opacity += 10
        else   
           if @button.y < 640   
              @button.opacity -= 15
              @button.y += 1
           end   
        end  
        @wp[@wp_page].contents_opacity -= 25
        @info.contents_opacity -= 25
        @background.opacity -= 25
        @cursor1.opacity -= 25
        @cursor2.opacity -= 25
     else  
        @picture.opacity -= 10
        @button.opacity -= 25
        @wp[@wp_page].contents_opacity += 25
        @info.contents_opacity += 25
        @background.opacity += 25
        @cursor1.opacity += 25
        @cursor2.opacity += 25        
     end  
end

#------------------------------------------------------------------------------
# ● Refresh Info Window
#------------------------------------------------------------------------------      
def refresh_info_window(starting = false)
     return if @image_active
     return if @wp_page_old == @wp_page and starting == false   
     @wp_page_old = @wp_page
     page = @wp_page + 1
     @picture_id = (9 * @wp_page) + @wp[@wp_page].index  + 1
     p_pages = "页数:" + page.to_s + " / " + @max_pages.to_s
     comp  = "    完成率:" + (@picures_enabled.to_f / @max_pictures.to_f * 100).truncate.to_s + " %"
     p_number = "     图片数: " + @picures_enabled.to_s + "  /  " + @max_pictures.to_s
     @info.set_text("            " + p_pages + comp + p_number)
end   

#------------------------------------------------------------------------------
# ● Update Slide
#------------------------------------------------------------------------------      
def update_slide
     @background2.ox += 1
     return if @wp[@wp_page].x == 0  
     slide_speed = 35
     @picture.opacity = 0
     @background.opacity = 255
     if @slide_type == 1     
        if @wp[@wp_page].x < 0
           @wp[@wp_page].x += slide_speed
           if @wp[@wp_page].x >= 0
              @wp[@wp_page].x = 0
           end
         end
        if @wp[@page_old].x < 640
           @wp[@page_old].x += slide_speed
           if @wp[@page_old].x >= 640
              @wp[@page_old].x = 640
           end
         end         
       else     
         if @wp[@wp_page].x > 0
            @wp[@wp_page].x -= slide_speed
            if @wp[@wp_page].x <= 0  
               @wp[@wp_page].x = 0
            end   
         end
         if @wp[@page_old].x > -640
            @wp[@page_old].x -= slide_speed
            if @wp[@page_old].x <= -640
               @wp[@page_old].x = -640
            end
         end           
       end
       if @slide_type == 0   
          @wp[@wp_page].x = 0 if @wp[@wp_page].x <= 0  
       else
           @wp[@wp_page].x = 0 if @wp[@wp_page].x >= 0
       end  
end

#------------------------------------------------------------------------------
# ● Check_limite
#------------------------------------------------------------------------------        
def check_limit
     if @wp_page < 0
        @wp_page = @max_pages - 1
     elsif @wp_page >= @max_pages   
        @wp_page = 0   
     end
     check_active_window
end  

#------------------------------------------------------------------------------
# ● Update Command Image
#------------------------------------------------------------------------------        
def update_command_image
    # if Input.trigger?(Input::B) or Input.trigger?(Input::C)
    #    $game_system.se_play($data_system.cursor_se)
    #    @image_active = false
    #    @wp[@wp_page].active = true
    #    return
    # end
     #修改#
     if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cursor_se)
        @image_active = false
        @wp[@wp_page].active = true
        return
      end
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se)
       @command_window.active = true
       @command_window.visible  = true
       return
     end
     #####
     if Input.trigger?(Input::R) or Input.trigger?(Input::L)
        $game_system.se_play($data_system.cursor_se)
        execute_zoom      
     end  
     if Input.press?(Input::RIGHT)
        @ex += 6
     elsif Input.press?(Input::LEFT)
        @ex -= 6
     elsif Input.press?(Input::DOWN)
        @ey += 6
     elsif Input.press?(Input::UP)   
        @ey -= 6
     end  
     @ex = @ex_max + @ex_max_zoom if @ex > @ex_max + @ex_max_zoom
     @ex = 0 if @ex < 0
     @ey = @ey_max + @ey_max_zoom if @ey > @ey_max + @ey_max_zoom
     @ey = 0 if @ey < 0        
     @picture.x = -@ex
     @picture.y = -@ey
end  

#------------------------------------------------------------------------------
# ● Execute Zoom
#------------------------------------------------------------------------------         
def execute_zoom
     if @picture.zoom_x == 1.0
        @picture.zoom_x = 1.5
        @picture.zoom_y = 1.5
        refresh_button(1)
        @ex_max_zoom = (@picture.bitmap.width / 2)
        if @ex != @ex_max
           @ex += @ex_max_zoom / 2         
        else   
           if @ex_max != 0   
              @ex += @ex_max_zoom
           else   
              @ex += @ex_max_zoom / 2
           end  
        end  
        @ey_max_zoom = (@picture.bitmap.height / 2)
        if @ey != @ey_max
           @ey += @ey_max_zoom / 2         
        else   
           if @ey_max != 0   
              @ey += @ey_max_zoom
           else   
              @ey += @ey_max_zoom / 2
           end  
         end  
      else
        if @picture.bitmap.width > 640 or
           @picture.bitmap.height > 480
           refresh_button(1)
        else
           refresh_button(0)
        end           
        @ex -= @ex_max_zoom / 2
        @ey -= @ey_max_zoom / 2           
        @picture.zoom_x = 1.0
        @picture.zoom_y = 1.0   
        @ex_max_zoom = 0
        @ey_max_zoom = 0
     end     
end  

#------------------------------------------------------------------------------
# ● check_avaliable_picture?
#------------------------------------------------------------------------------        
def check_avaliable_picture?
     @picture_id = (9 * @wp_page) + @wp[@wp_page].index  + 1
     return false if $gallery[@picture_id] == nil
     return true
end  

#------------------------------------------------------------------------------
# ● create_bitmap
#------------------------------------------------------------------------------        
def create_bitmap
     @picture.opacity = 0
     @picture.bitmap.dispose
     @picture.bitmap = RPG::Cache.gallery(@picture_id.to_s) rescue nil
     @ex = 0
     @ey = 0
     @ex_max_zoom = 0
     @ey_max_zoom = 0
     @picture.zoom_x = 1.0
     @picture.zoom_y = 1.0      
     if @picture.bitmap == nil
        @picture.bitmap = RPG::Cache.gallery("")
        refresh_button(0)
        return
     end  
     if @picture.bitmap.width > 640
        @ex_max = @picture.bitmap.width - 640
     else
        @ex_max = 0
     end
     if @picture.bitmap.height > 480
        @ey_max = @picture.bitmap.height - 480  
     else
        @ey_max = 0
     end   
     if @picture.bitmap.width > 640 or
        @picture.bitmap.height > 480
        refresh_button(1)
     else
        refresh_button(0)
     end
end  

#------------------------------------------------------------------------------
# ● Refresh Button
#------------------------------------------------------------------------------        
def refresh_button(type = 0)
     @button.bitmap.clear
     if type == 0
        src_rect = Rect.new(0, 0, @cw, @ch)
     else
        src_rect = Rect.new(0, @ch, @cw, @ch)
     end  
     @button_bitmap .blt(0,0, @button_image, src_rect)  
     @button.y = 443
     @button_fade_time = 120
     @button.opacity = 0 unless @button.y == 443
end   

#------------------------------------------------------------------------------
# ● Update Command
#------------------------------------------------------------------------------      
def update_command
     return if @wp[@wp_page].x != 0
     if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cursor_se)
        save
        $scene = Scene_Title.new
        #$game_system.bgm_play($data_system.title_bgm)
        return
     end
     if Input.trigger?(Input::C)
        if check_avaliable_picture?
           $game_system.se_play($data_system.decision_se)
           @image_active = true
           @wp[@wp_page].active = false
           create_bitmap
        else
          $game_system.se_play($data_system.buzzer_se)
        end
        return
     end  
     if Input.trigger?(Input::L) and @max_pages != 1
        $game_system.se_play($data_system.cursor_se)
        @page_old = @wp_page
        @wp_page -= 1
        @slide_type = 1
        check_limit
        return
     elsif Input.trigger?(Input::R) and @max_pages != 1   
        $game_system.se_play($data_system.cursor_se)
        @page_old = @wp_page
        @wp_page += 1
        @slide_type = 0
        check_limit
        return
     end  
end  
end  

$mog_xp_picture_gallery = true[/pre]
里面有一项保存壁纸的功能。
但是用默认加密功能之后,该功能会失效。
请问这个问题该怎么样解决呢?

附上范例:
壁纸(强化更改).zip (1.15 MB, 下载次数: 50)
一个只会简单事件的Rm新人,脚本完全不懂。只求做个简单的游戏完成自己的游戏之梦而已。
第一个游戏已经完成,等待各素材的完成和测试。

老黄鸡

梦石
4
星屑
45700
在线时间
7948 小时
注册时间
2009-7-6
回帖
13338

MZ评测员RM创作大赛01组委会开拓者贵宾

发表于 2018-1-28 23:32:35 | 显示全部楼层
用copyfile肯定是不行的,加密之后得从内存里导出图片,下面脚本整合了@SixRC 的bitmap->png简版和楼主的脚本
替换原有的MOG - Picture Gallery脚本页即可

[fold=点我打开]

  1. class Bitmap
  2.   #-------------------------------------------------------------------#
  3.   #借鉴dant所成
  4.   #当然 我也努力了 —_—||
  5.   #不 是很努力呢                         -By SixRC
  6.   #-------------------------------------------------------------------#
  7.   #用法为  bitmap.ToPng(filename)
  8.   #假如很追求速度的话 下面的第34行改成
  9.   #data2 = Zlib::Deflate.deflate(@bit_data,1)
  10.   #这样压缩速度会提高(约快一倍) 虽然文件会变大 那个数值可以是1-9 0是不压缩 但不骗你 很慢 因为 写入慢了
  11.   #-------------------------------------------------------------------#
  12.   #--------------------------获取数据头地址---------------
  13.   CWP = Win32API.new('user32.dll','CallWindowProc','ppiii','i')
  14.   GetAddr=[139,116,36,8,139,54,139,118,8,139,118,16,139,124,36,4,137,55,194,16,0].pack("C*")
  15.   def addr
  16.     s="\0"*4
  17.     CWP.call(GetAddr,s,object_id*2+16,0,0)
  18.     s.unpack("L")[0]
  19.   end
  20.   #--------------------------保存为png--------------------
  21.   D1="\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x0\x0\x0\xdIHDR"
  22.   D2="\x8\x6\x0\x0\x0"
  23.   D3="\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82"
  24.   GetData=[85,137,229,139,125,8,49,210,139,101,20,137,227,68,139,69,16,137,198,193,230,3,193,224,2,15,175,224,139,69,12,1,196,139,77,16,66,41,244,88,15,200,193,200,8,137,4,23,141,82,4,73,117,241,75,117,232,137,236,93,194,16,0].pack("C*")
  25.   def ToPng(pl)
  26.     unless @kg
  27.       @addr=addr
  28.       @kg=[width].pack("N")+[height].pack("N")
  29.       c1="IHDR"+@kg+D2
  30.       @crc1=[Zlib.crc32(c1)].pack("N")
  31.       @bit_data="\0"*height*(width*4+1)
  32.     end
  33.     CWP.call(GetData,@bit_data,@addr,width,height)
  34.     data2 = Zlib::Deflate.deflate(@bit_data)
  35.     crc2=[Zlib.crc32("IDAT"+data2)].pack("N")
  36.     sod=[data2.length].pack("N")
  37.     File.open(pl,"w+b"){|i|i.write(D1+@kg+D2+@crc1+sod+"IDAT"+data2+crc2+D3)}
  38.   end
  39. end


  40. #==============================================================================
  41. #作者 :Moghunter
  42. #脚本提供 :笵妮拉·亚修 (6R ID)
  43. #功能增强 :萧叶藏刀 (6R ID)
  44. #修改 : リデル  (百度 ID)(6R ID) 美丽晨露 (6R ID)
  45. #==============================================================================
  46. #使用方法:
  47. #$gallery[ID] = true
  48. #sav = Scene_Picture_Gallery.new
  49. #sav.save
  50. #储存文件在12,13,21行修改
  51. if FileTest.exist?("gallery.rxdata")
  52.   file = File.open("gallery.rxdata", "rb")
  53.   $gallery = Marshal.load(file)
  54.   file.close
  55. else
  56.   $gallery = []
  57. end
  58. class Scene_Picture_Gallery
  59.   def save
  60.     file = File.open("gallery.rxdata", "wb")
  61.     Marshal.dump($gallery, file)
  62.     file.close
  63.   end
  64. end
  65. #==============================================================================
  66. # +++ MOG XP - Picture Gallery (v1.0) +++
  67. #==============================================================================
  68. # By Moghunter
  69. # http://www.atelier-rgss.com/
  70. #==============================================================================
  71. # Sistema de galeria de imagens.
  72. #==============================================================================
  73. # Para ativar o script use o comando abaixo através de um evento usando o
  74. # comando chamar script. (Call Script)
  75. #
  76. # $scene = Scene_Picture_Gallery.new
  77. #
  78. #==============================================================================
  79. # Para disponibilizar as imagens na galeria você deverá usar o seguinte
  80. # código através do comando chamar script.
  81. #
  82. # $game_system.gallery[ID] = true
  83. #
  84. # EX   $game_system.gallery[10] = true
  85. #
  86. #==============================================================================
  87. # Você deverá criar uma pasta com o nome "Gallery" onde as imagens deverão
  88. # ser gravadas.
  89. #
  90. # Graphics/Gallery/
  91. #
  92. # A nomeação das imagens devem ser numéricas. (ID da imagem)
  93. # 0.jpg    (Imagem não disponível.)
  94. # 1.jpg
  95. # 2.jpg
  96. # 3.jpg
  97. # ...
  98. #
  99. # Prefira usar imagens com resoluções igual ou maior a 640x480 pixels.
  100. #
  101. #==============================================================================
  102. module MOG_PICTURE_GALLERY
  103.        #Quantidade maxima de imagens na galeria.
  104.        MAX_PICTURES = 25
  105. end  

  106. #==============================================================================
  107. # ■ Game_System
  108. #==============================================================================
  109. class Game_System
  110.   
  111. attr_accessor :gallery

  112. #------------------------------------------------------------------------------
  113. # ● Initialize
  114. #------------------------------------------------------------------------------   
  115. alias art_picture_initialize initialize
  116. def initialize
  117.       art_picture_initialize
  118.       @gallery = []
  119. end  
  120. end

  121. #==============================================================================
  122. # ■ RPG
  123. #==============================================================================
  124. module RPG
  125.   module Cache
  126.     def self.gallery(filename)
  127.         self.load_bitmap("Graphics/Gallery/", filename)
  128.     end
  129.   end
  130. end
  131. #==============================================================================
  132. # ■ Window_Base
  133. #==============================================================================
  134. class Window_Base < Window
  135.   #--------------------------------------------------------------------------
  136.   # Draw_Thumbnail
  137.   #--------------------------------------------------------------------------  
  138.   def draw_thumbnail(x,y,id)
  139.       image = RPG::Cache.gallery(id.to_s) rescue nil
  140.       return if image == nil
  141.       cw = image.width
  142.       ch = image.height
  143.       src_rect = Rect.new(0, 0, cw , ch)
  144.       src_rect2 = Rect.new(x, y, 150, 80)  
  145.       self.contents.stretch_blt(src_rect2, image, src_rect)
  146.   end
  147. end  

  148. #==============================================================================
  149. # ■ Window_Picture
  150. #==============================================================================
  151. class Window_Picture < Window_Selectable
  152.   
  153. #------------------------------------------------------------------------------
  154. # ● Initialize
  155. #------------------------------------------------------------------------------   
  156.   def initialize(page)
  157.       super(0, 64, 640, 365)
  158.       self.opacity = 0
  159.       @column_max = 3
  160.       @page = page
  161.       @pic_max = MOG_PICTURE_GALLERY::MAX_PICTURES
  162.       @pic_max = 1 if @pic_max <= 0
  163.       @pag_max = @pic_max / 9
  164.       if @pag_max == page
  165.          o = @pag_max * 9
  166.          o2 =  @pic_max - o
  167.          @item_max = o2
  168.       else
  169.          @item_max = 9
  170.        end  
  171.       refresh(page)
  172.       self.index = 0
  173.       
  174.   end

  175. #------------------------------------------------------------------------------
  176. # ● Refresh
  177. #------------------------------------------------------------------------------   
  178.   def refresh(page = 0)
  179.       if self.contents != nil
  180.          self.contents.dispose
  181.          self.contents = nil
  182.       end
  183.       if @item_max > 0
  184.          self.contents = Bitmap.new(width - 32, row_max * 110)
  185.          for i in 0...@item_max
  186.             draw_item(i,page)
  187.          end
  188.       end
  189.   end
  190.   
  191. #------------------------------------------------------------------------------
  192. # ● draw_item
  193. #------------------------------------------------------------------------------   
  194.   def draw_item(index,page)
  195.       np = 9 * page
  196.       picture_number = index + 1 + np
  197.       x = 15 + index % 3 * 215
  198.       y = 12 + index / 3 *110
  199.       s = picture_number
  200.       s = 0 if $gallery[picture_number] == nil
  201.       draw_thumbnail(x,y,s)
  202.       self.contents.draw_text(x + 45,y + 70, 64, 32, "图片 - " + picture_number.to_s,1)
  203.   end
  204.   
  205. #------------------------------------------------------------------------------
  206. # ● update_cursor_rect
  207. #------------------------------------------------------------------------------   
  208.   def update_cursor_rect
  209.       if @index < 0
  210.          self.cursor_rect.empty
  211.          return
  212.       end
  213.       row = @index / @column_max
  214.       if row < self.top_row
  215.          self.top_row = row
  216.       end
  217.       if row > self.top_row + (self.page_row_max - 1)
  218.          self.top_row = row - (self.page_row_max - 1)
  219.       end
  220.       cursor_width = self.width / @column_max - 32
  221.       x = index % 3 * 215
  222.       y = index / 3 *110
  223.       self.cursor_rect.set(x, y, cursor_width, 105)
  224.   end   
  225. end
  226. #-----------------------------------------------------------------------------

  227. #==============================================================================
  228. # ■ Scene_ArtPictures
  229. #==============================================================================
  230. class Scene_Picture_Gallery
  231. include MOG_PICTURE_GALLERY
  232.   
  233. #------------------------------------------------------------------------------
  234. # ● Main
  235. #------------------------------------------------------------------------------     
  236. def main
  237.      setup
  238.      create_background
  239.      create_window
  240.      create_image
  241.      create_cursor
  242.      create_button
  243.      #修改#
  244.      @command_window = Window_Command.new(160, ["   保存壁纸","     取消"])
  245.      @command_window.back_opacity = 160
  246.      @command_window.x = 480
  247.      @command_window.y = 384
  248.      @command_window.active = false
  249.      @command_window.visible  = false
  250.      #####
  251.      execute_loop
  252.      execute_dispose
  253. end

  254. #------------------------------------------------------------------------------
  255. # ● Setup
  256. #------------------------------------------------------------------------------      
  257. def setup
  258.      @max_pictures = MAX_PICTURES
  259.      @max_pictures = 1 if @max_pictures <= 0
  260.      v = (@max_pictures / 9)
  261.      v2 = (v - 1) * 9
  262.      v3 = (@max_pictures - v2) - 9
  263.      if v3 != 0
  264.         @max_pages = (@max_pictures / 9) + 1
  265.      else
  266.         @max_pages = (@max_pictures / 9)
  267.      end  
  268.      @max_pages = 1 if @max_pages == 0
  269.      @aw_center = 0
  270.      @aw_left = 0
  271.      @aw_right = 0
  272.      @slide_type = 0
  273.      @page_old = 0
  274.      @picture_id = 0
  275.      @image_active = false
  276.      @old_index = 0
  277.      @picures_enabled = 0
  278.      @comp = 0
  279.      @ex = 0
  280.      @ey = 0
  281.      @ex_max = 0
  282.      @ey_max = 0
  283.      @ex_max_zoom = 0
  284.      @ey_max_zoom = 0
  285.      for i in 0..MAX_PICTURES
  286.          @picures_enabled += 1 if $gallery[i]
  287.      end  
  288. end  
  289.    
  290. #------------------------------------------------------------------------------
  291. # ● create_background
  292. #------------------------------------------------------------------------------        
  293. def create_background
  294.      @background = Sprite.new
  295.      @background.bitmap = RPG::Cache.gallery("Background")  
  296.      @background.z = 0
  297.      @background2 = Plane.new
  298.      @background2.bitmap = RPG::Cache.gallery("Background2")      
  299.      @background2.z = -1
  300. end

  301. #------------------------------------------------------------------------------
  302. # ● Create Window
  303. #------------------------------------------------------------------------------      
  304. def create_window
  305.      @info = Window_Help.new
  306.      @info.y = 416
  307.      @info.opacity = 0
  308.      @wp_page = 0
  309.      @wp_page_old = @wp_page
  310.      @wp_index = 0
  311.      @wp =[]
  312.      for i in 0...@max_pages
  313.          @wp[i] = Window_Picture.new(i)
  314.          @wp[i].x = 32 * i
  315.      end  
  316.      check_active_window(true)
  317.      refresh_info_window(true)
  318. end

  319. #------------------------------------------------------------------------------
  320. # ● Create_image
  321. #------------------------------------------------------------------------------        
  322. def create_image
  323.      @picture = Sprite.new
  324.      @picture.bitmap = RPG::Cache.gallery("")
  325.      @picture.z = 100
  326.      @picture.opacity = 0
  327. end

  328. #------------------------------------------------------------------------------
  329. # ● Check Active Window
  330. #------------------------------------------------------------------------------      
  331. def check_active_window(starting = false)
  332.      for i in 0...@max_pages
  333.         if i == @wp_page
  334.             @wp[@wp_page].active = true
  335.             @wp[@wp_page].visible = true
  336.             if @slide_type == 0   
  337.                @wp[@wp_page].x = 640
  338.             else
  339.                @wp[@wp_page].x = -640
  340.             end   
  341.          elsif i == @page_old  and starting == false
  342.             @wp[@page_old].active = false
  343.             @wp[@page_old].visible = true
  344.             @wp[@page_old].visible = false if starting
  345.             @wp[@page_old].x = 0     
  346.          else   
  347.             @wp[i].active = false
  348.             @wp[i].visible = false
  349.          end   
  350.      end  
  351. end

  352. #------------------------------------------------------------------------------
  353. # ● Create Button
  354. #------------------------------------------------------------------------------      
  355. def create_button
  356.      @button_image = RPG::Cache.gallery("Button")
  357.      @button_bitmap =  Bitmap.new(@button_image.width, @button_image.height)
  358.      @cw = @button_image.width
  359.      @ch = @button_image.height / 2
  360.      src_rect = Rect.new(0, 0, @cw, @ch)
  361.      @button_bitmap .blt(0,0, @button_image, src_rect)           
  362.      @button = Sprite.new
  363.      @button.bitmap = @button_bitmap
  364.      @button.y = 443
  365.      @button.z = 250
  366.      @button.opacity = 0
  367.      @button_fade_time = 0
  368. end

  369. #------------------------------------------------------------------------------
  370. # ● Create Cursor
  371. #------------------------------------------------------------------------------      
  372. def create_cursor
  373.      @cx1 = 0
  374.      @cx2 = 0
  375.      @cursor_speed = 0
  376.      image = RPG::Cache.gallery("Cursor")
  377.      @bitmap = Bitmap.new(image.width, image.height)
  378.      cw = image.width / 2
  379.      ch = image.height
  380.      src_rect = Rect.new(cw, 0, cw, ch)
  381.      @bitmap.blt(0,0, image, src_rect)     
  382.      @cursor1 = Sprite.new
  383.      @cursor1.bitmap = @bitmap
  384.      @cursor1.x = 0 + @cx1
  385.      @cursor1.y = 220
  386.      @cursor1.z = 200
  387.      @bitmap2 = Bitmap.new(image.width, image.height)
  388.      src_rect2 = Rect.new(0, 0, cw, ch)
  389.      @bitmap2.blt(0,0, image, src_rect2)         
  390.      @cursor2 = Sprite.new
  391.      @cursor2.bitmap = @bitmap2
  392.      @cursor2.x = 610 + @cx2
  393.      @cursor2.y = 220
  394.      @cursor2.z = 200
  395.      image.dispose
  396.      if @max_pages == 1
  397.         @cursor1.visible = false
  398.         @cursor2.visible = false
  399.      end   
  400. end

  401. #------------------------------------------------------------------------------
  402. # ● Execute Loop
  403. #------------------------------------------------------------------------------     
  404. def execute_loop
  405.      Graphics.transition
  406.      loop do
  407.           Graphics.update
  408.           Input.update
  409.           update
  410.           if $scene != self
  411.               break
  412.           end
  413.      end
  414. end

  415. #------------------------------------------------------------------------------
  416. # ● Execute Dispose
  417. #------------------------------------------------------------------------------      
  418. def execute_dispose
  419.      Graphics.freeze
  420.      for i in 0...@max_pages
  421.          @wp[i].dispose
  422.      end   
  423.      @info.dispose
  424.      if @picture.bitmap != nil
  425.         @picture.bitmap.dispose
  426.      end
  427.      @picture.dispose
  428.      @background.bitmap.dispose
  429.      @background.dispose
  430.      @background2.bitmap.dispose
  431.      @background2.dispose     
  432.      @bitmap.dispose
  433.      @bitmap2.dispose
  434.      @cursor1.bitmap.dispose
  435.      @cursor1.dispose     
  436.      @cursor2.bitmap.dispose
  437.      @cursor2.dispose
  438.      @button_bitmap.dispose
  439.      @button.bitmap.dispose
  440.      @button.dispose
  441.      @button_image.dispose
  442. end

  443. #------------------------------------------------------------------------------
  444. # ● Update
  445. #------------------------------------------------------------------------------      
  446. def update
  447.      @wp[@wp_page].update
  448.      @info.update
  449.   #   if @image_active  
  450.   #      update_command_image
  451.   #   else   
  452.   #      update_command
  453.   #   end   
  454.   #修改#
  455.      if @command_window.visible
  456.       @command_window.update
  457.       if Input.trigger?(Input::C)
  458.         if @command_window.index == 0
  459.         $game_system.se_play($data_system.decision_se)
  460.         @picture.bitmap.ToPng("Gallery/#{@picture_id}.png")
  461.         @command_window.active = false
  462.         @command_window.visible = false
  463.         end
  464.         if @command_window.index == 1
  465.         @command_window.active = false
  466.         @command_window.visible = false
  467.         $game_system.se_play($data_system.cancel_se)
  468.         end
  469.       end
  470.       if Input.trigger?(Input::B)
  471.         $game_system.se_play($data_system.cancel_se)
  472.         @command_window.active = false
  473.         @command_window.visible = false
  474.       end        
  475.     elsif @image_active  
  476.         update_command_image
  477.      else   
  478.         update_command
  479.       end
  480.       #####
  481.      update_slide
  482.      update_image_effect
  483.      update_cursor_animation
  484.      refresh_info_window
  485. end  
  486.   
  487. #------------------------------------------------------------------------------
  488. # ● update_cursor_animation
  489. #------------------------------------------------------------------------------        
  490. def update_cursor_animation
  491.      @cursor_speed += 1
  492.      case @cursor_speed
  493.         when 1..20
  494.            @cx1 += 1
  495.            @cx2 -= 1
  496.         when 21..40
  497.            @cx1 -= 1
  498.            @cx2 += 1         
  499.         else  
  500.         @cursor_speed = 0
  501.         @cx1 = 0
  502.         @cx2 = 0
  503.      end
  504.      @cursor1.x = 0 + @cx1
  505.      @cursor2.x = 610 + @cx2
  506. end
  507.    
  508. #------------------------------------------------------------------------------
  509. # ● Update Image Effect
  510. #------------------------------------------------------------------------------      
  511. def update_image_effect
  512.      return if @wp[@wp_page].x != 0
  513.      @button_fade_time -= 1 if @button_fade_time > 0
  514.      if @image_active
  515.         @picture.opacity += 25
  516.         if @button_fade_time != 0
  517.            @button.opacity += 10
  518.         else   
  519.            if @button.y < 640   
  520.               @button.opacity -= 15
  521.               @button.y += 1
  522.            end   
  523.         end  
  524.         @wp[@wp_page].contents_opacity -= 25
  525.         @info.contents_opacity -= 25
  526.         @background.opacity -= 25
  527.         @cursor1.opacity -= 25
  528.         @cursor2.opacity -= 25
  529.      else  
  530.         @picture.opacity -= 10
  531.         @button.opacity -= 25
  532.         @wp[@wp_page].contents_opacity += 25
  533.         @info.contents_opacity += 25
  534.         @background.opacity += 25
  535.         @cursor1.opacity += 25
  536.         @cursor2.opacity += 25        
  537.      end  
  538. end

  539. #------------------------------------------------------------------------------
  540. # ● Refresh Info Window
  541. #------------------------------------------------------------------------------      
  542. def refresh_info_window(starting = false)
  543.      return if @image_active
  544.      return if @wp_page_old == @wp_page and starting == false   
  545.      @wp_page_old = @wp_page
  546.      page = @wp_page + 1
  547.      @picture_id = (9 * @wp_page) + @wp[@wp_page].index  + 1
  548.      p_pages = "页数:" + page.to_s + " / " + @max_pages.to_s
  549.      comp  = "    完成率:" + (@picures_enabled.to_f / @max_pictures.to_f * 100).truncate.to_s + " %"
  550.      p_number = "     图片数: " + @picures_enabled.to_s + "  /  " + @max_pictures.to_s
  551.      @info.set_text("            " + p_pages + comp + p_number)
  552. end   

  553. #------------------------------------------------------------------------------
  554. # ● Update Slide
  555. #------------------------------------------------------------------------------      
  556. def update_slide
  557.      @background2.ox += 1
  558.      return if @wp[@wp_page].x == 0  
  559.      slide_speed = 35
  560.      @picture.opacity = 0
  561.      @background.opacity = 255
  562.      if @slide_type == 1     
  563.         if @wp[@wp_page].x < 0
  564.            @wp[@wp_page].x += slide_speed
  565.            if @wp[@wp_page].x >= 0
  566.               @wp[@wp_page].x = 0
  567.            end
  568.          end
  569.         if @wp[@page_old].x < 640
  570.            @wp[@page_old].x += slide_speed
  571.            if @wp[@page_old].x >= 640
  572.               @wp[@page_old].x = 640
  573.            end
  574.          end         
  575.        else     
  576.          if @wp[@wp_page].x > 0
  577.             @wp[@wp_page].x -= slide_speed
  578.             if @wp[@wp_page].x <= 0  
  579.                @wp[@wp_page].x = 0
  580.             end   
  581.          end
  582.          if @wp[@page_old].x > -640
  583.             @wp[@page_old].x -= slide_speed
  584.             if @wp[@page_old].x <= -640
  585.                @wp[@page_old].x = -640
  586.             end
  587.          end           
  588.        end
  589.        if @slide_type == 0   
  590.           @wp[@wp_page].x = 0 if @wp[@wp_page].x <= 0  
  591.        else
  592.            @wp[@wp_page].x = 0 if @wp[@wp_page].x >= 0
  593.        end  
  594. end

  595. #------------------------------------------------------------------------------
  596. # ● Check_limite
  597. #------------------------------------------------------------------------------        
  598. def check_limit
  599.      if @wp_page < 0
  600.         @wp_page = @max_pages - 1
  601.      elsif @wp_page >= @max_pages   
  602.         @wp_page = 0   
  603.      end
  604.      check_active_window
  605. end  

  606. #------------------------------------------------------------------------------
  607. # ● Update Command Image
  608. #------------------------------------------------------------------------------        
  609. def update_command_image
  610.     # if Input.trigger?(Input::B) or Input.trigger?(Input::C)
  611.     #    $game_system.se_play($data_system.cursor_se)
  612.     #    @image_active = false
  613.     #    @wp[@wp_page].active = true
  614.     #    return
  615.     # end
  616.      #修改#
  617.      if Input.trigger?(Input::B)
  618.         $game_system.se_play($data_system.cursor_se)
  619.         @image_active = false
  620.         @wp[@wp_page].active = true
  621.         return
  622.       end
  623.      if Input.trigger?(Input::C)
  624.        $game_system.se_play($data_system.decision_se)
  625.        @command_window.active = true
  626.        @command_window.visible  = true
  627.        return
  628.      end
  629.      #####
  630.      if Input.trigger?(Input::R) or Input.trigger?(Input::L)
  631.         $game_system.se_play($data_system.cursor_se)
  632.         execute_zoom      
  633.      end  
  634.      if Input.press?(Input::RIGHT)
  635.         @ex += 6
  636.      elsif Input.press?(Input::LEFT)
  637.         @ex -= 6
  638.      elsif Input.press?(Input::DOWN)
  639.         @ey += 6
  640.      elsif Input.press?(Input::UP)   
  641.         @ey -= 6
  642.      end  
  643.      @ex = @ex_max + @ex_max_zoom if @ex > @ex_max + @ex_max_zoom
  644.      @ex = 0 if @ex < 0
  645.      @ey = @ey_max + @ey_max_zoom if @ey > @ey_max + @ey_max_zoom
  646.      @ey = 0 if @ey < 0        
  647.      @picture.x = -@ex
  648.      @picture.y = -@ey
  649. end  

  650. #------------------------------------------------------------------------------
  651. # ● Execute Zoom
  652. #------------------------------------------------------------------------------         
  653. def execute_zoom
  654.      if @picture.zoom_x == 1.0
  655.         @picture.zoom_x = 1.5
  656.         @picture.zoom_y = 1.5
  657.         refresh_button(1)
  658.         @ex_max_zoom = (@picture.bitmap.width / 2)
  659.         if @ex != @ex_max
  660.            @ex += @ex_max_zoom / 2         
  661.         else   
  662.            if @ex_max != 0   
  663.               @ex += @ex_max_zoom
  664.            else   
  665.               @ex += @ex_max_zoom / 2
  666.            end  
  667.         end  
  668.         @ey_max_zoom = (@picture.bitmap.height / 2)
  669.         if @ey != @ey_max
  670.            @ey += @ey_max_zoom / 2         
  671.         else   
  672.            if @ey_max != 0   
  673.               @ey += @ey_max_zoom
  674.            else   
  675.               @ey += @ey_max_zoom / 2
  676.            end  
  677.          end  
  678.       else
  679.         if @picture.bitmap.width > 640 or
  680.            @picture.bitmap.height > 480
  681.            refresh_button(1)
  682.         else
  683.            refresh_button(0)
  684.         end           
  685.         @ex -= @ex_max_zoom / 2
  686.         @ey -= @ey_max_zoom / 2           
  687.         @picture.zoom_x = 1.0
  688.         @picture.zoom_y = 1.0   
  689.         @ex_max_zoom = 0
  690.         @ey_max_zoom = 0
  691.      end     
  692. end  

  693. #------------------------------------------------------------------------------
  694. # ● check_avaliable_picture?
  695. #------------------------------------------------------------------------------        
  696. def check_avaliable_picture?
  697.      @picture_id = (9 * @wp_page) + @wp[@wp_page].index  + 1
  698.      return false if $gallery[@picture_id] == nil
  699.      return true
  700. end  

  701. #------------------------------------------------------------------------------
  702. # ● create_bitmap
  703. #------------------------------------------------------------------------------        
  704. def create_bitmap
  705.      @picture.opacity = 0
  706.      @picture.bitmap.dispose
  707.      @picture.bitmap = RPG::Cache.gallery(@picture_id.to_s) rescue nil
  708.      @ex = 0
  709.      @ey = 0
  710.      @ex_max_zoom = 0
  711.      @ey_max_zoom = 0
  712.      @picture.zoom_x = 1.0
  713.      @picture.zoom_y = 1.0      
  714.      if @picture.bitmap == nil
  715.         @picture.bitmap = RPG::Cache.gallery("")
  716.         refresh_button(0)
  717.         return
  718.      end  
  719.      if @picture.bitmap.width > 640
  720.         @ex_max = @picture.bitmap.width - 640
  721.      else
  722.         @ex_max = 0
  723.      end
  724.      if @picture.bitmap.height > 480
  725.         @ey_max = @picture.bitmap.height - 480  
  726.      else
  727.         @ey_max = 0
  728.      end   
  729.      if @picture.bitmap.width > 640 or
  730.         @picture.bitmap.height > 480
  731.         refresh_button(1)
  732.      else
  733.         refresh_button(0)
  734.      end
  735. end  

  736. #------------------------------------------------------------------------------
  737. # ● Refresh Button
  738. #------------------------------------------------------------------------------        
  739. def refresh_button(type = 0)
  740.      @button.bitmap.clear
  741.      if type == 0
  742.         src_rect = Rect.new(0, 0, @cw, @ch)
  743.      else
  744.         src_rect = Rect.new(0, @ch, @cw, @ch)
  745.      end  
  746.      @button_bitmap .blt(0,0, @button_image, src_rect)  
  747.      @button.y = 443
  748.      @button_fade_time = 120
  749.      @button.opacity = 0 unless @button.y == 443
  750. end   

  751. #------------------------------------------------------------------------------
  752. # ● Update Command
  753. #------------------------------------------------------------------------------      
  754. def update_command
  755.      return if @wp[@wp_page].x != 0
  756.      if Input.trigger?(Input::B)
  757.         $game_system.se_play($data_system.cursor_se)
  758.         save
  759.         $scene = Scene_Title.new
  760.         #$game_system.bgm_play($data_system.title_bgm)
  761.         return
  762.      end
  763.      if Input.trigger?(Input::C)
  764.         if check_avaliable_picture?
  765.            $game_system.se_play($data_system.decision_se)
  766.            @image_active = true
  767.            @wp[@wp_page].active = false
  768.            create_bitmap
  769.         else
  770.           $game_system.se_play($data_system.buzzer_se)
  771.         end
  772.         return
  773.      end  
  774.      if Input.trigger?(Input::L) and @max_pages != 1
  775.         $game_system.se_play($data_system.cursor_se)
  776.         @page_old = @wp_page
  777.         @wp_page -= 1
  778.         @slide_type = 1
  779.         check_limit
  780.         return
  781.      elsif Input.trigger?(Input::R) and @max_pages != 1   
  782.         $game_system.se_play($data_system.cursor_se)
  783.         @page_old = @wp_page
  784.         @wp_page += 1
  785.         @slide_type = 0
  786.         check_limit
  787.         return
  788.      end  
  789. end  
  790. end  

  791. $mog_xp_picture_gallery = true
复制代码
[/fold]

评分

参与人数 2星屑 +200 赞 +2 收起 理由
RyanBern + 200 + 1 感谢醋鸡
文雅夕露 + 1 感谢管理员前辈

查看全部评分

RGDirect - DirectX驱动的RGSS,点我了解.
(排满,暂停)RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部