Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit

Permalink
house ui scrollbar
Browse files Browse the repository at this point in the history
  • Loading branch information
kth1888 committed Jan 25, 2024
1 parent b33e549 commit 991e3ef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
16 changes: 11 additions & 5 deletions frontend/Savor-22b/scenes/select_house.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,23 @@ theme_override_constants/margin_bottom = 20
layout_mode = 2
color = Color(0, 0, 0, 1)

[node name="HomeGridContainer" type="GridContainer" parent="MarginContainer/Background"]
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/Background"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 50.0
offset_top = 50.0
offset_right = -50.0
offset_bottom = -50.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 50
theme_override_constants/margin_top = 50
theme_override_constants/margin_right = 50
theme_override_constants/margin_bottom = 50

[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/Background/MarginContainer"]
layout_mode = 2

[node name="HomeGridContainer" type="GridContainer" parent="MarginContainer/Background/MarginContainer/ScrollContainer"]
layout_mode = 2
theme_override_constants/h_separation = 100
theme_override_constants/v_separation = 50
columns = 5
Expand Down
1 change: 1 addition & 0 deletions frontend/Savor-22b/scripts/global/scene_context.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var user_state: Dictionary

var selected_house_index := 0
var selected_village_capacity := 0
var selected_village_width := 0

#func _ready():
#var json = JSON.new()
Expand Down
9 changes: 5 additions & 4 deletions frontend/Savor-22b/scripts/scenes/select_house.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ const SELECT_HOUSE_BUTTON = preload("res://ui/house_slot_button.tscn")
const SLOT_IS_FULL = preload("res://ui/notice_popup.tscn")

@onready var noticepopup = $MarginContainer/Background/Noticepopup
@onready var gridcontainer = $MarginContainer/Background/HomeGridContainer
@onready var gridcontainer = $MarginContainer/Background/MarginContainer/ScrollContainer/HomeGridContainer

var houses = []

func _ready():
print("select_house scene ready")
#var size = SceneContext.selected_village_capacity
var size = SceneContext.selected_village_capacity
testinput()

var size = 12
gridcontainer.columns = SceneContext.selected_village_width


for i in range(size):
var house = {"x" : size, "y" : 0, "owner" : "none"}
var house = {"x" : i, "y" : 0, "owner" : "none"}
houses.append(house)
var button = SELECT_HOUSE_BUTTON.instantiate()
button.set_house(house)
Expand Down
1 change: 1 addition & 0 deletions frontend/Savor-22b/scripts/scenes/select_village.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ func _on_start_button_button_down():
var village = SceneContext.get_selected_village()
var capacity = village["height"] * village["width"]
SceneContext.selected_village_capacity = capacity
SceneContext.selected_village_width = village["width"]

get_tree().change_scene_to_file("res://scenes/select_house.tscn")

0 comments on commit 991e3ef

Please sign in to comment.