Project1
标题:
有谁 知道 这个脚本 可以不可以 外链 单张图标
[打印本页]
作者:
z2z4
时间:
2012-8-18 13:09
标题:
有谁 知道 这个脚本 可以不可以 外链 单张图标
像XP 一样 一张图标一张图标 的外链
#==============================================================================
# XaiL System - Icon Item
# Author: Nicke
# Created: 09/04/2012
# Edited: 06/05/2012
# Version: 1.0b
#==============================================================================
# 介绍
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials but above ▼ Main. Remember to save.
#
# This script changes the item list to display icons as items instead.
# There is also a category feature which allows you to change the background
# color of each items/weapons/armour etc.
#
# Right now there is a setup of 6 categories one being the default one.
# You can easily edit the draw_item_rect method to add new ones.
#
# To setup a category for a item use the following code in the note field of the
# item:
# <category health>
# or
# <category mana>
# The above will only work if you did not edit the category list.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-ICON-SKILLS"] = true
module XAIL
module ICON_ITEM
#--------------------------------------------------------------------------#
# * 设置
#--------------------------------------------------------------------------#
# 字体 = [名称, 尺寸, 颜色, bold, 阴影]
FONT = [["Anklada™", "Verdana"], 16, Color.new(255,225,255), true, true]
# 显示/隐藏选项的项目现场。
# DISPLAY = [show_显示_图标, 显示_名称, 显示_描述, 显示_耗材, 显示_数量]
DISPLAY = [true, true, true, true, true]
# If this is false every item will have the same default black color.
# NO_分类 = true/false
NO_CATEGORIES = true
end
end
# *** 不要修改下面的除非你知道你在做什么. ***
#==============================================================================#
# ** 窗口_帮助
#==============================================================================#
class Window_Help < Window_Base
def set_item_help(item)
# // 设置项目窗口帮助.
contents.font.name = XAIL::ICON_ITEM::FONT[0]
contents.font.bold = XAIL::ICON_ITEM::FONT[3]
contents.font.shadow = XAIL::ICON_ITEM::FONT[4]
contents.font.out_color = Color.new(0,0,0,255)
if item
icon = XAIL::ICON_ITEM::DISPLAY[0] ? '\i[' + item.icon_index.to_s + ']' : ""
name = XAIL::ICON_ITEM::DISPLAY[1] ? '\c[2] »» ' + item.name + '\c[0]' : ""
weight = $imported["XAIL-INVENTORY-WEIGHT"] ? weight = " - Weight #{item.weight}." : ""
if item.is_a?(RPG::Item) and XAIL::ICON_ITEM::DISPLAY[2]
consumable = item.consumable ? " (消耗)" : " (不消耗)"
else
consumable = ""
end
desc = XAIL::ICON_ITEM::DISPLAY[3] ? item.description : ""
new_line = "\n"
item_text = icon + name + consumable + weight + new_line + desc
else
item_text = ""
end
set_text(item_text)
end
end
#==============================================================================#
# ** 窗口_项目表_图标
#==============================================================================#
class Window_ItemList_Icon < Window_ItemList
def col_max
# // 方法 to get col_max.
return 14
end
def spacing
# // 图标格的距离.
return 14
end
def item_width
# // 图标格的宽度.
return 32
end
def item_height
# // 图标格的高度.
return 32
end
def row_max
# // 方法 to get row_max.
return item_max
end
def update_help
# // 更新的帮助信息.
@help_window.set_item_help(item)
end
def item_rect(index)
# // 绘制项目矩形.
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * (item_height + 3)
rect
end
def page_row_max
# // 来确定页面行最大.
return 1
end
def scan_items(item)
# // 扫描注释的项目.
item.note.scan(/<category[:]*\s*(.+)>/i)
return $1 if !$1.nil?
end
def draw_item(index)
# // 重写绘制项目.
item = @data[index]
if item
rect = item_rect(index)
draw_item_rect(index, item, rect, rect.x, rect.y)
draw_item_number(rect, item) if $game_party.item_number(item) > 1 and XAIL::ICON_ITEM::DISPLAY[3]
end
end
def draw_item_icon(icon_index, x, y, enabled = true)
# // 绘制图标.
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index % 16 * 32, icon_index / 16 * 32, 32, 32) #24 图标大小
contents.blt(x, y, bitmap, rect, enabled ? 255 : 75)
end
def draw_item_rect(index, item, rect, x, y)
# // 绘制矩形.
outline = rect.clone
outline.width = rect.width + 1
outline.height = rect.height + 1
contents.fill_rect(outline,Color.new(255,255,255,80))
if XAIL::ICON_ITEM::NO_CATEGORIES
case scan_items(item)
when "health"
color = Color.new(150,0,0,45)
when "mana"
color = Color.new(0,0,150,45)
when "cure"
color = Color.new(0,130,0,45)
when "elixir"
color = Color.new(250,250,0,45)
when "herbs"
color = Color.new(0,215,0,45)
when nil
color = Color.new(0,0,0,128)
else
color = Color.new(0,0,0,128)
end
else
color = Color.new(0,0,0,128)
end
color = enable?(item) ? color : Color.new(0,0,0,128)
contents.fill_rect(rect, color)
draw_item_icon(item.icon_index, x + 1, y, enable?(item))
end
def check_color(color, enabled = true)
# // Method to set the color and alpha.
contents.font.color.set(color)
contents.font.color.alpha = 95 unless enabled
end
def draw_item_number(rect, item)
# // 方法绘制项目编号.
rect.y += 8
if $game_party.item_number(item) < 10
rect.x -= 2
end
contents.font = Font.new(XAIL::ICON_ITEM::FONT[0], XAIL::ICON_ITEM::FONT[1])
check_color(XAIL::ICON_ITEM::FONT[2], enable?(item))
contents.font.bold = XAIL::ICON_ITEM::FONT[3]
contents.font.shadow = XAIL::ICON_ITEM::FONT[4]
contents.font.out_color = Color.new(0,0,0,255)
draw_text(rect, sprintf("%2d", $game_party.item_number(item)), 1)
reset_font_settings
end
end
#==============================================================================#
# ** 场景_项目
#==============================================================================#
class Scene_Item < Scene_ItemBase
def create_item_window
# // 方法重写创建项目列表窗口.
wy = @category_window.y + @category_window.height
wh = Graphics.height - wy
@item_window = Window_ItemList_Icon.new(0, wy, Graphics.width, wh)
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@category_window.item_window = @item_window
end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1