赞 | 68 |
VIP | 0 |
好人卡 | 0 |
积分 | 65 |
经验 | 0 |
最后登录 | 2023-7-2 |
在线时间 | 119 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 6483
- 在线时间
- 119 小时
- 注册时间
- 2020-1-8
- 帖子
- 234
|
我没太明白楼主的意思
大概写了下
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化状态
#--------------------------------------------------------------------------
def initialize
super(80, 304, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.z = 9998
@fade_in = false
@fade_out = false
@contents_showing = false
@cursor_width = 0
self.active = false
self.index = -1
skin = Bitmap.new("Graphics/Windowskins/001-Blue01")
skin.fill_rect(Rect.new(0, 0, 128, 128), Color.new(0, 0, 0, 0))
skin.fill_rect(Rect.new(128, 0, 64, 64), Color.new(0, 0, 0, 0))
self.windowskin = skin
@blacks = Array.new(2) {|i|
sprite = Sprite.new
sprite.bitmap = Bitmap.new(640, 50 + i * 126)
sprite.bitmap.fill_rect(sprite.bitmap.rect, Color.new(0, 0, 0, 180))
sprite.y = 304 * i
sprite.z = self.z + 1
sprite.visible = false
sprite
}
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
terminate_message
$game_temp.message_window_showing = false
if @input_number_window != nil
@input_number_window.dispose
end
super
@blacks.each {|i|
i.bitmap.dispose
i.dispose
}
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 渐变的情况下
if @fade_in
self.contents_opacity += 24
@blacks.each {|i| i.opacity += 24 }
if @input_number_window != nil
@input_number_window.contents_opacity += 24
end
if self.contents_opacity == 255
@fade_in = false
end
return
end
# 输入数值的情况下
if @input_number_window != nil
@input_number_window.update
# 确定
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[$game_temp.num_input_variable_id] =
@input_number_window.number
$game_map.need_refresh = true
# 释放输入数值窗口
@input_number_window.dispose
@input_number_window = nil
terminate_message
end
return
end
# 显示信息中的情况下
if @contents_showing
# 如果不是在显示选择项中就显示暂停标志
if $game_temp.choice_max == 0
self.pause = true
end
# 取消
if Input.trigger?(Input::B)
if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
$game_system.se_play($data_system.cancel_se)
$game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
terminate_message
end
end
# 确定
if Input.trigger?(Input::C)
if $game_temp.choice_max > 0
$game_system.se_play($data_system.decision_se)
$game_temp.choice_proc.call(self.index)
end
terminate_message
end
return
end
# 在渐变以外的状态下有等待显示的信息与选择项的场合
if @fade_out == false and $game_temp.message_text != nil
@contents_showing = true
$game_temp.message_window_showing = true
reset_window
refresh
Graphics.frame_reset
self.visible = true
self.contents_opacity = 0
@blacks.each {|i| i.visible = true }
if @input_number_window != nil
@input_number_window.contents_opacity = 0
end
@fade_in = true
return
end
# 没有可以显示的信息、但是窗口为可见的情况下
if self.visible
@fade_out = true
self.opacity -= 48
@blacks.each {|i| i.opacity -= 48 }
if self.opacity == 0
self.visible = false
@blacks.each {|i| i.visible = false }
@fade_out = false
$game_temp.message_window_showing = false
end
return
end
end
end
|
评分
-
查看全部评分
|