赞 | 287 |
VIP | 11 |
好人卡 | 74 |
积分 | 226 |
经验 | 281171 |
最后登录 | 2024-11-16 |
在线时间 | 9415 小时 |
Lv5.捕梦者 (暗夜天使) 只有笨蛋才会看到
- 梦石
- 1
- 星屑
- 21631
- 在线时间
- 9415 小时
- 注册时间
- 2012-6-19
- 帖子
- 7118
|
本帖最后由 喵呜喵5 于 2013-11-7 18:20 编辑
- =begin
- ===============================================================================
- 包含立绘的美化型菜单 By喵呜喵5
- ===============================================================================
- 【说明】
-
- 一个可以显示立绘的游戏菜单
- 如果会脚本的话可以直接动手修改脚本的代码使这个菜单更加适应你的游戏
- 如果不会脚本的话……默认的样式我也挺满意的啦
-
- 立绘的文件名为队伍中第一名角色的昵称,放在“Graphics/m5lihui/”文件夹下
-
- 这个菜单主要用于适应解谜游戏,所以我不负责调整针对装备、技能功能的兼容
- =end
- module M5Menu
- #==============================================================================
- # 设定部分
- #==============================================================================
-
- COMMAND = ["查看物品","读取存档"]
-
- #这里设置在菜单中显示的指令名称
- #如果不懂脚本的话,不建议增加更多的指令
-
- SCENE = ["Scene_Item","Scene_Load"]
-
- #这里设置执行每条指令后游戏需要跳转到的场景,与上面的指令名称一一对应
- #如果不懂脚本的话,不建议修改这里
-
- WIDTH = 272
- #这里设置指令窗口的宽度
-
- HEIGHT = 60
- #这里设置指令窗口的高度
-
- FONT = 28
- #这里设置指令字体的大小
-
- X = 220
- #这里设置指令窗口的X坐标
-
- Y = 148
- #这里设置指令窗口的Y坐标
-
- Y_OFF = 60
- #这里设置两条指令之间的距离
-
- MEMO = true
- #在下次打开菜单时让光标会自动移动到上次关闭菜单时的位置
- #如果不需要这个功能,设置成false即可
-
- #==============================================================================
- # 设定结束
- #==============================================================================
- end
- module Cache
- def self.m5lihui(filename)
- load_bitmap("Graphics/m5lihui/", filename)
- end
- end
- class Window_M5MenuStatus < Window_Base
- def initialize
- super(0, 0, Graphics.width, Graphics.height)
- self.z = 200
- self.opacity = 0
- [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.members[0]
- refresh
- end
- def standard_padding
- return 0
- end
- def set_text(text)
- if $game_party.members[0].id != @actor.id
- @actor = $game_party.members[0]
- refresh
- end
- end
- def refresh
- contents.clear
- draw_actor_lihui
- end
- def draw_actor_lihui
- bitmap = Cache.m5lihui(@actor.nickname)
- rect = Rect.new(0, 0, Graphics.width, Graphics.height)
- contents.blt(0, 0, bitmap, rect, 255)
- bitmap.dispose
- end
- end
- class Window_M5MenuCommand < Window_Base
- attr_reader :selected
- def self.init_command_position
- @@menu_last_command = 0 if !M5Menu::MEMO
- end
- def self.init_command_position_without
- @@menu_last_command = 0
- end
- def initialize(index)
- super(M5Menu::X,win_y(index),M5Menu::WIDTH,M5Menu::HEIGHT)
- self.arrows_visible = false
- @text = M5Menu::COMMAND[index]
- refresh
- @selected = false
- end
- def win_y(index)
- M5Menu::Y + (M5Menu::Y_OFF + M5Menu::HEIGHT) * index
- end
- def caloff
- standard_padding * 2
- end
- def refresh
- contents.clear
- contents.font.size = M5Menu::FONT
- draw_text(0, 0, self.width - caloff, self.height - caloff, @text,1)
- end
- def selected=(selected)
- @selected = selected
- update_cursor
- end
- def update_cursor
- if @selected
- cursor_rect.set(0, 0, self.width - caloff, self.height - caloff)
- else
- cursor_rect.empty
- end
- end
- def menu_last_command
- @@menu_last_command
- end
- def menu_last_command=(last_command)
- @@menu_last_command = last_command
- end
- end
- class Scene_M5Menu < Scene_MenuBase
- def start
- super
- create_status_windows
- create_command_windows
- init_selection
- end
- def terminate
- super
- @command_windows.each {|window| window.dispose }
- end
- def update
- super
- @command_windows.each {|window| window.update }
- update_savefile_selection
- end
- def create_status_windows
- @status_windows = Window_M5MenuStatus.new
- end
- def create_command_windows
- @command_windows = Array.new(item_max) do |i|
- Window_M5MenuCommand.new(i)
- end
- end
- def init_selection
- [url=home.php?mod=space&uid=370741]@Index[/url] = @command_windows[0].menu_last_command
- @command_windows[@index].selected = true
- end
- def update_savefile_selection
- return on_command_ok if Input.trigger?(:C)
- return on_command_cancel if Input.trigger?(:B)
- update_cursor
- end
- def on_command_ok
- @command_windows[0].menu_last_command = @index
- SceneManager.call(eval(M5Menu::SCENE[@index]))
- Input.update
- end
- def on_command_cancel
- @command_windows[0].menu_last_command = @index
- Sound.play_cancel
- return_scene
- end
- def update_cursor
- last_index = @index
- cursor_down (Input.trigger?(:DOWN)) if Input.repeat?(:DOWN)
- cursor_up (Input.trigger?(:UP)) if Input.repeat?(:UP)
- if @index != last_index
- Sound.play_cursor
- @command_windows[last_index].selected = false
- @command_windows[@index].selected = true
- end
- end
- def cursor_down(wrap)
- @index = (@index + 1) % item_max
- end
- def cursor_up(wrap)
- @index = (@index - 1) % item_max
- end
- def item_max
- M5Menu::COMMAND.size
- end
- end
- class << DataManager
- alias m5_20131107_setup_new_game setup_new_game
- def setup_new_game
- m5_20131107_setup_new_game
- Window_MenuCommand::init_command_position_without
- end
- end
- Window_MenuCommand = Window_M5MenuCommand
- Scene_Menu = Scene_M5Menu
复制代码 |
|