赞 | 1 |
VIP | 0 |
好人卡 | 12 |
积分 | 2 |
经验 | 52910 |
最后登录 | 2024-8-20 |
在线时间 | 835 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 196
- 在线时间
- 835 小时
- 注册时间
- 2012-9-16
- 帖子
- 1811
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
没时间了...下面这个脚本是用于切换游戏的菜单背景图的,我想把它改成图片鉴赏那种。@protosssonny
脚本所需的素材:http://pan.baidu.com/share/link? ... 5&uk=1780376705
脚本:- #============================================================================
- # ◆ 菜单可更换壁纸Ver2.0 ◆ VX ◆
- # ◇ 2010-07-22 By: Carolawyer or Linki Shy ◇
- # 说明一:大幅缩减上一版的代码,更加成熟
- # 说明二:壁纸图片名称以1,2,3...自然数排列方式命名
- #============================================================================
- module Wallpaper
- # 壁纸存放文件夹的路径
- BG_DIR = "Graphics/Background/"
- # 所有窗口的透明度
- WINDOW_BACK_OPACITY = 100
- # 壁纸的默认样式,等于零时为截图背景
- WALLPAPER = 1
- # 壁纸的数量
- PAPERMAX = 10
- end
- #==============================================================================
- # ■ Cache
- #==============================================================================
- module Cache
- #--------------------------------------------------------------------------
- # * 获取背景图档
- # filename : 文件名
- #--------------------------------------------------------------------------
- def self.background(filename)
- load_bitmap(Wallpaper::BG_DIR, filename)
- end
- end
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :background_bitmap_temp # background bitmap temp
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- alias initialize_old initialize
- def initialize
- initialize_old
- @background_bitmap_temp = Bitmap.new(1, 1)
- end
- end
- #==============================================================================
- # ■ Game_System
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # ● 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :wallpaper # 壁纸
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- alias initialize_old initialize
- def initialize
- initialize_old
- @wallpaper = Wallpaper::WALLPAPER
- end
- end
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # 游戏中全部窗口的超级类。
- #==============================================================================
- class Window_Base < Window
- alias initialize_old initialize
- def initialize(x, y, width, height)
- initialize_old(x, y, width, height)
- self.back_opacity = Wallpaper::WINDOW_BACK_OPACITY
- end
- end
- #==============================================================================
- # ■ Scene_Base
- #------------------------------------------------------------------------------
- # 游戏中全部画面的超级类。
- #==============================================================================
- class Scene_Base
- #--------------------------------------------------------------------------
- # ● 截图做下一个画面的背景
- #--------------------------------------------------------------------------
- def snapshot_for_background
- $game_temp.background_bitmap.dispose
- $game_temp.background_bitmap = Graphics.snap_to_bitmap
- $game_temp.background_bitmap.blur
- $game_temp.background_bitmap_temp = $game_temp.background_bitmap
- end
- #--------------------------------------------------------------------------
- # ● 更换背景bitmap
- #--------------------------------------------------------------------------
- def change_wallpaper
- if $game_system.wallpaper > 0
- $game_temp.background_bitmap = Cache.background("#{$game_system.wallpaper}")
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成菜单画面背景
- #--------------------------------------------------------------------------
- def create_menu_background
- @menuback_sprite = Sprite.new
- @menuback_sprite.bitmap = $game_temp.background_bitmap
- if $game_system.wallpaper == 0
- @menuback_sprite.bitmap = $game_temp.background_bitmap_temp
- @menuback_sprite.color.set(16, 16, 16, 128)
- end
- update_menu_background
- end
- end
- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # 处理菜单画面的类。
- #==============================================================================
- class Scene_Menu < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- change_wallpaper
- create_menu_background
- create_command_window
- @gold_window = Window_Gold.new(0, 360)
- @status_window = Window_MenuStatus.new(160, 0)
- end
- end
- #==============================================================================
- # ■ Scene_End
- #------------------------------------------------------------------------------
- # 处理游戏结束画面的类。
- #==============================================================================
- class Scene_End < Scene_Base
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @command_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::C)
- case @command_window.index
- when 0 # 更换壁纸画面
- command_wallpaper
- when 1 # 回到标题画面
- command_to_title
- when 2 # 离开游戏
- command_shutdown
- when 3 # 取消
- command_cancel
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新菜单画面背景
- #--------------------------------------------------------------------------
- def update_menu_background
- super
- @menuback_sprite.tone.set(0, 0, 0, 128) if $game_system.wallpaper == 0
- end
- #--------------------------------------------------------------------------
- # ● 生成命令窗口
- #--------------------------------------------------------------------------
- def create_command_window
- s1 = "更换壁纸"
- s2 = Vocab::to_title
- s3 = Vocab::shutdown
- s4 = Vocab::cancel
- @command_window = Window_Command.new(172, [s1, s2, s3, s4])
- @command_window.x = (544 - @command_window.width) / 2
- @command_window.y = (416 - @command_window.height) / 2
- @command_window.openness = 0
- end
- #--------------------------------------------------------------------------
- # ● 进入壁纸更换画面
- #--------------------------------------------------------------------------
- def command_wallpaper
- Sound.play_decision
- @command_window.close
- $scene = Scene_Wallpaper.new
- end
- end
-
- #============================================================================
- # ■ Window_Wallpaper
- #----------------------------------------------------------------------------
- # 预览壁纸的界面(朴素版)
- #============================================================================
- class Scene_Wallpaper < Scene_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(paperstyle = $game_system.wallpaper)
- @paperstyle = paperstyle
- end
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- paper_show
- create_keys_help
- end
- #--------------------------------------------------------------------------
- # ● 结束处理
- #--------------------------------------------------------------------------
- def terminate
- super
- @keys_help_sprite.dispose
- @papersprite.dispose
- end
- #--------------------------------------------------------------------------
- # ● 返回上级画面
- #--------------------------------------------------------------------------
- def return_scene
- $scene = Scene_Menu.new(5)
- end
- #--------------------------------------------------------------------------
- # ● 下一张预览
- #--------------------------------------------------------------------------
- def nextpic
- @paperstyle += 1
- if @paperstyle == Wallpaper::PAPERMAX + 1
- @paperstyle = 0
- end
- $scene = Scene_Wallpaper.new(@paperstyle)
- end
- #--------------------------------------------------------------------------
- # ● 上一张预览
- #--------------------------------------------------------------------------
- def prevpic
- @paperstyle -= 1
- if @paperstyle == -1
- @paperstyle = Wallpaper::PAPERMAX
- end
- $scene = Scene_Wallpaper.new(@paperstyle)
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::C)
- $game_system.wallpaper = @paperstyle
- Sound.play_decision
- return_scene
- end
- if Input.trigger?(Input::UP) || Input.trigger?(Input::LEFT)
- prevpic
- elsif Input.trigger?(Input::DOWN) || Input.trigger?(Input::RIGHT)
- nextpic
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成按键帮助
- #--------------------------------------------------------------------------
- def create_keys_help
- bitmap = Cache.background("crosskey")
- @keys_help_sprite = Sprite.new
- @keys_help_sprite.bitmap = Bitmap.new(Graphics.width, 32)
- @keys_help_sprite.x = 170
- @keys_help_sprite.y = Graphics.height - 32
- @keys_help_sprite.bitmap.blt(240, 2, bitmap,bitmap.rect)
- @keys_help_sprite.bitmap.draw_text(290, 0 ,128, 24, "切换预览")
- end
- #--------------------------------------------------------------------------
- # ● 预览壁纸
- #--------------------------------------------------------------------------
- def paper_show
- if @paperstyle == 0
- bitmap = $game_temp.background_bitmap_temp
- else
- bitmap = Cache.background("#{@paperstyle}")
- end
- @papersprite = Sprite.new
- @papersprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- @papersprite.bitmap.blt(0, 0, bitmap, bitmap.rect)
- end
- end
复制代码 |
|