| 赞 | 35 |
| VIP | |
| 好人卡 | |
| 积分 | 64 |
| 经验 | |
| 最后登录 | 2025-12-12 |
| 在线时间 | 1473 小时 |
- 梦石
- 0
- 星屑
- 6375
- 在线时间
- 1473 小时
- 注册时间
- 2015-7-25
- 回帖
- 609
 
|
发表于 2017-9-8 18:27:40
|
显示全部楼层
第一种情况:使用显示文字
1.打几个空格就行了
2.
[pre lang="ruby"]class Window_Message < Window_Base
def fiber_main
update_width
$game_message.visible = true
update_background
update_placement
loop do
process_all_text if $game_message.has_text?
process_input
$game_message.clear
@gold_window.close
Fiber.yield
break unless text_continue?
end
close_and_wait
$game_message.visible = false
@fiber = nil
end
def update_width
self.width = $game_message.texts[0].size * 30
end
end[/pre]
3.选择暗色背景
第二种情况:自己写窗口
1.
[pre lang="ruby"]text = "哈哈哈哈哈"
draw_text(x, y, width, line_height, text,1)[/pre]
也同样可以自己打空格
2.
[pre lang="ruby"]self.width = text.size * 30[/pre]
3.
[pre lang="ruby"]def create_back_bitmap
@back_bitmap = Bitmap.new(width, height)
rect1 = Rect.new(0, 0, width, 12)
rect2 = Rect.new(0, 12, width, height - 24)
rect3 = Rect.new(0, height - 12, width, 12)
@back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
@back_bitmap.fill_rect(rect2, back_color1)
@back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
end
def back_color1
Color.new(0, 0, 0, 160)
end
def back_color2
Color.new(0, 0, 0, 0)
end
def create_back_sprite
@back_sprite = Sprite.new
@back_sprite.bitmap = @back_bitmap
@back_sprite.visible = true
@back_sprite.z = z - 1
end
def dispose
super
@back_bitmap.dispose
@back_sprite.dispose
end[/pre]
如果是第二种情况(自己写窗口),上面已经说了大概的思路
这里还是举个例子:
[pre lang="ruby"]class A < Window_Base
def initialize
super(0,0,544,120)
create_back_bitmap
create_back_sprite
self.opacity = 0
refresh
end
def refresh
text = "哈哈哈哈哈"
self.width = text.size * 30
draw_text(x, y, width, line_height, text,1)
end
def create_back_bitmap
@back_bitmap = Bitmap.new(width, height)
rect1 = Rect.new(0, 0, width, 12)
rect2 = Rect.new(0, 12, width, height - 24)
rect3 = Rect.new(0, height - 12, width, 12)
@back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
@back_bitmap.fill_rect(rect2, back_color1)
@back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
end
def back_color1
Color.new(0, 0, 0, 160)
end
def back_color2
Color.new(0, 0, 0, 0)
end
def create_back_sprite
@back_sprite = Sprite.new
@back_sprite.bitmap = @back_bitmap
@back_sprite.visible = true
@back_sprite.z = z - 1
end
def dispose
super
@back_bitmap.dispose
@back_sprite.dispose
end
end[/pre] |
评分
-
查看全部评分
|