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
031d85f2
Commit
031d85f2
authored
Feb 29, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对话框换行&滚动
parent
a4d41f1c
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
144 additions
and
72 deletions
+144
-72
graphics/graphics.7z
graphics/graphics.7z
+0
-0
lib.7z
lib.7z
+0
-0
lib/iduel/game.rb
lib/iduel/game.rb
+9
-0
lib/scene_duel.rb
lib/scene_duel.rb
+4
-1
lib/scene_login.rb
lib/scene_login.rb
+1
-0
lib/widget_inputbox.rb
lib/widget_inputbox.rb
+3
-0
lib/widget_scrollbar.rb
lib/widget_scrollbar.rb
+1
-1
lib/window_cardinfo.rb
lib/window_cardinfo.rb
+2
-1
lib/window_chat.rb
lib/window_chat.rb
+109
-27
lib/window_gameselect.rb
lib/window_gameselect.rb
+3
-0
lib/window_list.rb
lib/window_list.rb
+6
-4
lib/window_login.rb
lib/window_login.rb
+4
-0
lib/window_roomchat.rb
lib/window_roomchat.rb
+0
-36
lib/window_scrollable.rb
lib/window_scrollable.rb
+2
-2
No files found.
graphics/graphics.7z
0 → 100644
View file @
031d85f2
File added
lib.7z
0 → 100644
View file @
031d85f2
File added
lib/iduel/game.rb
View file @
031d85f2
...
...
@@ -83,6 +83,15 @@ class Iduel < Game
send
(
4
,
@key
,
msg
,
checknum
(
"CHATP"
,
@session
))
when
User
#私聊
send
(
3
,
@key
,
"
#{
chatmessage
.
channel
.
name
}
(
#{
chatmessage
.
channel
.
id
}
)"
,
msg
,
checknum
(
"CHATX"
,
@session
+
"X"
+
"
#{
chatmessage
.
channel
.
name
}
(
#{
chatmessage
.
channel
.
id
}
)"
))
when
Room
#房间消息:向双方分别私聊
channel
=
chatmessage
.
channel
chatmessage
.
channel
=
channel
.
player1
chat
chatmessage
if
channel
.
player2
chatmessage
.
channel
=
channel
.
player2
chat
chatmessage
end
chatmessage
.
channel
=
channel
end
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
...
...
lib/scene_duel.rb
View file @
031d85f2
...
...
@@ -134,7 +134,10 @@ class Scene_Duel < Scene
end
@replay
.
add
event
.
str
str
=
event
.
str
if
str
=~
/^\[\d+\] (?:●|◎)→(.*)$/m
if
str
=~
/^\[\d+\] (.*)$/m
str
=
$1
end
if
str
=~
/^(?:●|◎)→(.*)$/m
str
=
$1
end
user
=
if
$game
.
room
.
player2
==
$game
.
user
...
...
lib/scene_login.rb
View file @
031d85f2
...
...
@@ -20,6 +20,7 @@ class Scene_Login < Scene
end
def
update
@announcements_window
.
update
#@gameselect_window.update
super
end
def
handle_game
(
event
)
...
...
lib/widget_inputbox.rb
View file @
031d85f2
...
...
@@ -51,6 +51,9 @@ 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
update
#puts "UPDATE:" + self.to_s
end
def
self
.
determine
@@active
.
value
=
@@entry
.
get
.
encode
(
"UTF-8"
);
@@root
.
withdraw
(
true
);
@@active
.
refresh
;
true
end
...
...
lib/widget_scrollbar.rb
View file @
031d85f2
...
...
@@ -86,7 +86,7 @@ class Widget_ScrollBar < Window
def
scroll_max
=
(
scroll_max
)
return
unless
scroll_max
and
scroll_max
!=
@scroll_max
and
scroll_max
>=
0
@scroll_max
=
scroll_max
if
@scroll
>
=
@scroll_max
if
@scroll
>
@scroll_max
@scroll
=
@scroll_max
end
refresh
...
...
lib/window_cardinfo.rb
View file @
031d85f2
...
...
@@ -4,7 +4,8 @@ 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
=
Game_Card
.
new
Card
.
find
(
'name'
=>
:mycard
,
'number'
=>
:"000000"
,
'lore'
=>
"提示:
\n
快捷键:
\n
F10 退出房间
\n
F12 返回主界面"
,
'card_type'
=>
:" "
,
'stats'
=>
""
,
'archettypes'
=>
""
,
"mediums"
=>
""
,
"tokens"
=>
0
)
self
.
card
=
Game_Card
.
new
Card
.
find
(
'name'
=>
:mycard
,
'number'
=>
:"000000"
,
'lore'
=>
"提示:
\n
快捷键:
\n
F10 退出房间
\n
F12 返回主界面"
,
'card_type'
=>
:"通常魔法"
,
'stats'
=>
""
,
'archettypes'
=>
""
,
"mediums"
=>
""
,
"tokens"
=>
0
)
@card
.
card
.
instance_eval
{
@image
=
Card
::
CardBack
;
@image_small
=
Card
::
CardBack_Small
}
end
def
card
=
(
card
)
return
if
card
.
nil?
or
card
==
@card
or
!
card
.
known?
...
...
lib/window_chat.rb
View file @
031d85f2
...
...
@@ -6,12 +6,9 @@
require_relative
'widget_scrollbar'
require_relative
'widget_inputbox'
require_relative
'chatmessage'
class
Window_Chat
<
Window_List
require_relative
'window_scrollable'
class
Window_Chat
<
Window_Scrollable
WLH
=
16
User_Color
=
[
0
,
0
,
0xFF
]
Text_Color
=
[
0
,
0
,
0
]
Player_Color
=
[
0
,
0
,
0xFF
]
Opponent_Color
=
[
0xFF
,
0
,
0
]
def
initialize
(
x
,
y
,
width
,
height
)
super
(
x
,
y
,
width
,
height
)
if
@width
>
600
#判断大厅还是房间,这个判据比较囧,待优化
...
...
@@ -30,53 +27,138 @@ class Window_Chat < Window_List
Game_Event
.
push
Game_Event
::
Chat
.
new
(
chatmessage
)
end
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
14
)
@scroll
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
-
20
-
8
,
@y
+
31
+
3
,
@height
-
68
)
@scrolling
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
-
20
-
8
,
@y
+
31
+
3
,
@height
-
68
)
@page_size
=
(
@height
-
68
)
/
WLH
@@list
||=
{}
@list_splited
=
{}
@@list
.
each_pair
do
|
channel
,
chatmessages
|
chatmessages
.
each
do
|
chatmessage
|
add_split
(
chatmessage
)
end
end
@channels
=
[]
self
.
channel
=
:lobby
#self.items = [:lobby]#, User.new(1,"zh99997"), Room.new(1,"测试房间")]
end
def
add
(
chatmessage
)
@@list
[
chatmessage
.
channel
]
||=
[]
self
.
items
<<
chatmessage
.
channel
unless
self
.
item
s
.
include?
chatmessage
.
channel
@channels
<<
chatmessage
.
channel
unless
@channel
s
.
include?
chatmessage
.
channel
@@list
[
chatmessage
.
channel
]
<<
chatmessage
refresh
end
scroll_bottom
=
@items
.
size
-
self
.
scroll
<=
@page_size
add_split
(
chatmessage
)
if
chatmessage
.
channel
==
@channel
@scroll
=
[
@items
.
size
-
@page_size
,
0
].
max
if
scroll_bottom
refresh
end
end
def
add_split
(
chatmessage
)
@list_splited
[
chatmessage
.
channel
]
||=
[]
@list_splited
[
chatmessage
.
channel
]
<<
[
chatmessage
,
""
]
width
=
name_width
(
chatmessage
)
line
=
0
chatmessage
.
message
.
each_char
do
|
char
|
if
char
==
"
\n
"
line
+=
1
width
=
0
@list_splited
[
chatmessage
.
channel
]
<<
[
chatmessage
.
message_color
,
""
]
else
char_width
=
@font
.
text_size
(
char
)[
0
]
if
char_width
+
width
>
@width
-
14
-
20
line
+=
1
width
=
char_width
@list_splited
[
chatmessage
.
channel
]
<<
[
chatmessage
.
message_color
,
char
]
else
@list_splited
[
chatmessage
.
channel
].
last
[
1
]
<<
char
width
+=
char_width
end
end
end
end
def
mousemoved
(
x
,
y
)
if
y
-
@y
<
31
and
(
x
-
@x
)
<
@items
.
size
*
100
self
.
index
=
(
x
-
@x
)
/
100
if
y
-
@y
<
31
and
(
x
-
@x
)
<
@channels
.
size
*
100
#p '**********',@channels, (x-@x) / 100
self
.
index
=
@channels
[(
x
-
@x
)
/
100
]
else
self
.
index
=
nil
end
end
def
clicked
self
.
channel
=
@items
[
@index
]
if
@index
case
@index
when
nil
when
Integer
else
self
.
channel
=
@index
end
end
def
channel
=
(
channel
)
self
.
items
<<
channel
unless
self
.
items
.
include?
channel
return
if
@channel
==
channel
@channel
=
channel
@channels
<<
channel
unless
@channels
.
include?
channel
@list_splited
[
channel
]
||=
[]
@items
=
@list_splited
[
channel
]
@scroll
=
[
@items
.
size
-
@page_size
,
0
].
max
refresh
end
def
draw_item
(
index
,
status
=
0
)
Surface
.
blit
(
@tab
,
0
,
@channel
==
@items
[
index
]
?
0
:
31
,
100
,
31
,
@contents
,
index
*
100
+
3
,
0
)
channel_name
=
ChatMessage
.
channel_name
@items
[
index
]
case
index
when
nil
when
Integer
#描绘聊天消息
draw_item_chatmessage
(
index
,
status
)
else
#描绘频道标签
draw_item_channel
(
index
,
status
)
end
end
def
draw_item_channel
(
channel
,
status
)
index
=
@channels
.
index
(
channel
)
Surface
.
blit
(
@tab
,
0
,
@channel
==
channel
?
0
:
31
,
100
,
31
,
@contents
,
index
*
100
+
3
,
0
)
channel_name
=
ChatMessage
.
channel_name
channel
x
=
index
*
100
+
(
100
-
@font
.
text_size
(
channel_name
)[
0
])
/
2
draw_stroked_text
(
channel_name
,
x
,
8
,
1
,
@font
,
[
255
,
255
,
255
],
ChatMessage
.
channel_color
(
@items
[
index
]))
draw_stroked_text
(
channel_name
,
x
,
8
,
1
,
@font
,
[
255
,
255
,
255
],
ChatMessage
.
channel_color
(
channel
))
end
def
draw_item_chatmessage
(
index
,
status
)
x
,
y
=
item_rect_chatmessage
(
index
)
chatmessage
,
message
=
@items
[
index
]
if
chatmessage
.
is_a?
ChatMessage
@font
.
draw_blended_utf8
(
@contents
,
chatmessage
.
user
.
name
+
':'
,
x
,
y
,
*
chatmessage
.
name_color
)
if
chatmessage
.
name_visible?
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
+
name_width
(
chatmessage
),
y
,
*
chatmessage
.
message_color
)
unless
chatmessage
.
message
.
empty?
else
@font
.
draw_blended_utf8
(
@contents
,
message
,
x
,
y
,
*
chatmessage
)
end
end
def
item_rect
(
index
)
[
index
*
100
+
3
,
0
,
100
,
31
]
case
index
when
nil
when
Integer
#描绘聊天消息
item_rect_chatmessage
(
index
)
else
#描绘频道标签
item_rect_channel
(
index
)
end
end
def
item_rect_channel
(
channel
)
[
@channels
.
index
(
channel
)
*
100
+
3
,
0
,
100
,
31
]
end
def
item_rect_chatmessage
(
index
)
[
8
,
(
index
-
@scroll
)
*
WLH
+
31
+
3
,
@width
,
self
.
class
::
WLH
]
end
def
refresh
super
return
unless
@@list
[
@channel
]
@@list
[
@channel
].
last
((
@height
-
68
)
/
WLH
).
each_with_index
do
|
chatmessage
,
index
|
if
chatmessage
.
name_visible?
@font
.
draw_blended_utf8
(
@contents
,
chatmessage
.
user
.
name
+
':'
,
8
,
index
*
WLH
+
31
+
3
,
*
User_Color
)
name_width
=
@font
.
text_size
(
chatmessage
.
user
.
name
+
':'
)[
0
]
else
name_width
=
0
end
@font
.
draw_blended_utf8
(
@contents
,
chatmessage
.
message
,
8
+
name_width
,
index
*
WLH
+
31
+
3
,
*
chatmessage
.
message_color
)
unless
chatmessage
.
message
.
empty?
@channels
.
each
{
|
channel
|
draw_item_channel
(
channel
,
@index
==
channel
)}
end
def
name_width
(
chatmessage
)
chatmessage
.
name_visible?
?
@font
.
text_size
(
chatmessage
.
user
.
name
+
':'
)[
0
]
:
0
end
def
index_legal?
(
index
)
case
index
when
nil
,
Integer
super
else
@channels
.
include?
index
end
end
def
scroll_up
self
.
scroll
-=
1
end
def
scroll_down
self
.
scroll
+=
1
end
end
\ No newline at end of file
lib/window_gameselect.rb
View file @
031d85f2
...
...
@@ -60,6 +60,9 @@ 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
update
@login_window
.
update
if
@login_window
end
#def destroy
# @login_window.destroy if @login_window
# super
...
...
lib/window_list.rb
View file @
031d85f2
...
...
@@ -14,14 +14,14 @@ class Window_List < Window
super
(
x
,
y
,
width
,
height
,
z
)
end
def
index
=
(
index
)
index
=
nil
if
index
<
0
or
index
>=
@items
.
size
if
index
index
=
nil
unless
index_legal?
(
index
)
return
if
index
==
@index
if
@index
clear
(
*
item_rect
(
@index
))
draw_item
(
@index
,
0
)
if
@items
[
@index
]
draw_item
(
@index
,
0
)
if
index_legal?
(
@index
)
end
if
index
.
nil?
or
index
<
0
or
index
>=
@items
.
size
if
index
.
nil?
@index
=
nil
else
@index
=
index
...
...
@@ -69,6 +69,8 @@ class Window_List < Window
def
clicked
#子类定义
end
def
index_legal?
(
index
)
index
.
nil?
or
(
index
>=
0
and
index
<
@items
.
size
)
end
end
lib/window_login.rb
View file @
031d85f2
...
...
@@ -66,6 +66,10 @@ class Window_Login < Window
draw_item
(
@index
,
item_rect
(
@index
),
1
)
end
end
def
update
@username_inputbox
.
update
@password_inputbox
.
update
end
#def destroy
# @username_inputbox.destroy
# @password_inputbox.destroy
...
...
lib/window_roomchat.rb
deleted
100644 → 0
View file @
a4d41f1c
#encoding: UTF-8
require_relative
'scene_watch'
class
Window_RoomChat
<
Window
WLH
=
16
require_relative
'widget_scrollbar'
Player_Color
=
[
0
,
0
,
0xFF
]
Opponent_Color
=
[
0
,
0x66
,
0
]
def
initialize
(
x
,
y
,
width
,
height
)
super
(
x
,
y
,
width
,
height
-
24
)
@chat_input
=
Widget_InputBox
.
new
(
@x
,
@y
+
@height
,
@width
,
24
)
do
|
text
|
action
=
Action
::
Chat
.
new
(
true
,
text
)
if
$scene
.
is_a?
(
Scene_Watch
)
action
.
id
=
:
观战
$game
.
action
action
else
$scene
.
action
action
end
end
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
14
)
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@scroll
=
Widget_ScrollBar
.
new
(
self
,
@x
+
@width
-
20
,
@y
,
@height
)
@list
=
[]
$chat_window
=
self
end
def
add
(
player
,
content
)
@list
<<
[
player
,
content
]
refresh
end
def
refresh
@contents
.
fill_rect
(
0
,
0
,
@width
,
@height
,
0x99FFFFFF
)
@list
.
last
(
7
).
each_with_index
do
|
chat
,
index
|
player
,
content
=
chat
@font
.
draw_blended_utf8
(
@contents
,
content
.
empty?
?
" "
:
content
,
0
,
index
*
WLH
,
*
(
player
?
Player_Color
:
Opponent_Color
))
end
end
end
lib/window_scrollable.rb
View file @
031d85f2
...
...
@@ -35,13 +35,13 @@ class Window_Scrollable < Window_List
# clear(0, 0, @width, self.class::WLH * (scroll - @scroll))
#end
@scroll
=
scroll
@scrolling
.
scroll
=
@scroll
if
@scrolling
refresh
end
def
refresh
clear
(
@scroll
...
[(
@scroll
+
@page_size
),
@items
.
size
].
min
).
each
{
|
index
|
draw_item
(
index
,
@index
==
index
?
1
:
0
)}
@scrolling
.
scroll_max
=
@items
.
size
-
@page_size
if
@scrolling
@scrolling
.
scroll_max
=
[
@items
.
size
-
@page_size
,
0
].
max
if
@scrolling
@scrolling
.
scroll
=
@scroll
if
@scrolling
end
def
item_rect
(
index
)
[
0
,
(
index
-
@scroll
)
*
self
.
class
::
WLH
,
@width
,
self
.
class
::
WLH
]
...
...
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