赞 | 11 |
VIP | 302 |
好人卡 | 162 |
积分 | 62 |
经验 | 108302 |
最后登录 | 2024-11-21 |
在线时间 | 6593 小时 |
Lv4.逐梦者 醉啸 长风万里
- 梦石
- 0
- 星屑
- 6167
- 在线时间
- 6593 小时
- 注册时间
- 2007-12-16
- 帖子
- 4501
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 仲秋启明 于 2010-12-5 11:04 编辑
相必大家在游戏中查看图标数都是数的吧,这个可以查看图标数
上图:
- #===============================================================================
- # Yanfly Engine - IconView
- # 提供BY: 企鹅达达
- # 翻译BY: 仲秋启明
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["IconView"] = true
- module YE
- module TOOLS
- module ICONVIEW
- # 在运行时是否显示
- IV_ENABLE = true
- # 图标名
- ICONSET = "IconSet"
- # 指令名
- IV_NAME = "IconView"
- # 空的ICON
- EMPTYICON = 23
- end
- end
- end
- #==============================================================================
- # Scene IconView
- #==============================================================================
- class Scene_IconView < Scene_Base
- #--------------------------------------------------------------------------
- # 开始
- #--------------------------------------------------------------------------
- def start
- create_icon_window
- create_page_window
- @last_index = 256
- @up_page = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
- @dn_page = [255,254,253,252,251,250,249,248,247,246,245,244,243,242,241,240]
- @icon_window.update_icons(@page_window.index, @total_icons)
- @icon_id_window = Window_Base.new (0, 0, 128, 80)
- @instruction_window = Window_Base.new (0, 336, 128, 80)
- instruct1 = "L:PageUp"
- instruct2 = "R:PageDn"
- @instruction_window.contents.draw_text(4, 0, 88, 24, instruct1, 1)
- @instruction_window.contents.draw_text(4, 24, 88, 24, instruct2, 1)
- end
- #--------------------------------------------------------------------------
- # 结束
- #--------------------------------------------------------------------------
- def terminate
- @icon_window.dispose
- @page_window.dispose
- @icon_id_window.dispose
- @instruction_window.dispose
- end
- #--------------------------------------------------------------------------
- # 更新
- #--------------------------------------------------------------------------
- def update
- @icon_window.update
- update_icon_id_window
- if Input.repeat?(Input::L)
- pageup
- elsif Input.repeat?(Input::R)
- pagedn
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Title.new
- end
- end
- #--------------------------------------------------------------------------
- # 翻页
- #--------------------------------------------------------------------------
- def pageup
- Sound.play_decision
- @page_window.index -= 1
- @page_window.index = (@totalpages - 1 )if @page_window.index < 0
- @icon_window.update_icons(@page_window.index, @total_icons)
- @page_window.update
- force_update_id
- end
- def pagedn
- Sound.play_decision
- @page_window.index += 1
- @page_window.index = 0 if @page_window.index > (@totalpages - 1)
- @icon_window.update_icons(@page_window.index, @total_icons)
- @page_window.update
- force_update_id
- end
- #--------------------------------------------------------------------------
- # 更新窗口
- #--------------------------------------------------------------------------
- def update_icon_id_window
- if @last_index != @icon_window.index
- force_update_id
- end
- end
- #--------------------------------------------------------------------------
- # 更新窗口
- #--------------------------------------------------------------------------
- def force_update_id
- @icon_id_window.contents.clear
- id_text = sprintf("Icon %d", @page_window.index * 256 + @icon_window.index)
- @icon_id_window.contents.draw_text(4, 0, 88, 24, id_text, 1)
- id_total = sprintf("Total: %d", @total_icons - 1)
- @icon_id_window.contents.draw_text(4, 24, 88, 24, id_total, 1)
- @last_index = @icon_window.index
- end
- #--------------------------------------------------------------------------
- # 建立窗口
- #--------------------------------------------------------------------------
- def create_icon_window
- icon_list = []
- for i in 1..256
- icon_list.push (" ")
- end
- @icon_window = Window_Command.new(416, icon_list, 16, 16, 0)
- @icon_window.x = 128
- end
- #--------------------------------------------------------------------------
- # 建立窗口
- #--------------------------------------------------------------------------
- def create_page_window
- iconset = Cache.system(YE::TOOLS::ICONVIEW::ICONSET)
- iconrow = iconset.height / 24
- iconcol = iconset.width / 24
- @total_icons = iconrow * iconcol
- @totalpages = @total_icons / 256
- @totalpages += 1 if iconrow > (@totalpages * 256 / iconcol)
- page_list = []
- for i in 1..@totalpages
- page_list.push (sprintf("Page %d", i))
- end
- @page_window = Window_Command.new(128, page_list, 1, @totalpages)
- @page_window.y = 80
- @page_window.height = 256
- @page_window.active = false
- iconset.dispose
- end
- end
- #==============================================================================
- # Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # 更新图标
- #--------------------------------------------------------------------------
- def update_icons(page_number, total_icons)
- self.contents.clear
- iconrow = 0
- iconcol = 0
- icon_index = page_number * 256
- for i in 1..256
- draw_icon(icon_index, iconcol * 24, iconrow * 24) if icon_index < total_icons
- draw_icon(YE::TOOLS::ICONVIEW::EMPTYICON, iconcol * 24, iconrow * 24) if icon_index >= total_icons
- icon_index += 1
- iconcol += 1
- if iconcol == 16
- iconcol = 0
- iconrow += 1
- end
- end
- end
- end
- #==============================================================================
- # Scene_Title
- #==============================================================================
- class Scene_Title < Scene_Base
- #-----------------------------------------------------------------------------
- if $TEST and YE::TOOLS::ICONVIEW::IV_ENABLE
- #-----------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # 建立开始菜单窗口
- #--------------------------------------------------------------------------
- def create_command_window
- s1 = Vocab::new_game
- s2 = Vocab::continue
- s3 = Vocab::shutdown
- s4 = YE::TOOLS::ICONVIEW::IV_NAME
- @command_window = Window_Command.new(172, [s1, s2, s3, s4])
- @command_window.x = (544 - @command_window.width) / 2
- @command_window.y = 256
- if @continue_enabled
- @command_window.index = 1
- else
- @command_window.draw_item(1, false)
- end
- @command_window.openness = 0
- @command_window.open
- end
- #--------------------------------------------------------------------------
- # 更新
- #--------------------------------------------------------------------------
- def update
- super
- @command_window.update
- if Input.trigger?(Input::C)
- case @command_window.index
- when 0
- command_new_game
- when 1
- command_continue
- when 2
- command_shutdown
- when 3
- command_iconview
- end
- end
- end
- #--------------------------------------------------------------------------
- # 指令:IconView
- #--------------------------------------------------------------------------
- def command_iconview
- Sound.play_decision
- close_command_window
- $scene = Scene_IconView.new
- end
- end
- end
复制代码 |
|