赞 | 0 |
VIP | 177 |
好人卡 | 10 |
积分 | 1 |
经验 | 12547 |
最后登录 | 2017-8-1 |
在线时间 | 193 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 193 小时
- 注册时间
- 2013-3-24
- 帖子
- 448
|
修好了~- #==============================================================================
- # ■ Scene_Read
- #==============================================================================
- class Scene_Read_SUPER
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- sp = Spriteset_Map.new
- @read_window = Window_Reader.new([""], 0)
- @read_window.opacity = 230
- @read_window.z = 900
- @command_window = Window_Command.new(180, ["选音乐","选书阅读"])
- @command_window.y = (480 - @command_window.height)/2
- @command_window.opacity = 230
- @command_window.z = 999
- @doing = 0
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- @command_window.dispose if !@command_window.disposed?
- @read_window.dispose
- sp.dispose
- end
-
- def update
- case @doing
- when 0 #选项
- update_0
- when 1 #选书
- update_1
- when 2 #读书
- update_2
- when 3 #选音乐
- update_3
- end
- end
-
- def update_0
- @command_window.update
- if Input.trigger?(Input::C)
- case @command_window.index
- when 0
- $game_system.se_play($data_system.decision_se)
- text = Dir["Audio/music/*"]
- @text = []
- for tx in text
- @text.push(tx.split(/music\//)[1])
- end
- @command_window.dispose
- @command_window = Window_Command.new(180, @text)
- @command_window.y = (480 - @command_window.height)/2
- if @command_window.y < 0
- @command_window.y=0
- @command_window.height=480
- end
- @command_window.opacity = 230
- @command_window.z = 999
- @doing = 3
- when 1
- $game_system.se_play($data_system.decision_se)
- text = Dir["Graphics/txt/*"]
- @text = []
- for tx in text
- @text.push (tx.split(/txt\//)[1].split(/.txt/)[0])
- end
- @command_window.dispose
- @command_window = Window_Command.new(180, @text)
- @command_window.y = (480 - @command_window.height)/2
- if @command_window.y < 0
- @command_window.y=0
- @command_window.height=480
- end
- @command_window.opacity = 230
- @command_window.z = 999
- @doing = 1
- when 2
- $game_system.se_play($data_system.decision_se)
- @command_window.visible = false
- @command_window.active = false
- @doing = 2
- end
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Map.new
- end
- end
-
- def update_1
- @command_window.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @doing = 0
- @command_window.dispose
- if @read_window.text != [""]
- @command_window = Window_Command.new(180, ["选音乐","选书阅读","继续阅读"])
- else
- @command_window = Window_Command.new(180, ["选音乐","选书阅读"])
- end
- @command_window.y = (480 - @command_window.height)/2
- @command_window.opacity = 230
- @command_window.z = 999
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- filename = "Graphics/txt/" + @command_window.commands[@command_window.index]+".txt"
- file = File.open(filename, "r")
- r = file.readlines
- @real_text = []
- for i in 0...r.size
- temp_story = r[i].split(/\n/)[0]
- temp_story.gsub!(/,/) {","} if temp_story != nil
- temp_story.gsub!(/\./) {"。"} if temp_story != nil
- temp_story.gsub!(/ /) {" "} if temp_story != nil
- while(temp_story != nil)
- text = ""
- if temp_story.length > 75
- text = temp_story.slice!(0,75)
- else
- text = temp_story
- temp_story = nil
- end
- @real_text.push(text)
- end
- end
- file.close
- @read_window.renew(@real_text, 0)
- @command_window.visible = false
- @command_window.active = false
- @doing = 2
- end
- end
-
-
- def update_2
- @read_window.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.decision_se)
- @doing = 0
- @command_window.dispose
- if @read_window.text != [""]
- @command_window = Window_Command.new(180, ["选音乐","选书阅读","继续阅读"])
- else
- @command_window = Window_Command.new(180, ["选音乐","选书阅读"])
- end
- @command_window.y = (480 - @command_window.height)/2
- @command_window.opacity = 230
- @command_window.z = 999
- @doing = 0
- end
- if Input.trigger?(Input::UP)
- $game_system.se_play($data_system.cursor_se)
- @read_window.minus_1
- end
- if Input.trigger?(Input::DOWN)
- $game_system.se_play($data_system.cursor_se)
- @read_window.add_1
- end
- if Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
- $game_system.se_play($data_system.cursor_se)
- @read_window.page_back
- end
- if Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
- $game_system.se_play($data_system.cursor_se)
- @read_window.page_add
- end
- end
-
- def update_3
- @command_window.update
- #if @command_window.index >15
-
-
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- filename = "Audio/music/" + @command_window.commands[@command_window.index]
- Audio.bgm_play(filename, 100, 100)
- end
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @doing = 0
- @command_window.dispose
- if @read_window.text != [""]
- @command_window = Window_Command.new(180, ["选音乐","选书阅读","继续阅读"])
- else
- @command_window = Window_Command.new(180, ["选音乐","选书阅读"])
- end
- @command_window.y = (480 - @command_window.height)/2
- @command_window.opacity = 230
- @command_window.z = 999
- end
- end
- end
复制代码 p.s.我不知道實現翻頁是啥意思,因為我沒有Window_Reader的腳本,給出來在幫你吧...... |
评分
-
查看全部评分
|