Font Setup
▣ 다운로드
https://drive.google.com/file/d/0B-cKNhJz3SPESW1mZHZqNGJlVUk/view?usp=sharing
▣ 설명
폰트가 없을 시 메세지창이 뜨면서 게임이 종료됩니다.
LIST에 해당 폰트에 이름이랑 .ttf파일이 있으면 (암호화 상태에서도)
Fonts폴더가 생성되고 그 안에 폰트 .ttf파일이 생성됩니다.
+
네코 플레이어에서도
폰트 적용이 가능합니다.
▣ 사용법
Font.setup
▣ 추가하는법
Datas/Fonts폴더 안에 폰트 이름.ttf 파일을 넣고
LIST 해시 변수 사이에
"폰트 이름" => "Fonts/폰트 이름.ttf",
으로 폰트를 추가할 수있습니다.
▣ 사진
▣ 동영상
http://blog.naver.com/unjong_/220769185578
▣ 갱신 날짜
2016.07.22 오후 10:20
▣ 스크립트
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
#============================================================================== # ** Font #------------------------------------------------------------------------------ # * Auhor => UNJONG (unjong_@naver.com) # * Dat => 2016.07.22 # * Syntax => Ruby 1.8.1 (RMXP) #==============================================================================
class Font
# 디폴트 이름 @@default_name = "맑은 고딕"
# 디폴트 크기 @@default_size = 24
# 디폴트 볼드 @@default_bold = false
# 디폴트 이탤릭 @@default_italic = false
# 디폴트 색깔 @@default_color = Color.new(255, 255, 255)
# 목록 LIST = {
"맑은 고딕" => "Fonts/malgun",
"나눔명조" => "Fonts/NanumMyeongjo",
}
# Win32API ShellExecute = Win32API.new("shell32", "ShellExecute", "lppppl", "l")
# 셋업 def self.setup # 네코 neko # 윈도우 window end
# 네코 def self.neko if ENV['OS'] == "Android" route = sprintf("%s/KernysRGSS/", ENV['EXTERNAL_STORAGE']) i = @@default_name.is_a?(Array) ? @@default_name[0] : @@default_name data = Encryption.load_file(LIST[i], ".ttf") if File.exist?(route + "font.ttf") if File.size(route + "font.ttf") == data[0].size return end end Encryption.write_file(route + "font.ttf", data) end end
# 윈도우 def self.window @@default_name.each do |i| unless Font.exist?(i) msgbox(i + " 폰트가 없습니다. 폰트를 설치해주시기 바랍니다.") exit if LIST[i].nil? Encryption.save_file(LIST[i], ".ttf") ShellExecute.call(0, "open", Dir.pwd + "/Fonts", 0, 0, 1) exit end end end end
#============================================================================== # ** Encryption #==============================================================================
module Encryption
# 파일 저장 def self.save_file(filename, extend) return if exist?(filename, extend) data = load_file(filename, extend) return if data.nil? filename << data[1] create_dir(filename) write_file(filename, data[0]) filename end
# 파일 존재 def self.exist?(filename, extend) data = nil extend.each do |i| data = File.exist?(filename + i) if data.is_a?(TrueClass) break end end data end
# 파일 로드 def self.load_file(filename, extend) data = nil extend.each do |i| if data != nil break end begin data = [load_data("Data/" + filename + i), i] rescue nil end end data end
# 파일 쓰기 def self.write_file(filename, data) File.open(filename, "wb") do |f| f.write(data) end end
# 폴더 생성 def self.create_dir(path) path = path.split("/") path.each do |i| if i.include?(".") path.pop end end subpath = "" path.each do |i| subpath << i << "/" unless File.exist?(subpath) Dir.mkdir(subpath) end end subpath end end
#============================================================================== # ** Marshal #==============================================================================
module Marshal
# 셀프 클래스 class << self
# 메소드 별명 alias_method(:mar_load, :load) unless method_defined?(:mar_load)
# 로드 def load(port) mar_load(port) rescue TypeError if port.is_a?(File) port.rewind port.read else port end end end end
#============================================================================== # ** msgbox #==============================================================================
def msgbox(*args) print(args.collect { |arg| arg.to_s }.join("\n")) end unless defined?(msgbox)
#============================================================================== # ** msgbox_p #==============================================================================
def msgbox_p(*args) print(args.collect { |obj| obj.inspect }.join("\n")) end unless defined?(msgbox_p)
|
cs |