Commit 21f382e2 authored by zh99998's avatar zh99998

去掉Tk库,输入法改为夏娜版,get_open_file改为windows API

parent 940f2b07
require 'win32api'
module Dialog
#--------------------------------------------------------------------------
# ● 选择文件对话框
#--------------------------------------------------------------------------
GetOpenFileName = Win32API.new("comdlg32.dll", "GetOpenFileNameW", "p", "i")
OFN_EXPLORER = 0x00080000
OFN_PATHMUSTEXIST = 0x00000800
OFN_FILEMUSTEXIST = 0x00001000
OFN_ALLOWMULTISELECT = 0x00000200
OFN_FLAGS = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST |
OFN_ALLOWMULTISELECT
module_function
def get_open_file(title="选择文件", filter = {"所有文件 (*.*)" => "*.*"})
szFile = (0.chr * 20481).encode("UTF-16LE")
szFileTitle = 0.chr * 2049
szTitle = (title+"\0").encode("UTF-16LE")
szFilter = (filter.flatten.join("\0")+"\0\0").encode("UTF-16LE")
#p szFilter.encode("GBK")
szInitialDir = "\0"
ofn =
[
76, # lStructSize L
0, # hwndOwner L
0, # hInstance L
szFilter, # lpstrFilter L
0, # lpstrCustomFilter L
0, # nMaxCustFilter L
1, # nFilterIndex L
szFile, # lpstrFile L
szFile.size - 1, # nMaxFile L
szFileTitle, # lpstrFileTitle L
szFileTitle.size - 1, # nMaxFileTitle L
szInitialDir, # lpstrInitialDir L
szTitle, # lpstrTitle L
OFN_FLAGS, # Flags L
0, # nFileOffset S
0, # nFileExtension S
0, # lpstrDefExt L
0, # lCustData L
0, # lpfnHook L
0 # lpTemplateName L
].pack("LLLPLLLPLPLPPLS2L4")
Dir.chdir{GetOpenFileName.call(ofn)}
szFile.delete!("\0".encode("UTF-16LE"))
szFile.encode("UTF-8")
end
end
\ No newline at end of file
...@@ -138,8 +138,7 @@ class Game_Event ...@@ -138,8 +138,7 @@ class Game_Event
@title = title @title = title
@message = message @message = message
@fatal = fatal @fatal = fatal
p @title, @title.encoding, @message, @message.encoding, caller.to_s.encoding $log.error(@fatal ? "致命错误" : "一般错误"){"#{@title}: #{@message} #{caller}"}
$log.error(@fatal ? "致命错误" : "一般错误"){"#{@title}: #{@message.encode("UTF-8")} #{caller}"}
end end
end end
class Unknown < Error class Unknown < Error
......
...@@ -16,8 +16,8 @@ class Window_Login ...@@ -16,8 +16,8 @@ class Window_Login
Launchy.open(Iduel::Register_Url) Launchy.open(Iduel::Register_Url)
@last_clicked = Time.now @last_clicked = Time.now
when :replay when :replay
require 'tk' require_relative '../dialog'
file = Tk.getOpenFile.encode("UTF-8") file = Dialog.get_open_file("播放战报", "所有支持的战报 (*.txt;*.htm)" => "*.txt;*.htm", "iDuel的html的战报 (*.htm)" => "*.htm", "文本战报 (*.txt)" => "*.txt")
if !file.empty? if !file.empty?
$game = Iduel.new $game = Iduel.new
$game.user = User.new(0) $game.user = User.new(0)
......
...@@ -38,6 +38,9 @@ begin ...@@ -38,6 +38,9 @@ begin
#初始化SDL #初始化SDL
require 'sdl' require 'sdl'
include SDL include SDL
SDL::Event::APPMOUSEFOCUS = 1
SDL::Event::APPINPUTFOCUS = 2
SDL::Event::APPACTIVE = 4
SDL.putenv ("SDL_VIDEO_CENTERED=1"); SDL.putenv ("SDL_VIDEO_CENTERED=1");
SDL.init(INIT_VIDEO | INIT_AUDIO) SDL.init(INIT_VIDEO | INIT_AUDIO)
WM::set_caption("MyCard", "MyCard") WM::set_caption("MyCard", "MyCard")
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
# see http://www.xiph.org/ogg/vorbis/docs.html for documentation on vorbis format # see http://www.xiph.org/ogg/vorbis/docs.html for documentation on vorbis format
# http://www.xiph.org/ogg/vorbis/doc/v-comment.html # http://www.xiph.org/ogg/vorbis/doc/v-comment.html
require "iconv" #require "iconv"
# Raised on any kind of error related to ruby-ogginfo # Raised on any kind of error related to ruby-ogginfo
class OggInfoError < StandardError ; end class OggInfoError < StandardError ; end
......
...@@ -8,6 +8,7 @@ require_relative 'fpstimer' ...@@ -8,6 +8,7 @@ require_relative 'fpstimer'
require_relative 'game' require_relative 'game'
require_relative 'window_bgm' require_relative 'window_bgm'
require_relative 'ogginfo' require_relative 'ogginfo'
require_relative 'widget_inputbox'
class Scene class Scene
attr_reader :windows attr_reader :windows
attr_reader :background attr_reader :background
...@@ -106,6 +107,9 @@ class Scene ...@@ -106,6 +107,9 @@ class Scene
when 5 when 5
@active_window.scroll_down if @active_window @active_window.scroll_down if @active_window
end end
if !@active_window.is_a? Widget_InputBox
Widget_InputBox.focus = false
end
when Event::MouseButtonUp when Event::MouseButtonUp
case event.button case event.button
when Mouse::BUTTON_LEFT when Mouse::BUTTON_LEFT
...@@ -117,12 +121,16 @@ class Scene ...@@ -117,12 +121,16 @@ class Scene
when Key::F12 when Key::F12
$scene = Scene_Title.new $scene = Scene_Title.new
else else
#$log.debug('unhandled event'){event.inspect} #$log.info('unhandled event'){event.inspect}
end end
when Event::Quit when Event::Quit
$scene = nil $scene = nil
when Event::Active
if (event.state & Event::APPINPUTFOCUS) != 0
Widget_InputBox.focus = event.gain
end
else else
#$log.debug('unhandled event'){event.inspect} #$log.info('unhandled event'){event.inspect}
end end
end end
def handle_game(event) def handle_game(event)
...@@ -143,6 +151,7 @@ class Scene ...@@ -143,6 +151,7 @@ class Scene
# ● 结束处理 # ● 结束处理
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def terminate def terminate
self.windows.each{|window|window.destroy}
end end
def update_active_window(x, y) def update_active_window(x, y)
self.windows.reverse.each do |window| self.windows.reverse.each do |window|
......
...@@ -86,6 +86,8 @@ class Scene_Lobby < Scene ...@@ -86,6 +86,8 @@ class Scene_Lobby < Scene
$scene = Scene_Duel.new(room) $scene = Scene_Duel.new(room)
end end
def update def update
@chat_window.update
@host_window.update
if @count >= 600 if @count >= 600
$game.refresh $game.refresh
@count = 0 @count = 0
......
...@@ -18,7 +18,6 @@ class Scene_Login < Scene ...@@ -18,7 +18,6 @@ class Scene_Login < Scene
super super
end end
def update def update
#@announcements_window.update
@gameselect_window.update @gameselect_window.update
super super
end end
......
#输入法by夏娜
require 'dl'
require 'dl/import'
module RM_IME
extend DL::Importer
Dir.chdir('ruby/bin'){dlload 'RMIME.dll'}
extern 'void _init(long, int, int)'
extern 'void _update(int, int)'
extern 'void _dispose()'
extern 'void _get_text(char*)'
extern 'void _back(char*)'
module RM_INPUT
extend DL::Importer
dlload 'user32.dll'
extern 'int GetAsyncKeyState(int)'
extern 'long FindWindow(char*, char*)'
ENTER = 0x0D
ESC = 0x1B
TAB = 0x09
UP = 0x26
DOWN = 0x28
LEFT = 0x25
RIGHT = 0x27
Key_Hash = {}
Key_Repeat = {}
module_function
#----------------------------------------------------------------------
# ● 按下判断
#----------------------------------------------------------------------
def press?(rkey)
return GetAsyncKeyState(rkey) != 0
end
#----------------------------------------------------------------------
# ● 重复按下判断
#----------------------------------------------------------------------
def repeat?(rkey)
result = GetAsyncKeyState(rkey)
if result != 0
if Key_Repeat[rkey].nil?
Key_Repeat[rkey] = 0
return true
end
Key_Repeat[rkey] += 1
else
Key_Repeat[rkey] = nil
Key_Hash[rkey] = 0
end
if !Key_Repeat[rkey].nil? and Key_Repeat[rkey] > 4
Key_Repeat[rkey] = 0
return true
else
return false
end
end
#----------------------------------------------------------------------
# ● 击键判断
#----------------------------------------------------------------------
def trigger?(rkey)
result = GetAsyncKeyState(rkey)
if Key_Hash[rkey] == 1 and result != 0
return false
end
if result != 0
Key_Hash[rkey] = 1
return true
else
Key_Hash[rkey] = 0
return false
end
end
end
HWND = RM_INPUT.FindWindow('SDL_app', WM.caption[0])
module_function
def init
return if @active
_init(HWND, 0, 0)
@x = 0
@y = 0
@active = true
$log.info('输入法'){'开启'}
end
def set(x,y)
@x = x
@y = y
end
def text
buf = 0.chr * 1024
_get_text(buf)
buf.force_encoding("UTF-8")
buf.delete!("\0")
end
def update
_update(@x,@y)
buf = [0,0].pack("LL")
_back(buf)
buf = buf.unpack("LL")
@backspace = buf[0] == 1
@delete = buf[1] == 1
end
def dispose
return if !@active
_dispose
$log.info('输入法'){'关闭'}
@active = false
end
def active?
@active
end
def backspace?
@backspace
end
def delete?
@delete
end
def left?
RM_INPUT.repeat?(RM_INPUT::LEFT)
end
def right?
RM_INPUT.repeat?(RM_INPUT::RIGHT)
end
def tab?
RM_INPUT.trigger?(RM_INPUT::TAB)
end
def enter?
RM_INPUT.trigger?(RM_INPUT::ENTER)
end
def esc?
RM_INPUT.trigger?(RM_INPUT::ESC)
end
end
class Widget_InputBox < Window class Widget_InputBox < Window
attr_reader :value, :proc
attr_accessor :type attr_accessor :type
attr_reader :value
require 'tk' attr_reader :index
Root=TkRoot.new{ @@active = nil
withdraw @@cursor = nil
overrideredirect true @@focus = true
attributes :topmost, true
}
Entry = TkEntry.new(Root){
font TkFont.new "family" => 'WenQuanYi Micro Hei', "size" => 15
validate :focusout
validatecommand {Widget_InputBox.determine}
bind('Key-Return'){self.value="" if @@active.proc.call(get.encode("UTF-8")) if @@active.proc;true} #两个if的解释:当存在proc时,call那个proc,如果执行结果为真就清空value
pack
}
Thread.new{Tk.mainloop}
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/WenQuanYi Micro Hei.ttf", 20)
@proc = proc @proc = proc
@value = "" @value = ""
@type = :text @type = :text
@index = 0
@count = 0
@char_pos = [2]
end end
def value=(value) def value=(value)
return if @value == value return if @value == value
@value = value @value = value
@char_pos.replace [2]
@value.each_char do |char|
@char_pos << @char_pos.last + @font.text_size(@type == :password ? '*' : char)[0]
end
if @index > value.size
self.index = value.size
end
refresh refresh
end end
def index=(index)
if index > @value.size
index = @value.size
elsif index < 0
index = 0
end
return if @index == index
@index = index
@count = 0
@@cursor.visible = true
@@cursor.x = @x + @char_pos[@index]
RM_IME.set(@@cursor.x, @@cursor.y)
end
def refresh def refresh
clear clear
@font.draw_blended_utf8(@contents, @type == :password ? '*' * @value.size : @value, 2, 0, 0x00, 0x00, 0x00) unless @value.empty? @font.draw_blended_utf8(@contents, @type == :password ? '*' * @value.size : @value, 2, 0, 0x00, 0x00, 0x00) unless @value.empty?
end end
def clicked def clicked
Entry.value = @value RM_IME.init
Entry.show @type == :password ? '*' : nil @@active = self
Entry.focus :force @@focus = true
Entry.width @width unless @@cursor and !@@cursor.destroyed?
Root.geometry "#{@width}x#{@height}+#{@x+TkWinfo.pointerx(Root)-Mouse.state[0]}+#{@y+TkWinfo.pointery(Root)-Mouse.state[1]}" #根据鼠标位置来确定游戏窗口的相对位置,点击的瞬间鼠标移动了的话会有误差 @@cursor = Window.new(0,0,2,@height-4,301)
Root.deiconify @@cursor.contents.fill_rect(0,0,@@cursor.width,@@cursor.height,0xFF000000)
@@active = self #TODO:存在线程安全问题 end
@@cursor.y = @y + 2
mouse_x = Mouse.state[0] - @x
@index = nil #强制重置
if mouse_x < 0 or @value.empty?
self.index = 0
else
@char_pos.each_with_index do |x, index|
if x > mouse_x
return self.index = index - 1
end
end
self.index = @value.size
end
end end
def clear(x=0, y=0, width=@width, height=@height) def clear(x=0, y=0, width=@width, height=@height)
@contents.fill_rect(x,y,width,height,0x110000FF) @contents.fill_rect(x,y,width,height,0x110000FF)
@contents.fill_rect(x+2,y+2,width-4,height-4,0xFFFFFFFF) @contents.fill_rect(x+2,y+2,width-4,height-4,0xFFFFFFFF)
end end
def update def update
#puts "UPDATE:" + self.to_s return unless self == @@active and @@focus
if @count >= 40
@count = 0
@@cursor.visible = !@@cursor.visible
else
@count += 1
end
RM_IME.update
new_value = self.value.dup
new_index = self.index
text = RM_IME.text
if !text.empty?
new_value.insert(@index, text)
new_index += text.size
end
if RM_IME.backspace? and @index > 0
new_value.slice!(@index-1, 1)
new_index -= 1
end
if RM_IME.delete? and @index < @value.size
new_value.slice!(@index, 1)
end
if RM_IME.left?
new_index -= 1
end
if RM_IME.right?
new_index += 1
end
self.value = new_value
self.index = new_index
if @proc
if RM_IME.esc?
self.value = '' if @proc.call :ESC
end
if RM_IME.tab?
self.value = '' if @proc.call :TAB
end
if RM_IME.enter?
self.value = '' if @proc.call :ENTER
end
end
end end
def self.determine def destroy
@@active.value=Entry.get.encode("UTF-8");Root.withdraw(true);@@active.refresh;true if @@active == self
Widget_InputBox.focus = false
end
super
end end
end def self.focus=(focus)
@@focus = focus
if !@@focus
RM_IME.dispose
@@cursor.destroy if @@cursor
end
end
end
\ No newline at end of file
...@@ -21,11 +21,12 @@ class Window_Chat < Window_Scrollable ...@@ -21,11 +21,12 @@ class Window_Chat < Window_Scrollable
@background.fill_rect(0,0,@background.w, @background.h, 0xFFb2cefe) @background.fill_rect(0,0,@background.w, @background.h, 0xFFb2cefe)
@background.put(@chat_background,0,31-4) @background.put(@chat_background,0,31-4)
@tab = Surface.load "graphics/system/tab.png" @tab = Surface.load "graphics/system/tab.png"
@chat_input = Widget_InputBox.new(@x+8, @y+@height-24-10, @width-14, 24) do |message| @chat_input = Widget_InputBox.new(@x+8, @y+@height-24-10, @width-14, 24) do |key|
chatmessage = ChatMessage.new($game.user, message, @channel) chatmessage = ChatMessage.new($game.user, @chat_input.value, @channel)
$game.chat chatmessage $game.chat chatmessage
Game_Event.push Game_Event::Chat.new(chatmessage) Game_Event.push Game_Event::Chat.new(chatmessage)
end end
@chat_input.refresh
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 14) @font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 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
...@@ -160,4 +161,7 @@ class Window_Chat < Window_Scrollable ...@@ -160,4 +161,7 @@ class Window_Chat < Window_Scrollable
def scroll_down def scroll_down
self.scroll += 1 self.scroll += 1
end end
def update
@chat_input.update
end
end end
\ No newline at end of file
...@@ -66,6 +66,7 @@ class Window_GameSelect < Window_List ...@@ -66,6 +66,7 @@ class Window_GameSelect < Window_List
refresh refresh
end end
def update def update
@login_window.update if @login_window
@announcements_window.update if @announcements_window @announcements_window.update if @announcements_window
end end
#def lostfocus #def lostfocus
......
...@@ -9,7 +9,15 @@ class Window_Host < Window ...@@ -9,7 +9,15 @@ class Window_Host < Window
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16) @font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 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){clicked;false} @roomname_inputbox = Widget_InputBox.new(@x+96, @y+41, 165, WLH) do |key|
case key
when :ENTER
clicked
false
when :ESC
true
end
end
default_name = $game.user.name default_name = $game.user.name
1.upto(1000) do |i| 1.upto(1000) do |i|
if $game.rooms.all?{|room|room.name != i.to_s} if $game.rooms.all?{|room|room.name != i.to_s}
...@@ -72,4 +80,7 @@ class Window_Host < Window ...@@ -72,4 +80,7 @@ class Window_Host < Window
@match.destroy @match.destroy
super super
end end
def update
@roomname_inputbox.update
end
end end
\ No newline at end of file
...@@ -18,6 +18,9 @@ class Window_LobbyButtons < Window_List ...@@ -18,6 +18,9 @@ class Window_LobbyButtons < Window_List
self.index = nil self.index = nil
end end
def clicked def clicked
Window_Host.new(300,200) @host_window = Window_Host.new(300,200)
end
def update
@host_window.update if @host_window and !@host_window.destroyed?
end end
end end
...@@ -7,9 +7,29 @@ class Window_Login < Window ...@@ -7,9 +7,29 @@ class Window_Login < Window
@password = password @password = password
@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){|text|@username_inputbox.value = text;@password_inputbox.clicked;false} @username_inputbox = Widget_InputBox.new(@x+192, @y+80, 165, WLH) do |key|
case key
when :TAB, :ENTER
@password_inputbox.clicked
false
when :ESC
true
end
end
@username && !@username.empty? ? @username_inputbox.value = @username : @username_inputbox.refresh @username && !@username.empty? ? @username_inputbox.value = @username : @username_inputbox.refresh
@password_inputbox = Widget_InputBox.new(@x+192, @y+125, 165, WLH){|text|Widget_InputBox.determine;self.index=:login;clicked;false} @password_inputbox = Widget_InputBox.new(@x+192, @y+125, 165, WLH) do |key|
case key
when :TAB
self.index=:login
false
when :ENTER
self.index=:login
self.clicked
false
when :ESC
true
end
end
@password_inputbox.type = :password @password_inputbox.type = :password
@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]
......
class Game_Event class Game_Event
User_Filter = /\[(\d+),<font color="(?:blue|gray)">(.+?)(\(未认证\)|)<\/font>\]/ User_Filter = /\[(\d+),(.+?)\]/
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>/
class AllRooms < Game_Event class AllRooms < Game_Event
def self.parse(info) def self.parse(info)
@rooms = [] @rooms = []
info.scan(Room_Filter) do |id, name, status| info.scan(Room_Filter) do |id, name, status, users|
#p id, name, status, users, '------------'
player1 = player2 = nil player1 = player2 = nil
$&.scan(User_Filter) do |player, name, certified| users.scan(User_Filter) do |player, name|
if name =~ /^<font color="(?:blue|gray)">(.+?)<\/font>$/
name = $1
end
if name =~ /^(.+?)\(未认证\)$/
name = $1
certified = false
else
certified = true
end
if player["1"] if player["1"]
player1 = User.new(name.to_sym, name, certified.empty?) player1 = User.new(name.to_sym, name, certified)
elsif player["2"] elsif player["2"]
player2 = User.new(name.to_sym, name, certified.empty?) player2 = User.new(name.to_sym, name, certified)
end end
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)?\#?(.*)$/ 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
...@@ -33,8 +43,9 @@ class Game_Event ...@@ -33,8 +43,9 @@ class Game_Event
class AllUsers < Game_Event class AllUsers < Game_Event
def self.parse(info) def self.parse(info)
@users = [] @users = []
info.scan(User_Filter) do |player, name, certified| $game.rooms.each do |room|
@users << User.new(name.to_sym, name, certified.empty?) @users << room.player1 if room.player1
@users << room.player2 if room.player2
end end
self.new @users self.new @users
end end
......
...@@ -76,13 +76,15 @@ class Ygocore < Game ...@@ -76,13 +76,15 @@ class Ygocore < Game
end end
end end
def refresh def refresh
$log.info('刷新大厅信息'){'开始'}
Thread.new do Thread.new do
begin begin
open("#{@@config['api']}?operation=getroom") do |file| open("#{@@config['api']}?operation=getroom") do |file|
file.set_encoding("GBK") file.set_encoding("GBK")
info = file.read.encode("UTF-8") info = file.read.encode("UTF-8")
Game_Event.push Game_Event::AllUsers.parse info $log.info('刷新大厅信息'){'完成'}
Game_Event.push Game_Event::AllRooms.parse info Game_Event.push Game_Event::AllRooms.parse info
Game_Event.push Game_Event::AllUsers.parse info
yield if block_given? yield if block_given?
end end
end end
...@@ -93,8 +95,8 @@ class Ygocore < Game ...@@ -93,8 +95,8 @@ class Ygocore < Game
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 'tk' require_relative '../dialog'
$config['ygocore']['path'] = Tk.getOpenFile.encode("UTF-8") $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
......
...@@ -11,7 +11,8 @@ class Scene_Lobby ...@@ -11,7 +11,8 @@ class Scene_Lobby
GMEM_DDESHARE = 0x2000; GMEM_DDESHARE = 0x2000;
def join(room) def join(room)
path = $game.ygocore_path path = $game.ygocore_path
return Widget_Msgbox.destroy unless path
Widget_Msgbox.new("加入房间", "正在启动ygocore")
room_name = if room.pvp? and room.match? room_name = if room.pvp? and room.match?
"PM#" + room.name "PM#" + room.name
elsif room.pvp? elsif room.pvp?
......
register: http://sh.convnet.net:7955/regist.html register: http://card.touhou.cc/register
api: http://sh.convnet.net:7922/ api: http://140.113.242.66:7922/
index: http://sh.convnet.net:7922/ index: http://card.touhou.cc/
server: 221.226.68.62 server: 140.113.242.66
port: 7911 port: 7911
\ No newline at end of file
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