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
ac0436ff
Commit
ac0436ff
authored
Nov 25, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msgbox初步
parent
51f4ec56
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
88 additions
and
12 deletions
+88
-12
graphics/system/button.png
graphics/system/button.png
+0
-0
lib/action.rb
lib/action.rb
+1
-1
lib/card.rb
lib/card.rb
+1
-1
lib/iduel_event.rb
lib/iduel_event.rb
+3
-2
lib/main.rb
lib/main.rb
+1
-0
lib/scene.rb
lib/scene.rb
+8
-6
lib/scene_duel.rb
lib/scene_duel.rb
+2
-0
lib/scene_hall.rb
lib/scene_hall.rb
+2
-0
lib/scene_login.rb
lib/scene_login.rb
+2
-0
lib/scene_single.rb
lib/scene_single.rb
+2
-1
lib/widget_msgbox.rb
lib/widget_msgbox.rb
+63
-0
lib/window_list.rb
lib/window_list.rb
+3
-1
No files found.
graphics/system/button.png
View file @
ac0436ff
This diff was suppressed by a .gitattributes entry.
lib/action.rb
View file @
ac0436ff
...
...
@@ -109,7 +109,7 @@ class Action
if
@from_pos
.
is_a?
Integer
from_pos
=
@from_pos
else
from_pos
=
@card
.
is_a?
(
Game_Card
)
?
from_field
.
index
(
@card
)
:
from_field
.
index
{
|
card
|
card
.
card
==
@card
.
card
}
or
from_field
.
index
{
|
card
|!
card
.
known?
}
from_pos
=
(
@card
.
is_a?
(
Game_Card
)
?
from_field
.
index
(
@card
)
:
from_field
.
index
{
|
card
|
card
.
card
==
@card
})
or
from_field
.
index
{
|
card
|!
card
.
known?
}
end
to_field
=
case
@to_pos
...
...
lib/card.rb
View file @
ac0436ff
...
...
@@ -149,7 +149,7 @@ attr_accessor :tokens
Card
.
cache
[
@id
]
=
self
end
def
image
@image
||=
Surface
.
load
"
#{
PicPath
}
/
#{
@id
-
1
}
.jpg"
rescue
Surface
.
load
"graphics/field/card.
pn
g"
@image
||=
Surface
.
load
"
#{
PicPath
}
/
#{
@id
-
1
}
.jpg"
rescue
Surface
.
load
"graphics/field/card.
jp
g"
end
def
image_small
@image_small
||=
image
.
transform_surface
(
0
,
0
,
54.0
/
image
.
w
,
81.0
/
image
.
h
,
0
).
copy_rect
(
1
,
1
,
54
,
81
)
#尼玛!
...
...
lib/iduel_event.rb
View file @
ac0436ff
...
...
@@ -154,6 +154,7 @@ end
class
Iduel
::
Event
::
WATCHSTOP
<
Iduel
::
Event
end
class
Iduel
::
Event
::
Error
<
Iduel
::
Event
attr_reader
:title
,
:message
def
initialize
(
info
)
@title
,
@message
=
case
info
.
to_i
when
0x00
...
...
@@ -190,8 +191,8 @@ class Iduel::Event::Error < Iduel::Event
[
"错误"
,
"请求的房间无效"
]
end
#Exception.new(@message).raise
p
uts
@title
.
encode!
"GBK"
p
uts
@message
.
encode!
"GBK"
p
@title
p
@message
#system("pause")
end
end
...
...
lib/main.rb
View file @
ac0436ff
...
...
@@ -44,6 +44,7 @@ require_relative 'window_list'
require_relative
'window_user'
require_relative
'scene_title'
require_relative
'fpstimer'
require_relative
'widget_msgbox'
$fpstimer
=
FPSTimer
.
new
$scene
=
Scene_Title
.
new
while
$scene
...
...
lib/scene.rb
View file @
ac0436ff
...
...
@@ -58,13 +58,15 @@ class Scene
@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
.
destroted?
if
window
.
angle
.
zero?
Surface
.
blit
(
window
.
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
if
window
.
contents
&&
window
.
visible
Surface
.
blit
(
window
.
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
else
contents
=
window
.
contents
.
transform_surface
(
0x66000000
,
180
,
1
,
1
,
0
)
Surface
.
blit
(
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
if
window
.
contents
&&
window
.
visible
Surface
.
blit
(
contents
,
*
window
.
viewport
,
$screen
,
window
.
x
,
window
.
y
)
#Surface.transform_blit(window.contents,$screen,0,1,1,100,100,100,100,Surface::TRANSFORM_AA)#,0,0)
end
end
#$screen.put(window.contents, window.x, window.y) if window.contents && window.visible
end
$screen
.
update_rect
(
0
,
0
,
0
,
0
)
...
...
lib/scene_duel.rb
View file @
ac0436ff
...
...
@@ -154,6 +154,8 @@ class Scene_Duel < Scene
event
.
action
.
run
@player_field_window
.
refresh
@opponent_field_window
.
refresh
when
Iduel
::
Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
end
end
def
update
...
...
lib/scene_hall.rb
View file @
ac0436ff
...
...
@@ -110,6 +110,8 @@ class Scene_Hall < Scene
$scene
=
Scene_Watch
.
new
(
event
.
room
)
when
Iduel
::
Event
::
PCHAT
@chat
.
add
event
.
user
,
event
.
content
when
Iduel
::
Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
else
puts
"---unhandled iduel event----"
p
event
...
...
lib/scene_login.rb
View file @
ac0436ff
...
...
@@ -36,6 +36,8 @@ class Scene_Login < Scene
when
Iduel
::
Event
::
LOGINOK
require_relative
'scene_hall'
$scene
=
Scene_Hall
.
new
when
Iduel
::
Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
else
p
event
end
...
...
lib/scene_single.rb
View file @
ac0436ff
...
...
@@ -3,7 +3,7 @@
#------------------------------------------------------------------------------
# title
#==============================================================================
=begin
class Scene_Single < Scene
def start
@background = Sprite.new
...
...
@@ -40,3 +40,4 @@ class Scene_Single < Scene
end
end
=end
\ No newline at end of file
lib/widget_msgbox.rb
0 → 100644
View file @
ac0436ff
# To change this template, choose Tools | Templates
# and open the template in the editor.
class
Widget_Msgbox
<
Window
def
initialize
(
title
,
message
,
buttons
=
{
:ok
=>
"确定"
},
&
proc
)
@contents
=
Surface
.
load
'graphics/system/msgbox.png'
@button
=
Surface
.
load
'graphics/system/button.png'
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
super
((
1024
-
@contents
.
w
)
/
2
,
230
,
@contents
.
w
,
@contents
.
h
)
@title
=
title
@message
=
message
@buttons
=
buttons
@proc
=
proc
@index
=
nil
@items
=
{}
@space
=
(
@width
-
@buttons
.
size
*
@button
.
w
/
3
)
/
(
@buttons
.
size
+
1
)
button_y
=
100
@buttons
.
each_with_index
do
|
button
,
index
|
@items
[
button
[
0
]]
=
[(
@space
+
@button
.
w
)
*
index
+
@space
,
button_y
,
@button
.
w
/
3
,
@button
.
h
]
end
refresh
end
def
refresh
@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
)
@items
.
each_key
do
|
index
|
draw_item
(
index
,
@index
==
index
?
1
:
0
)
end
end
def
draw_item
(
index
,
status
=
0
)
Surface
.
blit
(
@button
,
@button
.
w
/
3
*
status
,
0
,
@button
.
w
/
3
,
@button
.
h
,
@contents
,
@items
[
index
][
0
],
@items
[
index
][
1
])
text_size
=
@font
.
text_size
(
@buttons
[
index
])
@font
.
draw_blended_utf8
(
@contents
,
@buttons
[
index
],
@items
[
index
][
0
]
+
(
@button
.
w
/
3
-
text_size
[
0
])
/
2
,
@items
[
index
][
1
]
+
(
@button
.
h
-
text_size
[
1
])
/
2
,
0xFF
,
0xFF
,
0xFF
)
end
def
mousemoved
(
x
,
y
)
self
.
index
=
@items
.
each
do
|
index
,
item_rect
|
if
x
.
between?
(
@x
+
item_rect
[
0
],
@x
+
item_rect
[
0
]
+
item_rect
[
2
])
and
y
.
between?
(
@y
+
item_rect
[
1
],
@y
+
item_rect
[
1
]
+
item_rect
[
3
])
break
index
end
end
end
def
index
=
(
index
)
return
if
index
==
@index
if
@index
#clear(*item_rect(@index))
draw_item
(
@index
,
0
)
end
if
index
.
nil?
or
!
@items
.
include?
index
@index
=
nil
else
@index
=
index
draw_item
(
@index
,
1
)
end
end
def
clicked
@proc
.
call
(
@index
)
if
@index
self
.
destroy
end
end
lib/window_list.rb
View file @
ac0436ff
...
...
@@ -37,7 +37,9 @@ class Window_List < Window
[
0
,
@index
*
self
.
class
::
WLH
,
@width
,
self
.
class
::
WLH
]
end
def
refresh
@item_max
.
times
{
|
index
|
draw_item
(
index
,
index
==
@index
?
1
:
0
)}
@item_max
.
times
do
|
index
|
draw_item
(
index
,
index
==
@index
?
1
:
0
)
end
end
def
cursor_up
self
.
index
=
@index
?
(
@index
-
@column_max
)
%
[
@list
.
size
,
@item_max
].
min
:
0
...
...
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