Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 一些小 Bug 修复 #61

Merged
merged 4 commits into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions levels/base_level/base_level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ var BaseLevelScn = load("res://levels/base_level/base_level.tscn")

const HEIGHT := 1080 / 4
const WIDTH := 1920 / 4
const SEP := 28
const PADDING := 5
const MARGIN := 12
const CARDS_SEP := 34


const I_NUMBER = ["I","II","III","VI","V"]


var expr := ""
var req_pos := [] # Array[int],金色框的位置列表
Expand All @@ -46,31 +45,30 @@ func init(_chap_id: int, _lvl_id: int) -> void:
var choices = count(LevelData.LEVEL_DATA[chap_id][lvl_id]["choices"].replace(" ", "").replace("X", "*"))


$HUDs/Title.set_text("%s-%d %s" % [I_NUMBER[chap_id], lvl_id + 1, lvl_name])

$HUDs/Title.set_text("%d-%d %s" % [chap_id + 1, lvl_id + 1, lvl_name])


question = question.replace("[]", ".")
question = question.replace("{}", "_")


var table_cloth = TableClothScn.instantiate()
var sep := SEP
var padding: int

if len(question) >= 16:
sep = SEP
padding = 0
else:
sep = int((1 - len(question) / 16.0) * SEP * 0.3) + SEP
padding = int((1 - len(question) / 16.0) * 6 + 0.5) / 2 * 2

table_cloth.size.x = sep * len(question) + 16 + 4
table_cloth.size.x = MARGIN * 2 + 28 * len(question) + padding * (len(question) - 1)
table_cloth.size.y = 48
table_cloth.get_child(0).size.x = sep * len(question) + 16 + 4
table_cloth.get_child(0).size.x = MARGIN * 2 + 28 * len(question) + padding * (len(question) - 1)
table_cloth.get_child(0).size.y = 48
table_cloth.position.x = WIDTH / 2 - sep * len(question) / 2 - 7
table_cloth.position.y = HEIGHT / 2 - 24
table_cloth.position.x = WIDTH / 2 - table_cloth.size.x / 2
table_cloth.position.y = HEIGHT / 2 - table_cloth.size.y / 2
$HUDs.add_child(table_cloth)

var pos := WIDTH / 2 - sep * len(question) / 2 + 12 + 7
var pos: int = table_cloth.position.x + MARGIN + 28 / 2
for i in range(len(question)):
var ch: String = question[i]

Expand All @@ -88,7 +86,7 @@ func init(_chap_id: int, _lvl_id: int) -> void:
else:
new_block.set_is_golden_frame(false)
new_block.set_position(Vector2(pos, HEIGHT / 2))
pos += sep
pos += 28 + padding

$Blocks.add_child(new_block)

Expand All @@ -97,8 +95,7 @@ func init(_chap_id: int, _lvl_id: int) -> void:
expr = question
# print(expr)


pos = WIDTH / 2 - CARDS_SEP * len(choices) / 2 + 16
pos = WIDTH / 2 - CARDS_SEP * (len(choices) - 1) / 2
for ch in choices:
var new_card_base: CardBase = CardBaseScn.instantiate()

Expand Down
2 changes: 1 addition & 1 deletion levels/base_level/next_level_button/next_level_button.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ wait_time = 0.3
one_shot = true

[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." index="3"]
position = Vector2(20, 21)
position = Vector2(17, 17)
sprite_frames = SubResource("SpriteFrames_r0kjg")
autoplay = "default"
2 changes: 1 addition & 1 deletion scripts/expr_validator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static func get_char_type(ch: String) -> CharType:
return CharType.VAR
else:
push_error("get_char_type(%s) is undefined" % ch)
return -1
return CharType.CONST


## 获取值等于 [param value] 的 [enum CharType] 名称。
Expand Down
Loading