sscharter 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sscharter/chart.rb +3 -1
- data/lib/sscharter/cli.rb +4 -3
- data/lib/sscharter/version.rb +1 -1
- data/lib/sscharter.rb +19 -5
- data/tutorial/tutorial.md +36 -23
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a943768e6ccb1b3d49ea613906e43cb2f67754163452b40ddca1a2bc79931ed
|
4
|
+
data.tar.gz: d2d6e47744b310cf86dca899136d26a7ed36b6322a663354be26b06c81de573e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9895ab04396393eee863bb0cb8af4631e27af7c7c7f1b154dcac4da796a691dcaf35cba80ece174b1cda9332f245c8a7ad4ac23c8159888fb29cd677d52f802
|
7
|
+
data.tar.gz: 2104bc67acc80130c885388b495f89fd3ce3c23d75a82d2f82d8829f51f47e669c5ef1541616b82fb987eede8f5a39b52484ef6e12d9764371a1d815f6447fe8
|
data/Gemfile.lock
CHANGED
data/lib/sscharter/chart.rb
CHANGED
@@ -7,7 +7,7 @@ class Sunniesnow::Chart
|
|
7
7
|
using Sunniesnow::Utils
|
8
8
|
|
9
9
|
attr_accessor :title, :artist, :charter
|
10
|
-
attr_accessor :difficulty_name, :difficulty_color, :difficulty
|
10
|
+
attr_accessor :difficulty_name, :difficulty_color, :difficulty, :difficulty_sup
|
11
11
|
attr_reader :events
|
12
12
|
|
13
13
|
def initialize
|
@@ -17,6 +17,7 @@ class Sunniesnow::Chart
|
|
17
17
|
@difficulty_name = ''
|
18
18
|
@difficulty_color = '#000000'
|
19
19
|
@difficulty = ''
|
20
|
+
@difficulty_sup = ''
|
20
21
|
@events = []
|
21
22
|
end
|
22
23
|
|
@@ -28,6 +29,7 @@ class Sunniesnow::Chart
|
|
28
29
|
difficultyName: @difficulty_name,
|
29
30
|
difficultyColor: @difficulty_color,
|
30
31
|
difficulty: @difficulty,
|
32
|
+
difficultySup: @difficulty_sup,
|
31
33
|
events: @events
|
32
34
|
}.to_json
|
33
35
|
end
|
data/lib/sscharter/cli.rb
CHANGED
@@ -176,10 +176,11 @@ module Sunniesnow::Charter::CLI
|
|
176
176
|
port = port.to_i
|
177
177
|
config = self.config
|
178
178
|
server = WEBrick::HTTPServer.new Port: port, DocumentRoot: config[:build_dir]
|
179
|
-
server.
|
180
|
-
|
179
|
+
def server.service request, response
|
180
|
+
super
|
181
181
|
response['Access-Control-Allow-Origin'] = '*'
|
182
|
-
response
|
182
|
+
response['Cache-Control'] = 'no-cache'
|
183
|
+
response['Content-Type'] = 'application/zip' if request.path.end_with? '.ssc'
|
183
184
|
end
|
184
185
|
url = CGI.escape "http://localhost:#{port}/#{config[:project_name]}.ssc"
|
185
186
|
filewatcher = Filewatcher.new [config[:files_dir], config[:sources_dir], *config[:include]]
|
data/lib/sscharter/version.rb
CHANGED
data/lib/sscharter.rb
CHANGED
@@ -363,6 +363,10 @@ class Sunniesnow::Charter
|
|
363
363
|
@difficulty = difficulty.to_s
|
364
364
|
end
|
365
365
|
|
366
|
+
def difficulty_sup difficulty_sup
|
367
|
+
@difficulty_sup = difficulty_sup.to_s
|
368
|
+
end
|
369
|
+
|
366
370
|
def offset offset
|
367
371
|
raise ArgumentError, 'offset must be a number' unless offset.is_a? Numeric
|
368
372
|
@current_offset = offset.to_f
|
@@ -496,16 +500,17 @@ class Sunniesnow::Charter
|
|
496
500
|
events.each { transform.apply _1 }
|
497
501
|
end
|
498
502
|
|
499
|
-
def duplicate events
|
503
|
+
def duplicate events, new_tip_points: true
|
500
504
|
result = []
|
501
505
|
events.each do |event|
|
506
|
+
next if event.type == :placeholder && !new_tip_points
|
502
507
|
result.push event = event.dup
|
503
|
-
if event[:tip_point]
|
508
|
+
if event[:tip_point] && new_tip_points
|
504
509
|
event[:tip_point] = "#@current_duplicate #{event[:tip_point]}"
|
505
510
|
end
|
506
511
|
@groups.each { _1.push event }
|
507
512
|
end
|
508
|
-
@current_duplicate += 1
|
513
|
+
@current_duplicate += 1 if new_tip_points
|
509
514
|
result
|
510
515
|
end
|
511
516
|
|
@@ -556,7 +561,15 @@ class Sunniesnow::Charter
|
|
556
561
|
end
|
557
562
|
alias f flick
|
558
563
|
|
559
|
-
def bg_note x, y, duration_beats = 0, text =
|
564
|
+
def bg_note x, y, duration_beats = 0, text = nil
|
565
|
+
if text.nil?
|
566
|
+
if duration_beats.is_a? String
|
567
|
+
text = duration_beats
|
568
|
+
duration_beats = 0
|
569
|
+
else
|
570
|
+
text = ''
|
571
|
+
end
|
572
|
+
end
|
560
573
|
if !x.is_a?(Numeric) || !y.is_a?(Numeric) || !duration_beats.is_a?(Numeric)
|
561
574
|
raise ArgumentError, 'x, y, and duration_beats must be numbers'
|
562
575
|
end
|
@@ -582,7 +595,7 @@ class Sunniesnow::Charter
|
|
582
595
|
event :big_text, duration_beats.to_r, text: text.to_s
|
583
596
|
end
|
584
597
|
|
585
|
-
%i[grid hexagon checkerboard diamond_grid pentagon turntable].each do |method_name|
|
598
|
+
%i[grid hexagon checkerboard diamond_grid pentagon turntable hexagram].each do |method_name|
|
586
599
|
define_method method_name do |duration_beats = 0|
|
587
600
|
unless duration_beats.is_a? Numeric
|
588
601
|
raise ArgumentError, 'duration_beats must be a number'
|
@@ -605,6 +618,7 @@ class Sunniesnow::Charter
|
|
605
618
|
result.difficulty_name = @difficulty_name
|
606
619
|
result.difficulty_color = @difficulty_color
|
607
620
|
result.difficulty = @difficulty
|
621
|
+
result.difficulty_sup = @difficulty_sup
|
608
622
|
@events.each { result.events.push _1.to_sunniesnow }
|
609
623
|
result
|
610
624
|
end
|
data/tutorial/tutorial.md
CHANGED
@@ -563,6 +563,7 @@ There are totally 7 different kinds of background patterns:
|
|
563
563
|
| diamond grid | `diamond_grid duration_beats=0` |
|
564
564
|
| pentagon | `pentagon duration_beats=0` |
|
565
565
|
| turntable | `turntable duration_beats=0` |
|
566
|
+
| hexagram | `hexagram duration_beats=0` |
|
566
567
|
|
567
568
|
Most of them only has one optional argument, specifying the duration.
|
568
569
|
The big text is different in that it needs an additional required argument,
|
@@ -669,13 +670,14 @@ The transformation is done like this:
|
|
669
670
|
> y'=\mathtt{yx}\cdot x+\mathtt{yy}\cdot y.
|
670
671
|
> ```
|
671
672
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
673
|
+
> [!NOTE]
|
674
|
+
> When doing spatial transformations,
|
675
|
+
> you do not need to worry about the direction of flick notes.
|
676
|
+
> They are taken care of as well.
|
677
|
+
>
|
678
|
+
> For background patterns,
|
679
|
+
> they are ignored when doing spatial transformations.
|
680
|
+
> They are still affected by temporal transformations, though.
|
679
681
|
|
680
682
|
Therefore, you can also apply, say, a horizontal flip on the duplicated notes like this:
|
681
683
|
|
@@ -789,9 +791,10 @@ end
|
|
789
791
|
|
790
792
|
### BPM changes
|
791
793
|
|
792
|
-
|
793
|
-
|
794
|
-
|
794
|
+
> [!NOTE]
|
795
|
+
> Because *Big-D* does not have BPM changes,
|
796
|
+
> this part of the tutorial will not be used in the actual chart of *Big-D*.
|
797
|
+
> You may still try it out, though.
|
795
798
|
|
796
799
|
You can use `bpm` to set the BPM starting at the current beat.
|
797
800
|
|
@@ -918,7 +921,7 @@ For example, in the expression
|
|
918
921
|
> ```
|
919
922
|
>
|
920
923
|
> the argument `speed:` is a keyword argument in the call of `tp_chain`.
|
921
|
-
The value of the keyword argument is `100`.
|
924
|
+
> The value of the keyword argument is `100`.
|
922
925
|
|
923
926
|
Knowing how to specify the position and time of the spawning of a tip point,
|
924
927
|
then creating tip points is just as easy as filling events in the code block
|
@@ -958,16 +961,16 @@ transform duplicate notes do
|
|
958
961
|
end
|
959
962
|
```
|
960
963
|
|
961
|
-
|
962
|
-
Just like `group`, `tip_point_chain` and `tip_point_drop`
|
963
|
-
may also not preserve beat.
|
964
|
-
You can let them not preserve beat by specifying the keyword argument `preserve_beat: false`:
|
965
|
-
|
966
|
-
```ruby
|
967
|
-
tp_chain 0, 100, speed: 100, preserve_beat: false do
|
968
|
-
|
969
|
-
end
|
970
|
-
```
|
964
|
+
> [!NOTE]
|
965
|
+
> Just like `group`, `tip_point_chain` and `tip_point_drop`
|
966
|
+
> may also not preserve beat.
|
967
|
+
> You can let them not preserve beat by specifying the keyword argument `preserve_beat: false`:
|
968
|
+
>
|
969
|
+
> ```ruby
|
970
|
+
> tp_chain 0, 100, speed: 100, preserve_beat: false do
|
971
|
+
> # notes...
|
972
|
+
> end
|
973
|
+
> ```
|
971
974
|
|
972
975
|
Now, the whole source codes file should look like this:
|
973
976
|
|
@@ -1009,11 +1012,21 @@ You may build the level file and play it on Sunniesnow to see what you have done
|
|
1009
1012
|
|
1010
1013
|

|
1011
1014
|
|
1012
|
-
*Notice*:
|
1013
1015
|
When duplicating tip-pointed events,
|
1014
1016
|
the duplicated events are not connected by the same tip point as the original events.
|
1015
1017
|
However, if two original events are connected by the same tip point,
|
1016
1018
|
their duplicates are also connected by the same tip point, too.
|
1019
|
+
If you want the duplicated events to be connected by the same tip point as the original events,
|
1020
|
+
you can add set the keyword argument `new_tip_points:` to `false` in the call of `duplicate`:
|
1021
|
+
|
1022
|
+
```ruby
|
1023
|
+
notes = tp_chain 0, 100, speed: 100 do
|
1024
|
+
# notes...
|
1025
|
+
end
|
1026
|
+
transform duplicate notes, new_tip_points: false do
|
1027
|
+
# transforms...
|
1028
|
+
end
|
1029
|
+
```
|
1017
1030
|
|
1018
1031
|
## Advanced charting techniques
|
1019
1032
|
|
@@ -1027,7 +1040,7 @@ TODO.
|
|
1027
1040
|
|
1028
1041
|
### Tip points and placeholders
|
1029
1042
|
|
1030
|
-
### Multiple offsets
|
1043
|
+
### Multiple offsets and timing tweaking
|
1031
1044
|
|
1032
1045
|
### JSON post-processing
|
1033
1046
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sscharter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ulysses Zhan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.4.
|
138
|
+
rubygems_version: 3.4.22
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: A Ruby DSL for writing Sunniesnow charts
|