Commit 720c746d authored by zh99998's avatar zh99998

版本0.4.4,嵌入ygocore

parent 1dd9e780
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
/mycard/ /mycard/
/mycard.exe /mycard.exe
/7z.exe /7z.exe
/ygocore/
/graphics/avatars/*_*.png /graphics/avatars/*_*.png
/error-程序出错请到论坛反馈.txt /error-程序出错请到论坛反馈.txt
Thumbs.db Thumbs.db
\ No newline at end of file
...@@ -24,7 +24,7 @@ end ...@@ -24,7 +24,7 @@ end
spec = Gem::Specification.new do |s| spec = Gem::Specification.new do |s|
s.name = 'mycard' s.name = 'mycard'
s.version = '0.4.3' s.version = '0.4.4'
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
...@@ -33,7 +33,7 @@ spec = Gem::Specification.new do |s| ...@@ -33,7 +33,7 @@ spec = Gem::Specification.new do |s|
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 replay) s.files = %w(LICENSE.txt README.txt replay)
%w{lib audio data fonts graphics}.each{|dir|s.files.concat list(dir)} %w{lib audio data fonts graphics ygocore}.each{|dir|s.files.concat list(dir)}
if Windows if Windows
s.files += %w(mycard.exe) + list("ruby") s.files += %w(mycard.exe) + list("ruby")
else else
...@@ -65,4 +65,4 @@ Rake::RDocTask.new do |rdoc| ...@@ -65,4 +65,4 @@ Rake::RDocTask.new do |rdoc|
rdoc.options << '--line-numbers' rdoc.options << '--line-numbers'
end end
CLOBBER.include %w(error-程序出错请到论坛反馈.txt log.log profile.log config.yml doc) + list('replay') + list('.').keep_if{|file|File.basename(file) == "Thumbs.db"} + list("graphics/avatars").keep_if{|file|File.basename(file) =~ /.*_(?:small|middle|large)\.png/} CLOBBER.include %w(error-程序出错请到论坛反馈.txt log.log profile.log config.yml doc ygocore/pics) + list('replay') + list('ygocore/replay') + list('.').keep_if{|file|File.basename(file) == "Thumbs.db"} + list("graphics/avatars").keep_if{|file|File.basename(file) =~ /.*_(?:small|middle|large)\.png/}
\ No newline at end of file \ No newline at end of file
...@@ -27,7 +27,7 @@ class Game ...@@ -27,7 +27,7 @@ class Game
def chat(chatmessage) def chat(chatmessage)
end end
def exit def exit
$scene = Scene_Login.new $scene = Scene_Login.new if $scene
end end
def watching? def watching?
@room and @room.include? @user @room and @room.include? @user
......
#encoding: UTF-8 #encoding: UTF-8
load File.expand_path('window_login.rb', File.dirname(__FILE__)) load 'lib/iduel/window_login.rb'
require 'open-uri' require 'open-uri'
class Iduel < Game class Iduel < Game
Version = "20110131" Version = "20110131"
...@@ -12,10 +12,10 @@ class Iduel < Game ...@@ -12,10 +12,10 @@ class Iduel < Game
def initialize def initialize
super super
require 'digest/md5' require 'digest/md5'
load File.expand_path('action.rb', File.dirname(__FILE__)) load 'lib/iduel/action.rb'
load File.expand_path('event.rb', File.dirname(__FILE__)) load 'lib/iduel/event.rb'
load File.expand_path('user.rb', File.dirname(__FILE__)) load 'lib/iduel/user.rb'
load File.expand_path('replay.rb', File.dirname(__FILE__)) load 'lib/iduel/replay.rb'
end end
def rename def rename
......
...@@ -49,8 +49,7 @@ class User ...@@ -49,8 +49,7 @@ class User
$game.rooms.find{|room|room.include? self} $game.rooms.find{|room|room.include? self}
end end
def space def space
require 'launchy' system("start http://www.duelcn.com/home.php?mod=space&uid=#{@id-100000}")
Launchy.open("http://www.duelcn.com/home.php?mod=space&uid=#{@id-100000}")
end end
def color def color
@friend ? [255,0,0] : [0,0,0] @friend ? [255,0,0] : [0,0,0]
......
...@@ -12,8 +12,7 @@ class Window_Login ...@@ -12,8 +12,7 @@ class Window_Login
$game.login(@username_inputbox.value, @password_inputbox.value) $game.login(@username_inputbox.value, @password_inputbox.value)
@last_clicked = Time.now @last_clicked = Time.now
when :register when :register
require 'launchy' system("start #{Iduel::Register_Url}")
Launchy.open(Iduel::Register_Url)
@last_clicked = Time.now @last_clicked = Time.now
when :replay when :replay
require_relative '../dialog' require_relative '../dialog'
......
...@@ -72,11 +72,16 @@ begin ...@@ -72,11 +72,16 @@ begin
} }
Profiler__::start_profile Profiler__::start_profile
end end
#初始化标题场景 #初始化标题场景
require_relative 'scene_title' require_relative 'scene_title'
$scene = Scene_Title.new $scene = Scene_Title.new
#自动更新
require_relative 'update'
Update.start
$log.info("main"){"初始化成功"} $log.info("main"){"初始化成功"}
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")}
......
...@@ -21,7 +21,7 @@ class Scene ...@@ -21,7 +21,7 @@ class Scene
@background = nil @background = nil
@windows = [] @windows = []
@active_window = nil @active_window = nil
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 16) @font = TTF.open('fonts/wqy-microhei.ttc', 16)
end end
def main def main
start start
...@@ -40,7 +40,11 @@ class Scene ...@@ -40,7 +40,11 @@ class Scene
@windows.each do |window| @windows.each do |window|
window.draw($screen) window.draw($screen)
end end
@font.draw_blended_utf8($screen, "%.1f" % @@fpstimer.real_fps, 0, 0, 0xFF, 0xFF, 0xFF) if Update.status
@font.draw_blended_utf8($screen, Update.status, 0, 0, 0xFF, 0xFF, 0xFF)
else
@font.draw_blended_utf8($screen, "%.1f" % @@fpstimer.real_fps, 0, 0, 0xFF, 0xFF, 0xFF)
end
$screen.update_rect(0,0,0,0) $screen.update_rect(0,0,0,0)
end end
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
......
require_relative 'widget_msgbox' require_relative 'widget_msgbox'
class Scene_Error < Scene class Scene_Error < Scene
def initialize(title="程序出错", text="似乎出现了一个bug,请到论坛反馈", &proc)
@title = title
@text = text
@proc = proc || proc{$scene = Scene_Title.new}
super()
end
def start def start
Widget_Msgbox.new("程序出错", "似乎出现了一个bug,请到论坛反馈", :ok => "确定"){$scene = Scene_Title.new} Widget_Msgbox.new(@title, @text, :ok => "确定", &@proc)
end end
end end
...@@ -41,7 +41,30 @@ class Scene_Title < Scene ...@@ -41,7 +41,30 @@ class Scene_Title < Scene
#Scene_Single.new #Scene_Single.new
when 2 when 2
require_relative 'widget_msgbox' require_relative 'widget_msgbox'
Widget_Msgbox.new("mycard", "功能未实现", :ok => "确定") require_relative 'scene_login'
Widget_Msgbox.new("编辑卡组", "\"导入\"导入已有卡组,\"编辑\"启动ygocore", :import => "导入", :edit => "编辑") do |button|
case button
when:import
require_relative 'dialog'
file = Dialog.get_open_file("导入卡组", "ygocore卡组 (*.ydk)"=>"*.ydk")#"所有支持的卡组 (*.txt;*.deck;*.ydk)"=>"*.ydk;*.txt;*.deck","ygocore卡组 (*.ydk)"=>"*.ydk", "NBX/iDuel/狐查卡组 (*.txt)" => "*.txt", "图形组卡器卡组 (*.deck)"=>"*.deck")
if !file.empty?
open(file) do |src|
Dir.mkdir "ygocore/deck" unless File.directory?("ygocore/deck")
open("ygocore/deck/#{File.basename(file)}", 'w') do |dest|
dest.write src.read
end
Widget_Msgbox.new("导入卡组", "导入卡组完成", :ok => "确定")
end rescue Widget_Msgbox.new("导入卡组", "导入卡组失败", :ok => "确定")
end
when :edit
load 'lib/ygocore/game.rb' #TODO:不规范啊不规范
if !Update.images.empty?
Widget_Msgbox.new("加入房间", "卡图正在下载中,可能显示不出部分卡图", :ok => "确定"){Ygocore.run_ygocore(:deck)}
else
Ygocore.run_ygocore(:deck)
end
end
end
#require_relative 'scene_deck' #require_relative 'scene_deck'
#Scene_Deck.new #Scene_Deck.new
when 3 when 3
......
require 'open-uri'
module Update
Version = '0.4.4'
URL = 'http://card.touhou.cc/mycard/update.json?version=0.4.4'
class <<self
attr_reader :thumbnails, :images, :status
def start
Dir.glob("mycard-update-*-*.zip") do |file|
file =~ /mycard-update-(.+?)-(.+?)\.zip/
if $1 <= Version and $2 > Version
$log.info('安装更新'){file}
WM::set_caption("MyCard - 正在更新 #{Version} -> #{$2}", "MyCard")
require 'zip/zip'
Zip::ZipFile::open(file) do |zip|
zip.each do |f|
if !File.directory?(f.name)
require "fileutils.rb"
FileUtils.mkdir_p(File.dirname(f.name))
end
f.extract{true}
end
end
Version.replace $2
File.delete file
@updated = true
end
end
if @updated
IO.popen('./mycard')
exit
end
@status = '正在检查更新'
Thread.new do
open(URL) do |file|
require 'json'
reply = file.read
$log.info('下载更新-服务器回传'){reply}
reply = JSON.parse(reply)
$log.info('下载更新-解析后'){reply.inspect}
reply.each do |fil|
name = File.basename fil
@status.replace "正在下载更新#{name}"
open(fil, 'rb') do |fi|
$log.info('下载完毕'){name}
open(name, 'wb') do |f|
f.write fi.read
end
end rescue nil
end
if File.file? "ygocore/cards.cdb"
require 'sqlite3'
db = SQLite3::Database.new( "ygocore/cards.cdb" )
@thumbnails = []
db.execute( "select id from datas" ) do |row|
@thumbnails << row[0]
end
@images = @thumbnails.dup
if !File.directory?('ygocore/pics/thumbnail')
require "fileutils.rb"
FileUtils.mkdir_p('ygocore/pics/thumbnail')
end
existed_thumbnails = []
Dir.foreach("ygocore/pics/thumbnail") do |file|
if file =~ /(\d+)\.jpg/
existed_thumbnails << $1.to_i
end
end
@thumbnails -= existed_thumbnails
$log.info('待下载的缩略卡图'){@thumbnails.inspect}
existed_images = []
Dir.foreach("ygocore/pics") do |file|
if file =~ /(\d+)\.jpg/
existed_images << $1.to_i
end
end
@images -= existed_images
$log.info('待下载的完整卡图'){@images.inspect}
threads = 5.times.collect do
thread = Thread.new do
while number = @thumbnails.pop
@status.replace "正在下载缩略卡图 (剩余#{@thumbnails.size}张)"
open("http://card.touhou.cc/images/cards/ygocore/thumbnail/#{number}.jpg", 'rb') do |remote|
next if File.file? "ygocore/pics/thumbnail/#{number}.jpg"
open("ygocore/pics/thumbnail/#{number}.jpg", 'wb') do |local|
local.write remote.read
end
end rescue nil
end
while number = @images.pop
@status.replace "正在下载完整卡图 (剩余#{@images.size}张)"
open("http://card.touhou.cc/images/cards/ygocore/#{number}.jpg", 'rb') do |remote|
next if File.file? "ygocore/pics/#{number}.jpg"
open("ygocore/pics/#{number}.jpg", 'wb') do |local|
local.write remote.read
end
end rescue nil
end
end
thread.priority = -1
thread
end
threads.each{|thread|thread.join}
end
end rescue nil
@status = nil
end
end
end
end
\ No newline at end of file
...@@ -10,7 +10,7 @@ class Widget_Checkbox < Window ...@@ -10,7 +10,7 @@ class Widget_Checkbox < Window
@text = text @text = text
@checked = checked @checked = checked
@checkbox = Surface.load('graphics/system/checkbox.png').display_format @checkbox = Surface.load('graphics/system/checkbox.png').display_format
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 20) @font = TTF.open("fonts/wqy-microhei.ttc", 20)
@proc = proc @proc = proc
refresh refresh
end end
......
...@@ -141,7 +141,7 @@ class Widget_InputBox < Window ...@@ -141,7 +141,7 @@ class Widget_InputBox < Window
@@focus = true @@focus = true
def initialize(x,y,width,height,z=300, &proc) def initialize(x,y,width,height,z=300, &proc)
super(x,y,width,height,z) super(x,y,width,height,z)
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 20) @font = TTF.open("fonts/wqy-microhei.ttc", 20)
@proc = proc @proc = proc
@value = "" @value = ""
@type = :text @type = :text
......
...@@ -16,7 +16,7 @@ class Widget_Msgbox < Window ...@@ -16,7 +16,7 @@ class Widget_Msgbox < Window
#@background = Surface.load 'graphics/system/msgbox.png' #@background = Surface.load 'graphics/system/msgbox.png'
@contents = Surface.load('graphics/system/msgbox.png').display_format @contents = Surface.load('graphics/system/msgbox.png').display_format
@button = Surface.load('graphics/system/button.png') @button = Surface.load('graphics/system/button.png')
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
super((1024-@contents.w)/2, 230, @contents.w, @contents.h) super((1024-@contents.w)/2, 230, @contents.w, @contents.h)
set(title, message, buttons, &proc) set(title, message, buttons, &proc)
end end
...@@ -33,7 +33,7 @@ class Widget_Msgbox < Window ...@@ -33,7 +33,7 @@ class Widget_Msgbox < Window
button_y = 100 button_y = 100
@buttons.each_with_index do |button, index| @buttons.each_with_index do |button, index|
@items[button[0]] = [(@space+@button.w)*index+@space, button_y, @button.w/3, @button.h] @items[button[0]] = [(@space+@button.w/3)*index+@space, button_y, @button.w/3, @button.h]
end end
refresh refresh
end end
...@@ -83,8 +83,8 @@ class Widget_Msgbox < Window ...@@ -83,8 +83,8 @@ class Widget_Msgbox < Window
end end
def clicked def clicked
return if @index.nil? return if @index.nil?
@proc.call(@index) if @proc
self.destroy self.destroy
@proc.call(@index) if @proc
end end
def self.destroy def self.destroy
instance = $scene.windows.find{|window|window.class == self and !window.destroyed?} instance = $scene.windows.find{|window|window.class == self and !window.destroyed?}
......
...@@ -12,7 +12,7 @@ class Window_Action < Window_List ...@@ -12,7 +12,7 @@ class Window_Action < Window_List
@up.set_alpha(RLEACCEL,255) @up.set_alpha(RLEACCEL,255)
@middle.set_alpha(RLEACCEL,255) @middle.set_alpha(RLEACCEL,255)
@down.set_alpha(RLEACCEL,255) @down.set_alpha(RLEACCEL,255)
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 16) @font = TTF.open('fonts/wqy-microhei.ttc', 16)
@visible = false @visible = false
end end
def items=(items) def items=(items)
......
...@@ -5,10 +5,10 @@ class Window_Announcements < Window ...@@ -5,10 +5,10 @@ class Window_Announcements < Window
@count = 0 @count = 0
@items = $config[$config['game']]['announcements'] @items = $config[$config['game']]['announcements']
@last_item = @item = @items.first @last_item = @item = @items.first
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 18) @font = TTF.open("fonts/wqy-microhei.ttc", 18)
@color = [44,64,78] @color = [44,64,78]
@time_color = [0x66, 0x66, 0x66] @time_color = [0x66, 0x66, 0x66]
@time_font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 14) @time_font = TTF.open("fonts/wqy-microhei.ttc", 14)
@transforming = nil @transforming = nil
refresh refresh
end end
...@@ -62,8 +62,7 @@ class Window_Announcements < Window ...@@ -62,8 +62,7 @@ class Window_Announcements < Window
end end
def clicked def clicked
return unless @item return unless @item
require 'launchy' system("start #{@item.url}") if @item.url
Launchy.open(@item.url) if @item.url
end end
def mousemoved(x,y) def mousemoved(x,y)
if !@focus if !@focus
......
...@@ -3,7 +3,7 @@ class Window_BGM < Window ...@@ -3,7 +3,7 @@ class Window_BGM < Window
WLH=20 WLH=20
def initialize(bgm_name) def initialize(bgm_name)
@bgm_name = bgm_name @bgm_name = bgm_name
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 18) @font = TTF.open("fonts/wqy-microhei.ttc", 18)
width = @font.text_size("♪#{@bgm_name}")[0] width = @font.text_size("♪#{@bgm_name}")[0]
@count = 0 @count = 0
@contents = @font.render_blended_utf8("♪#{@bgm_name}" , 255,255,255) @contents = @font.render_blended_utf8("♪#{@bgm_name}" , 255,255,255)
......
...@@ -2,7 +2,7 @@ class Window_CardInfo < Window ...@@ -2,7 +2,7 @@ class Window_CardInfo < Window
WLH = 20 WLH = 20
def initialize(x,y) def initialize(x,y)
super(x,y,1024-x,524,300) super(x,y,1024-x,524,300)
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
tip = Card.new('name' => :mycard, 'number' => :"000000", 'lore' => "提示:\n快捷键:\nF10 退出房间\nF12 返回主界面", 'card_type' => :"通常魔法", 'stats' => "", 'archettypes' => "", "mediums" => "", "tokens" => 0) tip = Card.new('name' => :mycard, 'number' => :"000000", 'lore' => "提示:\n快捷键:\nF10 退出房间\nF12 返回主界面", 'card_type' => :"通常魔法", 'stats' => "", 'archettypes' => "", "mediums" => "", "tokens" => 0)
tip.instance_eval { @image = Card::CardBack; @image_small = Card::CardBack_Small } tip.instance_eval { @image = Card::CardBack; @image_small = Card::CardBack_Small }
self.card = Game_Card.new tip self.card = Game_Card.new tip
......
...@@ -28,12 +28,12 @@ class Window_Chat < Window_Scrollable ...@@ -28,12 +28,12 @@ class Window_Chat < Window_Scrollable
$game.chat chatmessage $game.chat chatmessage
Game_Event.push Game_Event::Chat.new(chatmessage) Game_Event.push Game_Event::Chat.new(chatmessage)
true true
when :esc when :ESC
true true
end end
end end
@chat_input.refresh @chat_input.refresh
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 14) @font = TTF.open("fonts/wqy-microhei.ttc", 14)
@scrollbar = Widget_ScrollBar.new(self,@x+@width-20-8,@y+31+3,@height-68) @scrollbar = Widget_ScrollBar.new(self,@x+@width-20-8,@y+31+3,@height-68)
@page_size = (@height-68)/WLH @page_size = (@height-68)/WLH
@@list ||= {} @@list ||= {}
......
...@@ -6,7 +6,7 @@ class Window_Config < Window ...@@ -6,7 +6,7 @@ class Window_Config < Window
@button = Surface.load('graphics/system/button.png') @button = Surface.load('graphics/system/button.png')
@background = Surface.load('graphics/config/background.png').display_format @background = Surface.load('graphics/config/background.png').display_format
@contents = Surface.load('graphics/config/background.png').display_format @contents = Surface.load('graphics/config/background.png').display_format
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 20) @font = TTF.open('fonts/wqy-microhei.ttc', 20)
@index = nil @index = nil
@items = { @items = {
......
...@@ -26,7 +26,7 @@ class Window_Field < Window ...@@ -26,7 +26,7 @@ class Window_Field < Window
super(x,y,714,282) super(x,y,714,282)
@field = field @field = field
@player = player @player = player
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 12) @font = TTF.open('fonts/wqy-microhei.ttc', 12)
@items = {} @items = {}
@cards = {} @cards = {}
refresh refresh
......
class Window_GameSelect < Window_List class Window_GameSelect < Window_List
WLH = 56 WLH = 56
def initialize(x,y) def initialize(x,y)
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 24) @font = TTF.open("fonts/wqy-microhei.ttc", 24)
@color = [255,255,255] @color = [255,255,255]
@game_color = [47,156,192] @game_color = [47,156,192]
@game_stroke_color = [0xFF,0xFF,0xFF] @game_stroke_color = [0xFF,0xFF,0xFF]
......
...@@ -6,7 +6,7 @@ class Window_Host < Window ...@@ -6,7 +6,7 @@ class Window_Host < Window
@buttons = {:ok => "确定"} @buttons = {:ok => "确定"}
@background = Surface.load('graphics/system/msgbox.png').display_format @background = Surface.load('graphics/system/msgbox.png').display_format
super((1024-@background.w)/2, 230, @background.w, @background.h) super((1024-@background.w)/2, 230, @background.w, @background.h)
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
@title_color = [0xFF, 0xFF, 0xFF] @title_color = [0xFF, 0xFF, 0xFF]
@color = [0x04, 0x47, 0x7c] @color = [0x04, 0x47, 0x7c]
@roomname_inputbox = Widget_InputBox.new(@x+96, @y+41, 165, WLH) do |key| @roomname_inputbox = Widget_InputBox.new(@x+96, @y+41, 165, WLH) do |key|
......
...@@ -4,7 +4,7 @@ class Window_LobbyButtons < Window_List ...@@ -4,7 +4,7 @@ class Window_LobbyButtons < Window_List
super(x,y,86,30) super(x,y,86,30)
@items = ["新房间"] @items = ["新房间"]
@button = Surface.load("graphics/lobby/button.png") @button = Surface.load("graphics/lobby/button.png")
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
refresh refresh
end end
def draw_item(index, status=0) def draw_item(index, status=0)
......
...@@ -34,8 +34,8 @@ class Window_Login < Window ...@@ -34,8 +34,8 @@ class Window_Login < Window
@password && !@password.empty? ? @password_inputbox.value = @password : @password_inputbox.refresh @password && !@password.empty? ? @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/wqy-microhei.ttc", 16)
@font_button = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 18) @font_button = TTF.open("fonts/wqy-microhei.ttc", 18)
#@font.draw_blended_utf8(@contents, text, 105,80, *@game_color) #@font.draw_blended_utf8(@contents, text, 105,80, *@game_color)
@items = { @items = {
#:username => [192,80,165,WLH], #:username => [192,80,165,WLH],
......
...@@ -3,7 +3,7 @@ class Window_LP < Window ...@@ -3,7 +3,7 @@ class Window_LP < Window
def initialize(x,y,player,position=true) #true:左 false:右 def initialize(x,y,player,position=true) #true:左 false:右
super(x,y,355,48) super(x,y,355,48)
@position = position @position = position
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 20) @font = TTF.open("fonts/wqy-microhei.ttc", 20)
@color = [255,255,255] @color = [255,255,255]
self.player = player self.player = player
end end
......
...@@ -15,7 +15,7 @@ class Window_RoomList < Window_Scrollable ...@@ -15,7 +15,7 @@ class Window_RoomList < Window_Scrollable
#@contents = Surface.load 'graphics/lobby/roomitems.png' #@contents = Surface.load 'graphics/lobby/roomitems.png'
super(x,y,@button.w / 3, 48 * 10) super(x,y,@button.w / 3, 48 * 10)
@item_max = 0 @item_max = 0
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
@color = [0x03, 0x11, 0x22] @color = [0x03, 0x11, 0x22]
@scrollbar = Widget_ScrollBar.new(self,@x+@width,@y,@height) @scrollbar = Widget_ScrollBar.new(self,@x+@width,@y,@height)
self.items = items self.items = items
......
...@@ -3,7 +3,7 @@ class Window_User < Window_List ...@@ -3,7 +3,7 @@ class Window_User < Window_List
def initialize(x, y, user) def initialize(x, y, user)
@background = Surface.load("graphics/lobby/user.png").display_format @background = Surface.load("graphics/lobby/user.png").display_format
super(x,y,@background.w,@background.h, 300) super(x,y,@background.w,@background.h, 300)
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 16) @font = TTF.open('fonts/wqy-microhei.ttc', 16)
@user = user @user = user
@contents = Surface.load("graphics/lobby/user.png").display_format #TODO:调用已经加载了的背景 @contents = Surface.load("graphics/lobby/user.png").display_format #TODO:调用已经加载了的背景
......
...@@ -9,7 +9,7 @@ class Window_UserInfo < Window ...@@ -9,7 +9,7 @@ class Window_UserInfo < Window
def initialize(x, y, user) def initialize(x, y, user)
@avatar_boarder = Surface.load("graphics/lobby/avatar_boader.png") @avatar_boarder = Surface.load("graphics/lobby/avatar_boader.png")
super(x,y,280,144) super(x,y,280,144)
@font = TTF.open('fonts/WenQuanYi Micro Hei.ttf', 16) @font = TTF.open('fonts/wqy-microhei.ttc', 16)
@user = user @user = user
@background = Surface.load("graphics/lobby/userinfo.png").display_format @background = Surface.load("graphics/lobby/userinfo.png").display_format
refresh refresh
......
...@@ -12,7 +12,7 @@ class Window_UserList < Window_Scrollable ...@@ -12,7 +12,7 @@ class Window_UserList < Window_Scrollable
#@contents = Surface.load "graphics/lobby/useritems.png" #@contents = Surface.load "graphics/lobby/useritems.png"
#@background = Surface.load "graphics/lobby/useritems.png" #@background = Surface.load "graphics/lobby/useritems.png"
super(x,y,272,540) super(x,y,272,540)
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/wqy-microhei.ttc", 16)
@color = [0x03, 0x11, 0x22] @color = [0x03, 0x11, 0x22]
@color_friend = [0, 128, 0] @color_friend = [0, 128, 0]
@color_over = [200,200,255] @color_over = [200,200,255]
......
class Game_Event class Game_Event
User_Filter = /\[(\d+),(.+?)\]/ User_Filter = /\[(\d+),(.+?)(?:,(-1|0)|)\]/
Room_Filter = /\[(\d+),(.+?),(wait|start)(#{User_Filter}+?)\]/ Room_Filter = /\[(\d+),(.+?),(wait|start)(#{User_Filter}+?)\]/
#User_Filter = /<li>(:::观战:|===决斗1=|===决斗2=)<font color="(?:blue|gray)">(.+?)(\(未认证\)|)<\/font>;<\/li>/ #User_Filter = /<li>(:::观战:|===决斗1=|===决斗2=)<font color="(?:blue|gray)">(.+?)(\(未认证\)|)<\/font>;<\/li>/
#Room_Filter = /<div style="width:300px; height:150px; border:1px #ececec solid; float:left;padding:5px; margin:5px;">房间名称:(.+?)(<font color="d28311" title="竞技场模式">\[竞\]<\/font>|) (<font color=(?:\")?red(?:\")?>决斗已开始!<\/font>|<font color=(?:\")?blue(?:\")?>等待<\/font>)<font size="1">\(ID:(\d+)\)<\/font>#{User_Filter}+?<\/div>/ #Room_Filter = /<div style="width:300px; height:150px; border:1px #ececec solid; float:left;padding:5px; margin:5px;">房间名称:(.+?)(<font color="d28311" title="竞技场模式">\[竞\]<\/font>|) (<font color=(?:\")?red(?:\")?>决斗已开始!<\/font>|<font color=(?:\")?blue(?:\")?>等待<\/font>)<font size="1">\(ID:(\d+)\)<\/font>#{User_Filter}+?<\/div>/
...@@ -9,11 +9,13 @@ class Game_Event ...@@ -9,11 +9,13 @@ class Game_Event
info.scan(Room_Filter) do |id, name, status, users| info.scan(Room_Filter) do |id, name, status, users|
#p id, name, status, users, '------------' #p id, name, status, users, '------------'
player1 = player2 = nil player1 = player2 = nil
users.scan(User_Filter) do |player, name| users.scan(User_Filter) do |player, name, certified|
if name =~ /^<font color="(?:blue|gray)">(.+?)<\/font>$/ if name =~ /^<font color="(?:blue|gray)">(.+?)<\/font>$/
name = $1 name = $1
end end
if name =~ /^(.+?)\(未认证\)$/ if certified == '0'
certified = false
elsif name =~ /^(.+?)\(未认证\)$/
name = $1 name = $1
certified = false certified = false
else else
...@@ -27,7 +29,7 @@ class Game_Event ...@@ -27,7 +29,7 @@ class Game_Event
end end
room = Room.new(id.to_i, name, player1, player2, false, [0,0,0]) room = Room.new(id.to_i, name, player1, player2, false, [0,0,0])
room.status = status.to_sym room.status = status.to_sym
room.name =~ /^(P)?(M)?\#?(.*)(?:<font color="d28311" title="竞技场模式">[竞]<\/font>)?$/ room.name =~ /^(P)?(M)?\#?(.*?)(?:<font color="d28311" title="竞技场模式">\[竞\]<\/font>)?$/
room.name = $3 room.name = $3
room.pvp = !!$1 room.pvp = !!$1
room.match = !!$2 room.match = !!$2
......
#encoding: UTF-8 #encoding: UTF-8
load File.expand_path('window_login.rb', File.dirname(__FILE__)) load 'lib/ygocore/window_login.rb'
class Ygocore < Game class Ygocore < Game
attr_reader :password attr_reader :password
@@config = YAML.load_file("lib/ygocore/server.yml") @@config = YAML.load_file("lib/ygocore/server.yml")
WM_LBUTTONDOWN = 0x201
WM_LBUTTONUP = 0x202
VK_CONTROL = 0x11
VK_A = 0x41
VK_V = 0x56
VK_TAB = 0x09
VK_RETURN = 0x0D
KEYEVENTF_KEYUP = 0x02
CF_UNICODETEXT = 13;
GMEM_DDESHARE = 0x2000;
def initialize def initialize
super super
load File.expand_path('event.rb', File.dirname(__FILE__)) load 'lib/ygocore/event.rb'
load File.expand_path('user.rb', File.dirname(__FILE__)) load 'lib/ygocore/user.rb'
load File.expand_path('room.rb', File.dirname(__FILE__)) load 'lib/ygocore/room.rb'
load File.expand_path('scene_lobby.rb', File.dirname(__FILE__)) load 'lib/ygocore/scene_lobby.rb'
require 'json' require 'json'
end end
def login(username, password) def login(username, password)
...@@ -31,7 +43,7 @@ class Ygocore < Game ...@@ -31,7 +43,7 @@ class Ygocore < Game
@password = password @password = password
Game_Event.push Game_Event::Login.new(User.new(username.to_sym, username)) Game_Event.push Game_Event::Login.new(User.new(username.to_sym, username))
when "false" when "false"
Game_Event.push Game_Event::Error.new("登陆", "用户名或密码错误") Game_Event.push Game_Event::Error.new("登陆", "用户名或密码错误", false)
else else
Widget_Msgbox.new("登陆", "连接服务器失败", :ok => "确定") Widget_Msgbox.new("登陆", "连接服务器失败", :ok => "确定")
end end
...@@ -51,7 +63,11 @@ class Ygocore < Game ...@@ -51,7 +63,11 @@ class Ygocore < Game
if $game.rooms.any?{|game_room|game_room.name == room_name} if $game.rooms.any?{|game_room|game_room.name == room_name}
Widget_Msgbox.new("建立房间", "房间名已存在", :ok => "确定") Widget_Msgbox.new("建立房间", "房间名已存在", :ok => "确定")
else else
Game_Event.push Game_Event::Join.new(room) if !Update.images.empty?
Widget_Msgbox.new("加入房间", "卡图正在下载中,可能显示不出部分卡图", :ok => "确定"){Game_Event.push Game_Event::Join.new(room)}
else
Game_Event.push Game_Event::Join.new(room)
end
end end
end end
end end
...@@ -71,7 +87,11 @@ class Ygocore < Game ...@@ -71,7 +87,11 @@ class Ygocore < Game
elsif !$game.rooms.include? room elsif !$game.rooms.include? room
Widget_Msgbox.new("加入房间", "游戏已经取消", :ok => "确定") Widget_Msgbox.new("加入房间", "游戏已经取消", :ok => "确定")
else else
Game_Event.push Game_Event::Join.new(room) if !Update.images.empty?
Widget_Msgbox.new("加入房间", "卡图正在下载中,可能出现显示不出卡图", :ok => "确定"){Game_Event.push Game_Event::Join.new(room)}
else
Game_Event.push Game_Event::Join.new(room)
end
end end
end end
end end
...@@ -86,24 +106,24 @@ class Ygocore < Game ...@@ -86,24 +106,24 @@ class Ygocore < Game
Game_Event.push Game_Event::AllRooms.parse info Game_Event.push Game_Event::AllRooms.parse info
Game_Event.push Game_Event::AllUsers.parse info Game_Event.push Game_Event::AllUsers.parse info
yield if block_given? yield if block_given?
end end rescue nil
end end
end end
end end
def ygocore_path def ygocore_path
return $config['ygocore']['path'] if $config['ygocore']['path'] and File.file? $config['ygocore']['path'] # return $config['ygocore']['path'] if $config['ygocore']['path'] and File.file? $config['ygocore']['path']
return if @last_clicked and Time.now - @last_clicked < 3 #防止重复点击 # return if @last_clicked and Time.now - @last_clicked < 3 #防止重复点击
msgbox = Widget_Msgbox.new("加入房间", "请指定ygocore主程序位置") # msgbox = Widget_Msgbox.new("加入房间", "请指定ygocore主程序位置")
$scene.draw # $scene.draw
require_relative '../dialog' # require_relative '../dialog'
$config['ygocore']['path'] = Dialog.get_open_file("请指定ygocore主程序位置","ygocore主程序 (gframe.exe)" => "gframe.exe") # $config['ygocore']['path'] = Dialog.get_open_file("请指定ygocore主程序位置","ygocore主程序 (gframe.exe)" => "gframe.exe")
save_config # save_config
msgbox.destroy # msgbox.destroy
@last_clicked = Time.now # @last_clicked = Time.now
"ygocore/gframe.exe"
end end
def self.register def self.register
require 'launchy' system("start #{@@config['register']}")
Launchy.open @@config['register']
end end
def server def server
@@config['server'] @@config['server']
...@@ -111,12 +131,128 @@ class Ygocore < Game ...@@ -111,12 +131,128 @@ class Ygocore < Game
def port def port
@@config['port'] @@config['port']
end end
def self.run_ygocore(option)
path = 'ygocore/gframe.exe'
Widget_Msgbox.new("ygocore", "正在启动ygocore")
$scene.draw
#写入配置文件并运行ygocore
Dir.chdir(File.dirname(path)) do
$log.info('当前目录'){Dir.pwd.encode("UTF-8")}
if option.is_a?(Room)
system_conf = {}
begin
IO.readlines('system.conf').each do |line|
line.force_encoding "UTF-8"
next if line[0,1] == '#'
field, contents = line.chomp.split(' = ',2)
system_conf[field] = contents
end
rescue
system_conf['antialias'] = 2
system_conf['textfont'] = 'c:/windows/fonts/simsun.ttc 14'
system_conf['numfont'] = 'c:/windows/fonts/arialbd.ttf'
$log.error('找不到system.conf')
$log.info(Dir.foreach('.').to_a.inspect)
end
system_conf['nickname'] = "#{$game.user.name}#{"$" unless $game.password.nil? or $game.password.empty?}#{$game.password}"
system_conf['lastip'] = $game.server
system_conf['lastport'] = $game.port.to_s
open('system.conf', 'w') {|file|file.write system_conf.collect{|key,value|"#{key} = #{value}"}.join("\n")}
end
$log.info('ygocore路径') {path}
IO.popen('gframe.exe') #执行外部程序....有中文的情况下貌似只能这样了orz
end
#初始化windows API
require 'win32api'
@@FindWindow ||= Win32API.new("user32","FindWindow","pp","l")
@@SendMessage ||= Win32API.new('user32', 'SendMessage', ["L", "L", "L", "L"], "L")
@@SetForegroundWindow ||= Win32API.new('user32', 'SetForegroundWindow', 'l', 'v')
@@keybd_event ||= Win32API.new('user32', 'keybd_event', 'llll', 'v')
@@lstrcpy ||= Win32API.new('kernel32', 'lstrcpyW', ['I', 'P'], 'P');
@@lstrlen ||= Win32API.new('kernel32', 'lstrlenW', ['P'], 'I');
@@OpenClipboard ||= Win32API.new('user32', 'OpenClipboard', ['I'], 'I');
@@CloseClipboard ||= Win32API.new('user32', 'CloseClipboard', [], 'I');
@@EmptyClipboard ||= Win32API.new('user32', 'EmptyClipboard', [], 'I');
@@SetClipboardData ||= Win32API.new('user32', 'SetClipboardData', ['I', 'I'], 'I');
@@GlobalAlloc ||= Win32API.new('kernel32', 'GlobalAlloc', ['I','I'], 'I');
@@GlobalLock ||= Win32API.new('kernel32', 'GlobalLock', ['I'], 'I');
@@GlobalUnlock ||= Win32API.new('kernel32', 'GlobalUnlock', ['I'], 'I');
#获取句柄
hwnd = nil
50.times do
if (hwnd = @@FindWindow.call('CIrrDeviceWin32', nil)) != 0
break
else
sleep 0.1
end
end
if hwnd and hwnd != 0
#操作ygocore进入主机
WM.iconify
if option.is_a? Room
@@SendMessage.call(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(507,242))
@@SendMessage.call(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(507,242))
sleep 0.5
if @@OpenClipboard.Call(0) != 0
room = option
room_name = if room.pvp? and room.match?
"PM#" + room.name
elsif room.pvp?
"P#" + room.name
elsif room.match?
"M#" + room.name
else
room.name
end
$log.info('加入房间'){room_name}
@@EmptyClipboard.Call();
len = room_name.encode("UTF-16LE").bytesize
#p len=@@lstrlen.call(room_name.encode("UTF-16LE"))#
$log.info('房间名长度'){len.to_s}
hmem = @@GlobalAlloc.Call(GMEM_DDESHARE, len+2);
pmem = @@GlobalLock.Call(hmem);
@@lstrcpy.Call(pmem, room_name.encode("UTF-16LE"));
@@SetClipboardData.Call(CF_UNICODETEXT, hmem);
@@GlobalUnlock.Call(hmem);
@@CloseClipboard.Call;
@@SetForegroundWindow.call(hwnd)
@@SendMessage.call(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(380,500))
@@SendMessage.call(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(380,500))
@@keybd_event.call(VK_CONTROL,0,0,0)
@@keybd_event.call(VK_A,0,0,0)#全选以避免密码处已经有字的情况,正常情况下应该无用
@@keybd_event.call(VK_A,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_V,0,0,0)
@@keybd_event.call(VK_V,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_CONTROL,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_TAB,0,0,0)
@@keybd_event.call(VK_TAB,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_RETURN,0,0,0)
@@keybd_event.call(VK_RETURN,0,KEYEVENTF_KEYUP,0)
Widget_Msgbox.destroy
else
Widget_Msgbox.new("加入房间", '填写房间名失败 请把房间名手动填写到房间密码处', :ok => "确定")
end
else
@@SendMessage.call(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(507,389))
@@SendMessage.call(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(507,389))
Widget_Msgbox.destroy
end
else
Widget_Msgbox.new("加入房间", 'ygocore运行失败', :ok => "确定")
end
end
private private
def connect def connect
require 'open-uri' require 'open-uri'
end end
def self.get_announcements def self.get_announcements
#公告 #公告
$config['ygocore'] ||= {}
$config['ygocore']['announcements'] ||= [Announcement.new("正在读取公告...", nil, nil)] $config['ygocore']['announcements'] ||= [Announcement.new("正在读取公告...", nil, nil)]
Thread.new do Thread.new do
begin begin
...@@ -136,4 +272,8 @@ class Ygocore < Game ...@@ -136,4 +272,8 @@ class Ygocore < Game
end end
end end
get_announcements get_announcements
end
def MAKELPARAM(w1,w2)
(w2<<16) | w1
end end
\ No newline at end of file
class Scene_Lobby class Scene_Lobby
WM_LBUTTONDOWN = 0x201
WM_LBUTTONUP = 0x202
VK_CONTROL = 0x11
VK_A = 0x41
VK_V = 0x56
VK_TAB = 0x09
VK_RETURN = 0x0D
KEYEVENTF_KEYUP = 0x02
CF_UNICODETEXT = 13;
GMEM_DDESHARE = 0x2000;
def join(room) def join(room)
path = $game.ygocore_path Ygocore.run_ygocore(room)
return Widget_Msgbox.destroy unless path
Widget_Msgbox.new("加入房间", "正在启动ygocore")
room_name = if room.pvp? and room.match?
"PM#" + room.name
elsif room.pvp?
"P#" + room.name
elsif room.match?
"M#" + room.name
else
room.name
end
$scene.draw
#写入配置文件并运行ygocore
Dir.chdir(File.dirname(path)) do
$log.info('当前目录'){Dir.pwd.encode("UTF-8")}
system_conf = {}
begin
IO.readlines('system.conf').each do |line|
line.force_encoding "UTF-8"
next if line[0,1] == '#'
field, contents = line.chomp.split(' = ',2)
system_conf[field] = contents
end
rescue
system_conf['antialias'] = 2
system_conf['textfont'] = 'c:/windows/fonts/simsun.ttc 14'
system_conf['numfont'] = 'c:/windows/fonts/arialbd.ttf'
$log.error('找不到system.conf')
$log.info(Dir.foreach('.').to_a.inspect)
end
system_conf['nickname'] = "#{$game.user.name}#{"$" unless $game.password.nil? or $game.password.empty?}#{$game.password}"
system_conf['lastip'] = $game.server
system_conf['lastport'] = $game.port.to_s
open('system.conf', 'w') {|file|file.write system_conf.collect{|key,value|"#{key} = #{value}"}.join("\n")}
$log.info('ygocore路径') {path}
IO.popen("\"#{path}\"".encode("GBK")) #执行外部程序....有中文的情况下貌似只能这样了orz
end
#初始化windows API
require 'win32api'
@@FindWindow ||= Win32API.new("user32","FindWindow","pp","l")
@@SendMessage ||= Win32API.new('user32', 'SendMessage', ["L", "L", "L", "L"], "L")
@@SetForegroundWindow ||= Win32API.new('user32', 'SetForegroundWindow', 'l', 'v')
@@keybd_event ||= Win32API.new('user32', 'keybd_event', 'llll', 'v')
@@lstrcpy ||= Win32API.new('kernel32', 'lstrcpyW', ['I', 'P'], 'P');
@@lstrlen ||= Win32API.new('kernel32', 'lstrlenW', ['P'], 'I');
@@OpenClipboard ||= Win32API.new('user32', 'OpenClipboard', ['I'], 'I');
@@CloseClipboard ||= Win32API.new('user32', 'CloseClipboard', [], 'I');
@@EmptyClipboard ||= Win32API.new('user32', 'EmptyClipboard', [], 'I');
@@SetClipboardData ||= Win32API.new('user32', 'SetClipboardData', ['I', 'I'], 'I');
@@GlobalAlloc ||= Win32API.new('kernel32', 'GlobalAlloc', ['I','I'], 'I');
@@GlobalLock ||= Win32API.new('kernel32', 'GlobalLock', ['I'], 'I');
@@GlobalUnlock ||= Win32API.new('kernel32', 'GlobalUnlock', ['I'], 'I');
#获取句柄
hwnd = nil
50.times do
if (hwnd = @@FindWindow.call('CIrrDeviceWin32', nil)) != 0
break
else
sleep 0.1
end
end
if hwnd and hwnd != 0
#操作ygocore进入主机
WM.iconify
@@SendMessage.call(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(507,242))
@@SendMessage.call(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(507,242))
sleep 0.5
if @@OpenClipboard.Call(0) != 0
$log.info('加入房间'){room_name}
@@EmptyClipboard.Call();
len = room_name.encode("UTF-16LE").bytesize
#p len=@@lstrlen.call(room_name.encode("UTF-16LE"))#
$log.info('房间名长度'){len.to_s}
hmem = @@GlobalAlloc.Call(GMEM_DDESHARE, len+2);
pmem = @@GlobalLock.Call(hmem);
@@lstrcpy.Call(pmem, room_name.encode("UTF-16LE"));
@@SetClipboardData.Call(CF_UNICODETEXT, hmem);
@@GlobalUnlock.Call(hmem);
@@CloseClipboard.Call;
@@SetForegroundWindow.call(hwnd)
@@SendMessage.call(hwnd, WM_LBUTTONDOWN, 0, MAKELPARAM(380,500))
@@SendMessage.call(hwnd, WM_LBUTTONUP, 0, MAKELPARAM(380,500))
@@keybd_event.call(VK_CONTROL,0,0,0)
@@keybd_event.call(VK_A,0,0,0)#全选以避免密码处已经有字的情况,正常情况下应该无用
@@keybd_event.call(VK_A,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_V,0,0,0)
@@keybd_event.call(VK_V,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_CONTROL,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_TAB,0,0,0)
@@keybd_event.call(VK_TAB,0,KEYEVENTF_KEYUP,0)
@@keybd_event.call(VK_RETURN,0,0,0)
@@keybd_event.call(VK_RETURN,0,KEYEVENTF_KEYUP,0)
Widget_Msgbox.destroy #仅仅为了消掉正在加入房间的消息框
else
Widget_Msgbox.new("加入房间", '填写房间名失败 请把房间名手动填写到房间密码处', :ok => "确定")
end
else
Widget_Msgbox.new("加入房间", 'ygocore运行失败', :ok => "确定")
end
#这里似乎有个能引起ruby解释器崩溃的故障,但是没法稳定重现。
end
def MAKELPARAM(w1,w2)
return (w2<<16) | w1
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment