Commit 32725c5d authored by zh99998's avatar zh99998

版本0.4.3,iDuel修复 还不完整

parent 9e41e6af
......@@ -27,6 +27,7 @@ class Game
def chat(chatmessage)
end
def exit
$scene = Scene_Login.new
end
def watching?
@room and @room.include? @user
......
......@@ -8,8 +8,10 @@ class Game_Event
Login
when "C"
AllUsers
when "F", "Q" #F=加入观战
when "F"
Join
when "Q"
NewRoom
when "G"
Watch
when "H", "M"
......
......@@ -64,6 +64,7 @@ class Iduel < Game
@conn.close
@conn = nil
end
super
end
def recv(info)
if info.nil?
......
......@@ -22,11 +22,12 @@ class User
def avatar(size = :small)
cache = "graphics/avatars/#{@id}_#{size}.png"
result = Surface.load(cache) rescue Surface.load("graphics/avatars/loading_#{size}.gif")
scene = $scene
if block_given?
yield result
Thread.new do
open("http://www.duelcn.com/uc_server/avatar.php?uid=#{id-100000}&size=#{size}", 'rb') {|io|open(cache, 'wb') {|c|c.write io.read}} rescue cache = "graphics/avatars/noavatar_#{size}.gif"
yield Surface.load(cache)
yield Surface.load(cache) if scene == $scene
end
else
result
......
......@@ -136,8 +136,12 @@ class Scene
def handle_game(event)
case event
when Game_Event::Error
$game.exit if $game
Widget_Msgbox.new(event.title, event.message, :ok => "确定"){$scene = Scene_Login.new if event.fatal}
if event.fatal
$game.exit if $game
Widget_Msgbox.new(event.title, event.message, :ok => "确定"){$scene = Scene_Login.new}
else
Widget_Msgbox.new(event.title, event.message, :ok => "确定")
end
else
$log.debug('未处理的游戏事件'){event.inspect}
end
......
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