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
e9c3391f
Commit
e9c3391f
authored
Feb 27, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登陆界面输入框响应enter
parent
15b9ddaf
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
38 additions
and
16 deletions
+38
-16
lib/iduel/replay.rb
lib/iduel/replay.rb
+7
-3
lib/main.rb
lib/main.rb
+0
-1
lib/scene.rb
lib/scene.rb
+1
-1
lib/scene_duel.rb
lib/scene_duel.rb
+1
-0
lib/scene_lobby.rb
lib/scene_lobby.rb
+2
-1
lib/scene_login.rb
lib/scene_login.rb
+4
-0
lib/scene_title.rb
lib/scene_title.rb
+1
-0
lib/widget_inputbox.rb
lib/widget_inputbox.rb
+7
-4
lib/window_cardinfo.rb
lib/window_cardinfo.rb
+1
-1
lib/window_chat.rb
lib/window_chat.rb
+3
-3
lib/window_gameselect.rb
lib/window_gameselect.rb
+4
-0
lib/window_login.rb
lib/window_login.rb
+7
-2
No files found.
lib/iduel/replay.rb
View file @
e9c3391f
#encoding: UTF-8
class
Replay
User_Filter
=
/(.+?)
\((\d+)\)
(?:\(\d+:\d+:\d+\))?(?::|:) */
User_Filter
=
/(.+?)
(?:\((\d+)\))?
(?:\(\d+:\d+:\d+\))?(?::|:) */
Delimiter
=
/^
#{
User_Filter
}
\n ?/
Player_Filter
=
/
#{
Delimiter
}
\[\d+\] ◎→/
Opponent_Filter
=
/
#{
Delimiter
}
\[\d+\] ●→/
...
...
@@ -27,8 +27,8 @@ class Replay
require
'cgi'
contents
=
CGI
.
unescape_html
(
contents
)
else
result
.
player1
=
User
.
new
(
$2
.
to_i
,
$1
)
if
contents
=~
Player_Filter
result
.
player2
=
User
.
new
(
$2
.
to_i
,
$1
)
if
contents
=~
Opponent_Filter
result
.
player1
=
User
.
new
(
$2
?
$2
.
to_i
:
:player
,
$1
)
if
contents
=~
Player_Filter
result
.
player2
=
User
.
new
(
$2
?
$2
.
to_i
:
:opponent
,
$1
)
if
contents
=~
Opponent_Filter
from_players
=
contents
.
scan
(
Delimiter
).
collect
do
|
matched
|
id
=
matched
[
1
].
to_i
name
=
matched
[
0
]
...
...
@@ -52,6 +52,10 @@ class Replay
result
.
player2
||=
User
.
new
(
1
,
"对手"
)
lines
=
contents
.
split
(
Delimiter
)
lines
.
shift
#split后,在第一个操作之前会多出一个空白元素
if
from_players
.
empty?
Game_Event
.
push
Game_Event
::
Error
.
new
(
"播放战报"
,
"战报无法识别"
)
return
[]
end
lines
=
lines
.
each_slice
(
lines
.
size
/
from_players
.
size
).
collect
{
|
a
|
a
.
last
.
strip
}
from_players
=
from_players
.
to_enum
result
.
actions
=
lines
.
collect
do
|
action_str
|
...
...
lib/main.rb
View file @
e9c3391f
...
...
@@ -39,7 +39,6 @@ begin
$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
)
TTF
.
init
#设置标准输出编码(windows)
STDOUT
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
...
...
lib/scene.rb
View file @
e9c3391f
...
...
@@ -104,7 +104,7 @@ class Scene
case
event
when
Game_Event
::
Error
$game
.
exit
if
$game
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
,
:ok
=>
"确定"
){
$scene
=
Scene_
Title
.
new
if
event
.
fatal
}
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
,
:ok
=>
"确定"
){
$scene
=
Scene_
Login
.
new
if
event
.
fatal
}
else
$log
.
debug
(
'未处理的游戏事件'
){
event
.
inspect
}
end
...
...
lib/scene_duel.rb
View file @
e9c3391f
...
...
@@ -27,6 +27,7 @@ class Scene_Duel < Scene
@deck
=
deck
end
def
start
WM
::
set_caption
(
"MyCard -
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
) -
#{
@room
.
name
}
(
#{
@room
.
id
}
)"
,
"MyCard"
)
@bgm
=
Mixer
::
Music
.
load
"audio/bgm/duel.ogg"
Mixer
.
fade_in_music
(
@bgm
,
-
1
,
800
)
@background
=
Surface
.
load
(
"graphics/field/main.png"
).
display_format
...
...
lib/scene_lobby.rb
View file @
e9c3391f
...
...
@@ -13,6 +13,7 @@ class Scene_Lobby < Scene
require_relative
'chatmessage'
attr_reader
:chat_window
def
start
WM
::
set_caption
(
"MyCard -
#{
$config
[
'game'
]
}
-
#{
$game
.
user
.
name
}
(
#{
$game
.
user
.
id
}
)"
,
"MyCard"
)
$game
.
refresh
@background
=
Surface
.
load
(
"graphics/lobby/background.png"
).
display_format
Surface
.
blit
(
@background
,
0
,
0
,
0
,
0
,
$screen
,
0
,
0
)
...
...
@@ -93,7 +94,7 @@ class Scene_Lobby < Scene
end
def
update
if
@count
>=
3
00
if
@count
>=
6
00
$game
.
refresh
@count
=
0
end
...
...
lib/scene_login.rb
View file @
e9c3391f
...
...
@@ -9,6 +9,7 @@ require_relative 'window_login'
require_relative
'scene_replay'
class
Scene_Login
<
Scene
def
start
WM
::
set_caption
(
"MyCard"
,
"MyCard"
)
@background
=
Surface
.
load
(
"graphics/login/background.png"
).
display_format
@gameselect_window
=
Window_GameSelect
.
new
(
117
,
269
,
$config
[
"game"
])
end
...
...
@@ -27,4 +28,7 @@ class Scene_Login < Scene
super
end
end
#def terminate
# @gameselect_window.destroy
#end
end
\ No newline at end of file
lib/scene_title.rb
View file @
e9c3391f
...
...
@@ -8,6 +8,7 @@ require_relative 'scene'
require_relative
'window_title'
class
Scene_Title
<
Scene
def
start
WM
::
set_caption
(
"MyCard"
,
"MyCard"
)
title
=
Dir
.
glob
(
"graphics/titles/title_*.*"
)
title
=
title
[
rand
(
title
.
size
)]
@background
=
Surface
.
load
(
title
).
display_format
...
...
lib/widget_inputbox.rb
View file @
e9c3391f
...
...
@@ -16,16 +16,16 @@ class Widget_InputBox < Window
@@entry
=
TkEntry
.
new
(
@@root
){
font
@@font
validate
:focusout
validatecommand
{
@@active
.
value
=
get
.
encode
(
"UTF-8"
);
@@root
.
withdraw
(
true
);
@@active
.
refresh
;
tru
e
}
validatecommand
{
Widget_InputBox
.
determin
e
}
bind
(
'Key-Return'
){
self
.
value
=
""
if
@@active
.
proc
.
call
(
get
.
encode
(
"UTF-8"
))
if
@@active
.
proc
;
true
}
#两个if的解释:当存在proc时,call那个proc,如果执行结果为真就清空value
pack
}
Thread
.
new
{
Tk
.
mainloop
}
def
initialize
(
x
,
y
,
width
,
height
,
z
=
300
,
&
block
)
def
initialize
(
x
,
y
,
width
,
height
,
z
=
300
,
&
proc
)
super
(
x
,
y
,
width
,
height
,
z
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
20
)
@proc
=
block
@proc
=
proc
@value
=
""
@type
=
:text
end
...
...
@@ -36,7 +36,7 @@ class Widget_InputBox < Window
end
def
refresh
clear
@font
.
draw_blended_utf8
(
@contents
,
@type
==
:password
?
'*'
*
@value
.
size
:
@value
,
0
,
0
,
0x00
,
0x00
,
0x00
)
unless
@value
.
empty?
@font
.
draw_blended_utf8
(
@contents
,
@type
==
:password
?
'*'
*
@value
.
size
:
@value
,
2
,
0
,
0x00
,
0x00
,
0x00
)
unless
@value
.
empty?
end
def
clicked
@@entry
.
value
=
@value
...
...
@@ -51,4 +51,7 @@ class Widget_InputBox < Window
@contents
.
fill_rect
(
x
,
y
,
width
,
height
,
0x66FFFFFF
)
@contents
.
fill_rect
(
x
+
2
,
y
+
2
,
width
-
4
,
height
-
4
,
0xFFFFFFFF
)
end
def
self
.
determine
@@active
.
value
=
@@entry
.
get
.
encode
(
"UTF-8"
);
@@root
.
withdraw
(
true
);
@@active
.
refresh
;
true
end
end
lib/window_cardinfo.rb
View file @
e9c3391f
...
...
@@ -4,7 +4,7 @@ class Window_CardInfo < Window
def
initialize
(
x
,
y
)
super
(
x
,
y
,
1024
-
x
,
524
,
300
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
self
.
card
=
nil
self
.
card
=
Game_Card
.
new
Card
.
find
(
1
)
#new 'name' => :test, 'number' => :"000000", 'lore' => "test2", 'card_type' => :通常魔法, 'stats' => "", 'archettypes' => "", "mediums" => "", "tokens" => ""
end
def
card
=
(
card
)
return
if
card
.
nil?
or
card
==
@card
or
!
card
.
known?
...
...
lib/window_chat.rb
View file @
e9c3391f
...
...
@@ -3,11 +3,11 @@
#------------------------------------------------------------------------------
# title
#==============================================================================
require_relative
'widget_scrollbar'
require_relative
'widget_inputbox'
require_relative
'chatmessage'
class
Window_Chat
<
Window_List
WLH
=
16
require_relative
'widget_scrollbar'
require_relative
'widget_inputbox'
User_Color
=
[
0
,
0
,
0xFF
]
Text_Color
=
[
0
,
0
,
0
]
Player_Color
=
[
0
,
0
,
0xFF
]
...
...
lib/window_gameselect.rb
View file @
e9c3391f
...
...
@@ -60,4 +60,8 @@ class Window_GameSelect < Window_List
@login_window
.
destroy
if
@login_window
@login_window
=
Window_Login
.
new
(
316
,
316
,
$config
[
$config
[
'game'
]][
"username"
],
$config
[
$config
[
'game'
]][
"password"
])
end
#def destroy
# @login_window.destroy if @login_window
# super
#end
end
lib/window_login.rb
View file @
e9c3391f
...
...
@@ -8,9 +8,9 @@ class Window_Login < Window
@password
=
password
@button
=
Surface
.
load
(
"graphics/login/button.png"
)
super
(
x
,
y
,
597
,
338
)
@username_inputbox
=
Widget_InputBox
.
new
(
@x
+
192
,
@y
+
80
,
165
,
WLH
)
@username_inputbox
=
Widget_InputBox
.
new
(
@x
+
192
,
@y
+
80
,
165
,
WLH
)
{
@password_inputbox
.
clicked
;
false
}
@username
?
@username_inputbox
.
value
=
@username
:
@username_inputbox
.
refresh
@password_inputbox
=
Widget_InputBox
.
new
(
@x
+
192
,
@y
+
125
,
165
,
WLH
)
@password_inputbox
=
Widget_InputBox
.
new
(
@x
+
192
,
@y
+
125
,
165
,
WLH
)
{
Widget_InputBox
.
determine
;
self
.
index
=
:login
;
clicked
;
false
}
@password_inputbox
.
type
=
:password
@password
?
@password_inputbox
.
value
=
@password
:
@password_inputbox
.
refresh
@color
=
[
255
,
255
,
255
]
...
...
@@ -66,4 +66,9 @@ class Window_Login < Window
draw_item
(
@index
,
item_rect
(
@index
),
1
)
end
end
#def destroy
# @username_inputbox.destroy
# @password_inputbox.destroy
# super
#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