This repository has been archived by the owner on Mar 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.rb
65 lines (57 loc) · 1.75 KB
/
main.rb
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
# frozen_string_literal: true
require "io/console"
require_relative "install_object"
require_relative "level_data"
require_relative "calc_score"
require_relative "pack"
require_relative "configure"
require_relative "scale"
require_relative "http_lib"
require_relative "clean"
require_relative "console"
#
# .pedファイルを生成するモジュール。
#
class PSExo
VERSION = "0.1.0"
def start
logo
install_object
level_data
calc_score
pack
configure
cleanup
rescue Interrupt
puts
CPuts.error "中断しました。"
rescue StandardError => e
CPuts.error "エラーが発生しました。"
warn e.full_message
ensure
puts
CPuts.ask "何かキーを押してください。"
$stdin.getch
end
def logo
puts <<~LOGO
#{color_escape 0x00bbd0}== pjsekai-exo ----------------------------------------------------------------\e[m
#{color_escape 0x00afc7}pjsekai-exo / プロセカ風動画作成補助ツール\e[m
Version: #{color_escape 0x0f6ea3}#{VERSION}\e[m
Developed by #{color_escape 0x48b0d5}名無し。(@sevenc-nanashi)\e[m
https://github.com/sevenc-nanashi/pjsekai-exo
#{color_escape 0xff5a91}-------------------------------------------------------------------------------\e[m
LOGO
end
def color_escape(hex)
_, red, green, blue = [hex].pack("L").unpack("C*").reverse
"\e[38;2;#{red};#{green};#{blue}m"
end
def replace_version
File.read("./@main.obj", encoding: "shift_jis").then do |data|
data.gsub!("{{version}}", VERSION)
File.write("./replaced.tmp.obj", data, encoding: "shift_jis")
end
end
end
PSExo.new.start if (__FILE__ == $PROGRAM_NAME) && !defined? Ocra