Commit 54a59906 authored by 神楽坂玲奈's avatar 神楽坂玲奈

ygocore thc

parent d34b5cfe
This diff was suppressed by a .gitattributes entry.
...@@ -10,6 +10,7 @@ class Scene_Lobby < Scene ...@@ -10,6 +10,7 @@ class Scene_Lobby < Scene
require_relative 'window_userinfo' require_relative 'window_userinfo'
require_relative 'window_roomlist' require_relative 'window_roomlist'
require_relative 'window_chat' require_relative 'window_chat'
require_relative 'window_host'
require_relative 'chatmessage' require_relative 'chatmessage'
require_relative 'scene_duel' require_relative 'scene_duel'
attr_reader :chat_window attr_reader :chat_window
...@@ -22,7 +23,7 @@ class Scene_Lobby < Scene ...@@ -22,7 +23,7 @@ class Scene_Lobby < Scene
@userlist = Window_UserList.new(24,204,$game.users) @userlist = Window_UserList.new(24,204,$game.users)
@roomlist = Window_RoomList.new(320,50,$game.rooms) @roomlist = Window_RoomList.new(320,50,$game.rooms)
@userinfo = Window_UserInfo.new(24,24, $game.user) @userinfo = Window_UserInfo.new(24,24, $game.user)
@host_window = Window_Host.new(900,16)
@active_window = @roomlist @active_window = @roomlist
@chat_window = Window_Chat.new(313,543,698,212) @chat_window = Window_Chat.new(313,543,698,212)
@count = 0 @count = 0
...@@ -40,11 +41,11 @@ class Scene_Lobby < Scene ...@@ -40,11 +41,11 @@ class Scene_Lobby < Scene
when Key::RETURN when Key::RETURN
@active_window.clicked @active_window.clicked
when Key::F2 when Key::F2
@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手") #@joinroom_msgbox = Widget_Msgbox.new("创建房间", "正在等待对手")
$game.host("test") $game.host Room.new(0, $game.user.name)
when Key::F3 when Key::F3
@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间") #@joinroom_msgbox = Widget_Msgbox.new("加入房间", "正在加入房间")
$game.join 'localhost' #$game.join 'localhost'
when Key::F5 when Key::F5
if @roomlist.items and room = @roomlist.items.find{|room|room.player1 == $game.user or room.player2 == $game.user} if @roomlist.items and room = @roomlist.items.find{|room|room.player1 == $game.user or room.player2 == $game.user}
$game.qroom room $game.qroom room
......
...@@ -61,6 +61,7 @@ class Window_Announcements < Window ...@@ -61,6 +61,7 @@ class Window_Announcements < Window
super super
end end
def clicked def clicked
return unless @item
require 'launchy' require 'launchy'
Launchy.open(@item.url) if @item.url Launchy.open(@item.url) if @item.url
end end
......
#encoding: UTF-8
class Window_Host < Window_List
def initialize(x,y)
super(x,y,86,30)
@items = ["新房间"]
@button = Surface.load("graphics/lobby/button.png")
@font = TTF.open("fonts/WenQuanYi Micro Hei.ttf", 16)
refresh
end
def draw_item(index, status=0)
Surface.blit(@button, status*@button.w/3,0,@button.w/3,@button.h, @contents, 0, 0)
@font.draw_blended_utf8(@contents,"新房间",16,5,20,10,180)
end
def mousemoved(x,y)
self.index = 0
end
def lostfocus(active_window = nil)
self.index = nil
end
def clicked
$game.join Room.new(0, $game.user.name)
end
end
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
load File.expand_path('window_login.rb', File.dirname(__FILE__)) load File.expand_path('window_login.rb', File.dirname(__FILE__))
require 'open-uri' require 'open-uri'
class Ygocore < Game class Ygocore < Game
Register_Url = 'http://sh.convnet.net:7955/regist.html' Register_Url = 'http://140.113.242.65/register.html'
Port = 7911 Port = 7911
Server = '221.226.68.62' Server = '140.113.242.65'
WM_LBUTTONDOWN = 0x201 WM_LBUTTONDOWN = 0x201
WM_LBUTTONUP = 0x202 WM_LBUTTONUP = 0x202
...@@ -128,7 +128,7 @@ class Ygocore < Game ...@@ -128,7 +128,7 @@ class Ygocore < Game
def refresh def refresh
Thread.new do Thread.new do
begin begin
open('http://sh.convnet.net:7922/') do |file| open('http://140.113.242.65:7922/') 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 Game_Event.push Game_Event::AllUsers.parse info
...@@ -149,11 +149,11 @@ class Ygocore < Game ...@@ -149,11 +149,11 @@ class Ygocore < Game
$config['ygocore']['announcements'] ||= [Announcement.new("正在读取公告...", nil, nil)] $config['ygocore']['announcements'] ||= [Announcement.new("正在读取公告...", nil, nil)]
Thread.new do Thread.new do
begin begin
open('http://sh.convnet.net:7922/') do |file| open('http://140.113.242.65:7922/') do |file|
file.set_encoding "GBK" file.set_encoding "GBK"
announcements = [] announcements = []
file.read.scan(/<div style="color:red" >(.*?)<\/div>/).each do |title,others| file.read.encode("UTF-8").scan(/<div style="color:red" >公告:(.*?)<\/div>/).each do |title,others|
announcements << Announcement.new(title.encode("UTF-8"), "http://sh.convnet.net:7922/", nil) announcements << Announcement.new(title, "http://140.113.242.65/", nil)
end end
$config['ygocore']['announcements'].replace announcements $config['ygocore']['announcements'].replace announcements
save_config save_config
......
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