Project1
标题:
【翻译】IconView
[打印本页]
作者:
仲秋启明
时间:
2010-12-5 11:02
标题:
【翻译】IconView
本帖最后由 仲秋启明 于 2010-12-5 11:04 编辑
相必大家在游戏中查看图标数都是数的吧,这个可以查看图标数
上图:
2010-12-05_105349.png
(76.11 KB, 下载次数: 18)
下载附件
保存到相册
2010-12-5 11:02 上传
#===============================================================================
# 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
复制代码
作者:
一箭烂YiJL
时间:
2010-12-5 11:14
前辈,这件东西的意思是不用在脚本里打
draw_icon(X坐标, Y坐标, 编号)
复制代码
不用慢慢数吗?
作者:
仲秋启明
时间:
2010-12-5 11:18
回复
一箭烂YiJL
的帖子
只是查一下指定图标的编号,某些美化脚本用到图标了,我一般用PS切片查数
作者:
evermilk
时间:
2010-12-5 11:47
看到这个我果断泪目啊
作者:
越前リョーマ
时间:
2010-12-5 11:50
我泪目了……用那些菜单里有ico的数难过……虽然稍微有点小窍门
作者:
夕阳武士
时间:
2010-12-5 12:38
这个东西= =话说咱一般= =做个乘法就行了= = = =
作者:
菜鸟飞呀飞
时间:
2010-12-5 13:09
提示:
作者被禁止或删除 内容自动屏蔽
作者:
DeathKing
时间:
2010-12-5 13:17
PocketWiki里面资源众多……够得翻译得了。
作者:
earlysummer
时间:
2010-12-5 15:28
真是个好东西啊~~泪流满面
作者:
企鹅达达
时间:
2010-12-5 17:22
启明兄,加油
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1