Commit a5f345be authored by zh99998's avatar zh99998

BGM修正,退出时报错修正

parent 7f34a9cc
...@@ -20,7 +20,7 @@ class Game_Event ...@@ -20,7 +20,7 @@ class Game_Event
when "K" when "K"
WatchAction WatchAction
when "M" when "M"
QROOMOK #TODO Leave
when "O" when "O"
Chat Chat
when "P" when "P"
......
...@@ -54,9 +54,9 @@ class Iduel < Game ...@@ -54,9 +54,9 @@ class Iduel < Game
end end
def leave def leave
if @room.include? @user if @room.include? @user
# send(10, @key, room.id, checknum("QROOM", @session + room.id.to_s))
else else
send("QUITWATCHROOM", @key, checknum("QUITWATCHROOM", @session)) send(9, @key, checknum("QUITWATCHROOM", @session))
end end
end end
def action(action) def action(action)
......
#encoding: UTF-8 #encoding: UTF-8
#仅用于调试,发布时删 #仅用于调试
alias gbk_puts puts Windows = RUBY_PLATFORM["mingw"] || RUBY_PLATFORM["mswin"]
def puts(*args) if Windows
gbk_puts(*(args.collect{|item|item.to_s.encode "GBK", :invalid => :replace, :undef => :replace})) STDOUT.set_encoding "GBK", "UTF-8", :invalid => :replace, :undef => :replace
end
def p(*args)
print(args.collect{|item|item.inspect.encode "GBK", :invalid => :replace, :undef => :replace}.join("\n")+"\n") rescue print(args.join("\n")+"\n")
end end
def filesize_inspect(size) def filesize_inspect(size)
......
...@@ -29,7 +29,7 @@ class Scene_Duel < Scene ...@@ -29,7 +29,7 @@ class Scene_Duel < Scene
end end
def start def start
@bgm = Mixer::Music.load "audio/bgm/title.ogg" @bgm = Mixer::Music.load "audio/bgm/title.ogg"
Mixer.fade_in_music(@bgm, 8000, -1) Mixer.fade_in_music(@bgm, -1, 800)
@background = Surface.load "graphics/field/main.png" @background = Surface.load "graphics/field/main.png"
Surface.blit(@background, 0, 0, 0, 0, $screen, 0, 0) Surface.blit(@background, 0, 0, 0, 0, $screen, 0, 0)
...@@ -68,7 +68,7 @@ class Scene_Duel < Scene ...@@ -68,7 +68,7 @@ class Scene_Duel < Scene
end end
def change_phase(phase) def change_phase(phase)
action Action::ChangePhase.new(true, phase) action Action::ChangePhase.new(true, phase)
if phase == :EP if phase == :EP and
action Action::TurnEnd.new(true, $game.player_field, $game.turn_player ? $game.turn : $game.turn.next) action Action::TurnEnd.new(true, $game.player_field, $game.turn_player ? $game.turn : $game.turn.next)
end end
end end
...@@ -105,6 +105,8 @@ class Scene_Duel < Scene ...@@ -105,6 +105,8 @@ class Scene_Duel < Scene
when Key::F5 when Key::F5
reset reset
@player_field_window.refresh @player_field_window.refresh
when Key::F10
$game.leave
end end
else else
super super
...@@ -136,6 +138,11 @@ class Scene_Duel < Scene ...@@ -136,6 +138,11 @@ class Scene_Duel < Scene
Widget_Msgbox.new(event.title, event.message){$scene = Scene_Title.new} Widget_Msgbox.new(event.title, event.message){$scene = Scene_Title.new}
when Game_Event::Leave when Game_Event::Leave
$scene = Scene_Hall.new $scene = Scene_Hall.new
when Game_Event::NewRoom
if event.room == $game.room
@player_lp_window.player = $game.room.player1
@opponent_lp_window.player = $game.room.player2
end
end end
end end
def update def update
......
...@@ -22,7 +22,7 @@ class Scene_Hall < Scene ...@@ -22,7 +22,7 @@ class Scene_Hall < Scene
@chat = Window_Chat.new(321,551,682,168) @chat = Window_Chat.new(321,551,682,168)
bgm = Mixer::Music.load("audio/bgm/hall.ogg") bgm = Mixer::Music.load("audio/bgm/hall.ogg")
Mixer.fade_in_music(bgm, 800, -1) Mixer.fade_in_music(bgm, -1, 800)
@bgm.destroy if @bgm @bgm.destroy if @bgm
@bgm = bgm @bgm = bgm
@count = 0 @count = 0
......
...@@ -15,7 +15,7 @@ class Scene_Watch < Scene_Duel ...@@ -15,7 +15,7 @@ class Scene_Watch < Scene_Duel
end end
def start def start
super super
$game.action Action::Chat.new(true, "#{$game.user.name}(#{$game.user.id})进入了观战") #$game.action Action::Chat.new(true, "#{$game.user.name}(#{$game.user.id})进入了观战")
end end
def handle_game(event) def handle_game(event)
case event case event
......
...@@ -42,7 +42,7 @@ class Window ...@@ -42,7 +42,7 @@ class Window
def destroy def destroy
@destroyed = true @destroyed = true
@contents.destroy if @contents @contents.destroy if @contents
$scene.windows.delete self $scene.windows.delete self if $scene
end end
def destroyed? def destroyed?
@destroyed @destroyed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment