查看: 5255|回复: 4

[已经解决] 請問有方法讓滾動文字置中嗎?

[复制链接]
梦石
0
星屑
50
在线时间
39 小时
注册时间
2012-11-27
回帖
18
发表于 2013-3-8 02:19:35 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 grayshadow 于 2013-3-8 22:27 编辑

各位大大好!
如題所問,請問有沒有方法能讓滾動文字自動置中,
而不需要自己把空白鍵按個幾十遍呢?
(最好是可以不影響到其他的對話框向左對齊,
不然,所有文字都置中了也好像不太好看。)

找了蠻久,似乎能確定軟件本身沒有這個功能,
搜索過本論壇,但好像沒看到類似的解決方案,
能請大大們幫個忙嗎?
謝謝!
梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
回帖
1526
发表于 2013-3-8 12:22:56 | 显示全部楼层
卷动文字好像是用 draw_text_ex 来描绘的,它没有文字置中置右的参数,用来描绘带控制符的文字讯息,不知道换 draw_text 行不行?我没试过。

VX 倒是有卷动文字的脚本,可以置中,VA 好像没有见到过这种卷动文字脚本。
修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
39 小时
注册时间
2012-11-27
回帖
18
 楼主| 发表于 2013-3-8 14:50:54 | 显示全部楼层
嗯……似乎不行?
不管怎樣,先謝謝大大你了!
回复

使用道具 举报

梦石
0
星屑
50
在线时间
687 小时
注册时间
2012-10-29
回帖
1526
发表于 2013-3-8 16:57:42 | 显示全部楼层
本帖最后由 j433463 于 2013-3-8 17:00 编辑

您也许可以试试 VX 的卷动文字脚本,例如这一个:

http://forums.rpgmakerweb.com/in ... anas-credit-script/

这网址页中就是有人询问怎么在 VA 中使用的,方式很简单,把脚本贴到 Main 之前,然后把要显示的卷动文字内容剪贴到大约 64 行的 Credit= <<_MAP_CREDIT_ 下方,

像是这样:
  1. Credit= <<_MAP_CREDIT_


  2. <h>标题字
  3. <center>置中文字
  4. <left>置左文字
  5. <right>置右文字

  6. _MAP_CREDIT_
复制代码
不过 <b> 和 <i> 就别用了,会有问题。

调用它的方式是  SceneManager.scene.credit.start,测试效果还不错,但需要调整 @sprite.x 的位置:

s1.png



如果屏蔽看不到网页,这是脚本内容:

[pre lang="ruby" line="1"]#===============================================================
# ● [VX] ◦ Map Credit ◦ □
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 09/05/2008
# ◦ Version: 1.0
#----------------------------------------------------
# ◦ How to use:
# ** To start Credit, call script:
# $scene.credit.start
#
# ** To Stop and Clear Credit, call script:
# $scene.credit.terminate
#----------------------------------------------------
# ◦ Special Tags for Decorate Text:
# There are special tags that you can put in text to decorate that line
#
# You can also set default text decoration for all text in:
  #-------------------------------------
  # SETUP HEADER TEXT HERE
  #-------------------------------------
# for Header line (line that has tag <h>)
# &
  #-------------------------------------
  # SETUP CONTENT TEXT HERE
  #-------------------------------------
# for Normal line~
#-----------------------------------------------------
# ◦ >= Tag List <= ◦
# * These tags will only apply to the line it is in~
# * You cannot use opposite tags in same line. (e.g. <b> and </b>)
#
# <b> :Bold Text
# </b> :No Bold Text
# <i> :Italic Text
# </i> :No Italic Text
# <center> :Align text to Center
# <left> :Align text to left
# <right> :Align text to right
# <h> :Make that line become Header line
#===========================================================================
#----------------------------------------
# Map Credit Main Script \('w' )
#----------------------------------------
class Wora_Map_Credit
  BG_Image = '' # Background Image file name, image must be in folder 'Picture'
  # You can leave this as '' for no background
  BG_Image_Opacity = 255 # Background Opacity (0 - 255)

  Text_Begin_y = 416 # Use 0 - 416: Text will start in the screen
  # Use 416+: Text will start below the screen

  Text_Scroll_Speed = 2 # Higher this number = Faster
  Text_Scroll_Delay = 2 # Delay between each text move (0 for no delay)
  Text_Opacity = 220 # Text Opacity
  Text_Blend_Type = 0 # 0: Normal, 1: Add, 2: Subtraction

  Test_Text = 'I' # Text for test height,
  # Change to taller alphabet if height is not right~
#--------------------------
# Start Credit
#--------------------------
Credit= <<_MAP_CREDIT_


<h>HEADLINE
CREDITS HERE


_MAP_CREDIT_
#--------------------------
# End Credit
#--------------------------
  #-------------------------------------
  # SETUP HEADER TEXT HERE
  #-------------------------------------
  def header_properties(bitmap)
        bitmap.font.name = 'Twilight' # Text Font
        bitmap.font.color = Color.new(0, 0, 255, 255) # (Red, Green, Blue, Opacity)
        bitmap.font.size = 30 # Text size
        bitmap.font.bold = true # Bold Text? (true/false)
        bitmap.font.italic = false # Italic Text? (true/false)
        bitmap.font.shadow = true # Shadowed Text? (true/false)
        @text_outline = Color.new(0,0,0) # nil for no outline, Color.new(r,g,<img src='http://forums.rpgmakerweb.com/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' /> for outline
        @text_align = 1 # 0: Left, 1: Center, 2: Right
  end

  #-------------------------------------
  # SETUP CONTENT TEXT HERE
  #-------------------------------------
  def content_properties(bitmap)
        bitmap.font.name = 'Tahoma'
        bitmap.font.color = Color.new(255, 255, 255, 255)
        bitmap.font.size = 22
        bitmap.font.bold = true
        bitmap.font.italic = false
        bitmap.font.shadow = true
        @text_outline = nil
        @text_align = 1
  end
#-----------------------------------------------------------------------
# -END- MAP CREDIT SCRIPT SETUP PART
#===========================================================================
  def initialize
        @started = false
  end

  # Delete credit if credit started
  def terminate
        if @started
          if @bg != nil
                @bg.bitmap.dispose
                @bg.dispose
          end
          @sprite.bitmap.dispose
          @sprite.dispose
          @started = false
        end
  end

  # Start Credit
  def start(text = Credit, bg = BG_Image)
        # Create Background Sprite
        if BG_Image != ''
          @bg = Sprite.new
          @bg.bitmap = Cache.picture(bg)
          @bg.opacity = BG_Image_Opacity
          @bg.z = 10000
        end
        # Create Text Sprite
        @sprite = Sprite.new
        @sprite.x = 122
        @sprite.y = 0
        @sprite.z = 10001
        @sprite.opacity = Text_Opacity
        @sprite.blend_type = Text_Blend_Type
        # Calculate Credit Height
        header_line = 0
        content_line = 0
        height = 0
        text = text.split(/\n/)
        text.each do |i|
          if i.include?('<h>'); header_line += 1
          else; content_line += 1
          end
        end
        @sprite.bitmap = Bitmap.new(1,1)
        # Test Header Properties
        header_properties(@sprite.bitmap)
        header_height = @sprite.bitmap.text_size(Test_Text).height
        height += ( header_line * ( header_height ) )
        # Test Content Properties
        content_properties(@sprite.bitmap)
        content_height = @sprite.bitmap.text_size(Test_Text).height
        height += ( content_line * ( content_height ) )
        @sprite.bitmap.dispose
        # Finished Test, Draw Text
        @sprite.bitmap = Bitmap.new(300, Text_Begin_y + height + 32)
        content_x = 0
        content_y = Text_Begin_y
        text.each do |i|
       
          # Determine Special Tags
          if i.include?('<h>')
                i.sub!('<h>', '')
                header_properties(@sprite.bitmap)
                bitmap_height = header_height
          else
                content_properties(@sprite.bitmap)
                bitmap_height = content_height
          end
          # Bold Text
          if i.include?('<b>')
                i.sub!('<b>', ''); @sprite.font.bold = true
          elsif i.include?('</b>')
                i.sub!('</b>', ''); @sprite.font.bold = false
          end
          # Italic Text
          if i.include?('<i>')
                i.sub!('<i>', ''); @sprite.font.italic = true
          elsif i.include?('</i>')
                i.sub!('</i>', ''); @sprite.font.italic = false
          end
          # Align Text
          if i.include?('<center>')
                i.sub!('<center>', ''); @text_align = 1
          elsif i.include?('<left>')
                i.sub!('<left>', ''); @text_align = 0
          elsif i.include?('<right>')
                i.sub!('<right>', ''); @text_align = 2
          end
          if !@text_outline.nil? # Text Outline
                ori_color = @sprite.bitmap.font.color.clone
                @sprite.bitmap.font.color = @text_outline
                @sprite.bitmap.draw_text(content_x-1, content_y, @sprite.bitmap.width,
bitmap_height, i, @text_align)
                @sprite.bitmap.draw_text(content_x, content_y-1, @sprite.bitmap.width,
bitmap_height, i, @text_align)
                @sprite.bitmap.draw_text(content_x, content_y+1, @sprite.bitmap.width,
bitmap_height, i, @text_align)
                @sprite.bitmap.draw_text(content_x+1, content_y, @sprite.bitmap.width,
bitmap_height, i, @text_align)
                @sprite.bitmap.font.color = ori_color
          end
       
          # Draw Text
          @sprite.bitmap.draw_text(content_x, content_y, @sprite.bitmap.width,
bitmap_height, i, @text_align)
          content_y += bitmap_height
        end
        @delay = 0
        @started = true
  end

  # Update credit if credit started~
  def update
        if @started
          if @delay > 0
                @delay -= 1
                return
          else
                @sprite.oy += Text_Scroll_Speed
                @delay += Text_Scroll_Delay
          end
        end
  end
end
#----------------------------------------
# Plug Credit to Map >_> <img src='http://forums.rpgmakerweb.com/public/style_emoticons/<#EMO_DIR#>/dry.png' class='bbc_emoticon' alt='<_<' />~
#----------------------------------------
class Scene_Map < Scene_Base
  attr_reader :credit
  alias wor_mapcre_scemap_str start
  alias wor_mapcre_scemap_upd update
  alias wor_mapcre_scemap_ter terminate
  def start
        @credit = Wora_Map_Credit.new # Create Credit
        wor_mapcre_scemap_str
  end

  def update
        @credit.update # Update Credit
        wor_mapcre_scemap_upd
  end

  def terminate
        @credit.terminate # Dispose Credit
        wor_mapcre_scemap_ter
  end
end[/pre]
修改劇本中,仔細審查原來的劇情大綱,覺得有點不太滿意,嘗試編寫不同主角不同主線的劇情,希望能寫得出來。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
39 小时
注册时间
2012-11-27
回帖
18
 楼主| 发表于 2013-3-8 22:25:34 | 显示全部楼层
噢!謝謝大大了!
效果的確蠻不錯的~
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部