#===============================================================================
#物品界面、技能界面按SHIFT打开介绍窗口
#2019/1/14 By:真·可乐
#===============================================================================
module ZCL_Detail_Set
#窗口的皮肤名称
WINDOWSKILL = "Window"
#窗口的宽度
WWIDTH = Graphics.width / 2.3
#窗口的高度
WHEIGHT = Graphics.height / 1.5
#窗口物品名称栏的背景色,最后一项是不透明度,填成0的话就没颜色了
ITEMNAMEBACKCOLOR = [0,255,0,100]
#禁用设定 , 1 为禁用 物品界面细明窗口 ,2 为禁用 技能界面细明窗口 , 3 为全部禁用
DISABLE = 0
end
module RPG
class BaseItem
def detail
/\[de\](.*)\[ta\]/ =~ self.note
return ($1.is_a?(String) ? $1 : "")
end
end
end
class Window_Detail < Window_Base
attr_accessor :item
include ZCL_Detail_Set
def initialize(y)
super(x = 0,y,WWIDTH,WHEIGHT)
self.windowskin = Cache.system(WINDOWSKILL)
@item = nil
end
def refresh
self.contents.clear
return self.hide if @item.nil?
co = ITEMNAMEBACKCOLOR
contents.fill_rect(0,0,self.width,32,Color.new(co[0],co[1],co[2],co[3]))
text = @item.detail.gsub("\\n"){"\n"}
draw_item_name(@item,0,2,true);draw_text_ex(0,36,text)
end
def item=(titem)
@item = titem
self.refresh
end
end
class Scene_ItemBase
attr_reader :detail_window
alias startzcl2019114 start
def start
startzcl2019114;create_detail_window
end
def create_detail_window
@detail_window = Window_Detail.new(0)
@detail_window.hide
end
alias updatezcl2019114 update
def update
updatezcl2019114
update_detail
end
def update_detail
return @detail_window.hide unless @item_window.active
if Input.trigger?(Input::A)
return if self.is_a?(Scene_Item) && ZCL_Detail_Set::DISABLE == 1
return if self.is_a?(Scene_Skill) && ZCL_Detail_Set::DISABLE == 2
return unless ZCL_Detail_Set::DISABLE.between?(0,2)
refresh_detail_window;end
@detail_window.hide if Input.trigger?(:UP) || Input.trigger?(:DOWN) ||
Input.trigger?(:LEFT) || Input.trigger?(:RIGHT)
end
def refresh_detail_window
if @item_window.item.nil?
@detail_window.hide
return Sound.play_buzzer
end
@detail_window.y = @item_window.y
@detail_window.z = @item_window.z + 100
@detail_window.height = [Graphics.height - @detail_window.y , ZCL_Detail_Set::WHEIGHT ].min
@detail_window.create_contents
wx = Graphics.width/2 + (@item_window.index % 2 == 0 ? 0 : -@detail_window.width)
@detail_window.item = @item_window.item
@detail_window.x = wx
Sound.play_ok
@detail_window.visible = !@detail_window.visible
end
alias use_itemzcl2019114 use_item
def use_item
use_itemzcl2019114
refresh_detail_window
end
end