mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2025-05-07 05:02:04 +02:00
Add cli hints to the first three levels
This commit is contained in:
parent
437cbb7a37
commit
7ecc55a3fb
10 changed files with 75 additions and 15 deletions
scenes
|
@ -3,13 +3,13 @@
|
|||
[ext_resource path="res://images/cli-badge.svg" type="Texture" id=1]
|
||||
[ext_resource path="res://scenes/cli_badge.gd" type="Script" id=2]
|
||||
|
||||
[sub_resource type="Curve" id=2]
|
||||
[sub_resource type="Curve" id=1]
|
||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CurveTexture" id=3]
|
||||
curve = SubResource( 2 )
|
||||
[sub_resource type="CurveTexture" id=2]
|
||||
curve = SubResource( 1 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=1]
|
||||
[sub_resource type="ParticlesMaterial" id=3]
|
||||
emission_shape = 2
|
||||
emission_box_extents = Vector3( 20, 20, 1 )
|
||||
flag_disable_z = true
|
||||
|
@ -20,7 +20,7 @@ initial_velocity_random = 0.47
|
|||
orbit_velocity = 0.0
|
||||
orbit_velocity_random = 0.0
|
||||
scale = 7.25
|
||||
scale_curve = SubResource( 3 )
|
||||
scale_curve = SubResource( 2 )
|
||||
color = Color( 0.913725, 0.913725, 0.447059, 1 )
|
||||
|
||||
[node name="CLIBadge" type="TextureRect"]
|
||||
|
@ -42,4 +42,4 @@ position = Vector2( 21.7701, 14.5133 )
|
|||
z_index = 1
|
||||
amount = 3
|
||||
randomness = 0.34
|
||||
process_material = SubResource( 1 )
|
||||
process_material = SubResource( 3 )
|
||||
|
|
|
@ -22,14 +22,25 @@ func load(path):
|
|||
|
||||
title = config.get("title", slug)
|
||||
description = config.get("description", "(no description)")
|
||||
|
||||
# Surround all lines indented with four spaces with [code] tags.
|
||||
var monospace_regex = RegEx.new()
|
||||
monospace_regex.compile("\\n ([^\\n]*)")
|
||||
description = monospace_regex.sub(description, "\n [code]$1[/code]", true)
|
||||
description = monospace_regex.sub(description, "\n [code][color=#e1e160]$1[/color][/code]", true)
|
||||
description = description.split("---")
|
||||
|
||||
var cli_hints = "\n\n[color=#787878]"+config.get("cli", "")+"[/color]"
|
||||
description[0] = description[0] + cli_hints
|
||||
var cli_hints = config.get("cli", "")
|
||||
# Also do this substitution in the CLI hints.
|
||||
cli_hints = monospace_regex.sub(cli_hints, "\n [code][color=#bbbb5d]$1[/color][/code]", true)
|
||||
|
||||
# Also replace `code` with [code] tags.
|
||||
var monospace_inline_regex = RegEx.new()
|
||||
monospace_inline_regex.compile("`([^`]+)`")
|
||||
description[0] = monospace_inline_regex.sub(description[0], "[code][color=#e1e160]$1[/color][/code]")
|
||||
cli_hints = monospace_inline_regex.sub(cli_hints, "[code][color=#bbbb5d]$1[/color][/code]", true)
|
||||
|
||||
if cli_hints != "":
|
||||
description[0] = description[0] + "\n\n[color=#787878]"+cli_hints+"[/color]"
|
||||
|
||||
congrats = config.get("congrats", "Good job, you solved the level!\n\nFeel free to try a few more things or click 'Next level'.")
|
||||
cards = Array(config.get("cards", "").split(" "))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue