-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from not-blond-beard/feat/farm
feat: implement farm #1
- Loading branch information
Showing
9 changed files
with
271 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://vy5r0acj44oh"] | ||
|
||
[ext_resource type="Script" path="res://scripts/scenes/farm.gd" id="1_q2tum"] | ||
|
||
[node name="Farm" type="Control"] | ||
layout_mode = 3 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
script = ExtResource("1_q2tum") | ||
|
||
[node name="ColorRect" type="ColorRect" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
|
||
[node name="MarginContainer" type="MarginContainer" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
theme_override_constants/margin_left = 10 | ||
theme_override_constants/margin_top = 10 | ||
theme_override_constants/margin_right = 10 | ||
theme_override_constants/margin_bottom = 10 | ||
|
||
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer"] | ||
layout_mode = 2 | ||
theme_override_constants/separation = 0 | ||
|
||
[node name="ColorRect" type="ColorRect" parent="MarginContainer/HBoxContainer"] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_stretch_ratio = 0.7 | ||
color = Color(0, 0, 0, 1) | ||
|
||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer/ColorRect"] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
theme_override_constants/margin_left = 10 | ||
theme_override_constants/margin_top = 10 | ||
theme_override_constants/margin_right = 10 | ||
theme_override_constants/margin_bottom = 10 | ||
|
||
[node name="GridContainer" type="GridContainer" parent="MarginContainer/HBoxContainer/ColorRect/MarginContainer"] | ||
layout_mode = 2 | ||
theme_override_constants/h_separation = 10 | ||
theme_override_constants/v_separation = 10 | ||
columns = 2 | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer"] | ||
layout_mode = 2 | ||
size_flags_horizontal = 3 | ||
size_flags_stretch_ratio = 0.3 | ||
|
||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer/VBoxContainer"] | ||
layout_mode = 2 | ||
size_flags_vertical = 3 | ||
theme_override_constants/margin_left = 10 | ||
theme_override_constants/margin_top = 10 | ||
theme_override_constants/margin_right = 10 | ||
theme_override_constants/margin_bottom = 10 | ||
|
||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer/VBoxContainer/MarginContainer"] | ||
layout_mode = 2 | ||
|
||
[node name="HomeButton" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer/MarginContainer/VBoxContainer"] | ||
layout_mode = 2 | ||
size_flags_vertical = 0 | ||
theme_override_font_sizes/font_size = 50 | ||
text = "Home" | ||
|
||
[node name="InventoryButton" type="Button" parent="MarginContainer/HBoxContainer/VBoxContainer/MarginContainer/VBoxContainer"] | ||
layout_mode = 2 | ||
size_flags_vertical = 0 | ||
theme_override_font_sizes/font_size = 50 | ||
text = "Inventory" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,59 @@ | ||
extends Node | ||
|
||
#var villages_json_string := """{ | ||
#"villages": [ | ||
#{ | ||
#"id": 1, | ||
#"name": "평범한 도시 1", | ||
#"width": 3, | ||
#"height": 11, | ||
#"worldX": 5, | ||
#"worldY": 1, | ||
#"houses": [ | ||
#{ | ||
#"x": 1, | ||
#"y": 1, | ||
#"owner": "0x53103C2D7875D2f5f02AeC3075155e268a6e3A94" | ||
#} | ||
#] | ||
#}, | ||
#{ | ||
#"id": 2, | ||
#"name": "외로운 섬", | ||
#"width": 7, | ||
#"height": 13, | ||
#"worldX": -2, | ||
#"worldY": 7, | ||
#"houses": [] | ||
#}, | ||
#{ | ||
#"id": 3, | ||
#"name": "정글", | ||
#"width": 3, | ||
#"height": 5, | ||
#"worldX": 1, | ||
#"worldY": -3, | ||
#"houses": [] | ||
#} | ||
#] | ||
#}""" | ||
var villages: Array | ||
var selected_village_index := 0 | ||
var user_state: Dictionary | ||
|
||
#func _ready(): | ||
#var json = JSON.new() | ||
#var error = json.parse(villages_json_string) | ||
#if error != OK: | ||
#print(error) | ||
#else: | ||
#villages = json.data.villages | ||
|
||
func set_villages(query_data: Dictionary): | ||
villages = query_data.data.villages | ||
|
||
func set_user_state(query_data: Dictionary): | ||
user_state = query_data.data.userState | ||
|
||
func get_selected_village(): | ||
return villages[selected_village_index] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
extends Control | ||
|
||
func _ready(): | ||
print("farm scene ready") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extends ColorRect | ||
|
||
signal button_down(child_index: int) | ||
|
||
@onready var button = $Button | ||
|
||
var farm_slot: Dictionary | ||
|
||
func _ready(): | ||
_update_button() | ||
|
||
func _update_button(): | ||
if button == null: | ||
return | ||
|
||
button.text = """%s %s | ||
(%d %s)""" % [ | ||
"벼", | ||
"자라는 중", | ||
1, | ||
"블록 남음"] | ||
|
||
func set_farm_slot(farm_slot: Dictionary): | ||
self.farm_slot = farm_slot | ||
_update_button() | ||
|
||
func _on_button_button_down(): | ||
button_down.emit(get_index()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://c0qm0ud7mwmwb"] | ||
|
||
[ext_resource type="Script" path="res://ui/farm_slot_button.gd" id="1_vqq1f"] | ||
|
||
[node name="FarmSlotButton" type="ColorRect"] | ||
custom_minimum_size = Vector2(2.08165e-12, 200) | ||
size_flags_horizontal = 3 | ||
size_flags_vertical = 0 | ||
script = ExtResource("1_vqq1f") | ||
|
||
[node name="Button" type="Button" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
theme_override_font_sizes/font_size = 50 | ||
text = "[벼] 자라는 중 | ||
[N 블록 남음]" |