Commit ff51a04b authored by 神楽坂玲奈's avatar 神楽坂玲奈

0.8.4

parent 03bca965
...@@ -20,7 +20,7 @@ end ...@@ -20,7 +20,7 @@ end
spec = Gem::Specification.new do |s| spec = Gem::Specification.new do |s|
s.name = 'mycard' s.name = 'mycard'
s.version = '0.8.2' s.version = '0.8.4'
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
......
...@@ -8,5 +8,8 @@ module Cacheable ...@@ -8,5 +8,8 @@ module Cacheable
else else
@@all[self][id] = super(id, *args) @@all[self][id] = super(id, *args)
end end
end end
def find(id)
@@all[self][id]
end
end end
\ No newline at end of file
...@@ -66,8 +66,8 @@ class Scene_Lobby < Scene ...@@ -66,8 +66,8 @@ class Scene_Lobby < Scene
when Game_Event::AllUsers when Game_Event::AllUsers
@userlist.items = $game.users @userlist.items = $game.users
when Game_Event::AllRooms, Game_Event::AllServers when Game_Event::AllRooms, Game_Event::AllServers
@roomlist.items = $game.rooms.find_all { |room| @roomlist.items = p $game.rooms.find_all { |room|
$game.filter[:servers].collect { |server| server.id }.include?(room.server_id) and $game.filter[:servers].include?(room.server) and
$game.filter[:waiting_only] ? (room.status == :wait) : true and $game.filter[:waiting_only] ? (room.status == :wait) : true and
$game.filter[:normal_only] ? (!room.tag? && (room.ot == 0) && (room.lp = 8000)) : true $game.filter[:normal_only] ? (!room.tag? && (room.ot == 0) && (room.lp = 8000)) : true
} }
......
...@@ -2,7 +2,7 @@ require 'open-uri' ...@@ -2,7 +2,7 @@ require 'open-uri'
require "fileutils" require "fileutils"
require_relative 'card' require_relative 'card'
module Update module Update
Version = '0.8.2' Version = '0.8.4'
URL = "http://my-card.in/mycard/update.json?version=#{Version}" URL = "http://my-card.in/mycard/update.json?version=#{Version}"
class <<self class <<self
attr_reader :thumbnails, :images, :status attr_reader :thumbnails, :images, :status
......
...@@ -11,6 +11,7 @@ class Window_Filter < Window ...@@ -11,6 +11,7 @@ class Window_Filter < Window
@servers = $game.servers.each_with_index.collect do |server, index| @servers = $game.servers.each_with_index.collect do |server, index|
result = Widget_Checkbox.new(self, 4+@x,@y+WLH+WLH*index,@width-8,24,true,server.name){|checked|checked ? $game.filter[:servers].push(server) : $game.filter[:servers].delete(server) ; Game_Event.push(Game_Event::AllRooms.new($game.rooms))} result = Widget_Checkbox.new(self, 4+@x,@y+WLH+WLH*index,@width-8,24,true,server.name){|checked|checked ? $game.filter[:servers].push(server) : $game.filter[:servers].delete(server) ; Game_Event.push(Game_Event::AllRooms.new($game.rooms))}
result.background = @background.copy_rect(4,WLH+WLH*index,@width-8,24) result.background = @background.copy_rect(4,WLH+WLH*index,@width-8,24)
result.checked = $game.filter[:servers].include? server
result.refresh result.refresh
result result
end end
......
...@@ -7,22 +7,22 @@ class Game_Event ...@@ -7,22 +7,22 @@ class Game_Event
else else
Error.new('登录', '用户名或密码错误') Error.new('登录', '用户名或密码错误')
end end
when :rooms #when :rooms
AllRooms.new data.collect{|room|parse_room(room)} #AllRooms.new data.collect{|room|parse_room(room)}
when :rooms_update #when :rooms_update
RoomsUpdate.new data.collect{|room|parse_room(room)} #RoomsUpdate.new data.collect{|room|parse_room(room)}
when :servers #when :servers
servers = data.collect{|server|parse_server(server)} # servers = data.collect{|server|parse_server(server)}
$game.filter[:servers].concat (servers - $game.servers) # $game.filter[:servers].concat (servers - $game.servers)
AllServers.new servers # AllServers.new servers
#when :newuser #when :newuser
#NewUser.new parse_user data #NewUser.new parse_user data
#when :missinguser #when :missinguser
#MissingUser.new parse_user data #MissingUser.new parse_user data
when :newroom #when :newroom
NewRoom.new parse_room data # NewRoom.new parse_room data
when :missingroom #when :missingroom
MissingRoom.new parse_room data # MissingRoom.new parse_room data
when :chat when :chat
case data[:channel] case data[:channel]
when :lobby when :lobby
...@@ -33,25 +33,25 @@ class Game_Event ...@@ -33,25 +33,25 @@ class Game_Event
end end
end end
def self.parse_room(room) def self.parse_room(room)
result = Room.new(room[:id], room[:name]) result = Room.new(room['id'], room['name'])
result.player1 = room[:player1] && parse_user(room[:player1]) result.private = room['private']
result.player2 = room[:player2] && parse_user(room[:player2]) result.pvp = room['pvp']
result.private = room[:private] result.match = room['mode'] == 1
result.pvp = room[:pvp] result.tag = room['mode'] == 2
result.match = room[:match] result.ot = room['rule'] || 0
result.tag = room[:tag] result.status = room['status'].to_sym
result.ot = room[:ot] result.lp = room['start_lp'] || 8000
result.status = room[:status]
result.lp = room[:lp] result.player1 = room['users'][0] && parse_user(room['users'][0])
result._deleted = room[:_deleted] result.player2 = room['users'][1] && parse_user(room['users'][1])
result.server_id = room[:server_id]
result.server_ip = room[:server_ip] result.server = Server.find room['server_id']
result.server_port = room[:server_port]
result.server_auth = room[:server_auth] result._deleted = room['_deleted']
result result
end end
def self.parse_user(user) def self.parse_user(user)
User.new(user[:id], user[:name], user[:certified]) User.new(user['id'] || user[:id], user['name'] || user[:name], user['certified'] || user[:certified])
end end
def self.parse_server(server) def self.parse_server(server)
Server.new(server[:id], server[:name], server[:ip], server[:port], server[:auth]) Server.new(server[:id], server[:name], server[:ip], server[:port], server[:auth])
......
This diff is collapsed.
class Room class Room
attr_accessor :pvp attr_accessor :pvp
attr_accessor :match attr_accessor :match
attr_accessor :tag attr_accessor :tag
attr_accessor :ot attr_accessor :ot
attr_accessor :lp attr_accessor :lp
attr_accessor :status attr_accessor :status
attr_accessor :server_id, :server_ip, :server_port, :server_auth attr_accessor :server
alias pvp? pvp alias pvp? pvp
alias match? match alias match? match
alias tag? tag alias tag? tag
def lp def lp
@lp ||= 8000 @lp ||= 8000
end end
def ot def ot
@ot ||= 0 @ot ||= 0
end end
def full? def full?
$game.is_a?(Ygocore) ? (@status == :start) : player2 #不规范修正iduel房间识别问题 $game.is_a?(Ygocore) ? (@status == :start) : player2 #不规范修正iduel房间识别问题
end end
def extra def extra
result = {} result = {}
if pvp? if pvp?
result["[竞技场]"] = [255,0,0] result["[竞技场]"] = [255,0,0]
end end
if tag? if tag?
result["[TAG双打]"] = [128,0,255] result["[TAG双打]"] = [128,0,255]
elsif match? elsif match?
result["[三回决斗]"] = [0xff,0x72,0] result["[三回决斗]"] = [0xff,0x72,0]
end end
if ot == 1 if ot == 1
result["[TCG]"] = [255,0,0] result["[TCG]"] = [255,0,0]
elsif ot == 2 elsif ot == 2
result["[O/T混]"] = [255,0,0] result["[O/T混]"] = [255,0,0]
end end
if lp != 8000 if lp != 8000
result["[LP: #{lp}]"] = [255,0,0] result["[LP: #{lp}]"] = [255,0,0]
end end
result result
end end
end
def host_server
servers = $game.servers
servers.select!{|server|server.auth} if @pvp
s = servers & $game.filter[:servers]
servers = s if !s.empty?
server = servers.min_by{|server|$game.rooms.select{|room|room.server == server}.size}
p server
server ||= Server.new(nil, "", $game.server, $game.port, true)
self.server = server
server
end
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