Skip to content

Commit

Permalink
将章节号修改为罗马数字
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunnycxk authored and ligen131 committed Jan 27, 2024
1 parent 45eb5a4 commit 5dfcd15
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion levels/base_level/base_level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var req_pos = [] # Array[int]
var chap_id : int
var lvl_id : int

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

const DATA := [
[
Expand Down Expand Up @@ -70,7 +71,7 @@ func init(_chap_id: int, _lvl_id: int) -> void:
var choices = count(DATA[chap_id][lvl_id][2].replace(" ", "").replace("X", "*"))


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



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func init(chapter_id: int, level_id : int, pos : Vector2, type : int) -> void :

var txt
if type == 0:
txt = str(chapter_id + 1)
txt = "I" + str(chapter_id + 1)
else:
txt = str(level_id + 1)
set_word(txt)
Expand Down
4 changes: 2 additions & 2 deletions levels/chapter_menu/level_menu/level_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extends Node2D

const CHAP_NAMES = ["=P", "Add", "Multiply", "()", "Equal?"]


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

const LevelButton := preload("res://levels/chapter_menu/level_menu/level_button/level_button.tscn")
const BaseLevel := preload("res://levels/base_level/base_level.tscn")
Expand All @@ -21,7 +21,7 @@ func init(chap_id : int, lvl_num : int) -> void:
if lvl_num == -1:
lvl_num = len(BaseLevel.instantiate().DATA[chap_id])

$Title.set_text("Ch." + str(chap_id + 1) + " " + CHAP_NAMES[chap_id])
$Title.set_text("Ch." + I_NUMBER[chap_id] + " " + CHAP_NAMES[chap_id])

chapter_id = chap_id
for level_id in range(0, lvl_num):
Expand Down
13 changes: 10 additions & 3 deletions objects/main_menu/main_menu.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends AnimatedSprite2D

var ChapterMenu = preload("res://levels/chapter_menu/chapter_menu.tscn")

const ChapterMenu = preload("res://levels/chapter_menu/chapter_menu.tscn")
const BaseLevel := preload("res://levels/base_level/base_level.tscn")
# Called when the node enters the scene tree for the first time.
func _ready():
$start_button/AnimatedSprite2D.play()
Expand All @@ -18,5 +18,12 @@ func _on_animation_finished():


func _on_start_button_pressed():
get_tree().root.add_child(ChapterMenu.instantiate())
var base_level := BaseLevel.instantiate()

# print(chap_id, lvl_id)

base_level.init(0, 0)
get_tree().root.add_child(base_level)
queue_free()
#get_tree().root.add_child(ChapterMenu.instantiate())
#queue_free()

0 comments on commit 5dfcd15

Please sign in to comment.