赞 | 40 |
VIP | 0 |
好人卡 | 72 |
积分 | 63 |
经验 | 38967 |
最后登录 | 2024-11-5 |
在线时间 | 1481 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 6260
- 在线时间
- 1481 小时
- 注册时间
- 2015-7-25
- 帖子
- 652
|
第一种情况:使用显示文字
1.打几个空格就行了
2.
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
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
3.选择暗色背景
第二种情况:自己写窗口
1.
text = "哈哈哈哈哈" draw_text(x, y, width, line_height, text,1)
text = "哈哈哈哈哈"
draw_text(x, y, width, line_height, text,1)
也同样可以自己打空格
2.
self.width = text.size * 30
self.width = text.size * 30
3.
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
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
如果是第二种情况(自己写窗口),上面已经说了大概的思路
这里还是举个例子:
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
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
|
评分
-
查看全部评分
|