设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1328|回复: 5
打印 上一主题 下一主题

想使对话框变大能输入多行文字 怎么做?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
2 小时
注册时间
2008-4-30
帖子
266
跳转到指定楼层
1
发表于 2008-7-8 22:28:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我导入了一个对话脚本,对话框能显示四行文字 ,我想让它显示5行6行,怎么做?


谢谢



脚步内容:

  1. #
  2. #    呼出对话框 ver. 1.31 By パラ犬(日)
  3. #  来自 http://rpg.para.s3p.net/
  4. #
  5. #  汉化修改 66RPG bbschat(2006.1.5)
  6. #    来自 http://rpg.blue/web/
  7. #
  8. #    ●准备工作-窗口Skin
  9. #
  10. #    首先,确认自己使用的对话框窗口Skin,(数据库-系统-窗口外观图形)
  11. #    然后根据该窗口Skin制作对话框尾部使用的两个箭头图形
  12. #    尾部箭头图形命名方式:“窗口skin名-top”,“窗口skin名-under”
  13. #    将该图形文件存放在“Graphics/Windowskins”文件夹下。
  14. #
  15. #    本演示游戏内置2套窗口和箭头图形,
  16. #    一套是游戏默认的“001-Blue01”,一套是定制的“fk”
  17. #    玩家可以根据自己的需要参照样本定制自己的呼出对话框窗口Skin。
  18. #
  19. #    ●呼出对话框使用方法
  20. #
  21. #    在事件命令行使用[脚本]将事件ID代入[$mes_id]
  22. #    该事件就可以使用呼出对话框了。
  23. #   (举例:$mes_id=4)
  24. #
  25. #    ID 代入 -1 表示玩家,代入 0 表示事件自身。
  26. #    代入 nil 或者 "" 则返回成通常的信息窗口。
  27. #    对话框的表示位置可以通过事件的“更改文章选项”来设定(上、中、下)。
  28. #    表示位置为“中央”的话,不管事件位置在哪里,对话框都将显示在画面中央。
  29. #
  30. #    ●角色名字窗口的使用文字的方法
  31. #
  32. #    在事件命令行使用[脚本]将文字列代入[$mes_name]
  33. #    对话框就会显示角色名字窗口
  34. #   (举例:$mes_name="阿尔西斯")
  35. #    代入 nil 或者 "" 则不显示角色名字窗口。
  36. #
  37. #    以上两个机能是独立的,所以可以单独使用
  38. #
  39. #   $mes_id=(ID) + $mes_name="名字"  :呼出对话框显示 + 角色名字窗口
  40. #   $mes_id=(ID) + $mes_name=""      :呼出对话框显示(没有角色名字)
  41. #   $mes_id=nil  + $mes_name="名字"  :默认信息窗口 + 角色名字窗口
  42. #   $mes_id=nil  + $mes_name=""      :默认信息窗口(没有角色名字)
  43. #
  44. #    ●角色名字窗口使用角色图片的方法(汉化特别追加功能,原脚本只能使用文字)
  45. #   
  46. #    如果能在对应文件夹中找到文件名和角色名字相同的图片,   
  47. #    则角色名字窗口显示角色头像图片,角色图片最好能包括角色的名字。
  48. #    默认头像图片保存目录为“Graphics/Heads/”,玩家可自行修改。
  49. #
  50. #    如果不想使用角色名字直接作为头像文件名。
  51. #    可以使用下面在 Game_Temp 类里增加的namebmp属性。
  52. #    重新设定角色名字与文件名的对应关系。
  53. #
  54. #    ●信息表示速度的变更方法
  55. #
  56. #    在事件命令行使用[脚本]将数值代入[$mes_speed]
  57. #    速度为 0 即瞬间显示全部信息,数字越大,信息表示速度越慢。
  58. #   (举例:$mes_speed=1)
  59. #
  60. #    ●其他设置
  61. #
  62. #    请参照下面的注释
  63. #==============================================================================

  64. module FUKI

  65. # 头像图片保存目录的设定
  66. HEAD_PIC_DIR = "Graphics/Heads/"

  67. # 是否显示尾部图标
  68. TAIL_SHOW = true

  69. # Skin的设定
  70. # 使用数据库默认窗口Skin情况下这里使用[""]
  71. FUKI_SKIN_NAME = "001-Blue01"   # 呼出对话框用Skin
  72. NAME_SKIN_NAME = "001-Blue01"   # 角色名字窗口用Skin

  73. # 字体大小
  74. MES_FONT_SIZE = 22    # 呼出对话框
  75. NAME_FONT_SIZE = 14   # 角色名字窗口

  76. # 字体颜色
  77. #(设定为 Color.new(0, 0, 0, 0) 表示使用普通文字色)
  78. FUKI_COLOR = Color.new(255, 255, 255, 255)  # 呼出对话框
  79. NAME_COLOR = Color.new(255, 255, 255, 255)  # 角色名字窗口

  80. # 窗口透明度
  81. # 如修改窗口透明度请同时修改尾部箭头图形内部的透明度
  82. FUKI_OPACITY = 255    # 呼出对话框
  83. MES_OPACITY = 255     # 默认信息窗口
  84. NAME_OPACITY = 255    # 角色名字窗口

  85. # 角色名字窗口的相对位置
  86. NAME_SHIFT_X = 0      # 横坐标
  87. NAME_SHIFT_Y = 16     # 纵坐标

  88. # 窗口表示时是否根据画面大小自动检查窗口出现的位置,
  89. # 自动改变位置( true / false )
  90. # 设置成 true 可能出现箭头图标颠倒的问题 <- bbschat
  91. POS_FIX = false

  92. # 在画面最边缘表示时的稍微挪动
  93. # 使用圆形Skin的角和方框的角重合的情况下为 true
  94. CORNER_SHIFT = false
  95. SHIFT_PIXEL = 4   # true 时挪动的象素

  96. # 角色高度尺寸
  97. CHARACTOR_HEIGHT = 48
  98. # 呼出对话框的相对位置(纵坐标)
  99. POP_SHIFT_TOP = 0         # 表示位置为上的时候
  100. POP_SHIFT_UNDER = 0       # 表示位置为下的时候

  101. # 信息的表示速度(数字越小速度越快,0为瞬间表示)
  102. # 游戏中 可随时用数字代入 $mes_speed 来改变消息表示速度。
  103. MES_SPEED = 1

  104. end

  105. #==============================================================================
  106. # 方便用户同时设置2个常用参数而使用的函数
  107. #==============================================================================
  108. def chat(id = 0,name = "")
  109. $mes_id = id
  110. $mes_name = name
  111. end

  112. #==============================================================================
  113. # □ Game_Temp
  114. #==============================================================================

  115. class Game_Temp
  116. attr_accessor  :namebmp              #保存头像图片的Hash表
  117. alias initialize_fuki initialize
  118. def initialize
  119.    initialize_fuki
  120.    # 如果不想使用角色名字直接作为头像文件名
  121.    # 可在这里重新设定角色名字与文件名的对应关系
  122.    @namebmp ={"玩家"=>"001-Player-Face", "维斯特"=>"002-Player-Face", "大象"=>"003-face"}
  123. end
  124. end

  125. #==============================================================================
  126. # □ Window_FukiMessage
  127. #==============================================================================

  128. class Window_FukiMessage < Window_Selectable

  129. #--------------------------------------------------------------------------
  130. # ● 初始化状态
  131. #--------------------------------------------------------------------------
  132. def initialize
  133.    super(80, 304, 520, 160)
  134.    self.contents = Bitmap.new(width - 32, height - 32)
  135.    self.visible = false
  136.    self.z = 9998
  137.    @fade_in = false
  138.    @fade_out = false
  139.    @contents_showing = false
  140.    @cursor_width = 0
  141.    self.active = false
  142.    self.index = -1
  143.    @w = 0
  144.    @h = 0
  145.    @wait = 0
  146.    @dx = 0
  147.    @dy = 0
  148.    $mes_speed = FUKI::MES_SPEED
  149. end

  150. #--------------------------------------------------------------------------
  151. # ○ 决定窗口尺寸并生成窗口
  152. #--------------------------------------------------------------------------
  153. def refresh_create
  154.    self.contents.clear
  155.    self.contents.font.color = normal_color
  156.    self.contents.font.size = FUKI::MES_FONT_SIZE
  157.    # 取得窗口尺寸
  158.    get_windowsize
  159.    w = @w + 32 + 8
  160.    h = @h * (self.contents.font.size + 10) + 26
  161.    # 生成呼出窗口
  162.    set_fukidasi(self.x, self.y, w, h)
  163.    # 生成角色名字窗口
  164.    set_namewindow
  165.    # 初始化信息表示使用的变量
  166.    @dx = @dy = 0
  167.    @cursor_width = 0
  168.    @contents_drawing = true
  169.    # 瞬间表示的情况下
  170.    if $mes_speed == 0
  171.      # 循环信息描绘处理
  172.      while $game_temp.message_text != ""
  173.        draw_massage
  174.      end
  175.      draw_opt_text
  176.      @contents_showing_end = true
  177.      @contents_drawing = false
  178.    else
  179.      # 一个一个描绘文字
  180.      refresh_drawtext
  181.    end
  182. end

  183. #--------------------------------------------------------------------------
  184. # ○ 一个一个描绘文字
  185. #--------------------------------------------------------------------------
  186. def refresh_drawtext
  187.    if $game_temp.message_text != nil
  188.      if @wait > 0
  189.        @wait -= 1
  190.      elsif @wait == 0
  191.        # 描绘处理
  192.        draw_massage
  193.        @wait = $mes_speed
  194.      end
  195.    end
  196.    # 描绘结束
  197.    if $game_temp.message_text == ""
  198.      draw_opt_text
  199.      @contents_showing_end = true
  200.      @contents_drawing = false
  201.    end
  202. end

  203. #--------------------------------------------------------------------------
  204. # ○ 取得窗口尺寸
  205. #--------------------------------------------------------------------------
  206. def get_windowsize
  207.    x = y = 0
  208.    @h = @w = 0
  209.    @cursor_width = 0
  210.    # 有选择项的话,处理字的缩进
  211.    if $game_temp.choice_start == 0
  212.      x = 16
  213.    end
  214.    # 有等待显示的文字的情况下
  215.    if $game_temp.message_text != nil
  216.    text = $game_temp.message_text.clone
  217.      # 限制文字处理
  218.      begin
  219.        last_text = text.clone
  220.        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  221.      end until text == last_text
  222.      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  223.        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  224.      end
  225.      # 为了方便、将 "\\\\" 变换为 "\000"
  226.      text.gsub!(/\\\\/) { "\000" }
  227.      # "\\C" 变为 "\001" 、"\\G" 变为 "\002"
  228.      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001" }
  229.      text.gsub!(/\\[Gg]/) { "\002" }
  230.      # c 获取 1 个字 (如果不能取得文字就循环)
  231.      while ((c = text.slice!(/./m)) != nil)
  232.        # \\ 的情况下
  233.        if c == "\000"
  234.          # 还原为本来的文字
  235.          c = "\\"
  236.        end
  237.        # \C[n] 或者 \G 的情况下
  238.        if c == "\001" or c == "\002"
  239.          # 下面的文字
  240.          next
  241.        end
  242.        # 另起一行文字的情况下
  243.        if c == "\n"
  244.          # y 累加 1
  245.          y += 1
  246.          # 取得纵横尺寸
  247.          @h = y
  248.          @w = x > @w ? x : @w
  249.          if y >= $game_temp.choice_start
  250.            @w = x + 8 > @w ? x + 8 : @w
  251.          end
  252.          x = 0
  253.          # 移动到选择项的下一行
  254.          if y >= $game_temp.choice_start
  255.            x = 8
  256.          end
  257.          # 下面的文字
  258.          next
  259.        end
  260.        # x 为要描绘文字的宽度加法运算
  261.        x += self.contents.text_size(c).width
  262.      end
  263.    end
  264.    # 输入数值的情况
  265.    if $game_temp.num_input_variable_id > 0
  266.      digits_max = $game_temp.num_input_digits_max
  267.      number = $game_variables[$game_temp.num_input_variable_id]
  268.      @h += 1
  269.      x = digits_max * self.contents.font.size + 16
  270.      @w = x > @w ? x : @w
  271.    end
  272. end

  273. #--------------------------------------------------------------------------
  274. # ○ 描绘信息处理
  275. #--------------------------------------------------------------------------
  276. def draw_massage
  277.    # 有等待显示的文字的情况下
  278.    if $game_temp.message_text != nil
  279.      text = $game_temp.message_text
  280.      # 限制文字处理
  281.      begin
  282.        last_text = text.clone
  283.        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  284.      end until text == last_text
  285.      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  286.        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  287.      end
  288.      # 为了方便、将 "\\\\" 变换为 "\000"
  289.      text.gsub!(/\\\\/) { "\000" }
  290.      # "\\C" 变为 "\001"、"\\G" 变为 "\002"
  291.      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  292.      text.gsub!(/\\[Gg]/) { "\002" }
  293.      # c 获取 1 个字
  294.      if ((c = text.slice!(/./m)) != nil)
  295.        # 选择项的情况
  296.        if @dy >= $game_temp.choice_start
  297.          # 处理字的缩进
  298.          @dx = 8
  299.          # 描绘文字
  300.          self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  301.          # x 为要描绘文字宽度的加法运算
  302.          @dx += self.contents.text_size(c).width
  303.          # 循环
  304.          while ((c = text.slice!(/./m)) != "\n")
  305.            # 描绘文字
  306.            self.contents.draw_text(4 + @dx, 32 * @dy, 40, 32, c)
  307.            # x 为要描绘文字宽度的加法运算
  308.            @dx += self.contents.text_size(c).width
  309.          end
  310.          if c == "\n"
  311.            # 更新光标宽度
  312.            @cursor_width = [@cursor_width, @dx].max
  313.            # dy 累加 1
  314.            @dy += 1
  315.            @dx = 0
  316.          end
  317.          return
  318.        end
  319.        # \\ 的情况下
  320.        if c == "\000"
  321.          # 还原为本来的文字
  322.          c = "\\"
  323.        end
  324.        #\C[n] 的情况下
  325.        if c == "\001"
  326.          # 更改文字色
  327.          text.sub!(/\[([0-9]+)\]/, "")
  328.          color = $1.to_i
  329.          if color >= 0 and color <= 7
  330.            self.contents.font.color = text_color(color)
  331.          end
  332.        end
  333.        # \G 的情况下
  334.        if c == "\002"
  335.          # 生成金钱窗口
  336.          if @gold_window == nil
  337.            @gold_window = Window_Gold.new
  338.            @gold_window.x = 560 - @gold_window.width
  339.            if $game_temp.in_battle
  340.              @gold_window.y = 192
  341.            else
  342.              @gold_window.y = self.y >= 128 ? 32 : 384
  343.            end
  344.            @gold_window.opacity = self.opacity
  345.            @gold_window.back_opacity = self.back_opacity
  346.          end
  347.        end
  348.        # 另起一行文字的情况下
  349.        if c == "\n"
  350.          # dy 累加 1
  351.          @dy += 1
  352.          @dx = 0
  353.        end
  354.        # 描绘文字
  355.        self.contents.font.size = FUKI::MES_FONT_SIZE
  356.        font_size = self.contents.font.size
  357.        self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  358.        # dx 为要描绘文字的宽度加法运算
  359.        @dx += self.contents.text_size(c).width
  360.      end
  361.    end
  362. end

  363. #--------------------------------------------------------------------------
  364. # ○ 选择项和输入数值的情况下
  365. #--------------------------------------------------------------------------
  366. def draw_opt_text
  367.    # 选择项的情况下
  368.    if $game_temp.choice_max > 0
  369.      @item_max = $game_temp.choice_max
  370.      self.active = true
  371.      self.index = 0
  372.    end
  373.    # 输入数值的情况下
  374.    if $game_temp.num_input_variable_id > 0
  375.      digits_max = $game_temp.num_input_digits_max
  376.      number = $game_variables[$game_temp.num_input_variable_id]
  377.      @input_number_window = Window_InputNumber.new(digits_max)
  378.      @input_number_window.number = number
  379.      @input_number_window.x = self.x + 8
  380.      @input_number_window.y = self.y + $game_temp.num_input_start * 32
  381.    end
  382. end

  383. #--------------------------------------------------------------------------
  384. # ○ 设置呼出对话框
  385. #--------------------------------------------------------------------------
  386. def set_fukidasi(x, y, width, height)
  387.    # $mes_id 为空的时候,不显示呼出对话框
  388.    if $mes_id == nil or $mes_id == ""
  389.      del_fukidasi
  390.      reset_window
  391.    else
  392.      # 不显示暂停标志
  393.      self.pause = false
  394.      # 取得对话框位置
  395.      pos = get_fuki_pos(width, height)
  396.      x = pos[0]
  397.      y = pos[1]
  398.      skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  399.      # 生成呼出对话框
  400.      self.windowskin = RPG::Cache.windowskin(skin)
  401.      self.x = x
  402.      self.y = y
  403.      self.height = height
  404.      self.width = width
  405.      self.contents.dispose
  406.      self.contents = Bitmap.new(width - 32, height - 32)
  407.      self.back_opacity = FUKI::FUKI_OPACITY
  408.      self.contents.clear
  409.      self.contents.font.color = normal_color
  410.      self.contents.font.size = FUKI::MES_FONT_SIZE
  411.      # 描绘尾部图标
  412.      if $game_system.message_frame == 0
  413.        # 取得位置
  414.        tale_pos = get_tale_pos
  415.        @tale = Sprite.new
  416.        # 是否显示尾部图标 <- bbschat
  417.        if FUKI::TAIL_SHOW == true
  418.          case @message_position
  419.            when 0  # 上
  420.              @tale.bitmap = RPG::Cache.windowskin(skin + "-top")
  421.              @tale.x = tale_pos[0]
  422.              @tale.y = tale_pos[1]
  423.              @tale.z = self.z + 1
  424.            when 1  # 中
  425.              @tale.dispose
  426.              @tale = nil
  427.            when 2  # 下
  428.              @tale.bitmap = RPG::Cache.windowskin(skin + "-under")
  429.              @tale.x = tale_pos[0]
  430.              @tale.y = tale_pos[1]
  431.              @tale.z = self.z + 1
  432.          end
  433.        end
  434.      end
  435.    end
  436. end

  437. #--------------------------------------------------------------------------
  438. # ○ 计算呼出对话框的位置
  439. #--------------------------------------------------------------------------
  440. def get_fuki_pos(width, height)
  441.    
  442.    # 取得角色
  443.    @character = get_character($mes_id)
  444.    if @character == nil
  445.      # 角色不存在的情况下使用默认信息框
  446.      del_fukidasi
  447.      reset_window
  448.      return
  449.    end
  450.    # 处理坐标
  451.    x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  452.    # 为尽量显示在画面内而移动横坐标
  453.    if x + width > 640
  454.      x = 640 - width
  455.    elsif x < 0
  456.      x = 0
  457.    end
  458.    # 决定窗口位置
  459.    case $game_system.message_position
  460.      when 0  # 上
  461.        y = (@character.real_y - $game_map.display_y + 64) * 28 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  462.      when 1  # 中
  463.        y = (520 - height) / 2
  464.        x = (640 - width) / 2
  465.      when 2  # 下
  466.        y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  467.    end
  468.    # 纪录文章显示位置
  469.    @message_position = $game_system.message_position
  470.    # 如果选择自动修正,则如果文章会显示到画面外则自动改变窗口的尺寸(高度)
  471.    if FUKI::POS_FIX
  472.      case @message_position
  473.        when 0  # 上
  474.          if y <= 0
  475.            @message_position = 2
  476.            y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  477.          end
  478.        when 2  # 下
  479.          if y + height >= 520
  480.            p "上"
  481.            @message_position = 0
  482.            y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  483.          end
  484.      end
  485.    end
  486.    return [x,y]
  487.    
  488. end

  489. #--------------------------------------------------------------------------
  490. # ○ 计算尾部图标的位置
  491. #--------------------------------------------------------------------------
  492. def get_tale_pos
  493.    case @message_position
  494.      when 0  # 上
  495.        # 处理坐标
  496.        x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  497.        # 画面边缘的话则移动位置
  498.        if FUKI::CORNER_SHIFT
  499.          if x == 0
  500.            x = FUKI::SHIFT_PIXEL
  501.          elsif x == 640 - 32
  502.            x = 640 - 32 - FUKI::SHIFT_PIXEL
  503.          end
  504.        end
  505.        y = self.y + self.height - 16
  506.      when 1  # 中
  507.        x = nil
  508.        y = nil
  509.      when 2  # 下
  510.        # 处理坐标
  511.        x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  512.        # 画面边缘的话则移动位置
  513.        if FUKI::CORNER_SHIFT
  514.          if x == 0
  515.            x = FUKI::SHIFT_PIXEL
  516.          elsif @tale.x == 640 - 32
  517.            x = 640 - 32 - FUKI::SHIFT_PIXEL
  518.          end
  519.        end
  520.        y = self.y - 16
  521.    end
  522.    return [x,y]
  523. end

  524. #--------------------------------------------------------------------------
  525. # ○ 计算名字窗口的位置
  526. #--------------------------------------------------------------------------
  527. def get_name_pos
  528.    case @face_pic_txt
  529.      when 0  # 文字
  530.        x = self.x + FUKI::NAME_SHIFT_X
  531.        y = self.y - FUKI::NAME_FONT_SIZE - 16 + FUKI::NAME_SHIFT_Y
  532.      when 1  # 图片
  533.        if self.x >= @pic_width + 5
  534.          # 默认头像显示在对话框左边
  535.          x = self.x-@pic_width-5
  536.        else
  537.          # 对话框左边放不下时头像显示在右边
  538.          x = self.x + self.width
  539.        end
  540.        y = self.y+self.height/2 - (@pic_height + 5)/2
  541.      end

  542.    return [x,y]
  543. end

  544. #--------------------------------------------------------------------------
  545. # ○ 设置角色名字窗口
  546. #--------------------------------------------------------------------------
  547. def set_namewindow
  548.    
  549.    # $mes_name为空时不显示角色名字窗口
  550.    if $mes_name == nil or $mes_name == ""
  551.      return
  552.    else
  553.      # 设定变量
  554.      mes_name = $mes_name
  555.      skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  556.      
  557.      #判断名称是否有对应的图片"Graphics/heads/" +
  558.      if $game_temp.namebmp[mes_name] == nil then
  559.        sFile = "Graphics/heads/" + mes_name + ".png"
  560.      else
  561.        sFile = "Graphics/heads/" + $game_temp.namebmp[mes_name] + ".png"
  562.      end
  563.      
  564.      if FileTest.exist?(sFile) == true then
  565.       
  566.        @face_pic_txt = 1                       #名字窗口使用头像<- bbschat
  567.       
  568.        # 生成头像
  569.        bmp = Bitmap.new(sFile)
  570.        @pic_width = bmp.width
  571.        @pic_height = bmp.height
  572.       
  573.        if self.x >= @pic_width + 5
  574.          # 默认头像显示在对话框左边
  575.          name_x = self.x-@pic_width-5
  576.        else
  577.          # 对话框左边放不下时头像显示在右边
  578.          name_x = self.x + self.width
  579.        end
  580.        name_y = self.y+self.height/2 - (@pic_height + 5)/2
  581.       
  582.        # 生成角色头像窗口
  583.        @name_win = Window_Base.new(name_x, name_y, @pic_width + 5, @pic_height + 5)
  584.        @name_win.windowskin = RPG::Cache.windowskin(skin)
  585.        @name_win.back_opacity =0     
  586.        @name_win.z = self.z + 1
  587.       
  588.        @name_contents = Sprite.new
  589.        @name_contents.x = name_x + 2
  590.        @name_contents.y = name_y + 2
  591.        @name_contents.bitmap = bmp
  592.        #@name_contents.z = @name_win.z + 2     #这个用了似乎效果不好<- bbschat
  593.       
  594.      else
  595.       
  596.        @face_pic_txt = 0                       #名字窗口使用文字<- bbschat

  597.        # 生成名字
  598.        name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
  599.        name_height = FUKI::NAME_FONT_SIZE
  600.        name_x = self.x + FUKI::NAME_SHIFT_X
  601.        name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y

  602.        # 生成角色名字窗口(只有边框)
  603.        @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
  604.        @name_win.windowskin = RPG::Cache.windowskin(skin)
  605.        @name_win.back_opacity = FUKI::NAME_OPACITY
  606.        @name_win.z = self.z + 1
  607.       
  608.        # 为了使空白比Windows类限定的更小使用双重结构
  609.        @name_contents = Sprite.new
  610.        @name_contents.x = name_x + 12
  611.        @name_contents.y = name_y + 8
  612.        @name_contents.bitmap = Bitmap.new(name_width, name_height)
  613.        @name_contents.z = @name_win.z + 2
  614.       
  615.        # 设定文字色
  616.        nil_color = Color.new(0,0,0,0)
  617.        if FUKI::NAME_COLOR != nil_color
  618.          @name_contents.bitmap.font.color = FUKI::NAME_COLOR
  619.        else
  620.          @name_contents.bitmap.font.color = normal_color
  621.        end
  622.        @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
  623.        # 调整窗口尺寸
  624.        rect = @name_contents.bitmap.text_size(mes_name)
  625.        @name_win.width = rect.width + 32
  626.        # 描画名字
  627.        @name_contents.bitmap.draw_text(rect, mes_name)
  628.      end
  629.    end

  630. end

  631. #--------------------------------------------------------------------------
  632. # ○ 释放呼出对话框和角色名字窗口
  633. #--------------------------------------------------------------------------
  634. def del_fukidasi
  635.    if @tale != nil
  636.      @tale.dispose
  637.      @tale = nil
  638.    end
  639.    if @name_win != nil
  640.      @name_win.dispose
  641.      @name_win = nil
  642.      @name_contents.dispose
  643.      @name_contents = nil
  644.    end
  645.    self.opacity = 0
  646.    self.x = 80
  647.    self.width = 520
  648.    self.height = 160
  649.    self.contents.dispose
  650.    self.contents = Bitmap.new(width - 32, height - 32)
  651.    self.pause = true
  652. end

  653. #--------------------------------------------------------------------------
  654. # ○ 取得角色
  655. #     parameter : 参数
  656. #--------------------------------------------------------------------------
  657. def get_character(parameter)
  658.   # 参数分歧
  659.   case parameter
  660.   when -1  # 玩家
  661.     return $game_player
  662.   when 0   # 该事件
  663.     events = $game_map.events
  664.     return events == nil ? nil : events[$active_event_id]
  665.   else     # 特定事件
  666.     if parameter >0
  667.       events = $game_map.events
  668.       return events == nil ? nil : events[parameter]
  669.     else
  670.       $game_party.return_char(-parameter-2)
  671.     end
  672.   end
  673. end

  674. #--------------------------------------------------------------------------
  675. # ● 设定窗口位置和不透明度
  676. #--------------------------------------------------------------------------
  677. def reset_window
  678.    if $game_temp.in_battle
  679.      self.y = 16
  680.    else
  681.      case $game_system.message_position
  682.      when 0  # 上
  683.        self.y = 16
  684.      when 1  # 中
  685.        self.y = 200
  686.      when 2  # 下
  687.        self.y = 304
  688.      end
  689.    end
  690.    if $game_system.message_frame == 0
  691.      self.opacity = 255
  692.    else
  693.      self.opacity = 0
  694.    end
  695.    self.back_opacity = FUKI::MES_OPACITY
  696. end

  697. #--------------------------------------------------------------------------
  698. # ● 刷新画面
  699. #--------------------------------------------------------------------------
  700. def update
  701.    super
  702.    # 呼出模式下跟随事件移动
  703.    if @tale != nil
  704.      pos = get_fuki_pos(self.width, self.height)
  705.      self.x = pos[0]
  706.      self.y = pos[1]

  707.      tale_pos = get_tale_pos
  708.      @tale.x = tale_pos[0]
  709.      @tale.y = tale_pos[1]
  710.      
  711.      if @name_win != nil
  712.        name_pos = get_name_pos
  713.        @name_win.x = name_pos[0]
  714.        @name_win.y = name_pos[1]
  715.        case @face_pic_txt
  716.          when 0  # 文字
  717.            @name_contents.x = @name_win.x + 12
  718.            @name_contents.y = @name_win.y + 8
  719.          when 1  # 图片
  720.            @name_contents.x = @name_win.x + 2
  721.            @name_contents.y = @name_win.y + 2
  722.          end
  723.      end
  724.    end
  725.    
  726.    # 渐变的情况下
  727.    if @fade_in
  728.      self.contents_opacity += 24
  729.      if @name_win != nil
  730.        @name_win.opacity += 24
  731.      end
  732.      if @tale != nil
  733.        @tale.opacity += 24
  734.      end
  735.      if @input_number_window != nil
  736.        @input_number_window.contents_opacity += 24
  737.      end
  738.      if self.contents_opacity == 255
  739.        @fade_in = false
  740.      end
  741.      return
  742.    end
  743.    # 显示信息中的情况下
  744.    if @contents_drawing
  745.      refresh_drawtext
  746.      return
  747.    end
  748.    # 输入数值的情况下
  749.    if @input_number_window != nil
  750.      @input_number_window.update
  751.      # 确定
  752.      if Input.trigger?(Input::C)
  753.        $game_system.se_play($data_system.decision_se)
  754.        $game_variables[$game_temp.num_input_variable_id] =
  755.          @input_number_window.number
  756.        $game_map.need_refresh = true
  757.        # 释放输入数值窗口
  758.        @input_number_window.dispose
  759.        @input_number_window = nil
  760.        terminate_message
  761.      end
  762.      return
  763.    end
  764.    # 显示信息结束的情况下
  765.    if @contents_showing_end
  766.      # 不是显示选择项且不是呼出对话模式则显示暂停标志
  767.      if $game_temp.choice_max == 0 and @tale == nil
  768.        self.pause = true
  769.      else
  770.        self.pause = false
  771.      end
  772.      # 取消
  773.      if Input.trigger?(Input::B)
  774.        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  775.          $game_system.se_play($data_system.cancel_se)
  776.          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  777.          terminate_message
  778.        end
  779.      end
  780.      # 确定
  781.      if Input.trigger?(Input::C)
  782.        if $game_temp.choice_max > 0
  783.          $game_system.se_play($data_system.decision_se)
  784.          $game_temp.choice_proc.call(self.index)
  785.        end
  786.        terminate_message
  787.        # 释放呼出窗口
  788.        del_fukidasi
  789.      end
  790.      return
  791.    end
  792.    # 在渐变以外的状态下有等待显示的信息与选择项的场合
  793.    if @fade_out == false and $game_temp.message_text != nil
  794.      @contents_showing = true
  795.      $game_temp.message_window_showing = true
  796.      reset_window
  797.      refresh_create
  798.      if @name_win != nil
  799.        @name_win.opacity = 0
  800.      end
  801.      if @tale != nil
  802.        @tale.opacity = 0
  803.      end
  804.      Graphics.frame_reset
  805.      self.visible = true
  806.      self.contents_opacity = 0
  807.      if @input_number_window != nil
  808.        @input_number_window.contents_opacity = 0
  809.      end
  810.      @fade_in = true
  811.      return
  812.    end
  813.    # 没有可以显示的信息、但是窗口为可见的情况下
  814.    if self.visible
  815.      @fade_out = true
  816.      self.opacity -= 48
  817.      if @name_win != nil
  818.        @name_win.opacity -= 48
  819.      end
  820.      if @tale != nil
  821.        @tale.opacity -= 48
  822.      end
  823.      if self.opacity == 0
  824.        self.visible = false
  825.        @fade_out = false
  826.        $game_temp.message_window_showing = false
  827.        del_fukidasi
  828.      end
  829.      return
  830.    end
  831. end

  832. #--------------------------------------------------------------------------
  833. # ● 释放
  834. #--------------------------------------------------------------------------
  835. def dispose
  836.    terminate_message
  837.    $game_temp.message_window_showing = false
  838.    if @input_number_window != nil
  839.      @input_number_window.dispose
  840.    end
  841.    super
  842. end

  843. #--------------------------------------------------------------------------
  844. # ● 信息结束处理
  845. #--------------------------------------------------------------------------
  846. def terminate_message
  847.    self.active = false
  848.    self.pause = false
  849.    self.index = -1
  850.    self.contents.clear
  851.    # 清除显示中标志
  852.    @contents_showing = false
  853.    @contents_showing_end = false
  854.    # 呼叫信息调用
  855.    if $game_temp.message_proc != nil
  856.      $game_temp.message_proc.call
  857.    end
  858.    # 清除文章、选择项、输入数值的相关变量
  859.    $game_temp.message_text = nil
  860.    $game_temp.message_proc = nil
  861.    $game_temp.choice_start = 99
  862.    $game_temp.choice_max = 0
  863.    $game_temp.choice_cancel_type = 0
  864.    $game_temp.choice_proc = nil
  865.    $game_temp.num_input_start = 99
  866.    $game_temp.num_input_variable_id = 0
  867.    $game_temp.num_input_digits_max = 0
  868.    # 释放金钱窗口
  869.    if @gold_window != nil
  870.      @gold_window.dispose
  871.      @gold_window = nil
  872.    end
  873. end

  874. #--------------------------------------------------------------------------
  875. # ● 刷新光标矩形
  876. #--------------------------------------------------------------------------
  877. def update_cursor_rect
  878.    if @index >= 0
  879.      n = $game_temp.choice_start + @index
  880.      self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  881.    else
  882.      self.cursor_rect.empty
  883.    end
  884. end
  885. #--------------------------------------------------------------------------
  886. # ● 取得普通文字色
  887. #--------------------------------------------------------------------------
  888. def normal_color
  889.    nil_color = Color.new(0,0,0,0)
  890.    if FUKI::FUKI_COLOR != nil_color
  891.      color = FUKI::FUKI_COLOR
  892.    else
  893.      color = super
  894.    end
  895.    return color
  896. end
  897. end

  898. #==============================================================================
  899. # ■ Interpreter
  900. #==============================================================================

  901. class Interpreter
  902. #--------------------------------------------------------------------------
  903. # ● 设置事件
  904. #     event_id : 事件 ID
  905. #--------------------------------------------------------------------------
  906. alias setup_fuki setup
  907. def setup(list, event_id)
  908.    setup_fuki(list, event_id)
  909.    # 如果不是战斗中
  910.    if !($game_temp.in_battle)
  911.      # 记录事件 ID
  912.      $active_event_id = event_id
  913.    end
  914. end
  915. end

  916. #==============================================================================
  917. # ■ Scene_Map
  918. #==============================================================================

  919. class Scene_Map
  920. #--------------------------------------------------------------------------
  921. # ● 主处理
  922. #--------------------------------------------------------------------------
  923. def main
  924.    # 生成活动块
  925.    @spriteset = Spriteset_Map.new
  926.    # 生成信息窗口
  927.    @message_window = Window_FukiMessage.new
  928.    # 执行过渡
  929.    Graphics.transition
  930.    # 主循环
  931.    loop do
  932.      # 刷新游戏画面
  933.      Graphics.update
  934.      # 刷新输入信息
  935.      Input.update
  936.      # 刷新画面
  937.      update
  938.      # 如果画面切换的话就中断循环
  939.      if $scene != self
  940.        break
  941.      end
  942.    end
  943.    # 准备过渡
  944.    Graphics.freeze
  945.    # 释放活动块
  946.    @spriteset.dispose
  947.    # 释放信息窗口
  948.    @message_window.dispose
  949.    # 标题画面切换中的情况下
  950.    if $scene.is_a?(Scene_Title)
  951.      # 淡入淡出画面
  952.      Graphics.transition
  953.      Graphics.freeze
  954.    end
  955. end
  956. end

  957. #==============================================================================
  958. # ■ Window_InputNumber
  959. #==============================================================================

  960. class Window_InputNumber < Window_Base
  961. #--------------------------------------------------------------------------
  962. # ● 初始化对像
  963. #     digits_max : 位数
  964. #--------------------------------------------------------------------------
  965. def initialize(digits_max)
  966.    @digits_max = digits_max
  967.    @number = 0
  968.    # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
  969.    dummy_bitmap = Bitmap.new(32, 32)
  970.    dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
  971.    @cursor_width = dummy_bitmap.text_size("0").width + 8
  972.    dummy_bitmap.dispose
  973.    super(0, 0, @cursor_width * @digits_max + 32, 64)
  974.    self.contents = Bitmap.new(width - 32, height - 32)
  975.    self.contents.font.size = FUKI::MES_FONT_SIZE
  976.    self.z += 9999
  977.    self.opacity = 0
  978.    @index = 0
  979.    refresh
  980.    update_cursor_rect
  981. end
  982. end
复制代码


此贴于 2008-7-14 0:10:53 被版主darkten提醒,请楼主看到后对本贴做出回应。
版务信息:本贴由楼主自主结贴~

Lv1.梦旅人

梦石
0
星屑
50
在线时间
16 小时
注册时间
2008-5-11
帖子
318
2
发表于 2008-7-8 22:30:24 | 只看该作者
不行
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2008-7-9
帖子
154
3
发表于 2008-7-12 00:05:55 | 只看该作者
一个对话要那么多字干嘛?其实完全可以分两次说嘛!或者用读报系统……
《魔幻石奇迹》试玩版1.1 http://rpg.blue/forumTopicR ... 1%2D15+17%3A05%3A16 第一款游戏,做得不尽完善,请发现BUG及时指出!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
1 小时
注册时间
2008-2-12
帖子
56
4
发表于 2008-7-14 18:19:48 | 只看该作者
http://rpg.blue/web/htm/news827.htm
看看这个
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
请认可我的答案,不要自主结贴就走啊
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2008-4-13
帖子
771
5
发表于 2008-7-14 18:21:02 | 只看该作者
一次多行?
除非你去修改RMXP的程序而不是找脚本
我,南歌,回6R啦!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

奇情异士

梦石
0
星屑
50
在线时间
287 小时
注册时间
2006-7-5
帖子
3457

贵宾第6届短篇游戏比赛亚军

6
发表于 2008-7-14 18:21:36 | 只看该作者
http://rpg.blue/web/htm/news589.htm

——即使有可能会失去性命,
但也不会影响我以自己的意志成为英雄。

新时代R剧《被英雄》发布:
http://rpg.blue/thread-184410-1-1.html

博客地址

橡让作品合集(2007-2010)
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-8-8 19:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表