瀏覽代碼

slight refactor to make things less hardcoded

Ruduki2 5 年之前
父節點
當前提交
f9a90a1430
共有 3 個文件被更改,包括 29 次插入12 次删除
  1. 3 1
      .gitignore
  2. 23 4
      Rakefile
  3. 3 7
      main.tw2

+ 3 - 1
.gitignore

@@ -2,4 +2,6 @@
 /watch.html
 /watch.html
 /release.html
 /release.html
 /*_wrapper.tw2
 /*_wrapper.tw2
-/Gemfile.lock
+/Gemfile.lock
+/story.tw2
+/story_title.tw2

+ 23 - 4
Rakefile

@@ -12,6 +12,8 @@ STORY_TITLE = 'Volleyball'
 STORY_FORMAT = 'SugarCube'
 STORY_FORMAT = 'SugarCube'
 STORY_FORMAT_PATH = "story_formats/sugarcube-2.28.2-for-twine-2.1-local/sugarcube-2"
 STORY_FORMAT_PATH = "story_formats/sugarcube-2.28.2-for-twine-2.1-local/sugarcube-2"
 STORY_FORMAT_VERSION = '2.28.2'
 STORY_FORMAT_VERSION = '2.28.2'
+STORY_RELEASE_TITLE = 'Volleyball Chapter 1 v0.5'
+
 FILES = {
 FILES = {
   '01_intro' => '01 Intro',
   '01_intro' => '01 Intro',
   '02_transform' => '02 Transform',
   '02_transform' => '02 Transform',
@@ -32,16 +34,16 @@ def files
   end
   end
 end
 end
 
 
-task develop: %w(bundle_install storyjs) do
+task develop: %w(bundle_install storyjs story.tw2 story_title.tw2) do
   sh "bundle exec twee2 build '--format=#{STORY_FORMAT_PATH}' main.tw2 develop.html"
   sh "bundle exec twee2 build '--format=#{STORY_FORMAT_PATH}' main.tw2 develop.html"
 end
 end
 
 
-task watch: %w(bundle_install storyjs) do
+task watch: %w(bundle_install storyjs story.tw2 story_title.tw2) do
   sh 'start watch.html'  # FIXME non-windows
   sh 'start watch.html'  # FIXME non-windows
   sh "bundle exec twee2 watch '--format=#{STORY_FORMAT_PATH}'  main.tw2 watch.html"
   sh "bundle exec twee2 watch '--format=#{STORY_FORMAT_PATH}'  main.tw2 watch.html"
 end
 end
 
 
-task release: %w(bundle_install storyjs) do
+task release: %w(bundle_install storyjs story.tw2 story_title.tw2) do
   sh "bundle exec twee2 build '--format=#{STORY_FORMAT_PATH}' main.tw2 release.html"
   sh "bundle exec twee2 build '--format=#{STORY_FORMAT_PATH}' main.tw2 release.html"
 end
 end
 
 
@@ -53,8 +55,24 @@ task :storyjs do
   )
   )
 end
 end
 
 
+file 'story.tw2' do
+  File.open('story.tw2', 'w') do |f|
+    f.puts('::StoryIncludes')
+    files.each do |file|
+      f.puts(file.source_file)
+    end
+  end
+end
+
+file 'story_title.tw2' do
+  File.open('story_title.tw2', 'w') do |f|
+    f.puts('::StoryTitle')
+    f.puts("#{STORY_RELEASE_TITLE}")
+  end
+end
+
 desc 'export sub files to Twine 2'
 desc 'export sub files to Twine 2'
-task export: %w(bundle_install storyjs) do
+task export: %w(bundle_install storyjs story.tw2) do
   files.each do |file|
   files.each do |file|
     IO.write file.wrapper_file, <<~EOF
     IO.write file.wrapper_file, <<~EOF
       ::StoryTitle
       ::StoryTitle
@@ -64,6 +82,7 @@ task export: %w(bundle_install storyjs) do
       @story_start_name = 'Start #{file.long_name}'
       @story_start_name = 'Start #{file.long_name}'
       Twee2::build_config.story_format = '#{STORY_FORMAT}'
       Twee2::build_config.story_format = '#{STORY_FORMAT}'
       Twee2::build_config.story_format_version = '#{STORY_FORMAT_VERSION}'
       Twee2::build_config.story_format_version = '#{STORY_FORMAT_VERSION}'
+      Twee2::build_config.story_ifid = ''
       
       
       ::StoryIncludes
       ::StoryIncludes
       images.tw2
       images.tw2

+ 3 - 7
main.tw2

@@ -1,5 +1,5 @@
-::StoryTitle
-Volleyball Chapter 1 v0.5
+::StoryIncludes
+story_title.tw2
 
 
 ::landing <553,58>
 ::landing <553,58>
 This interactive story contains adult content. Make sure it is lawful in your jurisdiction to consume such content.
 This interactive story contains adult content. Make sure it is lawful in your jurisdiction to consume such content.
@@ -154,11 +154,7 @@ Graphics Used
 images.tw2
 images.tw2
 stylesheet.tw2
 stylesheet.tw2
 storyjs.tw2
 storyjs.tw2
-story/01_intro.tw2
-story/02_transform.tw2
-story/03_custom_girl.tw2
-story/04_money_game.tw2
-story/05_beaches.tw2
+story.tw2
 after.tw2
 after.tw2
 
 
 ::Twee2Settings [twee2]
 ::Twee2Settings [twee2]