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
xiaoye
mycard
Commits
b7dfeb3a
Commit
b7dfeb3a
authored
Aug 21, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.2.2
parent
d5b00e8d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
Rakefile
Rakefile
+1
-1
lib/update.rb
lib/update.rb
+1
-1
lib/ygocore/game.rb
lib/ygocore/game.rb
+7
-5
No files found.
Rakefile
View file @
b7dfeb3a
...
...
@@ -20,7 +20,7 @@ end
spec
=
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
'mycard'
s
.
version
=
'1.2.
1
'
s
.
version
=
'1.2.
2
'
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
summary
=
'a card game platform'
s
.
description
=
s
.
summary
...
...
lib/update.rb
View file @
b7dfeb3a
...
...
@@ -2,7 +2,7 @@
require
"fileutils"
require_relative
'card'
module
Update
Version
=
'1.2.
1
'
Version
=
'1.2.
2
'
URL
=
"https://my-card.in/mycard/update.json?version=
#{
Version
}
"
class
<<
self
attr_reader
:thumbnails
,
:images
...
...
lib/ygocore/game.rb
View file @
b7dfeb3a
...
...
@@ -38,11 +38,15 @@ class Ygocore < Game
else
jid
=
Jabber
::
JID
::
new
@username
,
'my-card.in'
,
'mycard'
end
Jabber
::
Client
.
module_eval
do
|
klass
|
def
start
super
send
(
generate_stream_start
(
@jid
.
domain
,
nil
,
nil
,
$config
[
'i18n'
][
'locale'
]))
{
|
e
|
e
.
name
==
'stream'
}
end
end
@@im
=
Jabber
::
Client
.
new
(
jid
)
@@im_room
=
Jabber
::
MUC
::
MUCClient
.
new
(
@@im
)
Jabber
.
logger
=
$log
Jabber
.
debug
=
true
@@im
.
on_exception
do
|
exception
,
c
,
where
|
$log
.
error
(
'聊天出错'
)
{
[
exception
,
c
,
where
]
}
...
...
@@ -100,10 +104,8 @@ class Ygocore < Game
Game_Event
.
push
Game_Event
::
Error
.
new
(
'ygocore'
,
'读取服务器列表失败.1'
,
true
)
end
#EventMachine::connect "mycard-server.my-card.in", 9997, Client
ws
=
WebSocket
::
EventMachine
::
Client
.
connect
(
:uri
=>
'wss://my-card.in/rooms.json'
);
ws
.
onmessage
do
|
msg
,
type
|
$log
.
info
(
'收到websocket消息'
)
{
msg
.
force_encoding
(
"UTF-8"
)
}
Game_Event
.
push
Game_Event
::
RoomsUpdate
.
new
JSON
.
parse
(
msg
).
collect
{
|
room
|
Game_Event
.
parse_room
(
room
)
}
end
ws
.
onclose
do
...
...
@@ -173,12 +175,12 @@ class Ygocore < Game
#@@im_room.join(Jabber::JID.new(I18n.t('lobby.room'), I18n.t('lobby.server'), nickname))
@@im_room
.
join
(
Jabber
::
JID
.
new
(
'mycard'
,
'conference.my-card.in'
,
nickname
))
rescue
Jabber
::
ServerError
=>
exception
Game_Event
.
push
(
Game_Event
::
Chat
.
new
(
ChatMessage
.
new
(
User
.
new
(
:system
,
'System'
),
exception
.
message
)))
if
exception
.
error
.
error
==
'conflict'
@nickname_conflict
<<
nickname
retry
end
end
#Game_Event.push Game_Event::AllUsers.new @@im_room.roster.keys.collect { |nick| User.new(nick.to_sym, nick) } rescue p $!
end
rescue
StandardError
=>
exception
$log
.
error
(
'聊天连接出错'
)
{
exception
}
...
...
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