#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Picture Command by Nathmatt
# Version: 1.01
# Type: Command
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# Picture Command Config
#==============================================================================
module Picture_Command_Config
Distance = 5 # Distance between pictures
Replace_Selector = false # New picture or false
Piture_Selector = false # Curser piture or false for default
Selctor_Off_X = 30 # curser's x offset
Selctor_Off_Y = 20 # curser's x offset
end
#==============================================================================
# Picture Command
#==============================================================================
class Picture_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(commands,graphic)
@bitmap = RPG::Cache.picture(graphic)
@cw = @bitmap.width
@ch = @bitmap.height
@dis = Picture_Command_Config::Distance
super(0, 0, @cw + 32, commands.size * (@ch + @dis) + 32)
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, height - 32)
self.index = -1
refresh
self.x -= 10
self.index = 0
self.opacity = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
(0...@item_max).each{|i|draw_item(i, normal_color)}
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(i, color)
pic = (Picture_Command_Config::Piture_Selector != false ?
Picture_Command_Config::Piture_Selector: @bitmap)
self.contents.font.color = color
self.contents.fill_rect(0, (@ch + @dis) * i, @cw, @ch, Color.new(0,0,0,0))
rect = Rect.new(0, 0, @cw, @ch)
self.contents.blt(0, (@ch + @dis) * i, pic, rect)
rect = Rect.new(0, (@ch + @dis) * i, @cw, @ch)
self.contents.draw_text(rect, @commands[i],1)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
elsif Picture_Command_Config::Piture_Selector != false
if @curser_selsect == nil
@curser_selsect = Sprite.new
@curser_selsect.bitmap = RPG::Cache.picture(
Picture_Command_Config::Piture_Selector)
end
@curser_selsect.x = Picture_Command_Config::Selctor_Off_X
@curser_selsect.y = (@index * (@ch + @dis)
) + Picture_Command_Config::Selctor_Off_Y
@curser_selsect.z = 9999
else
self.cursor_rect.set(0, @index * (@ch + @dis), @cw, @ch)
end
end
end