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

Project1

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

[已经解决] 如何改对话框并添加头像(已解决)

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
10 小时
注册时间
2013-2-1
帖子
6
跳转到指定楼层
1
发表于 2015-2-5 22:38:39 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 qch1113 于 2015-2-6 15:46 编辑

请问怎么把对话框弄成这种类型的,并且添加头像?

aaa.jpg (80.46 KB, 下载次数: 5)

aaa.jpg

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1089 小时
注册时间
2014-5-9
帖子
504
2
发表于 2015-2-6 11:36:49 | 只看该作者
1、换个窗口图案。
2、用显示图片的方法显示头像。(X/Y 需要调整)
已填坑作品:唤灵师1,唤灵师2-魔灵大陆,唤灵师3-莉娜丝的吊坠。破晓,傲歌。
填坑中作品:三国梦,罗亚大陆之雇佣兵团
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
155
在线时间
332 小时
注册时间
2013-7-6
帖子
356
3
发表于 2015-2-6 13:40:17 | 只看该作者
本帖最后由 wolves 于 2015-2-6 13:41 编辑
  1. #==============================================================================
  2. # ■ Window_Message
  3. #------------------------------------------------------------------------------
  4. #  显示文章的信息窗口。
  5. #==============================================================================

  6. class Window_Message < Window_Selectable
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化状态
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(-10, 304, 660, 115)#改
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     self.visible = false
  14.     self.z = 9998
  15.     @fade_in = false
  16.     @fade_out = false
  17.     @contents_showing = false
  18.     @cursor_width = 0
  19.     self.active = false
  20.     self.index = -1
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 释放
  24.   #--------------------------------------------------------------------------
  25.   def dispose
  26.     terminate_message
  27.     $game_temp.message_window_showing = false
  28.     if @input_number_window != nil
  29.       @input_number_window.dispose
  30.     end
  31.     super
  32.   end
  33.   #--------------------------------------------------------------------------
  34.   # ● 处理信息结束
  35.   #--------------------------------------------------------------------------
  36.   def terminate_message
  37.     self.active = false
  38.     self.pause = false
  39.     self.index = -1
  40.     self.contents.clear
  41.     # 清除显示中标志
  42.     @contents_showing = false
  43.     # 呼叫信息调用
  44.     if $game_temp.message_proc != nil
  45.       $game_temp.message_proc.call
  46.     end
  47.     # 清除文章、选择项、输入数值的相关变量
  48.     $game_temp.message_text = nil
  49.     $game_temp.message_proc = nil
  50.     $game_temp.choice_start = 99
  51.     $game_temp.choice_max = 0
  52.     $game_temp.choice_cancel_type = 0
  53.     $game_temp.choice_proc = nil
  54.     $game_temp.num_input_start = 99
  55.     $game_temp.num_input_variable_id = 0
  56.     $game_temp.num_input_digits_max = 0
  57.     # 开放金钱窗口
  58.     if @gold_window != nil
  59.       @gold_window.dispose
  60.       @gold_window = nil
  61.     end
  62.   end
  63.   #--------------------------------------------------------------------------
  64.   # ● 刷新
  65.   #--------------------------------------------------------------------------
  66.   def refresh
  67.     self.contents.clear
  68.     self.contents.font.color = normal_color
  69.     x = y = 0
  70.     @cursor_width = 0
  71.     # 到选择项的下一行字
  72.     if $game_temp.choice_start == 0
  73.       x = 8
  74.     end
  75.     # 有等待显示的文字的情况下
  76.     if $game_temp.message_text != nil
  77.       text = $game_temp.message_text
  78.       # 限制文字处理
  79.       begin
  80.         last_text = text.clone
  81.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  82.       end until text == last_text
  83.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  84.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  85.       end
  86.       # 为了方便、将 "\\\\" 变换为 "\000"
  87.       text.gsub!(/\\\\/) { "\000" }
  88.       # "\\C" 变为 "\001" 将
  89.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  90.       # "\\G" 变为 "\002"
  91.       text.gsub!(/\\[Gg]/) { "\002" }
  92.       # c 获取 1 个字 (如果不能取得文字就循环)
  93.       while ((c = text.slice!(/./m)) != nil)
  94.         # \\ 的情况下
  95.         if c == "\000"
  96.           # 还原为本来的文字
  97.           c = "\\"
  98.         end
  99.         # \C[n] 的情况下
  100.         if c == "\001"
  101.           # 更改文字色
  102.           text.sub!(/\[([0-9]+)\]/, "")
  103.           color = $1.to_i
  104.           if color >= 0 and color <= 7
  105.             self.contents.font.color = text_color(color)
  106.           end
  107.           # 下面的文字
  108.           next
  109.         end
  110.         # \G 的情况下
  111.         if c == "\002"
  112.           # 生成金钱窗口
  113.           if @gold_window == nil
  114.             @gold_window = Window_Gold.new
  115.             @gold_window.x = 560 - @gold_window.width
  116.             if $game_temp.in_battle
  117.               @gold_window.y = 192
  118.             else
  119.               @gold_window.y = self.y >= 128 ? 32 : 384
  120.             end
  121.             @gold_window.opacity = self.opacity
  122.             @gold_window.back_opacity = self.back_opacity
  123.           end
  124.           # 下面的文字
  125.           next
  126.         end
  127.         # 另起一行文字的情况下
  128.         if c == "\n"
  129.           # 刷新选择项及光标的高
  130.           if y >= $game_temp.choice_start
  131.             @cursor_width = [@cursor_width, x].max
  132.           end
  133.           # y 加 1
  134.           y += 1
  135.           x = 0
  136.           # 移动到选择项的下一行
  137.           if y >= $game_temp.choice_start
  138.             x = 8
  139.           end
  140.           # 下面的文字
  141.           next
  142.         end
  143.         # 描绘文字
  144.         self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
  145.         # x 为要描绘文字的加法运算
  146.         x += self.contents.text_size(c).width
  147.       end
  148.     end
  149.     # 选择项的情况
  150.     if $game_temp.choice_max > 0
  151.       @item_max = $game_temp.choice_max
  152.       self.active = true
  153.       self.index = 0
  154.     end
  155.     # 输入数值的情况
  156.     if $game_temp.num_input_variable_id > 0
  157.       digits_max = $game_temp.num_input_digits_max
  158.       number = $game_variables[$game_temp.num_input_variable_id]
  159.       @input_number_window = Window_InputNumber.new(digits_max)
  160.       @input_number_window.number = number
  161.       @input_number_window.x = self.x + 8
  162.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  163.     end
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # ● 设置窗口位置与不透明度
  167.   #--------------------------------------------------------------------------
  168.   def reset_window
  169.     if $game_temp.in_battle
  170.       self.y = 16
  171.     else
  172.       case $game_system.message_position
  173.       when 0  # 上
  174.         self.y = 0
  175.       when 1  # 中
  176.         self.y = 160
  177.       when 2  # 下
  178.         self.y = 367 #改
  179.       end
  180.     end
  181.     if $game_system.message_frame == 0
  182.       self.opacity = 255
  183.     else
  184.       self.opacity = 0
  185.     end
  186.     self.back_opacity = 160
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 刷新画面
  190.   #--------------------------------------------------------------------------
  191.   def update
  192.     super
  193.     # 渐变的情况下
  194.     if @fade_in
  195.       self.contents_opacity += 24
  196.       if @input_number_window != nil
  197.         @input_number_window.contents_opacity += 24
  198.       end
  199.       if self.contents_opacity == 255
  200.         @fade_in = false
  201.       end
  202.       return
  203.     end
  204.     # 输入数值的情况下
  205.     if @input_number_window != nil
  206.       @input_number_window.update
  207.       # 确定
  208.       if Input.trigger?(Input::C)
  209.         $game_system.se_play($data_system.decision_se)
  210.         $game_variables[$game_temp.num_input_variable_id] =
  211.           @input_number_window.number
  212.         $game_map.need_refresh = true
  213.         # 释放输入数值窗口
  214.         @input_number_window.dispose
  215.         @input_number_window = nil
  216.         terminate_message
  217.       end
  218.       return
  219.     end
  220.     # 显示信息中的情况下
  221.     if @contents_showing
  222.       # 如果不是在显示选择项中就显示暂停标志
  223.       if $game_temp.choice_max == 0
  224.         self.pause = true
  225.       end
  226.       # 取消
  227.       if Input.trigger?(Input::B)
  228.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  229.           $game_system.se_play($data_system.cancel_se)
  230.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  231.           terminate_message
  232.         end
  233.       end
  234.       # 确定
  235.       if Input.trigger?(Input::C)
  236.         if $game_temp.choice_max > 0
  237.           $game_system.se_play($data_system.decision_se)
  238.           $game_temp.choice_proc.call(self.index)
  239.         end
  240.         terminate_message
  241.       end
  242.       return
  243.     end
  244.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  245.     if @fade_out == false and $game_temp.message_text != nil
  246.       @contents_showing = true
  247.       $game_temp.message_window_showing = true
  248.       reset_window
  249.       refresh
  250.       Graphics.frame_reset
  251.       self.visible = true
  252.       self.contents_opacity = 0
  253.       if @input_number_window != nil
  254.         @input_number_window.contents_opacity = 0
  255.       end
  256.       @fade_in = true
  257.       return
  258.     end
  259.     # 没有可以显示的信息、但是窗口为可见的情况下
  260.     if self.visible
  261.       @fade_out = true
  262.       self.opacity -= 48
  263.       if self.opacity == 0
  264.         self.visible = false
  265.         @fade_out = false
  266.         $game_temp.message_window_showing = false
  267.       end
  268.       return
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● 刷新光标矩形
  273.   #--------------------------------------------------------------------------
  274.   def update_cursor_rect
  275.     if @index >= 0
  276.       n = $game_temp.choice_start + @index
  277.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  278.     else
  279.       self.cursor_rect.empty
  280.     end
  281.   end
  282. end
复制代码
把这段插在main前面,或者直接替换Window_Message脚本,然后把:

这张图放在windowskins文件夹下,之后通过数据库、系统相关、窗口外观图形选择这个图片。
至于头像,在指定位置显示图片就好了。
(・∀・)

评分

参与人数 1星屑 +200 收起 理由
RyanBern + 200 认可答案

查看全部评分

偶是熬夜学编程的傻子
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
10 小时
注册时间
2013-2-1
帖子
6
4
 楼主| 发表于 2015-2-6 15:41:37 | 只看该作者
wolves 发表于 2015-2-6 13:40
把这段插在main前面,或者直接替换Window_Message脚本,然后把:

这张图放在windowskins文件夹下,之后通 ...

非常感谢(。◕∀◕。)
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 11:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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