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
3fcc87f9
Commit
3fcc87f9
authored
Jan 28, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本0.3.9
parent
448ac108
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
101 additions
and
560 deletions
+101
-560
.gitignore
.gitignore
+2
-1
Rakefile
Rakefile
+13
-4
config.yml
config.yml
+0
-7
lib/action.rb
lib/action.rb
+12
-0
lib/card.rb
lib/card.rb
+17
-13
lib/iduel/action.rb
lib/iduel/action.rb
+17
-11
lib/main.rb
lib/main.rb
+33
-7
lib/nbx/action.rb
lib/nbx/action.rb
+1
-504
lib/window.rb
lib/window.rb
+4
-11
lib/window_login.rb
lib/window_login.rb
+2
-2
No files found.
.gitignore
View file @
3fcc87f9
/nbproject/
/nbproject/
/ruby/
/ruby/
/pkg/
/pkg/
/config.yml
/log.log
/log.log
/
err
.log
/
profile
.log
/replay/
/replay/
/mycard/
/mycard/
/mycard.exe
/mycard.exe
...
...
Rakefile
View file @
3fcc87f9
...
@@ -2,13 +2,13 @@ require 'rubygems'
...
@@ -2,13 +2,13 @@ require 'rubygems'
require
'rake'
require
'rake'
require
'rake/clean'
require
'rake/clean'
require
'rake/gempackagetask'
require
'rake/gempackagetask'
#
require 'rake/rdoctask'
require
'rake/rdoctask'
#require 'rake/testtask'
#require 'rake/testtask'
Windows
=
RUBY_PLATFORM
[
"mingw"
]
||
RUBY_PLATFORM
[
"mswin"
]
Windows
=
RUBY_PLATFORM
[
"mingw"
]
||
RUBY_PLATFORM
[
"mswin"
]
spec
=
Gem
::
Specification
.
new
do
|
s
|
spec
=
Gem
::
Specification
.
new
do
|
s
|
s
.
name
=
'mycard'
s
.
name
=
'mycard'
s
.
version
=
'0.3.
8
'
s
.
version
=
'0.3.
9
'
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
extra_rdoc_files
=
[
'README.txt'
,
'LICENSE.txt'
]
s
.
summary
=
'a card game'
s
.
summary
=
'a card game'
s
.
description
=
s
.
summary
s
.
description
=
s
.
summary
...
@@ -16,7 +16,7 @@ spec = Gem::Specification.new do |s|
...
@@ -16,7 +16,7 @@ spec = Gem::Specification.new do |s|
s
.
email
=
'zh99998@gmail.com'
s
.
email
=
'zh99998@gmail.com'
s
.
homepage
=
'http://card.touhou,cc'
s
.
homepage
=
'http://card.touhou,cc'
# s.executables = ['your_executable_here']
# s.executables = ['your_executable_here']
s
.
files
=
%w(LICENSE.txt README.txt
config.yml
replay)
+
Dir
.
glob
(
"{lib,audio,data,fonts,graphics}/**/*"
)
s
.
files
=
%w(LICENSE.txt README.txt replay)
+
Dir
.
glob
(
"{lib,audio,data,fonts,graphics}/**/*"
)
if
Windows
if
Windows
s
.
files
+=
%w(mycard.exe)
+
Dir
.
glob
(
"{ruby}/**/*"
)
s
.
files
+=
%w(mycard.exe)
+
Dir
.
glob
(
"{ruby}/**/*"
)
else
else
...
@@ -36,4 +36,13 @@ Rake::GemPackageTask.new(spec) do |p|
...
@@ -36,4 +36,13 @@ Rake::GemPackageTask.new(spec) do |p|
end
end
end
end
CLOBBER
.
include
%w(log.log)
+
Dir
.
glob
(
"{replay}/**/*"
)
+
Dir
.
glob
(
"**/Thumbs.db"
)
+
Dir
.
glob
(
"graphics/avatars/*_*.png"
)
Rake
::
RDocTask
.
new
do
|
rdoc
|
\ No newline at end of file
files
=
[
'README.txt'
,
'LICENSE.txt'
,
'lib/**/*.rb'
]
rdoc
.
rdoc_files
.
add
(
files
)
rdoc
.
main
=
"README.txt"
# page to start on
rdoc
.
title
=
"Mycard Docs"
rdoc
.
rdoc_dir
=
'doc/rdoc'
# rdoc output folder
rdoc
.
options
<<
'--line-numbers'
end
CLOBBER
.
include
%w(log.log profile.log config.yml doc)
+
Dir
.
glob
(
"{replay}/**/*"
)
+
Dir
.
glob
(
"**/Thumbs.db"
)
+
Dir
.
glob
(
"graphics/avatars/*_*.png"
)
\ No newline at end of file
config.yml
deleted
100644 → 0
View file @
448ac108
---
fullscreen
:
false
width
:
1024
height
:
768
autologin
:
true
username
:
zh99997
password
:
"
111111"
lib/action.rb
View file @
3fcc87f9
...
@@ -692,6 +692,18 @@ class Action
...
@@ -692,6 +692,18 @@ class Action
end
end
end
end
end
end
class
CardInfo
<
Action
def
initialize
(
card
,
card_type
,
atk
,
_def
,
attribute
,
type
,
level
,
lore
)
card
.
card_type
=
card_type
card
.
monster_type
=
monster_type
card
.
atk
=
atk
card
.
def
=
_def
card
.
attribute
=
attribute
card
.
type
=
type
card
.
level
=
level
card
.
lore
=
lore
end
end
class
Unknown
<
Action
class
Unknown
<
Action
def
initialize
(
str
)
def
initialize
(
str
)
@str
=
str
@str
=
str
...
...
lib/card.rb
View file @
3fcc87f9
#encoding: UTF-8
#encoding: UTF-8
#==============================================================================
#==Card Model
# ■ Scene_Login
#------------------------------------------------------------------------------
# login
#==============================================================================
class
Card
class
Card
require
'sqlite3'
require
'sqlite3'
@db
=
SQLite3
::
Database
.
new
(
"data/data.sqlite"
)
@db
=
SQLite3
::
Database
.
new
(
"data/data.sqlite"
)
@all
=
[]
@all
=
{}
@diy
=
{}
@count
=
@db
.
get_first_value
(
"select COUNT(*) from YGODATA"
)
rescue
0
@count
=
@db
.
get_first_value
(
"select COUNT(*) from YGODATA"
)
rescue
0
@db
.
results_as_hash
=
true
@db
.
results_as_hash
=
true
#PicPath = '/media/44CACC1DCACC0D5C/game/yu-gi-oh/YGODATA/YGOPIC'
PicPath
=
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
PicPath
=
'E:/game/yu-gi-oh/YGODATA/YGOPIC'
require
'win32/registry'
Win32
::
Registry
::
HKEY_CURRENT_USER
.
open
(
'Software\OCGSOFT\Cards'
){
|
reg
|
reg
[
'Path'
]}
rescue
''
else
''
#其他操作系统卡图存放位置标准尚未制定。
end
CardBack
=
Surface
.
load
(
"graphics/field/card.jpg"
).
display_format
CardBack
=
Surface
.
load
(
"graphics/field/card.jpg"
).
display_format
CardBack_Small
=
Surface
.
load
(
"graphics/field/card_small.gif"
).
display_format
CardBack_Small
=
Surface
.
load
(
"graphics/field/card_small.gif"
).
display_format
class
<<
self
class
<<
self
def
find
(
id
,
order_by
=
nil
)
def
find
(
id
,
order_by
=
nil
)
case
id
case
id
...
@@ -22,7 +22,11 @@ class Card
...
@@ -22,7 +22,11 @@ class Card
@all
[
id
]
||
old_new
(
@db
.
get_first_row
(
"select * from YGODATA where id =
#{
id
}
"
))
@all
[
id
]
||
old_new
(
@db
.
get_first_row
(
"select * from YGODATA where id =
#{
id
}
"
))
when
Symbol
when
Symbol
row
=
@db
.
get_first_row
(
"select * from YGODATA where name = '
#{
id
}
'"
)
row
=
@db
.
get_first_row
(
"select * from YGODATA where name = '
#{
id
}
'"
)
(
row
&&
(
@all
[
row
[
'id'
].
to_i
]
||
old_new
(
row
)))
||
Card
.
new
(
'id'
=>
0
,
'number'
=>
:"00000000"
,
'name'
=>
id
,
'card_type'
=>
:
通常怪兽
,
'stats'
=>
""
,
'archettypes'
=>
""
,
'mediums'
=>
""
,
'lore'
=>
""
)
if
row
@all
[
row
[
'id'
].
to_i
]
||
old_new
(
row
)
else
@diy
[
id
]
||=
Card
.
new
(
'id'
=>
0
,
'number'
=>
:"00000000"
,
'name'
=>
id
,
'card_type'
=>
:
通常怪兽
,
'stats'
=>
""
,
'archettypes'
=>
""
,
'mediums'
=>
""
,
'lore'
=>
""
)
end
when
Hash
when
Hash
old_new
(
id
)
old_new
(
id
)
when
nil
when
nil
...
@@ -185,9 +189,9 @@ class Card
...
@@ -185,9 +189,9 @@ class Card
def
token?
def
token?
@token
@token
end
end
#
def inspect
def
inspect
#
"[#{card_type}][#{name}]"
"[
#{
card_type
}
][
#{
name
}
]"
#
end
end
Unknown
=
Card
.
new
(
'id'
=>
0
,
'number'
=>
:"00000000"
,
'name'
=>
""
,
'lore'
=>
''
,
'card_type'
=>
:
通常怪兽
,
'stats'
=>
""
,
'archettypes'
=>
""
,
'mediums'
=>
""
)
Unknown
=
Card
.
new
(
'id'
=>
0
,
'number'
=>
:"00000000"
,
'name'
=>
""
,
'lore'
=>
''
,
'card_type'
=>
:
通常怪兽
,
'stats'
=>
""
,
'archettypes'
=>
""
,
'mediums'
=>
""
)
Unknown
.
instance_eval
{
@image
=
CardBack
;
@image_small
=
CardBack_Small
}
Unknown
.
instance_eval
{
@image
=
CardBack
;
@image_small
=
CardBack_Small
}
end
end
\ No newline at end of file
lib/iduel/action.rb
View file @
3fcc87f9
#encoding: UTF-8
#encoding: UTF-8
#这个文件iduel和nbx相同,编辑时推荐使用软/硬链接来保持一致
class
Action
class
Action
CardFilter
=
/(<?\[?Token[ \\\d]*\]?>?|<?(?:\[.*?\])?\[(?:.*?)\][ \d
]*>?|一张怪兽卡|一张魔\/陷卡|一张卡|\?\?)/
CardFilter
=
/(<?\[?Token[ \\\d]*\]?>?|<?(?:\[.*?\])?\[(?:.*?)\][ \d
?]*>?|一张怪兽卡|一张魔\/陷卡|一张卡|\?\?)/
.
to_s
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|墓地\|,,,,,\|\*\:\d+张\:\*|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|墓地\|,,,,,\|\*\:\d+张\:\*|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
.
to_s
PositionFilter
=
/(表攻|表守|里守|攻击表示|防守表示|里侧表示|背面守备表示)/
PositionFilter
=
/(表攻|表守|里守|攻击表示|防守表示|里侧表示|背面守备表示)/
.
to_s
PhaseFilter
=
/(抽卡`阶段|准备`阶段|主`阶段1|战斗`阶段|主`阶段2|结束`阶段)/
PhaseFilter
=
/(抽卡`阶段|准备`阶段|主`阶段1|战斗`阶段|主`阶段2|结束`阶段)/
.
to_s
CountersFilter
=
/(?:\()?(\d+)?(?:\))?/
CountersFilter
=
/(?:\()?(\d+)?(?:\))?/
.
to_s
FieldFilter
=
/(?:LP:(\d+)\n手卡(?:数)?:(\d+)\n卡组:(\d+)\n墓地:(\d+)\n除外:(\d+)\n前场:\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n后场:<(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?>\n场地\|<(?:无|
#{
CountersFilter
}#{
CardFilter
}
)>\n(?:◎|●)→\\)/
FieldFilter
=
/(?:LP:(\d+)\n手卡(?:数)?:(\d+)\n卡组:(\d+)\n墓地:(\d+)\n除外:(\d+)\n前场:\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n <(?:
#{
CountersFilter
}#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\n后场:<(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?><(?:
#{
CountersFilter
}#{
CardFilter
}
)?>\n场地\|<(?:无|
#{
CountersFilter
}#{
CardFilter
}
)>\n(?:◎|●)→\\)/
.
to_s
def
self
.
parse_pos
(
pos
)
def
self
.
parse_pos
(
pos
)
if
index
=
pos
.
index
(
"("
)
if
index
=
pos
.
index
(
"("
)
index
+=
1
index
+=
1
...
@@ -174,6 +173,7 @@ class Action
...
@@ -174,6 +173,7 @@ class Action
counters
.
to_i
counters
.
to_i
end
end
def
self
.
parse
(
str
)
def
self
.
parse
(
str
)
#TODO:效率优化
from_player
=
nil
from_player
=
nil
case
str
case
str
when
/^\[(\d+)\] (.*)$/m
when
/^\[(\d+)\] (.*)$/m
...
@@ -181,8 +181,14 @@ class Action
...
@@ -181,8 +181,14 @@ class Action
result
=
case
$2
result
=
case
$2
when
/^┊(.*)┊$/m
when
/^┊(.*)┊$/m
Chat
.
new
from_player
,
$1
Chat
.
new
from_player
,
$1
when
/^※\[(.*)\]\n(.*)\n注释$/m
when
/^※\[(.*)\]\n(.*)\n注释.*$/m
Note
.
new
from_player
,
$2
,
Card
.
find
(
$1
.
to_sym
)
card
=
Card
.
find
(
$1
)
case
$2
when
/(.+怪兽),种族:(.+),属性:(.+),星级:(\d+),攻击:(\d+|?),防御:(\d+|?),效果:(.+)/
CardInfo
.
new
(
card
,
$1
.
to_sym
,
$5
==
"?"
?
nil
:
$5
.
to_i
,
$6
==
"?"
?
nil
:
$6
.
to_i
,
$3
.
to_sym
,
$2
.
to_sym
,
$4
.
to_sym
,
$7
)
when
/(魔法|陷阱)种类:(.+),效果:(.+)/
CardInfo
.
new
((
$2
+
$1
).
to_sym
,
nil
,
nil
,
nil
,
nil
,
nil
,
$3
)
end
when
/^※(.*)$/
when
/^※(.*)$/
Chat
.
new
from_player
,
$1
Chat
.
new
from_player
,
$1
when
/^(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[\d+\]\n
#{
FieldFilter
}
(.*)$/
#把这货弄外面的原因是因为这个指令里开头有一个●→,后面还有,下面判msg的正则会判错
when
/^(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[\d+\]\n
#{
FieldFilter
}
(.*)$/
#把这货弄外面的原因是因为这个指令里开头有一个●→,后面还有,下面判msg的正则会判错
...
@@ -262,7 +268,7 @@ class Action
...
@@ -262,7 +268,7 @@ class Action
when
/第(\d+)张手牌为:
#{
CardFilter
}
/
when
/第(\d+)张手牌为:
#{
CardFilter
}
/
Show
.
new
(
from_player
,
$1
.
to_i
+
10
,
parse_card
(
$2
))
Show
.
new
(
from_player
,
$1
.
to_i
+
10
,
parse_card
(
$2
))
when
/\|--\+>手卡:(?:\[
#{
CardFilter
}
\])*/
when
/\|--\+>手卡:(?:\[
#{
CardFilter
}
\])*/
MultiShow
.
new
from_player
,
:hand
,
$&
.
scan
(
CardFilter
).
collect
{
|
matched
|
parse_card
(
matched
.
first
)}
MultiShow
.
new
from_player
,
:hand
,
$&
.
scan
(
/
#{
CardFilter
}
/
).
collect
{
|
matched
|
parse_card
(
matched
.
first
)}
when
/^(?:(\d+)
#{
CardFilter
}
\n?)+$/
when
/^(?:(\d+)
#{
CardFilter
}
\n?)+$/
from_pos
=
71
from_pos
=
71
cards
=
$&
.
lines
.
collect
do
|
line
|
cards
=
$&
.
lines
.
collect
do
|
line
|
...
@@ -318,7 +324,7 @@ class Action
...
@@ -318,7 +324,7 @@ class Action
when
"加入手卡"
when
"加入手卡"
:hand
:hand
end
end
cards
=
$&
.
scan
(
CardFilter
).
collect
{
|
matched
|
parse_card
matched
.
first
}
cards
=
$&
.
scan
(
/
#{
CardFilter
}
/
).
collect
{
|
matched
|
parse_card
matched
.
first
}
MultiMove
.
new
(
from_player
,
from_pos
,
to_pos
,
cards
)
MultiMove
.
new
(
from_player
,
from_pos
,
to_pos
,
cards
)
when
/己方
#{
PosFilter
}#{
CardFilter
}
送入对手墓地/
when
/己方
#{
PosFilter
}#{
CardFilter
}
送入对手墓地/
SendToOpponentGraveyard
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
SendToOpponentGraveyard
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
...
...
lib/main.rb
View file @
3fcc87f9
#!/usr/bin/env ruby
#!/usr/bin/env ruby
#encoding: UTF-8
#encoding: UTF-8
GC
.
disable
begin
begin
#读取配置文件
#读取配置文件
require
'yaml'
require
'yaml'
$config
=
YAML
.
load_file
(
"config.yml"
)
$config
=
YAML
.
load_file
(
"config.yml"
)
rescue
{}
$config
[
'width'
]
||=
1024
$config
[
'height'
]
||=
768
File
.
open
(
"config.yml"
,
"w"
){
|
config
|
YAML
.
dump
(
$config
,
config
)}
#读取命令行参数
#读取命令行参数
log
=
"log.log"
log
=
"log.log"
profile
=
nil
ARGV
.
each
do
|
arg
|
ARGV
.
each
do
|
arg
|
case
arg
case
arg
when
/--log=(.*)/
when
/--log=(.*)/
log
.
replace
$1
log
.
replace
$1
when
/--profile=(.*)/
profile
=
$1
end
end
end
end
...
@@ -25,18 +31,35 @@ begin
...
@@ -25,18 +31,35 @@ begin
Mixer
.
open
(
Mixer
::
DEFAULT_FREQUENCY
,
Mixer
::
DEFAULT_FORMAT
,
Mixer
::
DEFAULT_CHANNELS
,
512
)
Mixer
.
open
(
Mixer
::
DEFAULT_FREQUENCY
,
Mixer
::
DEFAULT_FORMAT
,
Mixer
::
DEFAULT_CHANNELS
,
512
)
TTF
.
init
TTF
.
init
#初始化标题场景
#设置标准输出编码(windows)
require_relative
'scene_title'
STDOUT
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
$scene
=
Scene_Title
.
new
#初始化日志
#初始化日志
require
'logger'
require
'logger'
if
log
==
"STDOUT"
#调试用
if
log
==
"STDOUT"
#调试用
log
=
STDOUT
log
=
STDOUT
log
.
set_encoding
"GBK"
,
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
if
RUBY_PLATFORM
[
"win"
]
||
RUBY_PLATFORM
[
"ming"
]
end
end
$log
=
Logger
.
new
(
log
)
$log
=
Logger
.
new
(
log
)
$log
.
info
(
"main"
){
"初始化成功"
}
$log
.
info
(
"main"
){
"初始化成功"
}
#性能分析
if
profile
if
profile
==
"STDOUT"
profile
=
STDOUT
else
profile
=
open
(
profile
,
'w'
)
end
require
'profiler'
RubyVM
::
InstructionSequence
.
compile_option
=
{
:trace_instruction
=>
true
,
:specialized_instruction
=>
false
}
Profiler__
::
start_profile
end
#初始化标题场景
require_relative
'scene_title'
$scene
=
Scene_Title
.
new
rescue
Exception
=>
exception
rescue
Exception
=>
exception
open
(
'error-程序出错请到论坛反馈.txt'
,
'w'
){
|
f
|
f
.
write
[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
open
(
'error-程序出错请到论坛反馈.txt'
,
'w'
){
|
f
|
f
.
write
[
exception
.
inspect
,
*
exception
.
backtrace
].
join
(
"
\n
"
)}
exit
(
1
)
exit
(
1
)
...
@@ -53,6 +76,9 @@ rescue Exception => exception
...
@@ -53,6 +76,9 @@ rescue Exception => exception
$scene
=
Scene_Error
.
new
$scene
=
Scene_Error
.
new
retry
retry
ensure
ensure
#(Thread.list-[Thread.main]).each{|t|t.exit} #消灭其他
if
profile
Profiler__
::
print_profile
(
profile
)
profile
.
close
end
$log
.
close
$log
.
close
end
end
\ No newline at end of file
lib/nbx/action.rb
View file @
3fcc87f9
This diff is collapsed.
Click to expand it.
lib/window.rb
View file @
3fcc87f9
class
Window
class
Window
WLH
=
24
WLH
=
24
attr_accessor
:x
,
:y
,
:width
,
:height
,
:z
,
:contents
,
:
angle
,
:
visible
,
:viewport
attr_accessor
:x
,
:y
,
:width
,
:height
,
:z
,
:contents
,
:visible
,
:viewport
alias
visible?
visible
alias
visible?
visible
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
def
initialize
(
x
,
y
,
width
,
height
,
z
=
200
)
@x
=
x
@x
=
x
...
@@ -9,7 +9,7 @@ class Window
...
@@ -9,7 +9,7 @@ class Window
@width
=
width
@width
=
width
@height
=
height
@height
=
height
@visible
=
true
@visible
=
true
@angle
=
0
#
@angle = 0
@viewport
=
[
0
,
0
,
@width
,
@height
]
@viewport
=
[
0
,
0
,
@width
,
@height
]
@destroyed
=
false
@destroyed
=
false
amask
=
0xff000000
amask
=
0xff000000
...
@@ -42,15 +42,8 @@ class Window
...
@@ -42,15 +42,8 @@ class Window
@destroyed
@destroyed
end
end
def
draw
(
screen
)
def
draw
(
screen
)
if
self
.
contents
&&
self
.
visible
&&
!
self
.
destroyed?
return
unless
self
.
contents
&&
self
.
visible?
&&
!
self
.
destroyed?
if
self
.
angle
.
zero?
Surface
.
blit
(
self
.
contents
,
*
self
.
viewport
,
screen
,
self
.
x
,
self
.
y
)
Surface
.
blit
(
self
.
contents
,
self
.
viewport
[
0
],
self
.
viewport
[
1
],
self
.
viewport
[
2
]
,
self
.
viewport
[
3
],
screen
,
self
.
x
,
self
.
y
)
#直接用*self.viewport,netbeans老给我报错....
else
contents
=
self
.
contents
.
transform_surface
(
0x66000000
,
180
,
1
,
1
,
0
)
Surface
.
blit
(
contents
,
self
.
viewport
[
0
],
self
.
viewport
[
1
],
self
.
viewport
[
2
]
,
self
.
viewport
[
3
],
screen
,
self
.
x
,
self
.
y
)
#Surface.transform_blit(window.contents,$screen,0,1,1,100,100,100,100,Surface::TRANSFORM_AA)#,0,0)
end
end
end
end
def
clear
(
x
=
0
,
y
=
0
,
width
=
@width
,
height
=
@height
)
def
clear
(
x
=
0
,
y
=
0
,
width
=
@width
,
height
=
@height
)
if
$scene
and
$scene
.
background
if
$scene
and
$scene
.
background
...
...
lib/window_login.rb
View file @
3fcc87f9
...
@@ -8,10 +8,10 @@ class Window_Login < Window
...
@@ -8,10 +8,10 @@ class Window_Login < Window
@button
=
Surface
.
load
(
"graphics/login/button.png"
)
@button
=
Surface
.
load
(
"graphics/login/button.png"
)
super
(
x
,
y
,
597
,
338
)
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
)
@username
_inputbox
.
value
=
@username
if
@username
@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
)
@password_inputbox
.
type
=
:password
@password_inputbox
.
type
=
:password
@password
_inputbox
.
value
=
@password
if
@password
@password
?
@password_inputbox
.
value
=
@password
:
@password_inputbox
.
refresh
@color
=
[
255
,
255
,
255
]
@color
=
[
255
,
255
,
255
]
@color_stroke
=
[
0
,
0
,
0
]
@color_stroke
=
[
0
,
0
,
0
]
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
@font
=
TTF
.
open
(
"fonts/WenQuanYi Micro Hei.ttf"
,
16
)
...
...
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