赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 2 |
经验 | 9521 |
最后登录 | 2020-7-8 |
在线时间 | 142 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 161
- 在线时间
- 142 小时
- 注册时间
- 2014-5-17
- 帖子
- 25
|
6楼
楼主 |
发表于 2015-9-4 22:48:25
|
只看该作者
- #encoding:utf-8
- #==============================================================================
- # ■ 带有大图标,推展线索的物品栏
- #------------------------------------------------------------------------------
- # 适合解密类游戏的菜单,
- # 脚本:VIPArcher
- # 美工 && 创意:断电
- # -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
- #==============================================================================
- # 使用说明:
- # 物品备注栏备注 <image:文件名> 显示大图
- # 物品备注栏备注 <no se> 使用不播放使用道具音效
- # 物品备注栏备注 <clue:内容> 显示线索,支持控制符。
- #==============================================================================
- #------------·------------·------------·------------·------------·
- #清新道具+XaiL System - Icon Item
- #------------·------------·------------·------------·------------·
- #==============================================================================
- # ■ 设定部分
- #==============================================================================
- module VIPArcher
- # BACKGROUND = "背景" #背景图片文件名
- module Item_Help #物品栏的帮助窗口
- X = -2 # 窗口x坐标
- Y = 310 # 窗口y坐标
- Width = 545 # 窗口宽度
- Height = 46 # 窗口高度
- Font_Outline = false # 描边
- Font_Bold = false # 粗体
- Font_Color = Color.new(255,255,255) # 字体颜色
- Font_Size = 20 # 字体大小
- Font_Name = "方正品尚黑简体" # 字体名称
- end
- module Item_Name #物品的名称窗口
- X = 0 # 窗口x坐标
- Y = 160 # 窗口y坐标
- Width = 220 # 窗口宽度
- Height = 52 # 窗口高度
- Font_Outline = false # 描边
- Font_Bold = false # 粗体
- Font_Color = Color.new(255,255,255) # 字体颜色
- Font_Size = 28 # 字体大小
- Font_Name = "方正品尚黑简体" # 字体名称
- end
- module Item_List #物品栏的列表窗口
- X = 100 # 窗口x坐标
- Y = 348 # 窗口y坐标
- Width = 340 # 窗口宽度
- Height = 65 # 窗口高度
- Font_Outline = false # 描边
- Font_Bold = false # 粗体
- Font_Color = Color.new(255,255,255) # 字体颜色
- Font_Size = 28 # 字体大小
- Font_Name = "方正品尚黑简体" # 字体名称
- No_Number = false #是否描绘物品个数
- end
- module Item_Note #物品的备注信息窗口
- X = 448 # 窗口x坐标
- Y = 160 # 窗口y坐标
- Width = 210 # 窗口宽度
- Height = 60 # 窗口高度
- Regex = /<Clue:\s*(.*)>/im # 正则匹配式
- Font_Outline = false # 描边
- Font_Bold = false # 粗体
- Font_Color = Color.new(255,255,255) # 字体颜色
- Font_Size = 20 # 字体大小
- Font_Name = "微软雅黑" # 字体名称
- end
- module Item_Image #物品的大图窗口
- X = -12 # 窗口x坐标
- Y = 5 # 窗口y坐标
- Width = 580 # 窗口宽度
- Height = 416 # 窗口高度
- Regex = /<Image:\s*(\S*)>/i # 正则匹配式
- end
- module Item_Category #物品的分类窗口
- X = -11#Graphics.width - 255 # 窗口x坐标
- Y = -10 # 窗口y坐标
- Width = 640 # 窗口宽度
- Height = 416 # 窗口高度
- #各分类的对应的图标文件名(分别对应着[道具,key,武器,防具])
- #这里有几项就有几个分类
- Category_Name = ["物品"]
- end
- end
- ($imported ||= {})["XAIL-ICON-SKILLS"] = true
- module XAIL
- module ICON_ITEM
- #--------------------------------------------------------------------------#
- # * Settings
- #--------------------------------------------------------------------------#
- # FONT = [name, size, color, bold, shadow]
- # FONT = [["黑体", "Verdana"], 15, Color.new(124,252,0), true, true]
- #255,225,255
- # Show/hide option for the item scene.
- # DISPLAY = [show_help_icon, show_name, show_description,
- # show_consumable, show_amount]
- # DISPLAY = [true, true, true, true, true]
- # If this is false every item will have the same default black color.
- # NO_CATEGORIES = true/false
- NO_CATEGORIES = true
- end
- end
- module Cache
- #--------------------------------------------------------------------------
- # ● 获取物品栏图片
- #--------------------------------------------------------------------------
- def self.ItemImage(filename)
- load_bitmap("Graphics/itemimage/", filename)
- end
- end
- class Window_Base < Window
- #----------------------------------------------------------------------
- # ● 绘制物品栏图片
- #--------------------------------------------------------------------------
- def draw_itemimage(x, y, itemimage)
- bitmap = Cache.ItemImage(itemimage)
- contents.blt(x, y, bitmap, bitmap.rect)
- bitmap.dispose
- end
- end
- class Window_Selectable < Window_Base
- attr_reader :item_image_window # 图片窗口
- attr_reader :item_name_window # 名字窗口
- attr_reader :item_note_window # 名字窗口
- #--------------------------------------------------------------------------
- # ● 设置图片帮助窗口
- #--------------------------------------------------------------------------
- def item_image_window=(item_image_window)
- @item_image_window = item_image_window
- end
- #--------------------------------------------------------------------------
- # ● 设置名称帮助窗口
- #--------------------------------------------------------------------------
- def item_name_window=(item_name_window)
- @item_name_window = item_name_window
- end
- #--------------------------------------------------------------------------
- # ● 设置备注帮助窗口
- #--------------------------------------------------------------------------
- def item_note_window=(item_note_window)
- @item_note_window = item_note_window
- end
- end
- class Window_Help < Window_Base
- include VIPArcher::Item_Help
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(line_number = 2,width = Graphics.width)
- super(0, 0,width, fitting_height(line_number))
- end
- #--------------------------------------------------------------------------
- # ● 重置字体设置
- #--------------------------------------------------------------------------
- alias vip_20140921_rfs reset_font_settings
- def reset_font_settings
- vip_20140921_rfs
- if SceneManager.scene_is?(Scene_Item)
- contents.font.name = Font_Name
- contents.font.outline = Font_Outline
- contents.font.color.set(Font_Color)
- contents.font.size = Font_Size
- contents.font.bold = Font_Bold
- end
- end
- end
- #显示物品备注信息的窗口
- class Window_Item_Note < Window_Base
- include VIPArcher::Item_Note
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- if text != @text
- @text = text
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 技能、物品等
- #--------------------------------------------------------------------------
- def set_item(item)
- item.note =~ Regex if item
- $1 == nil ? set_text("") : set_text($1)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_text_ex(0, 0, @text)
- end
- #--------------------------------------------------------------------------
- # ● 重置字体设置
- #--------------------------------------------------------------------------
- alias vip_20140921_rfs reset_font_settings
- def reset_font_settings
- vip_20140921_rfs
- if SceneManager.scene_is?(Scene_Item)
- contents.font.name = Font_Name
- contents.font.outline = Font_Outline
- contents.font.color.set(Font_Color)
- contents.font.size = Font_Size
- contents.font.bold = Font_Bold
- end
- end
- end
- #显示物品名称的窗口
- class Window_Item_Name < Window_Base
- include VIPArcher::Item_Name
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- if text != @text
- @text = text
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 技能、物品等
- #--------------------------------------------------------------------------
- def set_item(item)
- set_text(item ? item.name : "")
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- contents.font.name = Font_Name
- contents.font.outline = Font_Outline
- contents.font.color.set(Font_Color)
- contents.font.size = Font_Size
- contents.font.bold = Font_Bold
- draw_text(4, 0, 220, line_height, @text, 0)
- end
- end
- #显示物品详细图片的窗口
- class Window_Item_Image < Window_Base
- include VIPArcher::Item_Image
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- if text != @text
- @text = text
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 技能、物品等
- #--------------------------------------------------------------------------
- def set_item(item)
- item.note =~ Regex if item
- $1 == nil ? set_text("") : set_text($1)
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_itemimage(0,0,@text) if @text != ""
- end
- end
- #显示分类名字图片的窗口
- class Window_Item_Category < Window_Base
- include VIPArcher::Item_Category
- def initialize(x, y, width, height)
- super
- @category_name = Category_Name[0]
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 设置分类图片
- #--------------------------------------------------------------------------
- def category_name=(category)
- return if @category_name == category
- @category_name = category
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新窗口
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_itemimage(0,0,@category_name)
- end
- end
- class Window_ItemList < Window_Selectable
- include VIPArcher::Item_List
- alias vip20140921_update_help update_help
- attr_accessor :category_id
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super
- @category_id = 0
- @category = :item #VIP
- @data = []
- end
- #class Window_ItemList_Icon < Window_ItemList
- def col_max
- # // Method to get col_max.一行最大数
- return 6
- end
- def spacing
- # // Method to get spacing.间距
- return 13
- end
- def item_width
- # // Method to get item_width.
- return 40
- end
- def item_height
- # // Method to get item_height.
- return 40
- end
- def row_max
- # // Method to get row_max.
- return item_max
- end
- def update_help
- # // Method to update help details.
- @help_window.set_item_help(item)
- end
- def item_rect(index)
- # // Method to draw item rect.
- 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 + 4)
- rect
- end
- def page_row_max
- # // Method to define page row max.
- return 1
- end
- def scan_items(item)
- # // Method to scan the notes for the items.
- item.note.scan(/<category[:]*\s*(.+)>/i)
- return $1 if !$1.nil?
- end
- def draw_item(index)
- # // Method override to draw item.
- item = @data[index]
- if item
- rect = item_rect(index)
- draw_item_rect(index, item, rect, rect.x + 7, rect.y + 7)#调整图标位置
- 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)
- # // Method to draw icon.
- bitmap = Cache.system("Iconset")
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : 75)
- end
- def draw_item_rect(index, item, rect, x, y)
- # // Method to draw rect.
- 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)
- # // Method to draw the item number.
- 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
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- vip20140921_update_help
- @item_image_window.set_item(item) if @item_image_window
- @item_name_window.set_item(item) if @item_name_window
- @item_note_window.set_item(item) if @item_note_window
- end
- end
- #==============================================================================
- # ■ Scene_Item
- #------------------------------------------------------------------------------
- # 物品画面
- #==============================================================================
- class Scene_Item < Scene_ItemBase
- include VIPArcher
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_item_window
- create_item_image_window
- create_item_name_window
- create_category_window
- create_item_note_window
- on_category_ok
- window_opacity
- @image = Image.new
- end
- #--------------------------------------------------------------------------
- # ● 生成物品窗口
- #--------------------------------------------------------------------------
- def create_item_window
- x = Item_List::X
- y = Item_List::Y
- w = Item_List::Width
- h = Item_List::Height
- @item_window = Window_ItemList.new(x,y,w,h)
- @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(:return_scene))
- @item_window.set_handler(:pagedown, method(:next_category))
- @item_window.set_handler(:pageup, method(:prev_category))
- end
- #分类窗口
- def create_category_window
- x = Item_Category::X
- y = Item_Category::Y
- w = Item_Category::Width
- h = Item_Category::Height
- @category_window = Window_Item_Category.new(x,y,w,h)
- @category_window.viewport = @viewport
- end
- #上一分类
- def prev_category
- size = Item_Category::Category_Name.size - 1
- @item_window.category_id == 0 ? @item_window.category_id = size : @item_window.category_id -= 1
- on_category_change
- @item_window.activate
- @item_window.index = 0
- end
- #下一分类
- def next_category
- size = Item_Category::Category_Name.size - 1
- @item_window.category_id == size ? @item_window.category_id = 0 : @item_window.category_id += 1
- on_category_change
- @item_window.activate
- @item_window.index = 0
- end
- #切换分类
- def on_category_change
- case @item_window.category_id
- when 0
- @item_window.category = :item
- @category_window.category_name = Item_Category::Category_Name[0]
- when 1
- @item_window.category = :key_item
- @category_window.category_name = Item_Category::Category_Name[1]
- when 2
- @item_window.category = :weapon
- @category_window.category_name = Item_Category::Category_Name[2]
- when 3
- @item_window.category = :armor
- @category_window.category_name = Item_Category::Category_Name[3]
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成帮助窗口
- #--------------------------------------------------------------------------
- def create_help_window
- @help_window = Window_Help.new(2,Item_Help::Width)
- @help_window.viewport = @viewport
- @help_window.x = Item_Help::X
- @help_window.y = Item_Help::Y
- @help_window.height = Item_Help::Height
- end
- #--------------------------------------------------------------------------
- # ● 生成物品图片窗口
- #--------------------------------------------------------------------------
- def create_item_image_window
- x = Item_Image::X
- y = Item_Image::Y
- w = Item_Image::Width
- h = Item_Image::Height
- @item_image_window = Window_Item_Image.new(x,y,w,h)
- @item_image_window.viewport = @viewport
- @item_window.item_image_window = @item_image_window
- end
- #--------------------------------------------------------------------------
- # ● 生成名称窗口
- #--------------------------------------------------------------------------
- def create_item_name_window
- x = Item_Name::X
- y = Item_Name::Y
- w = Item_Name::Width
- h = Item_Name::Height
- @item_name_window = Window_Item_Name.new(x,y,w,h)
- @item_name_window.viewport = @viewport
- @item_window.item_name_window = @item_name_window
- end
- #--------------------------------------------------------------------------
- # ● 备注信息窗口
- #--------------------------------------------------------------------------
- def create_item_note_window
- x = Item_Note::X
- y = Item_Note::Y
- w = Item_Note::Width
- h = Item_Note::Height
- @item_note_window = Window_Item_Note.new(x,y,w,h)
- @item_note_window.viewport = @viewport
- @item_window.item_note_window = @item_note_window
- end
- #--------------------------------------------------------------------------
- # ● 背景透明
- #--------------------------------------------------------------------------
- def window_opacity
- @item_window.opacity = 0
- @help_window.opacity = 0
- @item_image_window.opacity = 0
- @category_window.opacity = 0
- @item_name_window.opacity = 0
- @item_note_window.opacity = 0
- end
- #--------------------------------------------------------------------------
- # ● 生成背景
- #--------------------------------------------------------------------------
- # def create_background
- # @background_sprite = Sprite.new
- # @background_sprite.bitmap = Cache.ItemImage(BACKGROUND)
- # end
- #--------------------------------------------------------------------------
- # ● 释放背景
- #--------------------------------------------------------------------------
- # def dispose_background
- # @background_sprite.dispose
- # end
- #--------------------------------------------------------------------------
- # ● 分类“确定”
- #--------------------------------------------------------------------------
- def on_category_ok
- @item_window.activate
- @item_window.select_last
- @item_window.refresh
- @help_window.set_item(item) #VIP
- @item_image_window.set_item(item) #VIP
- @item_name_window.set_item(item) #VIP
- @item_note_window.set_item(item) #VIP
- end
- #--------------------------------------------------------------------------
- # ● 播放使用物品声效 SION
- #--------------------------------------------------------------------------
- def play_se_for_item
- Sound.play_use_item unless item.note.include? "<no se>"
- end
- end
复制代码 |
|