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
f07e6d72
Commit
f07e6d72
authored
Nov 26, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时提交
parent
ac0436ff
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
60 additions
and
38 deletions
+60
-38
graphics/system/msgbox_btn.png
graphics/system/msgbox_btn.png
+0
-0
lib/action.rb
lib/action.rb
+4
-4
lib/fpstimer.rb
lib/fpstimer.rb
+11
-13
lib/iduel.rb
lib/iduel.rb
+1
-1
lib/iduel_action.rb
lib/iduel_action.rb
+2
-0
lib/iduel_event.rb
lib/iduel_event.rb
+1
-0
lib/main.rb
lib/main.rb
+7
-4
lib/scene.rb
lib/scene.rb
+4
-5
lib/scene_hall.rb
lib/scene_hall.rb
+5
-0
lib/scene_title.rb
lib/scene_title.rb
+1
-0
lib/widget_inputbox.rb
lib/widget_inputbox.rb
+1
-1
lib/widget_msgbox.rb
lib/widget_msgbox.rb
+16
-4
lib/window.rb
lib/window.rb
+3
-3
lib/window_cardinfo.rb
lib/window_cardinfo.rb
+2
-1
lib/window_field.rb
lib/window_field.rb
+2
-2
No files found.
graphics/system/msgbox_btn.png
deleted
100644 → 0
View file @
ac0436ff
This diff was suppressed by a .gitattributes entry.
lib/action.rb
View file @
f07e6d72
...
...
@@ -160,13 +160,13 @@ class Action
end
end
class
Summon
<
Move
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
)
super
(
from_player
,
from_pos
,
to_pos
,
card
,
nil
,
:attack
)
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
,
msg
=
nil
)
super
(
from_player
,
from_pos
,
to_pos
,
card
,
msg
,
:attack
)
end
end
class
SpecialSummon
<
Move
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
,
position
=
:attack
)
super
(
from_player
,
from_pos
,
to_pos
,
card
,
nil
,
position
)
def
initialize
(
from_player
,
from_pos
,
to_pos
,
card
,
msg
=
nil
,
position
=
:attack
)
super
(
from_player
,
from_pos
,
to_pos
,
card
,
msg
,
position
)
end
end
class
SendToGraveyard
<
Move
...
...
lib/fpstimer.rb
View file @
f07e6d72
...
...
@@ -8,6 +8,7 @@ class FPSTimer
# +accurary+ is the accurary of sleep/SDL.delay in milisecond
def
initialize
(
fps
=
60
,
accurary
=
10
,
skip_limit
=
15
)
@fps
=
fps
@spf
=
(
1.0
/
@fps
)
@accurary
=
accurary
/
1000.0
@skip_limit
=
skip_limit
reset
...
...
@@ -15,7 +16,7 @@ class FPSTimer
# reset timer, you should call just before starting loop
def
reset
@old
=
get_ticks
@old
=
Time
.
now
.
to_f
@skip
=
0
@real_fps
=
@fps
@frame_count
=
0
...
...
@@ -26,19 +27,16 @@ class FPSTimer
# execute given block and wait
def
wait_frame
now
=
get_ticks
nxt
=
@old
+
(
1.0
/
@fps
)
if
nxt
>
now
||
@skip
>
@skip_limit
yield
@skip
=
0
wait
(
nxt
)
@old
=
nxt
else
@skip
+=
1
@total_skip
+=
1
@old
=
get_ticks
#sleep 0.01
#yield
nxt
=
@old
+
@spf
#now =
yield
if
nxt
>
Time
.
now
.
to_f
if
(
sleeptime
=
nxt
-
Time
.
now
.
to_f
)
>
0
sleep
(
sleeptime
)
end
#end
@old
=
nxt
calc_real_fps
end
...
...
lib/iduel.rb
View file @
f07e6d72
...
...
@@ -35,7 +35,7 @@ class Iduel
info
.
encode!
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
puts
">>
#{
info
}
"
Event
.
parse
info
rescue
rescue
IOError
@conn
.
close
@conn
=
nil
Event
::
Error
.
new
(
0
)
...
...
lib/iduel_action.rb
View file @
f07e6d72
...
...
@@ -198,6 +198,8 @@ class Action
ReturnToExtra
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/从
#{
PosFilter
}
取
#{
CardFilter
}
加入手卡/
ReturnToHand
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
when
/
#{
PosFilter
}#{
CardFilter
}
效果发(?:\~){0,1}动/
Effect_Activate
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/
#{
PhaseFilter
}
/
ChangePhase
.
new
(
from_player
,
parse_phase
(
$1
))
else
...
...
lib/iduel_event.rb
View file @
f07e6d72
...
...
@@ -191,6 +191,7 @@ class Iduel::Event::Error < Iduel::Event
[
"错误"
,
"请求的房间无效"
]
end
#Exception.new(@message).raise
p
caller
p
@title
p
@message
#system("pause")
...
...
lib/main.rb
View file @
f07e6d72
...
...
@@ -47,7 +47,10 @@ require_relative 'fpstimer'
require_relative
'widget_msgbox'
$fpstimer
=
FPSTimer
.
new
$scene
=
Scene_Title
.
new
while
$scene
$scene
.
main
begin
$scene
.
main
while
$scene
#rescue
# p $!, $!.backtrace
# Widget_Msgbox.new("程序出错", "程序可能出现了一个bug,请去论坛反馈") { $scene = Scene_Title.new }
# retry
end
\ No newline at end of file
SDL
.
quit
#这货居然会卡一下///囧
\ No newline at end of file
lib/scene.rb
View file @
f07e6d72
...
...
@@ -19,13 +19,13 @@ class Scene
end
def
initialize
@windows
=
[]
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
end
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def
start
@fps
=
Window
.
new
(
0
,
0
,
100
,
24
,
500
)
@font
=
TTF
.
open
(
'fonts/WenQuanYi Micro Hei.ttf'
,
16
)
end
def
refresh_rect
(
x
,
y
,
width
,
height
,
background
=
@background
,
ox
=
0
,
oy
=
0
)
Surface
.
blit
(
background
,
x
+
ox
,
y
+
oy
,
width
,
height
,
$screen
,
x
,
y
)
...
...
@@ -55,10 +55,8 @@ class Scene
#@fpscount += 1
$fpstimer
.
wait_frame
do
$screen
.
put
(
@background
,
0
,
0
)
@fps
.
contents
.
fill_rect
(
0
,
0
,
@fps
.
contents
.
w
,
@fps
.
contents
.
h
,
0x00000000
)
@font
.
draw_solid_utf8
(
@fps
.
contents
,
"%.1f"
%
$fpstimer
.
real_fps
,
0
,
0
,
0xFF
,
0xFF
,
0xFF
)
@windows
.
each
do
|
window
|
if
window
.
contents
&&
window
.
visible
&&
!
window
.
destro
t
ed?
if
window
.
contents
&&
window
.
visible
&&
!
window
.
destro
y
ed?
if
window
.
angle
.
zero?
Surface
.
blit
(
window
.
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
else
...
...
@@ -69,6 +67,7 @@ class Scene
end
#$screen.put(window.contents, window.x, window.y) if window.contents && window.visible
end
@font
.
draw_blended_utf8
(
$screen
,
"%.1f"
%
$fpstimer
.
real_fps
,
0
,
0
,
0xFF
,
0xFF
,
0xFF
)
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
end
end
...
...
lib/scene_hall.rb
View file @
f07e6d72
#encoding: UTF-8
#==============================================================================
# Scene_Hall
#------------------------------------------------------------------------------
...
...
@@ -112,6 +113,8 @@ class Scene_Hall < Scene
@chat
.
add
event
.
user
,
event
.
content
when
Iduel
::
Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
when
Iduel
::
Event
::
QROOMOK
@joinroom_msgbox
.
message
=
"读取房间信息"
if
@joinroom_msgbox
&&
!
@joinroom_msgbox
.
destroyed?
else
puts
"---unhandled iduel event----"
p
event
...
...
@@ -136,8 +139,10 @@ class Scene_Hall < Scene
return
unless
@roomlist
.
index
and
room
=
@roomlist
.
list
[
@roomlist
.
index
]
if
room
.
full?
$iduel
.
watch
room
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入观战"
){}
else
$iduel
.
join
room
,
"test"
@joinroom_msgbox
=
Widget_Msgbox
.
new
(
"加入房间"
,
"正在加入房间"
){}
end
end
end
...
...
lib/scene_title.rb
View file @
f07e6d72
...
...
@@ -81,6 +81,7 @@ class Scene_Title < Scene
p
event
end
end
#super #黑历史,title在有那架构之前就已经写好了,暂时懒得动
end
def
determine
return
unless
@command_window
.
index
...
...
lib/widget_inputbox.rb
View file @
f07e6d72
...
...
@@ -15,7 +15,7 @@ class Widget_InputBox < Window
bind
(
'Key-Return'
){
@@active
.
proc
.
call
(
get
);
delete
(
0
,
get
.
size
);
@@root
.
withdraw
(
true
);
true
}
pack
}
Thread
.
new
{
Tk
.
mainloop
}
Thread
.
new
{
Tk
.
mainloop
}
.
priority
=
1
def
initialize
(
x
,
y
,
width
,
height
,
z
=
300
,
&
block
)
super
(
x
,
y
,
width
,
height
,
z
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
20
)
...
...
lib/widget_msgbox.rb
View file @
f07e6d72
# To change this template, choose Tools | Templates
# and open the template in the editor.
#encoding: UTF-8
class
Widget_Msgbox
<
Window
def
initialize
(
title
,
message
,
buttons
=
{
:ok
=>
"确定"
},
&
proc
)
#@background = Surface.load 'graphics/system/msgbox.png'
@contents
=
Surface
.
load
'graphics/system/msgbox.png'
@button
=
Surface
.
load
'graphics/system/button.png'
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
...
...
@@ -23,9 +22,22 @@ class Widget_Msgbox < Window
end
refresh
end
def
title
=
(
title
)
@title
.
replace
title
refresh
end
def
message
=
(
message
)
@message
.
replace
message
refresh
end
def
buttons
=
(
buttons
)
@buttons
.
replace
buttons
refresh
end
def
refresh
@contents
=
Surface
.
load
'graphics/system/msgbox.png'
@font
.
draw_blended_utf8
(
@contents
,
@title
,
(
@width
-
@font
.
text_size
(
@title
)[
0
])
/
2
,
2
,
0xFF
,
0xFF
,
0xFF
)
@font
.
draw_blended_utf8
(
@contents
,
@message
,
0
,
24
,
0xFF
,
0xFF
,
0x66
)
@font
.
draw_blended_utf8
(
@contents
,
@message
,
2
,
24
+
2
,
0xFF
,
0xFF
,
0x66
)
@items
.
each_key
do
|
index
|
draw_item
(
index
,
@index
==
index
?
1
:
0
)
end
...
...
lib/window.rb
View file @
f07e6d72
...
...
@@ -40,12 +40,12 @@ class Window
x
>
@x
&&
x
<
@x
+
@width
&&
y
>
@y
&&
y
<
@y
+
@height
end
def
destroy
@destro
t
ed
=
true
@destro
y
ed
=
true
@contents
.
destroy
if
@contents
$scene
.
windows
.
delete
self
end
def
destro
t
ed?
@destro
t
ed
def
destro
y
ed?
@destro
y
ed
end
def
clear
(
x
,
y
,
width
,
height
)
Surface
.
blit
(
@background
,
x
,
y
,
width
,
height
,
@contents
,
x
,
y
)
...
...
lib/window_cardinfo.rb
View file @
f07e6d72
...
...
@@ -9,7 +9,8 @@ class Window_CardInfo < Window
self
.
card
=
nil
end
def
card
=
(
card
)
@card
=
card
||
Card
.
find
(
nil
)
return
if
card
.
nil?
or
card
==
@card
or
!
card
.
known?
@card
=
card
refresh
end
def
update
...
...
lib/window_field.rb
View file @
f07e6d72
...
...
@@ -240,7 +240,7 @@ class Window_Field < Window
case
$scene
.
action_window
.
index
when
0
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:extra
,
pos
,
@card
,
:attack
).
run
Action
::
SpecialSummon
.
new
(
true
,
:extra
,
pos
,
@card
,
nil
,
:attack
).
run
else
p
"场位已满"
end
...
...
@@ -337,7 +337,7 @@ class Window_Field < Window
end
when
1
#特殊召唤
if
pos
=
@field
.
empty_field
(
@card
)
Action
::
SpecialSummon
.
new
(
true
,
:hand
,
pos
,
@card
,
:attack
).
run
Action
::
SpecialSummon
.
new
(
true
,
:hand
,
pos
,
@card
,
nil
,
:attack
).
run
else
p
"场位已满"
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