Hey o/
Eu tava olhando os posts na área de rgss e vi que um membro, não me lembro qual, havia mencionado o fato de querer poder deixar os botões do netplay com um degradê, parecido com o do telam ludos, então, eu, como um jovem caridoso xD resolvi editar o estilo dos botões e das texto box.
Screen:
Então aqui está o da Text_Box:
Eu tava olhando os posts na área de rgss e vi que um membro, não me lembro qual, havia mencionado o fato de querer poder deixar os botões do netplay com um degradê, parecido com o do telam ludos, então, eu, como um jovem caridoso xD resolvi editar o estilo dos botões e das texto box.
Screen:
- Spoiler:
Então aqui está o da Text_Box:
- Código:
#==============================================================================
# ** Text boxes - This class is used to create Text boxes.
#------------------------------------------------------------------------------
# Author Trebor777
# Modified Marlos Gama
# Version 2.0
#==============================================================================
class Text_Box < Widget
attr_accessor( :hide, :active, :extended)
def initialize(win,x,y,width,max,lines=1)
super(win,x,y)
@max = max
@width = width
@height = lines*(16+2)
@lines = lines
s.bitmap = Bitmap.new(width,lines*(16+2))
s.bitmap.font.color = Color.new(0, 0, 0, 255)
s.bitmap.font.size = win.contents.font.size
@text = ""
@extended = true
@wait = 0
@hide = false
@blink = false
self.tool_tip=["Comprimento máximo de #{@max} caráters."]
refresh
end
#--------------------------------------------------------------------------
def text
return @text
end
#--------------------------------------------------------------------------
def text=(t)
@text=t.to_s
refresh
end
#--------------------------------------------------------------------------
def con(t)
return "" if t == nil
return t if !@hide
return "*"*t.size
end
#--------------------------------------------------------------------------
def refresh
#s.bitmap.clear
s.bitmap.fill_rect(0,0,@s.bitmap.width,25, Color.new(53,53,53))
s.bitmap.fill_rect(1,1,@s.bitmap.width-2,1, Color.new(104, 104, 104))
s.bitmap.fill_rect(1,2,@s.bitmap.width-2,1, Color.new(102, 102, 102))
s.bitmap.fill_rect(1,3,@s.bitmap.width-2,1, Color.new(100, 100, 100))
s.bitmap.fill_rect(1,4,@s.bitmap.width-2,1, Color.new(98, 98, 98))
s.bitmap.fill_rect(1,5,@s.bitmap.width-2,1, Color.new(96, 96, 96))
s.bitmap.fill_rect(1,6,@s.bitmap.width-2,1, Color.new(94, 94, 94))
s.bitmap.fill_rect(1,7,@s.bitmap.width-2,1, Color.new(92, 92, 92))
s.bitmap.fill_rect(1,8,@s.bitmap.width-2,1, Color.new(90, 90, 90))
s.bitmap.fill_rect(1,9,@s.bitmap.width-2,1, Color.new(88, 88, 88))
s.bitmap.fill_rect(1,10,@s.bitmap.width-2,1, Color.new(86, 86, 86))
s.bitmap.fill_rect(1,11,@s.bitmap.width-2,1, Color.new(84, 84, 84))
s.bitmap.fill_rect(1,12,@s.bitmap.width-2,1, Color.new(82, 82, 82))
s.bitmap.fill_rect(1,13,@s.bitmap.width-2,1, Color.new(80, 80, 80))
s.bitmap.fill_rect(1,14,@s.bitmap.width-2,1, Color.new(78, 78, 78))
s.bitmap.fill_rect(1,15,@s.bitmap.width-2,1, Color.new(76, 76, 76))
s.bitmap.fill_rect(1,16,@s.bitmap.width-2,1, Color.new(74, 74, 74))
#s.bitmap.fill_rect(0, 0, @width, @height, Color.new(59,59,59,127))
#s.bitmap.fill_rect(1, 1, @width-2, @height-2, Color.new(208,214,221,127))
#s.bitmap.fill_rect(2, 2, @width-4, 9, Color.new(221,226,233,127))
#s.bitmap.fill_rect(2, 10, @width-4, 7, Color.new(195,203,213,127))
if s.bitmap.height>win.contents.height-5
win.oy=text.count("-N-")*win.contents.font.size-1
end
if @lines>1 and text.count("-N-")>0
i=0
for line in text.split("-N-")
@tw = s.bitmap.text_size(con(line)).width
s.bitmap.draw_text(5, i*win.contents.font.size, @width, 18, con(line))
i+=1
end
else
@tw = s.bitmap.text_size(con(text)).width
s.bitmap.draw_text(5, 0, @width, 18, con(text))
end
@tw = 0 if text[-1,1] == "-N-"
s.bitmap.font.color = Color.new(181,181,181)
s.bitmap.draw_text(@tw+2+2, text.count("-N-")*win.contents.font.size-1, @width, 18, '|') if self.active and not @blink
s.bitmap.draw_text(@tw+2+2, text.count("-N-")*win.contents.font.size-1, @width, 18, ' ') if !self.active or (self.active and @blink)
end
#--------------------------------------------------------------------------
def outclick
refresh
end
#--------------------------------------------------------------------------
def update
super
s.visible = win.visible
if self.active and not @blink
@wait += 1
@blink = true if @wait >= 20
@wait = 0 if @wait >= 20
elsif not @blink
@blink = false
@wait = 0
end
if self.active and @blink
@wait += 1
@blink = false if @wait >= 20
@wait = 0 if @wait >= 20
elsif @blink
@blink = false
@wait = 0
end
if self.active
entry = @text
if Input.triggerd?(Input::Back) and entry.size != 0
entry.chop!
@text = entry
refresh
return
end
if entry.size-entry.count("-N-") == @max
return
end
k=""
Input::Carac.keys.each do |key|
if Input.triggerd?(Input::Carac[key])
k = key.to_s.downcase
if Input.pressed?(Input::Shift)
k = key.to_s.upcase
k = Input::Equ[key].to_s if key.kind_of? Numeric and @extended
end
entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
entry+=k
end
end
if @extended
k=""
if Input.triggerd?(Input::Comma)
k=","
k="<" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Space)
k=" "
elsif Input.triggerd?(Input::Dot)
k="."
k=">" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Collon)
k=";"
k=":" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Equal)
k="="
k="+" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Backslash)
k="/"
k="?" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Quote)
k="'"
k="''" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Underscore)
k="-"
k="_" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Lb)
k="["
k="{" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::Rb)
k="]"
k= "}" if Input.pressed?(Input::Shift)
elsif Input.triggerd?(Input::DC)
k="\"
k="|" if Input.pressed?(Input::Shift)
end
if k!=""
entry+="-N-" if entry.split("-N-").last != nil and @s.bitmap.text_size(entry.split("-N-").last+k).width>=@s.bitmap.width-5
entry+=k
end
end
entry+="-N-" if Input.triggerd?(13) and @lines>1 and entry.count("-N-")<@lines-1
if entry != @text
@text = entry
end
s.bitmap.font.size = win.contents.font.size
#s.bitmap.font.color = Window_Edits::Text_Box_FontColor
s.bitmap.font.color = win.text_color(2) if text.size-text.count("-N-") == @max
refresh
end
end
#--------------------------------------------------------------------------
def dispose
super
@text = nil
end
end
- Código:
#==============================================================================
# ** Button - This class is used to create buttons.
#------------------------------------------------------------------------------
# Author Trebor777
# Modified Marlos Gama
# Version 2.0
#==============================================================================
class Button < Widget
attr_accessor :mask
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(win,x,y,text,&block)
super(win,x, y)
@text = text
@block = block
refresh
end
#--------------------------------------------------------------------------
# Draw the button text, and create the mask.
#--------------------------------------------------------------------------
def refresh
b = Bitmap.new(4,4)
b.font.size = 16
cx = (b.text_size(@text).width)
b.dispose
s.bitmap = Bitmap.new(cx+10, 18)
s.bitmap.font.color = Color.new(0,0,0,255)
s.bitmap.font.size = 16
@largura = cx
@mask = Sprite.new(win.viewport)
@mask.x=s.x
@mask.y=s.y
@mask.visible= false
@mask.z = 5000
@mask.bitmap=Bitmap.new(s.bitmap.width,s.bitmap.height)
@mask.bitmap.fill_rect(0, 0, @s.bitmap.width, @s.bitmap.height, Window_Edits::Button_ColorSkin_Start)
s.bitmap.clear
s.bitmap.fill_rect(0,0,@s.bitmap.width,25, Color.new(53,53,53))
s.bitmap.fill_rect(1,1,@s.bitmap.width-2,1, Color.new(104, 104, 104))
s.bitmap.fill_rect(1,2,@s.bitmap.width-2,1, Color.new(102, 102, 102))
s.bitmap.fill_rect(1,3,@s.bitmap.width-2,1, Color.new(100, 100, 100))
s.bitmap.fill_rect(1,4,@s.bitmap.width-2,1, Color.new(98, 98, 98))
s.bitmap.fill_rect(1,5,@s.bitmap.width-2,1, Color.new(96, 96, 96))
s.bitmap.fill_rect(1,6,@s.bitmap.width-2,1, Color.new(94, 94, 94))
s.bitmap.fill_rect(1,7,@s.bitmap.width-2,1, Color.new(92, 92, 92))
s.bitmap.fill_rect(1,8,@s.bitmap.width-2,1, Color.new(90, 90, 90))
s.bitmap.fill_rect(1,9,@s.bitmap.width-2,1, Color.new(88, 88, 88))
s.bitmap.fill_rect(1,10,@s.bitmap.width-2,1, Color.new(86, 86, 86))
s.bitmap.fill_rect(1,11,@s.bitmap.width-2,1, Color.new(84, 84, 84))
s.bitmap.fill_rect(1,12,@s.bitmap.width-2,1, Color.new(82, 82, 82))
s.bitmap.fill_rect(1,13,@s.bitmap.width-2,1, Color.new(80, 80, 80))
s.bitmap.fill_rect(1,14,@s.bitmap.width-2,1, Color.new(78, 78, 78))
s.bitmap.fill_rect(1,15,@s.bitmap.width-2,1, Color.new(76, 76, 76))
s.bitmap.fill_rect(1,16,@s.bitmap.width-2,1, Color.new(74, 74, 74))
s.bitmap.font.color = Color.new(181,181,181)
s.bitmap.font.size = 13
s.bitmap.draw_text(0, 1, @s.bitmap.width, s.bitmap.height, @text, 1)
end
#--------------------------------------------------------------------------
# Dispose the mask, and itself
#--------------------------------------------------------------------------
def dispose
@mask.dispose
super
end
#--------------------------------------------------------------------------
# Frame update, check the mask status, and active status
#--------------------------------------------------------------------------
def update
@mask.visible= false if @mask.visible and !visible
if visible
@mask.x=s.x if @mask.x != s.x
@mask.y=s.y if @mask.y != s.y
@mask.update
if in_area?
@mask.visible=true
else
@mask.visible=false
end
self.active=false if self.active
s.opacity = Window_Edits::Button_Active_Opacity if s.opacity<Window_Edits::Button_Active_Opacity
end
super
end
#--------------------------------------------------------------------------
# Change the button opacity when clicked
#--------------------------------------------------------------------------
def clicked
$game_system.se_play($data_system.decision_se)
s.opacity -= Window_Edits::Button_Not_Active_Opacity if s.opacity==Window_Edits::Button_Active_Opacity
if @block != nil
@block.call
else
self.active = true
end
end
#--------------------------------------------------------------------------
# Visible
#--------------------------------------------------------------------------
def visible=(v)
@mask.visible=v if @mask != nil
s.visible = v if s != nil
end
end