Commit 796d2794 authored by zh99998's avatar zh99998

版本0.4.6,ygocore房间加人声音+托盘提示,不规范修正先进入ygocore再进入iduel后房间全为等待中问题

parent a287617c
...@@ -24,7 +24,7 @@ end ...@@ -24,7 +24,7 @@ end
spec = Gem::Specification.new do |s| spec = Gem::Specification.new do |s|
s.name = 'mycard' s.name = 'mycard'
s.version = '0.4.5' s.version = '0.4.6'
s.extra_rdoc_files = ['README.txt', 'LICENSE.txt'] s.extra_rdoc_files = ['README.txt', 'LICENSE.txt']
s.summary = 'a card game' s.summary = 'a card game'
s.description = s.summary s.description = s.summary
......
...@@ -47,6 +47,7 @@ begin ...@@ -47,6 +47,7 @@ begin
WM::icon = Surface.load("graphics/system/icon.gif") WM::icon = Surface.load("graphics/system/icon.gif")
$screen = Screen.open($config['screen']['width'], $config['screen']['height'], 0, HWSURFACE | ($config['screen']['fullscreen'] ? FULLSCREEN : 0)) $screen = Screen.open($config['screen']['width'], $config['screen']['height'], 0, HWSURFACE | ($config['screen']['fullscreen'] ? FULLSCREEN : 0))
Mixer.open(Mixer::DEFAULT_FREQUENCY,Mixer::DEFAULT_FORMAT,Mixer::DEFAULT_CHANNELS,512) Mixer.open(Mixer::DEFAULT_FREQUENCY,Mixer::DEFAULT_FORMAT,Mixer::DEFAULT_CHANNELS,512)
Mixer.set_volume_music(60)
TTF.init TTF.init
Thread.abort_on_exception = true Thread.abort_on_exception = true
......
...@@ -51,7 +51,7 @@ class Scene ...@@ -51,7 +51,7 @@ class Scene
# ● 开始处理 # ● 开始处理
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def start def start
if $config['bgm'] and @@last_bgm != bgm if $config['bgm'] and @@last_bgm != bgm and File.file? "audio/bgm/#{bgm}"
@@bgm.destroy if @@bgm @@bgm.destroy if @@bgm
@@bgm = Mixer::Music.load "audio/bgm/#{bgm}" @@bgm = Mixer::Music.load "audio/bgm/#{bgm}"
Mixer.fade_in_music(@@bgm, -1, 800) Mixer.fade_in_music(@@bgm, -1, 800)
......
...@@ -43,6 +43,8 @@ class Scene_Duel < Scene ...@@ -43,6 +43,8 @@ class Scene_Duel < Scene
@player_lp_window = Window_LP.new(0,0, @room.player1, true) @player_lp_window = Window_LP.new(0,0, @room.player1, true)
@opponent_lp_window = Window_LP.new(360,0, @room.player2, false) @opponent_lp_window = Window_LP.new(360,0, @room.player2, false)
@join_se = Mixer::Wave.load("audio/se/join.ogg")
create_action_window create_action_window
create_chat_window create_chat_window
super super
...@@ -159,6 +161,7 @@ class Scene_Duel < Scene ...@@ -159,6 +161,7 @@ class Scene_Duel < Scene
player = $game.room.player1 == $game.user ? $game.room.player2 : $game.room.player1 player = $game.room.player1 == $game.user ? $game.room.player2 : $game.room.player1
if player if player
notify_send("对手加入房间", "#{player.name}(#{player.id})") notify_send("对手加入房间", "#{player.name}(#{player.id})")
Mixer.play_channel(-1,@join_se,0)
else else
notify_send("对手离开房间", "对手离开房间") notify_send("对手离开房间", "对手离开房间")
end end
......
...@@ -4,6 +4,12 @@ class Game_Event ...@@ -4,6 +4,12 @@ class Game_Event
#User_Filter = /<li>(:::观战:|===决斗1=|===决斗2=)<font color="(?:blue|gray)">(.+?)(\(未认证\)|)<\/font>;<\/li>/ #User_Filter = /<li>(:::观战:|===决斗1=|===决斗2=)<font color="(?:blue|gray)">(.+?)(\(未认证\)|)<\/font>;<\/li>/
#Room_Filter = /<div style="width:300px; height:150px; border:1px #ececec solid; float:left;padding:5px; margin:5px;">房间名称:(.+?)(<font color="d28311" title="竞技场模式">\[竞\]<\/font>|) (<font color=(?:\")?red(?:\")?>决斗已开始!<\/font>|<font color=(?:\")?blue(?:\")?>等待<\/font>)<font size="1">\(ID:(\d+)\)<\/font>#{User_Filter}+?<\/div>/ #Room_Filter = /<div style="width:300px; height:150px; border:1px #ececec solid; float:left;padding:5px; margin:5px;">房间名称:(.+?)(<font color="d28311" title="竞技场模式">\[竞\]<\/font>|) (<font color=(?:\")?red(?:\")?>决斗已开始!<\/font>|<font color=(?:\")?blue(?:\")?>等待<\/font>)<font size="1">\(ID:(\d+)\)<\/font>#{User_Filter}+?<\/div>/
class AllRooms < Game_Event class AllRooms < Game_Event
def self.notify_send(title, msg)
command = "notify-send -i graphics/system/icon.ico #{title} #{msg}"
command = "start ruby/bin/#{command}".encode "GBK" if RUBY_PLATFORM["win"] || RUBY_PLATFORM["ming"]
system(command)
$log.info command
end
def self.parse(info) def self.parse(info)
@rooms = [] @rooms = []
info.scan(Room_Filter) do |id, name, status, users| info.scan(Room_Filter) do |id, name, status, users|
...@@ -27,6 +33,20 @@ class Game_Event ...@@ -27,6 +33,20 @@ class Game_Event
player2 = User.new(name.to_sym, name, certified) player2 = User.new(name.to_sym, name, certified)
end end
end end
if player1 == $game.user or player2 == $game.user
$game.room = Room.new(id.to_i, name)
end
if $game.room and id.to_i == $game.room.id and (($game.room.player1.nil? and player1 and player1 != $game.user) or ($game.room.player2.nil? and player2 and player2 != $game.user))
@@join_se ||= Mixer::Wave.load("audio/se/join.ogg")
Mixer.play_channel(-1,@@join_se,0)
if $game.room.player1.nil? and player1 and player1 != $game.user
player = player1
elsif $game.room.player2.nil? and player2 and player2 != $game.user
player = player2
end
notify_send("对手加入房间", "#{player.name}(#{player.id})")
end
room = Room.new(id.to_i, name, player1, player2, false, [0,0,0]) room = Room.new(id.to_i, name, player1, player2, false, [0,0,0])
room.status = status.to_sym room.status = status.to_sym
room.name =~ /^(P)?(M)?\#?(.*?)(?:<font color="d28311" title="竞技场模式">\[竞\]<\/font>)?$/ room.name =~ /^(P)?(M)?\#?(.*?)(?:<font color="d28311" title="竞技场模式">\[竞\]<\/font>)?$/
......
...@@ -94,7 +94,9 @@ class Ygocore < Game ...@@ -94,7 +94,9 @@ class Ygocore < Game
Game_Event.push Game_Event::AllRooms.parse info Game_Event.push Game_Event::AllRooms.parse info
Game_Event.push Game_Event::AllUsers.parse info Game_Event.push Game_Event::AllUsers.parse info
yield if block_given? yield if block_given?
end rescue nil end
rescue Exception => exception
$log.warn('刷新大厅'){[exception.inspect, *exception.backtrace].collect{|str|str.encode("UTF-8")}.join("\n")}
end end
end end
end end
......
...@@ -5,7 +5,7 @@ class Room ...@@ -5,7 +5,7 @@ class Room
alias pvp? pvp alias pvp? pvp
alias match? match alias match? match
def full? def full?
@status == :start $game.is_a?(Ygocore) ? (@status == :start) : super #不规范修正iduel房间识别问题
end end
def extra def extra
result = {} result = {}
......
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