Commit f590f7b2 authored by 神楽坂玲奈's avatar 神楽坂玲奈

linux fix

parent f8d64192
......@@ -20,20 +20,21 @@ end
spec = Gem::Specification.new do |s|
s.name = 'mycard'
s.version = '0.9.3'
s.version = '0.9.8'
s.extra_rdoc_files = ['README.txt', 'LICENSE.txt']
s.summary = 'a card game'
s.summary = 'a card game platform'
s.description = s.summary
s.author = 'zh99998'
s.email = 'zh99998@gmail.com'
s.homepage = 'http://my-card.in'
s.homepage = 'http://my-card.in/'
# s.executables = ['your_executable_here']
s.files = %w(LICENSE.txt README.txt config.yml replay)
%w{lib audio data fonts locales graphics ygocore}.each{|dir|s.files.concat list(dir)}
s.files = %w(LICENSE.txt README.txt replay)
%w{lib audio data locales graphics ygocore}.each{|dir|s.files.concat list(dir)}
if Windows
s.files += %w(mycard.exe) + list("ruby")
s.files += %w(fonts ruby mycard.exe)
else
s.files += %w(install.sh)
s.files += %w(mycard.sh)
s.platform = Gem::Platform::CURRENT
end
s.require_path = "lib"
#s.bindir = "bin"
......@@ -48,7 +49,7 @@ Gem::PackageTask.new(spec) do |p|
"#{package_name}-win32.7z"
end
else
p.need_tar = true
p.need_tar_gz = true
end
end
......
#!/bin/sh
base=$(cd "$(dirname "$0")"; pwd)
echo "#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Mycard
Name[zh_CN]=Mycard - 萌卡
Comment=a card game platform
Comment[zh_CN]=卡片游戏对战客户端
Exec=/usr/bin/env ruby -KU lib/main.rb %u
Terminal=false
Icon=$base/graphics/system/icon.png
Type=Application
Categories=Game
Path=$base
URL=http://my-card.in/
MimeType=x-scheme-handler/mycard;application/x-ygopro-deck;application/x-ygopro-replay" > ~/.local/share/applications/mycard.desktop
echo '<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-ygopro-deck">
<comment>ygopro deck</comment>
<icon name="application-x-ygopro-deck"/>
<glob-deleteall/>
<glob pattern="*.ydk"/>
</mime-type>
</mime-info>' > ~/.local/share/mime/packages/application-x-ygopro-deck.xml
echo '<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-ygopro-replay">
<comment>ygopro replay</comment>
<icon name="application-x-ygopro-replay"/>
<glob-deleteall/>
<glob pattern="*.yrp"/>
</mime-type>
</mime-info>' > ~/.local/share/mime/packages/application-x-ygopro-replay.xml
xdg-mime default mycard.desktop application/x-ygopro-deck application/x-ygopro-replay x-scheme-handler/mycard
xdg-icon-resource install --context mimetypes --size 256 $base/graphics/system/icon.png application/x-ygopro-deck
xdg-icon-resource install --context mimetypes --size 256 $base/graphics/system/icon.png application/x-ygopro-replay
update-mime-database ~/.local/share/mime
update-desktop-database
......@@ -109,7 +109,8 @@ EOF
if need?
if Windows
request do
register rescue Dialog.uac("ruby/bin/rubyw.exe", "-KU lib/main.rb register_association")
require 'rbconfig'
register rescue Dialog.uac(File.join(RbConfig::CONFIG["bindir"],RbConfig::CONFIG["RUBY_INSTALL_NAME"] + RbConfig::CONFIG["EXEEXT"]), "-KU lib/main.rb register_association")
end
else
register
......
......@@ -2,6 +2,7 @@
begin
Windows = RUBY_PLATFORM["win"] || RUBY_PLATFORM["ming"]
Font = Windows ? File.expand_path('fonts/wqy-microhei.ttc') : '/usr/share/fonts/wqy-microhei/wqy-microhei.ttc'
#System_Encoding = Windows ? "CP#{`chcp`.scan(/\d+$/)}" : `locale |grep LANG |awk -F '=' '{print $2}'`
Dir.glob('post_update_*.rb').sort.each { |file| load file }
......@@ -91,7 +92,6 @@ begin
WM::icon = Surface.load("graphics/system/icon.gif")
$screen = Screen.open($config['screen']['width'], $config['screen']['height'], 0, HWSURFACE | ($config['screen']['fullscreen'] ? FULLSCREEN : 0))
TTF.init
#声音
begin
SDL.init(INIT_AUDIO)
......
......@@ -21,7 +21,7 @@ class Scene
@background = nil
@windows = []
@active_window = nil
@font = TTF.open('fonts/wqy-microhei.ttc', 16)
@font = TTF.open(Font, 16)
end
def main
start
......
......@@ -28,7 +28,8 @@ module Update
end
end
if @updated
IO.popen('./mycard')
require 'rbconfig'
IO.popen(File.join(RbConfig::CONFIG["bindir"],RbConfig::CONFIG[Windows ? "RUBYW_INSTALL_NAME" : "RUBY_INSTALL_NAME"] + RbConfig::CONFIG["EXEEXT"]) + " -KU lib/main.rb")
$scene = nil
end
@images = []
......@@ -57,7 +58,11 @@ module Update
end rescue $log.error('检查更新') { '检查更新失败' }
if @updated
require_relative 'widget_msgbox'
Widget_Msgbox.new('mycard', '下载更新完毕,点击确定重新运行mycard并安装更新', :ok => "确定") { IO.popen('./mycard'); $scene = nil }
Widget_Msgbox.new('mycard', '下载更新完毕,点击确定重新运行mycard并安装更新', :ok => "确定") {
require 'rbconfig'
IO.popen(File.join(RbConfig::CONFIG["bindir"],RbConfig::CONFIG[Windows ? "RUBYW_INSTALL_NAME" : "RUBY_INSTALL_NAME"] + RbConfig::CONFIG["EXEEXT"]) + " -KU lib/main.rb")
$scene = nil
}
end
if File.file? "ygocore/cards.cdb"
require 'sqlite3'
......
......@@ -10,7 +10,7 @@ class Widget_Checkbox < Window
@text = text
@checked = checked
@checkbox = Surface.load('graphics/system/checkbox.png').display_format
@font = TTF.open("fonts/wqy-microhei.ttc", 20)
@font = TTF.open(Font, 20)
@proc = proc
refresh
end
......
......@@ -170,7 +170,7 @@ class Widget_InputBox < Window
def initialize(x, y, width, height, z=300, &proc)
super(x, y, width, height, z)
@font = TTF.open("fonts/wqy-microhei.ttc", 20)
@font = TTF.open(Font, 20)
@proc = proc
@value = ""
@type = :text
......
......@@ -16,7 +16,7 @@ class Widget_Msgbox < Window
#@background = Surface.load 'graphics/system/msgbox.png'
@contents = Surface.load('graphics/system/msgbox.png').display_format
@button = Surface.load('graphics/system/button.png')
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
super((1024-@contents.w)/2, 230, @contents.w, @contents.h,500)
set(title, message, buttons, &proc)
end
......
......@@ -12,7 +12,7 @@ class Window_Action < Window_List
@up.set_alpha(RLEACCEL,255)
@middle.set_alpha(RLEACCEL,255)
@down.set_alpha(RLEACCEL,255)
@font = TTF.open('fonts/wqy-microhei.ttc', 16)
@font = TTF.open(Font, 16)
@visible = false
end
def items=(items)
......
......@@ -5,10 +5,10 @@ class Window_Announcements < Window
@count = 0
@items = $config[$config['game']]['announcements']
@last_item = @item = @items.first
@font = TTF.open("fonts/wqy-microhei.ttc", 18)
@font = TTF.open(Font, 18)
@color = [44,64,78]
@time_color = [0x66, 0x66, 0x66]
@time_font = TTF.open("fonts/wqy-microhei.ttc", 14)
@time_font = TTF.open(Font, 14)
@transforming = nil
refresh
end
......
......@@ -3,7 +3,7 @@ class Window_BGM < Window
WLH=20
def initialize(bgm_name)
@bgm_name = bgm_name
@font = TTF.open("fonts/wqy-microhei.ttc", 18)
@font = TTF.open(Font, 18)
width = @font.text_size("♪#{@bgm_name}")[0]
@count = 0
@contents = @font.render_blended_utf8("♪#{@bgm_name}" , 255,255,255)
......
......@@ -2,7 +2,7 @@ class Window_CardInfo < Window
WLH = 20
def initialize(x,y)
super(x,y,1024-x,524,300)
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
tip = Card.new('name' => :mycard, 'number' => :"000000", 'lore' => "iDuel部分仅实现了观战,无法进行决斗\n\n提示:\n快捷键:\nF10 退出房间\nF12 返回主界面", 'card_type' => :"通常魔法", 'stats' => "", 'archettypes' => "", "mediums" => "", "tokens" => 0)
tip.instance_eval { @image = Card::CardBack; @image_small = Card::CardBack_Small }
self.card = Game_Card.new tip
......
......@@ -33,7 +33,7 @@ class Window_Chat < Window_Scrollable
end
end
@chat_input.refresh
@font = TTF.open("fonts/wqy-microhei.ttc", 14)
@font = TTF.open(Font, 14)
@scrollbar = Widget_ScrollBar.new(self,@x+@width-20-8,@y+31+3,@height-68)
@page_size = (@height-68)/WLH
@@list ||= {}
......
......@@ -6,7 +6,7 @@ class Window_Config < Window
@button = Surface.load('graphics/system/button.png')
@background = Surface.load('graphics/config/background.png').display_format
@contents = Surface.load('graphics/config/background.png').display_format
@font = TTF.open('fonts/wqy-microhei.ttc', 20)
@font = TTF.open(Font, 20)
@index = nil
@items = {
......
......@@ -19,7 +19,7 @@ class Window_Deck < Window
@buttons_pos[button[0]] = [(space+@button.w/3)*index+space, button_y, @button.w/3, @button.h]
end
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
@title_color = [0xFF, 0xFF, 0xFF]
@color = [0x04, 0x47, 0x7c]
refresh
......
......@@ -26,7 +26,7 @@ class Window_Field < Window
super(x,y,714,282)
@field = field
@player = player
@font = TTF.open('fonts/wqy-microhei.ttc', 12)
@font = TTF.open(Font, 12)
@items = {}
@cards = {}
refresh
......
......@@ -3,7 +3,7 @@ class Window_Filter < Window
def initialize(x,y)
@background = Surface.load('graphics/lobby/filter.png').display_format
super(x,y, @background.w, @background.h)
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
@color = [0x04, 0x47, 0x7c]
@title_color = [0xFF, 0xFF, 0xFF]
......
class Window_GameSelect < Window_List
WLH = 56
def initialize(x,y)
@font = TTF.open("fonts/wqy-microhei.ttc", 24)
@font = TTF.open(Font, 24)
@color = [255,255,255]
@game_color = [47,156,192]
@game_stroke_color = [0xFF,0xFF,0xFF]
......
......@@ -6,7 +6,7 @@ class Window_Host < Window
@buttons = {:ok => "确定", :cancel => "取消"}
@background = Surface.load('graphics/lobby/host.png').display_format
super((1024-@background.w)/2, 230, @background.w, @background.h)
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
@title_color = [0xFF, 0xFF, 0xFF]
@color = [0x04, 0x47, 0x7c]
@roomname_inputbox = Widget_InputBox.new(@x+96, @y+41, 165, WLH)
......
......@@ -7,7 +7,7 @@ class Window_Join < Window
@buttons = {:ok => "确定", :cancel => "取消"}
@background = Surface.load('graphics/system/msgbox.png').display_format
super((1024-@background.w)/2, 230, @background.w, @background.h)
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
@title_color = [0xFF, 0xFF, 0xFF]
@color = [0x04, 0x47, 0x7c]
@password_inputbox = Widget_InputBox.new(@x+96, @y+41, 165, WLH) do |key|
......
......@@ -4,7 +4,7 @@ class Window_LobbyButtons < Window_List
@items = [I18n.t('lobby.faq'), I18n.t('lobby.filter'), I18n.t('lobby.editdeck'), I18n.t('lobby.newroom'), I18n.t('lobby.match')]
@button = Surface.load("graphics/lobby/button.png")
super(x, y, @items.size*@button.w/3+@items.size*4, 30)
@font = TTF.open("fonts/wqy-microhei.ttc", 15)
@font = TTF.open(Font, 15)
refresh
end
......
......@@ -34,8 +34,8 @@ class Window_Login < Window
@password && !@password.empty? ? @password_inputbox.value = @password : @password_inputbox.refresh
@color = [255,255,255]
@color_stroke = [0,0,0]
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font_button = TTF.open("fonts/wqy-microhei.ttc", 18)
@font = TTF.open(Font, 16)
@font_button = TTF.open(Font, 18)
#@font.draw_blended_utf8(@contents, text, 105,80, *@game_color)
@items = {
#:username => [192,80,165,WLH],
......
......@@ -3,7 +3,7 @@ class Window_LP < Window
def initialize(x,y,player,position=true) #true:左 false:右
super(x,y,355,48)
@position = position
@font = TTF.open("fonts/wqy-microhei.ttc", 20)
@font = TTF.open(Font, 20)
@color = [255,255,255]
self.player = player
end
......
......@@ -16,7 +16,7 @@ class Window_RoomList < Window_Scrollable
#@contents = Surface.load 'graphics/lobby/roomitems.png'
super(x,y,@button.w / 3, ($config['screen']['height'] - 288) / 48 * 48)
@item_max = 0
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
@color = [0x03, 0x11, 0x22]
@scrollbar = Widget_ScrollBar.new(self,@x+@width,@y,@height)
self.items = items
......
......@@ -3,7 +3,7 @@ class Window_User < Window_List
def initialize(x, y, user)
@background = Surface.load("graphics/lobby/user.png").display_format
super(x,y,@background.w,@background.h, 300)
@font = TTF.open('fonts/wqy-microhei.ttc', 16)
@font = TTF.open(Font, 16)
@user = user
@contents = Surface.load("graphics/lobby/user.png").display_format #TODO:调用已经加载了的背景
@close = Surface.load("graphics/lobby/userclose.png")
......
......@@ -9,7 +9,7 @@ class Window_UserInfo < Window
def initialize(x, y, user)
@avatar_boarder = Surface.load("graphics/lobby/avatar_boader.png")
super(x,y,280,144)
@font = TTF.open('fonts/wqy-microhei.ttc', 16)
@font = TTF.open(Font, 16)
@user = user
@background = Surface.load("graphics/lobby/userinfo.png").display_format
refresh
......
......@@ -12,7 +12,7 @@ class Window_UserList < Window_Scrollable
#@contents = Surface.load "graphics/lobby/useritems.png"
#@background = Surface.load "graphics/lobby/useritems.png"
super(x,y,272,$config['screen']['height'] - 220)
@font = TTF.open("fonts/wqy-microhei.ttc", 16)
@font = TTF.open(Font, 16)
@color = [0x03, 0x11, 0x22]
@color_friend = [0, 128, 0]
@color_over = [200,200,255]
......
......@@ -313,10 +313,10 @@ class Ygocore < Game
end
font, size = system_conf['textfont'].split(' ')
if !File.file?(font) or size.to_i.to_s != size
system_conf['textfont'] = '../fonts/wqy_microhei.ttc 14'
system_conf['textfont'] = Font + ' 14'
end
if !File.file?(system_conf['numfont'])
system_conf['textfont'] = Windows ? '../fonts/wqy_microhei.ttc 14' : '/usr/share/fonts/gnu-free/FreeSansBold.ttf'
system_conf['textfont'] = Windows ? 'c:/windows/fonts/arialbd.ttf' : '/usr/share/fonts/gnu-free/FreeSansBold.ttf'
end
system_conf['lastip'] = room.server.ip
system_conf['lastport'] = room.server.port.to_s
......
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