This repository was archived by the owner on Feb 7, 2025. It is now read-only.
-
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.
- Loading branch information
Showing
10 changed files
with
130 additions
and
67 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
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,4 +1,46 @@ | ||
extends Control | ||
|
||
const FARM_SLOT_EMPTY = preload("res://ui/farm_slot_empty.tscn") | ||
const FARM_SLOT_OCCUPIED = preload("res://ui/farm_slot_button.tscn") | ||
const FARM_SLOT_DONE = preload("res://ui/farm_slot_done.tscn") | ||
|
||
@onready var leftfarm = $MC/HC/CR/MC/HC/Left | ||
@onready var rightfarm = $MC/HC/CR/MC/HC/Right | ||
|
||
var farms = [] | ||
|
||
func _ready(): | ||
print("farm scene ready") | ||
|
||
print(SceneContext.user_state["villageState"]["houseFieldStates"]) | ||
farms = SceneContext.user_state["villageState"]["houseFieldStates"] | ||
|
||
#create blank slots | ||
for i in range(0,5): | ||
var farm | ||
if (farms[i] == null): | ||
farm = FARM_SLOT_EMPTY.instantiate() | ||
else: | ||
if(farms[i]["isHarvested"]): | ||
farm = FARM_SLOT_DONE.instantiate() | ||
farm.set_farm_slot(farms[i]) | ||
else: | ||
farm = FARM_SLOT_OCCUPIED.instantiate() | ||
farm.set_farm_slot(farms[i]) | ||
|
||
leftfarm.add_child(farm) | ||
|
||
for i in range(5,10): | ||
var farm | ||
if (farms[i] == null): | ||
farm = FARM_SLOT_EMPTY.instantiate() | ||
else: | ||
if(farms[i]["isHarvested"]): | ||
farm = FARM_SLOT_DONE.instantiate() | ||
else: | ||
farm = FARM_SLOT_OCCUPIED.instantiate() | ||
|
||
rightfarm.add_child(farm) | ||
|
||
|
||
|
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
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,26 @@ | ||
extends ColorRect | ||
|
||
signal button_down(child_index: int) | ||
|
||
@onready var button = $V/Button | ||
|
||
var farm_slot: Dictionary | ||
|
||
var format_string = "[%s] %s" | ||
|
||
func _ready(): | ||
_update_button() | ||
|
||
func _update_button(): | ||
if button == null: | ||
return | ||
|
||
button.text = format_string % [farm_slot.seedName, "수확하기"] | ||
|
||
|
||
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