Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


+4
Maverick ~
Valentine
†AnjoFael†
Roku
8 participantes

    New Button and Text_Box styles

    avatar
    Roku
    Iniciante
    Iniciante


    Mensagens : 41
    Créditos : 6

    New Button and Text_Box styles Empty New Button and Text_Box styles

    Mensagem por Roku Ter maio 01, 2012 12:45 am

    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:
    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
    Botões:
    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
    Galera, tenham o mínimo de conciência e prestem atenção na modificação, é óbvio que se você apenas colar nos scripts ela não irá funcionar e ainda dará erro! Então, faça o seguinte, copie apenas a parte do s.bitmap.fill_rec e substitua pela dos outros ok? Não tirarei dúvidas, não esclarecerei mais sobre a edição, e vou deixar claro, é ÓBVIO que essa edição funciona pois apenas editei as cores, então façam o favor de conseguir aplicar a modificação direito!
    †AnjoFael†
    †AnjoFael†
    Experiente
    Experiente


    Mensagens : 408
    Créditos : 67

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por †AnjoFael† Ter maio 01, 2012 12:49 am

    Olha soh rapaz!
    Vc min ajudou mt vlws!


    _________________

    New Button and Text_Box styles 34g0n7q
    New Button and Text_Box styles CczuLhS
    Facebook
    Valentine
    Valentine
    Administrador
    Administrador


    Medalhas : New Button and Text_Box styles ZgLkiRU
    Mensagens : 5336
    Créditos : 1163

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Valentine Ter maio 01, 2012 11:46 am

    Nossa cara, estão muito bonitos + 1 crédito
    avatar
    Roku
    Iniciante
    Iniciante


    Mensagens : 41
    Créditos : 6

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Roku Ter maio 01, 2012 12:44 pm

    Vlw ai xD
    Eu tentei deixar tipo um degradê, mas como o rgss não tem esse método eu tive que desenhar linha por linha.


    _________________
    MRM
    é igual um gigante cadeirante, quando cai, é muito difícil se levantar,
    e quando se levanta não consegue ir para frente sem cair novamente.
    Maverick ~
    Maverick ~
    Membro Ativo
    Membro Ativo


    Mensagens : 372
    Créditos : 39

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Maverick ~ Ter maio 01, 2012 1:27 pm

    Nossa cara ficou muito bom mano,
    parabéns.+1Cred



    _________________
    Alguma Duvida!? Me mande uma MP

    New Button and Text_Box styles BgIconeLivro                 Regras do Fórum


    New Button and Text_Box styles L4thF
    DeaN
    DeaN
    Colaborador
    Colaborador


    Mensagens : 1243
    Créditos : 48

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por DeaN Ter maio 01, 2012 2:26 pm

    Fico muito massa cara bem bonito 1+


    _________________
    Dean, Programador Geral :)

    Contato: Skype:matucarvalho e Facebook
    The Enze - Vulzt

    Shield Block
    Anti-Cheat para jogos de FPS, agora vou adaptar para jogos de RPG principalmente para o RMXP.
    www.shieldblock.net
    fb.com/shieldblockoficial

    New Button and Text_Box styles MiB0H
    Vxxx12
    Vxxx12
    Semi-Experiente
    Semi-Experiente


    Mensagens : 131
    Créditos : 5

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Vxxx12 Dom maio 20, 2012 6:23 pm

    Ow mano ta dando erro no script text box aki na linha 182, alguem ajuda?

    EDIT: Consegui tirar o erro mais só alguns buttons ficam nesse estilo


    _________________
    New Button and Text_Box styles FJ8Rp19
    Canjoo
    Canjoo
    Experiente
    Experiente


    Mensagens : 505
    Créditos : 52

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Canjoo Qua Jun 06, 2012 6:55 pm

    estão bonitos!
    cara poderia fazer um azuis pra min?
    1cred.
    avatar
    Roku
    Iniciante
    Iniciante


    Mensagens : 41
    Créditos : 6

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Roku Qua Jun 06, 2012 7:07 pm

    Vxxx12: Isso acontece pois existem vários scripts de botões no netplay master, sendo assim deve substituir em todos.
    Pedro: Não, isso é extremamente simples, por isso, se quiser faça você mesmo.


    _________________
    MRM
    é igual um gigante cadeirante, quando cai, é muito difícil se levantar,
    e quando se levanta não consegue ir para frente sem cair novamente.
    Minos
    Minos
    Ocasional
    Ocasional


    Mensagens : 238
    Créditos : 38

    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Minos Qua Jun 06, 2012 7:34 pm

    Cara Aki ta dando um erro na linha 182 do Text Box ajuda ai

    Conteúdo patrocinado


    New Button and Text_Box styles Empty Re: New Button and Text_Box styles

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Sex Abr 19, 2024 2:09 pm