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

Project1

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

[有事请教] 求大佬ACE让这分辨率脚本全都可以用

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1528
在线时间
113 小时
注册时间
2023-12-26
帖子
209
跳转到指定楼层
1
发表于 2025-4-9 15:29:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
求大佬ACE让这分辨率脚本全都可以用,特别是宽屏的不能用。求大佬让这分辨选项里的都可以用。谢谢

RUBY 代码复制
  1. #===============================================================================
  2. # 选择分辨率脚本                               updated: 11/15/2014
  3. # 共同完成 by: Dekita 和 Venka
  4. #===============================================================================
  5. # Dekita's web site and available scripts:
  6. # [url]www.dekyde.com[/url]
  7. # [url]www.dekitarpg.wordpress.com[/url]
  8. #===============================================================================
  9. # Contact Venka by private message via the official RPG Maker forums here:
  10. # [url]http://forums.rpgmakerweb.com/index.php?/user/2313-venka/[/url]
  11. # The most up to date version of this script can be found here:
  12. # [url]http://forums.rpgmakerweb.com/index.php?/topic/33783-resolution-selection-script/[/url]
  13. #===============================================================================
  14. # - 介绍 -
  15. #-------------------------------------------------------------------------------
  16. # 本脚本可以让玩家在游戏里选择分辨率。
  17. # 在下面可以获取高分辨率的dll:
  18. # [url]http://forums.rpgmakerweb.com/index.php?/topic/31953-high-res-rpg-maker-project/[/url]
  19. #
  20. # 该dll非必需,但如果你不使用它则无法将游戏分辨率扩大到 640x480 以上.
  21. #
  22. #-------------------------------------------------------------------------------
  23. # - 安装 -
  24. #-------------------------------------------------------------------------------
  25. # 本脚本还可以设定不用分辨率下使用的文件素材路径。
  26. # 例如:在 宽屏3 (1024x640) 时,脚本会在 Graphics 文件夹里寻找一个叫 1024x640
  27. # 的文件夹.
  28. # 则在该分辨率下,title1的文件会使用: "Graphics/1024x640/Title1/文件名"
  29. # 而不是原来的 "Graphics/Title1/文件名"
  30. #
  31. # 如果脚本在分辨率文件夹中没有找到素材,则会在默认的文件路径中寻找(避免不受分
  32. # 辨率影响的素材重复放置)
  33. # 所以文件夹命名要准确 :)
  34. #
  35. # 这是一个即插即用的脚本,请放在  "▼ 插件脚本" 之下
  36. #
  37. #===============================================================================
  38. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  39. #===============================================================================
  40. # This script can be use in both commercial and non-commercial games.
  41. # Credit must be given to Dekita and Venka.
  42. #===============================================================================
  43. module SelRes
  44.   #-----------------------------------------------------------------------------
  45.   # 设置分辨率
  46.   # 列表里的分辨率类型可以任意增减,长款最好设定为32的倍数,因为1个图块=32像素.
  47.   #-----------------------------------------------------------------------------
  48.   Sizes = [
  49.   # [ "名称", 宽度, 高度],
  50.     [ "普通1"  ,   544,   416 ],
  51.     [ "普通2"  ,   640,   480 ],
  52.     [ "普通3"  ,   736,   576 ],
  53.     [ "普通4"  ,   928,   704 ],
  54.     [ "宽屏1"  ,   640,   416 ],
  55.     [ "宽屏2"  ,   832,   544 ],
  56.     [ "宽屏3"  ,  1024,   640 ],
  57.     [ "宽屏4"  ,  1920,   960 ],
  58.     [ "宽屏5"  ,  1920,   1200 ],
  59.   ] # <- 别动
  60.   #-----------------------------------------------------------------------------
  61.   # 在上面的列表里选一个作为默认分辨率,游戏重新开始时会应用该设定.
  62.   #-----------------------------------------------------------------------------
  63.   Default_Size = ["宽屏1", 640, 416]
  64.   #-----------------------------------------------------------------------------
  65.   # 玩家在选择分辨率后显示的第一个场景。
  66.   # 一般都是"Scene_Title"除非你使用自定义标题场景.
  67.   #-----------------------------------------------------------------------------
  68.   First_Scene  = Scene_Title
  69.   Options_Text = "分辨率"
  70. end
  71. #===============================================================================
  72. module SceneManager
  73. #===============================================================================
  74.   #----------------------------------------------------------------------------
  75.   # ● overwrite method: first_scene_class
  76.   #----------------------------------------------------------------------------
  77.   def self.first_scene_class
  78.     if Graphics.initialize_resolution[1]
  79.       size = Graphics.initialize_resolution[0]
  80.       Graphics.resize_screen(size[1],size[2])
  81.       $BTEST ? Scene_Battle : SelRes::First_Scene
  82.     else
  83.       Scene_ResSel
  84.     end
  85.   end
  86. end
  87. #===============================================================================
  88. module Cache
  89. #===============================================================================
  90.   #----------------------------------------------------------------------------
  91.   # ● overwrite method: normal_bitmap
  92.   #----------------------------------------------------------------------------
  93.   def self.normal_bitmap(path)
  94.     if path[0..8] == "Graphics/"
  95.       begin
  96.         reso_path = path.clone
  97.         reso_path.insert(9, "#{Graphics.width}x#{Graphics.height}/")
  98.         @cache[reso_path] = Bitmap.new(reso_path) unless include?(reso_path)
  99.         @cache[reso_path]
  100.       rescue
  101.         @cache[path] = Bitmap.new(path) unless include?(path)
  102.         @cache[path]
  103.       end
  104.     end
  105.   end
  106. end
  107. #===============================================================================
  108. class Window_ResSel < Window_Command
  109. #===============================================================================
  110.   #----------------------------------------------------------------------------
  111.   # ● upgraded method: initialize
  112.   #----------------------------------------------------------------------------
  113.   def initialize(reso_size)
  114.     super(0, 0)
  115.     select(get_index(reso_size))
  116.     @reso = reso_size
  117.     hide
  118.     move_window
  119.   end
  120.   #----------------------------------------------------------------------------
  121.   # ○ new method: get_index
  122.   #----------------------------------------------------------------------------
  123.   def get_index(reso_size)
  124.     item_max.times do |i|
  125.       return i if @list[i][:name] == "#{reso_size[1]}x#{reso_size[2]}"
  126.     end
  127.   end
  128.   #----------------------------------------------------------------------------
  129.   # ○ new method: move_window
  130.   #----------------------------------------------------------------------------
  131.   def move_window
  132.     self.x = (Graphics.width - window_width) * 0.5
  133.     self.y = (Graphics.height - height) / 2
  134.     show
  135.   end
  136.   #----------------------------------------------------------------------------
  137.   # ● window settings
  138.   #----------------------------------------------------------------------------
  139.   def window_width; return 220; end
  140.   #----------------------------------------------------------------------------
  141.   # ● upgraded method: make_command_list
  142.   #----------------------------------------------------------------------------
  143.   def make_command_list
  144.     SelRes::Sizes.compact.each do |data|
  145.       add_command("#{data[1]}x#{data[2]}", :reso)
  146.     end
  147.   end
  148.   #----------------------------------------------------------------------------
  149.   # ● upgraded method: draw_item
  150.   #----------------------------------------------------------------------------
  151.   def draw_item(index)
  152.     rect = item_rect_for_text(index)
  153.     rect.width = item_rect_for_text(index).width * 0.5
  154.     draw_text(rect, SelRes::Sizes[index][0], 1)
  155.     rect.x += rect.width
  156.     draw_text(rect, command_name(index), 1)
  157.   end
  158. end
  159. #===============================================================================
  160. class Scene_ResSel < Scene_Base
  161. #===============================================================================
  162.   #----------------------------------------------------------------------------
  163.   # ● upgraded method: start
  164.   #----------------------------------------------------------------------------
  165.   def start
  166.     size = Graphics.initialize_resolution[0]
  167.     Graphics.resize_screen(size[1],size[2])
  168.     super
  169.     @command = Window_ResSel.new(size)
  170.     @command.set_handler(:reso, method(:fix_reso))
  171.   end
  172.   #----------------------------------------------------------------------------
  173.   # ○ new method: fix_reso
  174.   #----------------------------------------------------------------------------
  175.   def fix_reso
  176.     @command.hide
  177.     size = SelRes::Sizes.compact[@command.index]
  178.     Graphics.resize_screen(size[1], size[2])
  179.     Graphics.save_resolution(size)
  180.     SceneManager.goto($BTEST ? Scene_Battle : SelRes::First_Scene)
  181.   end
  182. end
  183. #===============================================================================
  184. class << Graphics
  185. #===============================================================================
  186.   #----------------------------------------------------------------------------
  187.   # ♦ Private Instance Variables
  188.   #----------------------------------------------------------------------------
  189.   ReadIni  = Win32API.new('kernel32', 'GetPrivateProfileString'  , 'ppppip', 'i')
  190.   WriteIni = Win32API.new('kernel32', 'WritePrivateProfileString', 'pppp'  , 'i')
  191.   #----------------------------------------------------------------------------
  192.   # ○ new method: initialize_resolution
  193.   #----------------------------------------------------------------------------
  194.   def initialize_resolution
  195.     @reso_setting = []
  196.     load_resolution
  197.     set_up = (@reso_setting[1] == 0 ? false : true)
  198.     @reso_setting = SelRes::Default_Size if @reso_setting[1] == 0
  199.     return [@reso_setting, set_up]
  200.   end
  201.   #----------------------------------------------------------------------------
  202.   # ○ new method: load_resolution
  203.   #----------------------------------------------------------------------------
  204.   def load_resolution
  205.     buffer = [].pack('x256')
  206.     get_option = Proc.new do |key|
  207.       l = ReadIni.call('Resolution', key, '0', buffer, buffer.size, './Game.ini')
  208.       buffer[0, l]
  209.     end
  210.     @reso_setting[1] = get_option.call('Width', '0').to_i
  211.     @reso_setting[2] = get_option.call('Height', '0').to_i
  212.   end
  213.   #----------------------------------------------------------------------------
  214.   # ○ new method: save_resolution
  215.   #----------------------------------------------------------------------------
  216.   def save_resolution(setting)
  217.     @reso_setting = setting
  218.     set_option = Proc.new do |key, value|
  219.       WriteIni.call('Resolution', key, value.to_s, './Game.ini')
  220.     end
  221.     set_option.call('Width', @reso_setting[1])
  222.     set_option.call('Height', @reso_setting[2])
  223.   end
  224. end
  225. #===============================================================================
  226. class Window_TitleCommand < Window_Command
  227. #===============================================================================
  228.   #----------------------------------------------------------------------------
  229.   # ● overwrite method: make_command_list
  230.   #----------------------------------------------------------------------------
  231.   def make_command_list
  232.     add_command(Vocab::new_game,      :new_game)
  233.     add_command(Vocab::continue,      :continue, continue_enabled)
  234.     add_command(SelRes::Options_Text, :settings)
  235.     add_command(Vocab::shutdown,      :shutdown)
  236.   end
  237. end
  238. #===============================================================================
  239. class Scene_Title < Scene_Base
  240. #===============================================================================
  241.   #----------------------------------------------------------------------------
  242.   # ● alias method: create_command_window
  243.   #----------------------------------------------------------------------------
  244.   alias :reso_settings_ccw :create_command_window
  245.   def create_command_window
  246.     reso_settings_ccw
  247.     @command_window.set_handler(:settings, method(:command_settings))
  248.   end
  249.   #----------------------------------------------------------------------------
  250.   # ○ new method: command_settings
  251.   #----------------------------------------------------------------------------
  252.   def command_settings
  253.     SceneManager.goto(Scene_ResSel)
  254.   end
  255. end
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-4-19 17:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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