Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
ff51a04b
Commit
ff51a04b
authored
Dec 18, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.8.4
parent
03bca965
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
412 additions
and
107 deletions
+412
-107
Rakefile
Rakefile
+1
-1
lib/cacheable.rb
lib/cacheable.rb
+4
-1
lib/scene_lobby.rb
lib/scene_lobby.rb
+2
-2
lib/update.rb
lib/update.rb
+1
-1
lib/window_filter.rb
lib/window_filter.rb
+1
-0
lib/ygocore/event.rb
lib/ygocore/event.rb
+28
-28
lib/ygocore/game.rb
lib/ygocore/game.rb
+319
-33
lib/ygocore/room.rb
lib/ygocore/room.rb
+56
-41
No files found.
Rakefile
View file @
ff51a04b
...
...
@@ -20,7 +20,7 @@ end
spec
=
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
'mycard'
s
.
version
=
'0.8.
2
'
s
.
version
=
'0.8.
4
'
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
summary
=
'a card game'
s
.
description
=
s
.
summary
...
...
lib/cacheable.rb
View file @
ff51a04b
...
...
@@ -9,4 +9,7 @@ module Cacheable
@@all
[
self
][
id
]
=
super
(
id
,
*
args
)
end
end
def
find
(
id
)
@@all
[
self
][
id
]
end
end
\ No newline at end of file
lib/scene_lobby.rb
View file @
ff51a04b
...
...
@@ -66,8 +66,8 @@ class Scene_Lobby < Scene
when
Game_Event
::
AllUsers
@userlist
.
items
=
$game
.
users
when
Game_Event
::
AllRooms
,
Game_Event
::
AllServers
@roomlist
.
items
=
$game
.
rooms
.
find_all
{
|
room
|
$game
.
filter
[
:servers
].
collect
{
|
server
|
server
.
id
}.
include?
(
room
.
server_id
)
and
@roomlist
.
items
=
p
$game
.
rooms
.
find_all
{
|
room
|
$game
.
filter
[
:servers
].
include?
(
room
.
server
)
and
$game
.
filter
[
:waiting_only
]
?
(
room
.
status
==
:
wait
)
:
true
and
$game
.
filter
[
:normal_only
]
?
(
!
room
.
tag?
&&
(
room
.
ot
==
0
)
&&
(
room
.
lp
=
8000
))
:
true
}
...
...
lib/update.rb
View file @
ff51a04b
...
...
@@ -2,7 +2,7 @@ require 'open-uri'
require
"fileutils"
require_relative
'card'
module
Update
Version
=
'0.8.
2
'
Version
=
'0.8.
4
'
URL
=
"http://my-card.in/mycard/update.json?version=
#{
Version
}
"
class
<<
self
attr_reader
:thumbnails
,
:images
,
:status
...
...
lib/window_filter.rb
View file @
ff51a04b
...
...
@@ -11,6 +11,7 @@ class Window_Filter < Window
@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
.
background
=
@background
.
copy_rect
(
4
,
WLH
+
WLH
*
index
,
@width
-
8
,
24
)
result
.
checked
=
$game
.
filter
[
:servers
].
include?
server
result
.
refresh
result
end
...
...
lib/ygocore/event.rb
View file @
ff51a04b
...
...
@@ -7,22 +7,22 @@ class Game_Event
else
Error
.
new
(
'登录'
,
'用户名或密码错误'
)
end
when
:rooms
AllRooms
.
new
data
.
collect
{
|
room
|
parse_room
(
room
)}
when
:rooms_update
RoomsUpdate
.
new
data
.
collect
{
|
room
|
parse_room
(
room
)}
when
:servers
servers
=
data
.
collect
{
|
server
|
parse_server
(
server
)}
$game
.
filter
[
:servers
].
concat
(
servers
-
$game
.
servers
)
AllServers
.
new
servers
#
when :rooms
#
AllRooms.new data.collect{|room|parse_room(room)}
#
when :rooms_update
#
RoomsUpdate.new data.collect{|room|parse_room(room)}
#
when :servers
#
servers = data.collect{|server|parse_server(server)}
#
$game.filter[:servers].concat (servers - $game.servers)
#
AllServers.new servers
#when :newuser
#NewUser.new parse_user data
#when :missinguser
#MissingUser.new parse_user data
when
:newroom
NewRoom
.
new
parse_room
data
when
:missingroom
MissingRoom
.
new
parse_room
data
#
when :newroom
#
NewRoom.new parse_room data
#
when :missingroom
#
MissingRoom.new parse_room data
when
:chat
case
data
[
:channel
]
when
:lobby
...
...
@@ -33,25 +33,25 @@ class Game_Event
end
end
def
self
.
parse_room
(
room
)
result
=
Room
.
new
(
room
[
:id
],
room
[
:name
])
result
.
p
layer1
=
room
[
:player1
]
&&
parse_user
(
room
[
:player1
])
result
.
p
layer2
=
room
[
:player2
]
&&
parse_user
(
room
[
:player2
])
result
.
private
=
room
[
:private
]
result
.
pvp
=
room
[
:pvp
]
result
.
match
=
room
[
:match
]
result
.
tag
=
room
[
:tag
]
result
.
ot
=
room
[
:ot
]
result
.
status
=
room
[
:status
]
result
.
lp
=
room
[
:lp
]
result
.
_deleted
=
room
[
:_deleted
]
result
.
server_id
=
room
[
:server_id
]
result
.
server
_ip
=
room
[
:server_ip
]
result
.
server_port
=
room
[
:server_port
]
result
.
server_auth
=
room
[
:server_auth
]
result
=
Room
.
new
(
room
[
'id'
],
room
[
'name'
])
result
.
p
rivate
=
room
[
'private'
]
result
.
p
vp
=
room
[
'pvp'
]
result
.
match
=
room
[
'mode'
]
==
1
result
.
tag
=
room
[
'mode'
]
==
2
result
.
ot
=
room
[
'rule'
]
||
0
result
.
status
=
room
[
'status'
].
to_sym
result
.
lp
=
room
[
'start_lp'
]
||
8000
result
.
player1
=
room
[
'users'
][
0
]
&&
parse_user
(
room
[
'users'
][
0
])
result
.
player2
=
room
[
'users'
][
1
]
&&
parse_user
(
room
[
'users'
][
1
])
result
.
server
=
Server
.
find
room
[
'server_id'
]
result
.
_deleted
=
room
[
'_deleted'
]
result
end
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
def
self
.
parse_server
(
server
)
Server
.
new
(
server
[
:id
],
server
[
:name
],
server
[
:ip
],
server
[
:port
],
server
[
:auth
])
...
...
lib/ygocore/game.rb
View file @
ff51a04b
This diff is collapsed.
Click to expand it.
lib/ygocore/room.rb
View file @
ff51a04b
...
...
@@ -5,7 +5,7 @@ class Room
attr_accessor
:ot
attr_accessor
:lp
attr_accessor
:status
attr_accessor
:server
_id
,
:server_ip
,
:server_port
,
:server_auth
attr_accessor
:server
alias
pvp?
pvp
alias
match?
match
alias
tag?
tag
...
...
@@ -38,4 +38,19 @@ class Room
end
result
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment