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

Project1

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

[已经过期] 【脚本】关于人物名称显示的问题

[复制链接]

Lv4.逐梦者

素材区好人

梦石
3
星屑
7842
在线时间
3544 小时
注册时间
2011-7-21
帖子
2284

极短25参与极短24参与极短23参与极短22参与极短21参与

跳转到指定楼层
1
发表于 2012-5-21 21:39:34 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式
使用前的效果:因为是插入图片的方法显示头像,所以我改了改对话框的大小,并设计成图片可以覆盖住对话框

可是这样做文章就只能容纳2横,于是我找了一个把人物名称显示到最上面的脚本(想让文章可以显示3横),可是这么做却出现了不小的问题

1,对话框再次挡住头像
2,最上面的人物名字太窄,能否加宽一些
3,最重要的,即使这样也只能显示2横半,第三横一部分被挡住了(明明对话框宽度为96像素的话,可以完整的容纳3横文字)
这是脚本
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————
  4. #——说明
  5. #默认为一个字一个字的方式,如果需要一次全部显示,
  6. #请在游戏中使用脚本:$game_system.typing = true
  7. # 其他在对话中可以使用的功能:
  8. # \n[1]:显示1号角色的姓名
  9. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  10. # \name[\n[1]]:显示1号主角的姓名方框
  11. # \p[1]:对话框出现在1号事件的上方
  12. # \p[0]:主人公上方出现对话框
  13. #——————————————————使用\p功能后可以自动调整对话框大小
  14. # \> :文字不用打字方式
  15. # \< :文字使用打字方式
  16. # \\:显示"\"这个符号
  17. # \c[1-8]:更改颜色
  18. # \g:显示金钱窗口
  19. # \t: 显示游戏时间窗口
  20. # \v[7]:显示7号变量的值
  21. # \v[a7]:显示7号防具的名称
  22. # \v[s7]:显示7号特技的名称
  23. # \v[w7]:显示7号武器的名称
  24. # \v[i7]:显示7号道具的名称
  25. # \I :下一行从这个位置开始
  26. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  27. # \h[12]:改用12号字
  28. # \b[50]:空50象素
  29. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  30. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  31. # \Lk:清除左边的图像
  32. # \Rk:清除右边的图像
  33. # \A:头像及姓名框靠左排列
  34. # \a:头像及姓名框靠右排列
  35. # \M[60]:等待60帧文字直接消失
  36. # \MS[1-8]:更改文字背景颜色
  37. # \ME:恢复文字背景颜色
  38. #颜色自定义设定范围0-255
  39. #使用方法:在文章前输入如下脚本定义颜色
  40. # $color0 = 数值
  41. # $color1 = 数值
  42. # $color2 = 数值
  43. #\name参数的颜色自定义设定范围0-255
  44. #使用方法:在文章前输入如下脚本定义颜色
  45. # $ncolor0 = 数值
  46. # $ncolor1 = 数值
  47. # $ncolor2 = 数值
  48. # \! :等待玩家按回车再继续
  49. #$speed :文字的打字速度设置用的,数字越大速度越慢。
  50. #============================
  51. class Game_System
  52. attr_accessor :typing
  53. alias carol3_ini initialize
  54. def initialize
  55. carol3_ini
  56. @typing = true
  57. end
  58. end
  59. #=================================#==============================================================================
  60. # ■ Window_Message
  61. #------------------------------------------------------------------------------
  62. class Window_Message < Window_Selectable
  63. #颜色自定义用的全局变量定义
  64. $color0 = 255
  65. $color1 = 255
  66. $color2 = 255
  67. #颜色自定义用的全局变量定义
  68. #说话速度设置用的全局变量
  69. $speed = 0
  70. #--------------------------------------------------------------------------
  71. # ● 初始化状态
  72. #--------------------------------------------------------------------------
  73. def initialize
  74. super(80, 304, 480, 160)
  75. self.contents = Bitmap.new(width - 32, height - 32)
  76. self.visible = false
  77. self.z = 600
  78. @fade_in = false
  79. @fade_out = false
  80. @contents_showing = false
  81. @cursor_width = 0
  82. # Start
  83. @bflag = false
  84. # End
  85. @autoclosetime = -1
  86. self.active = false
  87. self.index = -1
  88. @opacity_text_buf = Bitmap.new(32, 32)
  89. end
  90. #--------------------------------------------------------------------------
  91. # ● 释放
  92. #--------------------------------------------------------------------------
  93. def dispose
  94. terminate_message
  95. $game_temp.message_window_showing = false
  96. if @input_number_window != nil
  97. @input_number_window.dispose
  98. end
  99. super
  100. end
  101. #--------------------------------------------------------------------------
  102. # ● 处理信息结束
  103. #--------------------------------------------------------------------------
  104. def terminate_message
  105. self.active = false
  106. self.pause = false
  107. self.index = -1
  108. self.contents.clear
  109. # 清除显示中标志
  110. @contents_showing = false
  111. # 呼叫信息调用
  112. if $game_temp.message_proc != nil
  113. $game_temp.message_proc.call
  114. end
  115. # 清除文章、选择项、输入数值的相关变量
  116. $game_temp.message_text = nil
  117. $game_temp.message_proc = nil
  118. $game_temp.choice_start = 99
  119. $game_temp.choice_max = 0
  120. $game_temp.choice_cancel_type = 0
  121. $game_temp.choice_proc = nil
  122. $game_temp.num_input_start = 99
  123. $game_temp.num_input_variable_id = 0
  124. $game_temp.num_input_digits_max = 0
  125. # 开放金钱窗口
  126. if @gold_window != nil
  127. @gold_window.dispose
  128. @gold_window = nil
  129. end
  130. #Start
  131. # ピクチャ廃棄処理
  132. begin
  133. # if @spgra.disposed? == false
  134. @spgra.dispose
  135. # end
  136. # if @backgraphic.disposed? == false
  137. @backgraphic.dispose
  138. # end
  139. rescue
  140. # print "ピクチャが読み込めていません!"
  141. end
  142. #End
  143. # 开放时间窗口
  144. if @playtime_window != nil
  145. @playtime_window.dispose
  146. @playtime_window = nil
  147. end
  148. if @name_window_frame != nil
  149. @name_window_frame.dispose
  150. @name_window_frame = nil
  151. end
  152. if @name_window_text != nil
  153. @name_window_text.dispose
  154. @name_window_text = nil
  155. end
  156. if @right_picture != nil and @right_keep == true
  157. @right_picture.dispose
  158. end
  159. if @left_picture != nil and @left_keep == true
  160. @left_picture.dispose
  161. end
  162. @face_bitmap = nil
  163. end
  164. def refresh
  165. # 初期化
  166. self.contents.clear
  167. self.contents.font.color = normal_color
  168. self.contents.font.size = Font.default_size
  169. @x = @y = @max_x = @max_y = @indent = @lines = 0
  170. @left_keep = @right_keep = false
  171. @face_indent = 0
  172. @opacity = 255
  173. @cursor_width = 0
  174. @autoclosetime = -1
  175. @write_speed = $speed
  176. @write_wait = 0
  177. @mid_stop = false
  178. face = nil
  179. @popchar = -2
  180. @alignment = true
  181. if $game_temp.choice_start == 0
  182. @x = 8
  183. end
  184. if $game_temp.message_text != nil
  185. @now_text = $game_temp.message_text
  186. #——对齐设置
  187. if (/\\([Aa])/.match(@now_text))!=nil then
  188. if $1 == "A"
  189. @alignment = true
  190. else
  191. @alignment = false
  192. end
  193. @now_text.gsub!(/\\([Aa])/) { "" }
  194. end
  195. #——头像设置
  196. if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  197. @face = $2 + "_f.png"
  198. if $1 == "f" and $game_actors[$2.to_i] != nil
  199. @face = $game_actors[$2.to_i].battler_name + "_f.png"
  200. end
  201. if FileTest.exist?("Graphics/Pictures/#{@face}")
  202. @face_bitmap = Bitmap.new("Graphics/Pictures/#{@face}")
  203. if @alignment
  204. @x = @face_indent = 128
  205. self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  206. else
  207. self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  208. Rect.new(0, 0, 96, 96))
  209. end
  210. else
  211. @face = nil
  212. @face_bitmap = nil
  213. end
  214. @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  215. end
  216. #——左半身像设置
  217. if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  218. @face = "66rpg_" + $1 + "_h.png"
  219. if $加密 == true
  220. if @left_picture != nil
  221. @left_picture.dispose
  222. end
  223. @left_picture = Sprite.new
  224. @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  225. @left_picture.y = 480-@left_picture.bitmap.height
  226. @left_picture.x = 0
  227. @left_picture.mirror = true
  228. @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  229. else
  230. if FileTest.exist?("Graphics/battlers/#{@face}")
  231. if @left_picture != nil
  232. @left_picture.dispose
  233. end
  234. @left_picture = Sprite.new
  235. @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  236. @left_picture.y = 480-@left_picture.bitmap.height
  237. @left_picture.x = 0
  238. @left_picture.mirror = true
  239. @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  240. end
  241. end
  242. end
  243. #——右半身像设置
  244. if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  245. @face = "66rpg_" + $1 + "_h.png"
  246. if $加密 == true
  247. if @right_picture != nil
  248. @right_picture.dispose
  249. end
  250. @right_picture = Sprite.new
  251. @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  252. @right_picture.y = 480-@right_picture.bitmap.height
  253. @right_picture.x = 640-@right_picture.bitmap.width
  254. @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  255. else
  256. if FileTest.exist?("Graphics/battlers/#{@face}")
  257. if @right_picture != nil
  258. @right_picture.dispose
  259. end
  260. @right_picture = Sprite.new
  261. @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  262. @right_picture.y = 480-@right_picture.bitmap.height
  263. @right_picture.x = 640-@right_picture.bitmap.width
  264. @right_picture.z = 999
  265. @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  266. end
  267. end
  268. end
  269. if (/\\[Rr]k/.match(@now_text)) != nil
  270. @right_keep = true
  271. @now_text.sub!(/\\[Rr]k/) { "" }
  272. end
  273. if (/\\[Ll]k/.match(@now_text)) != nil
  274. @left_keep = true
  275. @now_text.sub!(/\\[Ll]k/) { "" }
  276. end
  277. # 替换人物姓名
  278. @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  279. $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  280. end
  281. # 显示人物姓名
  282. name_window_set = false
  283. if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  284. name_window_set = true
  285. name_text = $2
  286. @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  287. end
  288. # 文字位置的判定
  289. if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  290. @popchar = $1.to_i
  291. if @popchar == -1
  292. @x = @indent = 48
  293. @y = 4
  294. end
  295. @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  296. end
  297. # 开始
  298. begin
  299. last_text = @now_text.clone
  300. @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  301. end until @now_text == last_text
  302. @now_text.gsub!(/\\\\/) { "\000" }
  303. @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  304. @now_text.gsub!(/\\[Gg]/) { "\002" }
  305. @now_text.gsub!(/\\[Tt]/) { "\004" }
  306. @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  307. @now_text.gsub!(/\\[Ii]/) { "\023" }
  308. @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  309. @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  310. @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  311. @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  312. @now_text.gsub!(/\\[!]/) { "\020" }
  313. @now_text.gsub!(/\\[>]/) { "\016" }
  314. @now_text.gsub!(/\\[<]/) { "\017" }
  315. # Start
  316. # ◎
  317. # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  318. @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  319. @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  320. # ◎
  321. # End
  322. if @popchar >= 0
  323. @text_save = @now_text.clone
  324. @max_x = 0
  325. @max_y = 4
  326. for i in 0..3
  327. line = @now_text.split(/\n/)[3-i]
  328. @max_y -= 1 if line == nil and @max_y <= 4-i
  329. next if line == nil
  330. cx = contents.text_size(line).width
  331. @max_x = cx if cx > @max_x
  332. end
  333. self.width = @max_x + 48 + @face_indent
  334. self.height = (@max_y - 1) * 32 + 64
  335. else
  336. @max_x = self.width - 32 - @face_indent
  337. end
  338. reset_window
  339. if name_window_set
  340. off_x = 0
  341. off_y = -40
  342. space = 2
  343. w = self.contents.text_size(name_text).width + 26 + space
  344. x = @alignment ? self.x + off_x - space / 2 : self.x + off_x - space / 2 + self.width - w
  345. y = self.y + off_y - space / 2
  346. h = 40 + space
  347. @name_window_frame = Window_Frame.new(x, y, w, h)
  348. @name_window_frame.z = self.z + 1
  349. x = @alignment ? self.x + off_x - space / 2 + 4 : self.x + off_x - space / 2 + 4 + self.width - w
  350. y = self.y + off_y - space / 2
  351. @name_window_text = Air_Text.new(x+4, y+6, name_text)
  352. @name_window_text.z = self.z + 2
  353. end
  354. end
  355. reset_window
  356. if $game_temp.choice_max > 0
  357. @item_max = $game_temp.choice_max
  358. self.active = true
  359. self.index = 0
  360. end
  361. if $game_temp.num_input_variable_id > 0
  362. digits_max = $game_temp.num_input_digits_max
  363. number = $game_variables[$game_temp.num_input_variable_id]
  364. @input_number_window = Window_InputNumber.new(digits_max)
  365. @input_number_window.number = number
  366. @input_number_window.x = self.x + 8
  367. @input_number_window.y = self.y + $game_temp.num_input_start * 32
  368. end
  369. end
  370. #--------------------------------------------------------------------------
  371. # ● 更新
  372. #--------------------------------------------------------------------------
  373. def update
  374. super

  375. #颜色自定义设定范围0-255
  376. self.contents.font.color = Color.new($color0, $color1, $color2)
  377. #颜色自定义设定范围0-255

  378. if @autoclosetime == 0
  379. @autoclosetime = -1
  380. terminate_message
  381. end
  382. if @autoclosetime >= 1
  383. @autoclosetime -= 1
  384. end
  385. if @fade_in
  386. self.contents_opacity += 24
  387. if @input_number_window != nil
  388. @input_number_window.contents_opacity += 24
  389. end
  390. if self.contents_opacity == 255
  391. @fade_in = false
  392. end
  393. return
  394. end
  395. @now_text = nil if @now_text == ""
  396. if @now_text != nil and @mid_stop == false
  397. if @write_wait > 0
  398. @write_wait -= 1
  399. return
  400. end
  401. text_not_skip = $game_system.typing
  402. while true
  403. @max_x = @x if @max_x < @x
  404. @max_y = @y if @max_y < @y
  405. if (c = @now_text.slice!(/./m)) != nil
  406. if c == "\000"
  407. c = "\\"
  408. end
  409. if c == "\001"
  410. @now_text.sub!(/\[([0-9]+)\]/, "")
  411. color = $1.to_i
  412. if color >= 0 and color <= 7
  413. self.contents.font.color = text_color(color)
  414. end
  415. c = ""
  416. end
  417. if c == "\002"
  418. if @gold_window == nil and @popchar <= 0
  419. @gold_window = Window_Gold.new
  420. @gold_window.x = 560 - @gold_window.width
  421. if $game_temp.in_battle
  422. @gold_window.y = 192
  423. else
  424. @gold_window.y = self.y >= 128 ? 32 : 384
  425. end
  426. @gold_window.opacity = self.opacity
  427. @gold_window.back_opacity = self.back_opacity
  428. end
  429. c = ""
  430. end
  431. if c == "\004"
  432. if @playtime_window == nil and @popchar <=0
  433. @playtime_window = Window_PlayTime.new
  434. @playtime_window.x = 80
  435. if $game_temp.in_battle
  436. @playtime_window.y = 192
  437. else
  438. @playtime_window.y = self.y >= 128 ? 32 : 384
  439. end
  440. @playtime_window.opacity = self.opacity
  441. @playtime_window.back_opacity = self.back_opacity
  442. end
  443. end
  444. if c == "\016"
  445. text_not_skip = false
  446. c = ""
  447. end
  448. if c == "\017"
  449. text_not_skip = true
  450. c = ""
  451. end
  452. if c == "\020"
  453. @mid_stop = true
  454. c = ""
  455. end
  456. if c == "\023"
  457. @indent = @x
  458. c = ""
  459. end
  460. if c == "\024"
  461. @now_text.sub!(/\[([0-9]+)\]/, "")
  462. @opacity = $1.to_i
  463. c = ""
  464. end
  465. if c == "\025"
  466. @now_text.sub!(/\[([0-9]+)\]/, "")
  467. self.contents.font.size = [[$1.to_i, 6].max, 32].min
  468. c = ""
  469. end
  470. if c == "\026"
  471. @now_text.sub!(/\[([0-9]+)\]/, "")
  472. @x += $1.to_i
  473. c = ""
  474. end
  475. if c == "\027"
  476. @now_text.sub!(/\[([0-9]+)\]/, "")
  477. @x += $1.to_i * self.contents.font.size / 2
  478. next
  479. end
  480. if c == "\030"
  481. @now_text.sub!(/\[(.*?)\]/, "")
  482. self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  483. @x += 24
  484. c = ""
  485. end
  486. if c == "\050"
  487. @now_text.sub!(/\[([0-9]+)\]/, "")
  488. @autoclosetime = $1.to_i
  489. next
  490. end
  491. # Start
  492. # ◎
  493. # \MSの場合
  494. if c == "\052"
  495. @now_text.sub!(/\[([0-9]+)\]/, "")
  496. bcolor = $1.to_i
  497. @bflag = true
  498. end
  499. # \MEの場合
  500. if c == "\053"
  501. @bflag = false
  502. bcolor = 0
  503. end
  504. # ◎
  505. # End
  506. # Start
  507. # ◎
  508. if @bflag == true
  509. if bcolor >= 0 and bcolor <= 7
  510. bsize = self.contents.text_size(c).width
  511. self.contents.fill_rect(4 + @x, 32 * @y, bsize, 32, text_color(bcolor))
  512. end
  513. end
  514. # ◎
  515. # End
  516. if c == "\n"
  517. if @lines >= $game_temp.choice_start
  518. @cursor_width = [@cursor_width, @max_x - @face_indent].max
  519. end
  520. @lines += 1
  521. @y += 1
  522. @x = 0 + @indent + @face_indent
  523. if @lines >= $game_temp.choice_start
  524. @x = 8 + @indent + @face_indent
  525. end
  526. c = ""
  527. end
  528. if c != ""
  529. # 文字描画
  530. @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  531. end
  532. if Input.press?(Input::B)
  533. text_not_skip = false
  534. end
  535. else
  536. text_not_skip = true
  537. break
  538. end
  539. # 終了判定
  540. if text_not_skip
  541. break
  542. end
  543. end
  544. @write_wait += @write_speed
  545. return
  546. end
  547. if @input_number_window != nil
  548. @input_number_window.update
  549. # 決定
  550. if Input.trigger?(Input::C)
  551. $game_system.se_play($data_system.decision_se)
  552. $game_variables[$game_temp.num_input_variable_id] =
  553. @input_number_window.number
  554. $game_map.need_refresh = true
  555. @input_number_window.dispose
  556. @input_number_window = nil
  557. terminate_message
  558. end
  559. return
  560. end
  561. if @contents_showing
  562. if $game_temp.choice_max == 0
  563. self.pause = true
  564. end
  565. # 取消
  566. if Input.trigger?(Input::B)
  567. if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  568. $game_system.se_play($data_system.cancel_se)
  569. $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  570. terminate_message
  571. end
  572. end
  573. # 決定
  574. if Input.trigger?(Input::C)
  575. if $game_temp.choice_max > 0
  576. $game_system.se_play($data_system.decision_se)
  577. $game_temp.choice_proc.call(self.index)
  578. end
  579. if @mid_stop
  580. @mid_stop = false
  581. return
  582. else
  583. terminate_message
  584. end
  585. end
  586. return
  587. end
  588. if @fade_out == false and $game_temp.message_text != nil
  589. @contents_showing = true
  590. $game_temp.message_window_showing = true
  591. refresh
  592. Graphics.frame_reset
  593. self.visible = true
  594. self.contents_opacity = 0
  595. if @input_number_window != nil
  596. @input_number_window.contents_opacity = 0
  597. end
  598. @fade_in = true
  599. return
  600. end
  601. if self.visible
  602. @fade_out = true
  603. self.opacity -= 48
  604. if self.opacity == 0
  605. self.visible = false
  606. @fade_out = false
  607. $game_temp.message_window_showing = false
  608. end
  609. return
  610. end
  611. end
  612. #--------------------------------------------------------------------------
  613. # ● 获得字符
  614. #--------------------------------------------------------------------------
  615. def get_character(parameter)
  616. case parameter
  617. when 0
  618. return $game_player
  619. else
  620. events = $game_map.events
  621. return events == nil ? nil : events[parameter]
  622. end
  623. end
  624. #--------------------------------------------------------------------------
  625. # ● ウィンドウの位置と不透明度の設定
  626. #--------------------------------------------------------------------------
  627. def reset_window
  628. # 判定
  629. if @popchar >= 0
  630. events = $game_map.events
  631. if events != nil
  632. character = get_character(@popchar)
  633. x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  634. y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  635. self.x = x
  636. self.y = y
  637. end
  638. elsif @popchar == -1
  639. self.x = -4
  640. self.y = -4
  641. self.width = 648
  642. self.height = 488
  643. else
  644. if $game_temp.in_battle
  645. self.y = 48
  646. self.z = 9999
  647. else
  648. case $game_system.message_position
  649. when 0 # 上
  650. self.y = 16
  651. self.height = 160
  652. when 1 # 中
  653. self.y = 160
  654. self.height = 160
  655. when 2 # 下
  656. self.y = 344
  657. self.height = 120
  658. end
  659. self.x = 80
  660. if @face_bitmap == nil
  661. self.width = 480
  662. else
  663. self.width = 600
  664. self.x -= 60
  665. end
  666. #self.height = 120
  667. end
  668. end
  669. self.contents = Bitmap.new(self.width - 32, self.height - 32)
  670. if @face_bitmap != nil
  671. if @alignment
  672. self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  673. else
  674. self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  675. Rect.new(0, 0, 96, 96))
  676. end
  677. end
  678. if @popchar == -1
  679. self.opacity = 255
  680. self.back_opacity = 0
  681. elsif $game_system.message_frame == 0
  682. self.opacity = 255
  683. self.back_opacity = 100
  684. else
  685. self.opacity = 0
  686. self.back_opacity = 100
  687. end
  688. end
  689. #--------------------------------------------------------------------------
  690. # ● line_height
  691. #--------------------------------------------------------------------------
  692. # 返回値:行高
  693. #--------------------------------------------------------------------------
  694. def line_height
  695. return 32
  696. if self.contents.font.size >= 20 and self.contents.font.size <= 24
  697. return 32
  698. else
  699. return self.contents.font.size * 15 / 10
  700. end
  701. end
  702. #--------------------------------------------------------------------------
  703. # ● \V 变换
  704. #--------------------------------------------------------------------------
  705. def convart_value(option, index)
  706. option == nil ? option = "" : nil
  707. option.downcase!
  708. case option
  709. when "i"
  710. unless $data_items[index].name == nil
  711. r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  712. end
  713. when "w"
  714. unless $data_weapons[index].name == nil
  715. r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  716. end
  717. when "a"
  718. unless $data_armors[index].name == nil
  719. r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  720. end
  721. when "s"
  722. unless $data_skills[index].name == nil
  723. r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  724. end
  725. else
  726. r = $game_variables[index]
  727. end
  728. r == nil ? r = "" : nil
  729. return r
  730. end
  731. #--------------------------------------------------------------------------
  732. # ● 透過文字描画
  733. #--------------------------------------------------------------------------
  734. # target :描画対象。Bitmapクラスを指定。
  735. # x :x座標
  736. # y :y座標
  737. # str  :描画文字列
  738. # opacity:透過率(0~255)
  739. # 返回値 :文字幅(@x増加値)。
  740. #--------------------------------------------------------------------------
  741. def opacity_draw_text(target, x, y, str,opacity)
  742. height = target.font.size
  743. width = target.text_size(str).width
  744. opacity = [[opacity, 0].max, 255].min
  745. if opacity == 255
  746. target.draw_text(x, y, width, height, str)
  747. return width
  748. else
  749. if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  750. @opacity_text_buf.dispose
  751. @opacity_text_buf = Bitmap.new(width, height)
  752. else
  753. @opacity_text_buf.clear
  754. end
  755. @opacity_text_buf.font.size = target.font.size
  756. @opacity_text_buf.draw_text(0, 0, width, height, str)
  757. target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  758. return width
  759. end
  760. end
  761. def ruby_draw_text(target, x, y, str,opacity)
  762. sizeback = target.font.size
  763. target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  764. rubysize = [rubysize, 6].max
  765. opacity = [[opacity, 0].max, 255].min
  766. split_s = str.split(/,/)
  767. split_s[0] == nil ? split_s[0] = "" : nil
  768. split_s[1] == nil ? split_s[1] = "" : nil
  769. height = sizeback + rubysize
  770. width = target.text_size(split_s[0]).width
  771. target.font.size = rubysize
  772. ruby_width = target.text_size(split_s[1]).width
  773. target.font.size = sizeback
  774. buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  775. width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  776. if opacity == 255
  777. target.font.size = rubysize
  778. target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  779. target.font.size = sizeback
  780. target.draw_text(x, y, width, target.font.size, split_s[0])
  781. return width
  782. else
  783. if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  784. @opacity_text_buf.dispose
  785. @opacity_text_buf = Bitmap.new(buf_width, height)
  786. else
  787. @opacity_text_buf.clear
  788. end
  789. @opacity_text_buf.font.size = rubysize
  790. @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  791. @opacity_text_buf.font.size = sizeback
  792. @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  793. if sub_x >= 0
  794. target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  795. else
  796. target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  797. end
  798. return width
  799. end
  800. end
  801. #--------------------------------------------------------------------------
  802. # ● 解放
  803. #--------------------------------------------------------------------------
  804. def dispose
  805. terminate_message
  806. if @gaiji_cache != nil
  807. unless @gaiji_cache.disposed?
  808. @gaiji_cache.dispose
  809. end
  810. end
  811. unless @opacity_text_buf.disposed?
  812. @opacity_text_buf.dispose
  813. end
  814. $game_temp.message_window_showing = false
  815. if @input_number_window != nil
  816. @input_number_window.dispose
  817. end
  818. super
  819. end
  820. #--------------------------------------------------------------------------
  821. # ● 矩形更新
  822. #--------------------------------------------------------------------------
  823. def update_cursor_rect
  824. if @index >= 0
  825. n = $game_temp.choice_start + @index
  826. self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  827. else
  828. self.cursor_rect.empty
  829. end
  830. end
  831. end
  832. #==============================================================================
  833. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  834. #==============================================================================
  835. class Window_Frame < Window_Base
  836. #--------------------------------------------------------------------------
  837. # ● オブジェクト初期化
  838. #--------------------------------------------------------------------------
  839. def initialize(x, y, width, height)
  840. super(x, y, width, height)
  841. self.contents = nil
  842. self.back_opacity = 100
  843. end
  844. #--------------------------------------------------------------------------
  845. # ● 解放
  846. #--------------------------------------------------------------------------
  847. def dispose
  848. super
  849. end
  850. end
  851. #==============================================================================
  852. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  853. #==============================================================================
  854. class Air_Text < Window_Base

  855. #参数的颜色自定义设定范围0-255
  856. $ncolor0 = 255
  857. $ncolor1 = 255
  858. $ncolor2 = 255
  859. #参数的颜色自定义设定范围0-255
  860. #--------------------------------------------------------------------------
  861. # ● オブジェクト初期化
  862. #--------------------------------------------------------------------------
  863. def initialize(x, y, designate_text)
  864. super(x-16, y-16, 32 + designate_text.size * 12, 56)
  865. self.opacity = 0
  866. self.back_opacity = 0
  867. self.contents = Bitmap.new(self.width - 32, self.height - 32)
  868. w = self.contents.width
  869. h = self.contents.height

  870. #颜色自定义设定范围0-255
  871. self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  872. #颜色自定义设定范围0-255

  873. # self.contents.font.color = text_color(color)
  874. self.contents.draw_text(0, 0, w, h, designate_text)
  875. end
  876. #--------------------------------------------------------------------------
  877. # ● 解放
  878. #--------------------------------------------------------------------------
  879. def dispose
  880. self.contents.clear
  881. super
  882. end
  883. end
复制代码

Lv4.逐梦者

素材区好人

梦石
3
星屑
7842
在线时间
3544 小时
注册时间
2011-7-21
帖子
2284

极短25参与极短24参与极短23参与极短22参与极短21参与

2
 楼主| 发表于 2012-5-21 21:52:43 | 只看该作者
tommay 发表于 2012-5-21 21:46
没有测试,有问题请告知

变成这样了

点评

已更新并经过测试  发表于 2012-5-21 22:01
稍等,还有点问题,过会儿一并更新了  发表于 2012-5-21 21:58
对不起我错了,已更新  发表于 2012-5-21 21:53
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-30 10:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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