查看: 2903|回复: 4

[已经解决] 关于一个菜单脚本使用的问题

[复制链接]
梦石
4
星屑
2013
在线时间
442 小时
注册时间
2015-7-19
回帖
106
发表于 2016-4-9 19:50:15 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 类人猿 于 2016-4-10 15:40 编辑

[pre lang="ruby"]#encoding:utf-8
#==============================================================================
# ■ 带有大图标,推展线索的物品栏
#------------------------------------------------------------------------------
# 适合解密类游戏的菜单,
# 脚本:VIPArcher
# 美工 && 创意:断电
#  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
#==============================================================================
# 使用说明:
# 物品备注栏备注 <image:文件名> 显示大图
# 物品备注栏备注 <no se> 使用不播放使用道具音效
# 物品备注栏备注 <clue:内容> 显示线索,支持控制符。
#==============================================================================
# ■ 设定部分
#==============================================================================
module VIPArcher
  BACKGROUND = "itembackground"   #背景图片文件名
  module Item_Help   #物品栏的帮助窗口
    X = 40                        # 窗口x坐标
    Y = 50                        # 窗口y坐标
    Width = 240                   # 窗口宽度
    Height = 72                   # 窗口高度
    Font_Outline = false          # 描边
    Font_Bold = false             # 粗体
    Font_Color = Color.new(0,0,0) # 字体颜色
    Font_Size = 14                # 字体大小
    Font_Name = "黑体"        # 字体名称
  end
  module Item_Name  #物品的名称窗口
    X = 52                        # 窗口x坐标
    Y = 10                        # 窗口y坐标
    Width = 220                   # 窗口宽度
    Height = 52                   # 窗口高度
    Font_Outline = false          # 描边
    Font_Bold = false             # 粗体
    Font_Color = Color.new(0,0,0) # 字体颜色
    Font_Size = 22                # 字体大小
    Font_Name = "黑体"        # 字体名称
  end
  module Item_List  #物品栏的列表窗口
    X = 282                       # 窗口x坐标
    Y = 100                       # 窗口y坐标
    Width = 220                   # 窗口宽度
    Height = 300                  # 窗口高度
    Font_Outline = false          # 描边
    Font_Bold = false             # 粗体
    Font_Color = Color.new(0,0,0) # 字体颜色
    Font_Size = 20                # 字体大小
    Font_Name = "黑体"        # 字体名称
    No_Number = false             #是否描绘物品个数
  end
  module Item_Note  #物品的备注信息窗口
    X = 40                        # 窗口x坐标
    Y = 116                       # 窗口y坐标
    Width = 240                   # 窗口宽度
    Height = 100                  # 窗口高度
    Regex = /<Clue:\s*(.*)>/im    # 正则匹配式
    Font_Outline = false          # 描边
    Font_Bold = false             # 粗体
    Font_Color = Color.new(0,0,0) # 字体颜色
    Font_Size = 14               # 字体大小
    Font_Name = "黑体"        # 字体名称
  end
  module Item_Image  #物品的大图窗口
    X = 0                         # 窗口x坐标
    Y = 240                       # 窗口y坐标
    Width = 175                   # 窗口宽度
    Height = 175                  # 窗口高度
    Regex = /<Image:\s*(\S*)>/i   # 正则匹配式
  end
  module Item_Category  #物品的分类窗口 !!!!
#    X = Graphics.width - 255      # 窗口x坐标
    X = -12
#    Y = 0                         # 窗口y坐标
    Y = -8
#   Width = 255                   # 窗口宽度
#   Height = 100                  # 窗口高度
    Width = 544 + 12
    Height = 416
    #各分类的对应的图标文件名(分别对应着[道具,武器,贵重物品,防具])
    #这里有几项就有几个分类
    Category_Name = ["道具","藏品","花卉","配方"]
  end
end
module Cache
  #--------------------------------------------------------------------------
  # ● 获取物品栏图片
  #--------------------------------------------------------------------------  
  def self.ItemImage(filename)
    load_bitmap("Graphics/Pictures/", 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
   
    bitmap = Cache.ItemImage(@text)
   
    a = 76 - bitmap.width / 2
    b = 76 - bitmap.height / 2
   
   # draw_itemimage(0,0,@text) if @text != ""
   draw_itemimage(a,b,@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
  #--------------------------------------------------------------------------
  # ● 获取列数
  #--------------------------------------------------------------------------
  def col_max
    return scene_im? ? 1 : 2
  end
  #--------------------------------------------------------------------------
  # ● 获取行高
  #--------------------------------------------------------------------------
  def line_height
    return scene_im? ? 33 : 24
  end
  def scene_im?
    SceneManager.scene_is?(Scene_Item) ||
    SceneManager.scene_is?(Scene_Map)
  end
  #--------------------------------------------------------------------------
  # ● 绘制物品(取消半透明图标的y+4) !!!!!!
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
#   draw_icon(item.icon_index, x, y + 4)
    change_color(normal_color)
    if SceneManager.scene_is?(Scene_Item) ||
      SceneManager.scene_is?(Scene_Map)
      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
[/pre]

来自花篮谷杀手 @FHNBHJ   
ps:知道原帖的告诉我也行
梦石
1
星屑
22083
在线时间
4885 小时
注册时间
2014-12-22
回帖
1509

开拓者

发表于 2016-4-10 09:55:14 | 显示全部楼层
目测是这个~
【UI界面】——一款清新的物品栏菜单(20141006更新)
https://rpg.blue/thread-371790-1-1.html
回复

使用道具 举报

梦石
0
星屑
2724
在线时间
227 小时
注册时间
2016-3-27
回帖
557
发表于 2016-4-10 10:47:59 | 显示全部楼层
本帖最后由 WantMy蕙 于 2016-4-12 17:56 编辑

不是很懂va啊
这个贴子里面有类似的解法??
https://rpg.blue/forum.php?mod=viewthread&tid=383382

已帮楼主购买楼上的工程文件,100e有点心疼qwq已私发

点评

1  发表于 2016-4-10 14:32
我觉得人家的付费工程你买了私下送给楼主一个人也就算了,现在却免费挂出来,请迅速处理。  发表于 2016-4-10 11:28

评分

参与人数 1梦石 +1 收起 理由
丿梁丶小柒 + 1 认可答案

查看全部评分

现在还能改名吗qwq
回复

使用道具 举报

鼬痴汉

梦石
29
星屑
3401
在线时间
1300 小时
注册时间
2010-4-24
回帖
919

短篇十吟唱者组别亚军开拓者

发表于 2016-4-10 12:03:17 | 显示全部楼层
去2楼的链接,使用原帖中的脚本(花篮谷中,该脚本已经被我修改)
回复

使用道具 举报

梦石
4
星屑
2013
在线时间
442 小时
注册时间
2015-7-19
回帖
106
 楼主| 发表于 2016-4-10 15:03:39 | 显示全部楼层
FHNBHJ 发表于 2016-4-10 12:03
去2楼的链接,使用原帖中的脚本(花篮谷中,该脚本已经被我修改)

谢谢                             
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部