-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/add decipher shop #21
Open
sashavdv
wants to merge
5
commits into
main
Choose a base branch
from
feat/add-decipher-shop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
27e0ab2
feat: add decipher shop
99c7599
Merge branch 'main' into feat/add-decipher-shop
7ce9825
Merge branch 'main' into feat/add-decipher-shop
tmttn 068f0f2
Merge branch 'main' into feat/add-decipher-shop
sashavdv 0c93494
Merge branch 'main' into feat/add-decipher-shop
tmttn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://dyx76tn885md3" | ||
path="res://.godot/imported/energy_orb.png-2cbe75b8af4388a02af2b14d7f4c3fa2.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://assets/UI/energy_orb.png" | ||
dest_files=["res://.godot/imported/energy_orb.png-2cbe75b8af4388a02af2b14d7f4c3fa2.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 |
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,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://df58t5bfmj70a" | ||
path="res://.godot/imported/scroll_base.png-693a0b068424563664384c6eb0209196.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://assets/UI/scroll_base.png" | ||
dest_files=["res://.godot/imported/scroll_base.png-693a0b068424563664384c6eb0209196.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 |
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,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://dmvsmadpgt07f" | ||
path="res://.godot/imported/tilemap.png-083a8bbebe37cff77c4a1b9df77bc47f.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://assets/UI/tilemap.png" | ||
dest_files=["res://.godot/imported/tilemap.png-083a8bbebe37cff77c4a1b9df77bc47f.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 |
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,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://b27cwck0oyrc" | ||
path="res://.godot/imported/tilemap_packed.png-42b0b930e1378971414a5562b18c2f23.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://assets/UI/tilemap_packed.png" | ||
dest_files=["res://.godot/imported/tilemap_packed.png-42b0b930e1378971414a5562b18c2f23.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,34 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://d0e0habrx3lmx" | ||
path="res://.godot/imported/scroll_shop.png-6c62852703f1bf6b927ce6a799fdfcdf.ctex" | ||
metadata={ | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://assets/backgrounds/scroll_shop.png" | ||
dest_files=["res://.godot/imported/scroll_shop.png-6c62852703f1bf6b927ce6a799fdfcdf.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 |
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 @@ | ||
shader_type canvas_item; | ||
|
||
uniform vec4 glow_color : source_color = vec4(1.0, 0.85, 0.4, 1.0); // Warm yellow glow | ||
uniform float glow_strength : hint_range(0.0, 1.0) = 0.0; | ||
uniform float outline_width : hint_range(0.0, 10.0) = 1.2; | ||
|
||
void fragment() { | ||
vec4 texture_color = texture(TEXTURE, UV); | ||
|
||
// Calculate outline | ||
float outline = 0.0; | ||
for(float x = -outline_width; x <= outline_width; x++) { | ||
for(float y = -outline_width; y <= outline_width; y++) { | ||
vec2 offset = vec2(x, y) * TEXTURE_PIXEL_SIZE; | ||
if(texture(TEXTURE, UV + offset).a > 0.0) { | ||
outline = 1.0; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
// Only show outline on the edges (where the original texture is transparent) | ||
outline *= (1.0 - texture_color.a); | ||
|
||
// Add glow to the original color | ||
vec4 glow = glow_color * outline * glow_strength; | ||
COLOR = texture_color + glow; | ||
} |
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,52 @@ | ||
[gd_scene load_steps=4 format=3 uid="uid://cndnjigot1as7"] | ||
|
||
[ext_resource type="Script" path="res://scripts/decipher_shop.gd" id="1_10ejr"] | ||
[ext_resource type="Texture2D" uid="uid://d0e0habrx3lmx" path="res://assets/backgrounds/scroll_shop.png" id="1_56d1j"] | ||
[ext_resource type="Script" path="res://scripts/managers/decoder_manager.gd" id="3_bo20c"] | ||
|
||
[node name="DecipherUI" 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_10ejr") | ||
|
||
[node name="ScrollShop" type="Sprite2D" parent="."] | ||
position = Vector2(780, 613) | ||
scale = Vector2(1.89022, 1.49542) | ||
texture = ExtResource("1_56d1j") | ||
|
||
[node name="ScrollContainer" type="ScrollContainer" parent="ScrollShop"] | ||
anchors_preset = 15 | ||
anchor_right = 1.0 | ||
anchor_bottom = 1.0 | ||
offset_left = -370.0 | ||
offset_top = -316.0 | ||
offset_right = -1021.0 | ||
offset_bottom = -464.0 | ||
grow_horizontal = 2 | ||
grow_vertical = 2 | ||
size_flags_horizontal = 3 | ||
horizontal_scroll_mode = 0 | ||
vertical_scroll_mode = 3 | ||
|
||
[node name="GridContainer" type="GridContainer" parent="ScrollShop/ScrollContainer"] | ||
clip_contents = true | ||
layout_mode = 2 | ||
columns = 3 | ||
|
||
[node name="DecipherPointsLabel" type="Label" parent="."] | ||
layout_mode = 1 | ||
anchors_preset = 1 | ||
anchor_left = 1.0 | ||
anchor_right = 1.0 | ||
offset_left = -170.0 | ||
offset_top = 50.0 | ||
offset_right = -111.0 | ||
offset_bottom = 86.0 | ||
grow_horizontal = 0 | ||
|
||
[node name="DecoderManager" type="Node" parent="."] | ||
script = ExtResource("3_bo20c") |
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,85 @@ | ||
extends Control | ||
|
||
# First, move the shop card script to a constant reference | ||
const ShopCardScript = preload("res://scripts/scenes/decipher_shop_card.gd") | ||
|
||
@onready var grid_container = $ScrollShop/ScrollContainer/GridContainer | ||
@onready var scroll_container = $ScrollShop/ScrollContainer | ||
@onready var card_scene = preload("res://scenes/card.tscn") | ||
@onready var points_label = $DecipherPointsLabel | ||
@onready var decoder_manager = $DecoderManager | ||
|
||
# Cards available for deciphering | ||
var available_cards = GameState.current_deck | ||
|
||
var card_size: Vector2 | ||
|
||
func _ready() -> void: | ||
setup_grid_container() | ||
populate_shop_cards() | ||
update_points_display() | ||
|
||
# Connect to decoder manager signals | ||
decoder_manager.points_changed.connect(_on_points_changed) | ||
decoder_manager.aspect_decoded.connect(_on_aspect_decoded) | ||
|
||
func setup_grid_container() -> void: | ||
# Configure grid layout | ||
grid_container.columns = 3 | ||
grid_container.add_theme_constant_override("h_separation", 20) | ||
grid_container.add_theme_constant_override("v_separation", 20) | ||
|
||
# Make GridContainer take full width | ||
grid_container.size_flags_horizontal = Control.SIZE_EXPAND | Control.SIZE_FILL | ||
|
||
# Calculate card sizes based on scroll container width | ||
var available_width = scroll_container.size.x | ||
var card_width = (available_width - (grid_container.columns - 1) * grid_container.get_theme_constant("h_separation")) / grid_container.columns | ||
card_size = Vector2(card_width, card_width * 1.5) | ||
|
||
# Calculate total height needed | ||
var rows = ceil(float(available_cards.size()) / grid_container.columns) | ||
var total_height = (card_size.y * rows) + ((rows - 1) * grid_container.get_theme_constant("v_separation")) | ||
|
||
# Set GridContainer size | ||
grid_container.custom_minimum_size = Vector2(available_width, total_height) | ||
|
||
func populate_shop_cards() -> void: | ||
# Clear existing cards | ||
for child in grid_container.get_children(): | ||
child.queue_free() | ||
|
||
# Add available cards to the shop | ||
for card_path in available_cards: | ||
var card_resource = load(card_path) | ||
if card_resource: | ||
var card_instance = card_scene.instantiate() | ||
|
||
# Set the script before setup | ||
card_instance.set_script(ShopCardScript) | ||
|
||
grid_container.add_child(card_instance) | ||
|
||
# Set the card's custom minimum size | ||
card_instance.custom_minimum_size = card_size - Vector2(-10, -30) | ||
|
||
# Make the card expand to fill its cell | ||
card_instance.size_flags_horizontal = Control.SIZE_SHRINK_CENTER | ||
card_instance.size_flags_vertical = Control.SIZE_SHRINK_CENTER | ||
|
||
# Get decoded aspects for this card from GameState | ||
var decoded_aspects = GameState.decoded_aspects.get(card_path, {}) | ||
|
||
# Set up the card with both resource and decoder manager | ||
if card_instance.has_method("setup_shop_card"): | ||
card_instance.setup_shop_card(card_resource, decoded_aspects, decoder_manager) | ||
|
||
func update_points_display() -> void: | ||
points_label.text = "Decipher Points: " + str(decoder_manager.available_points) | ||
|
||
func _on_points_changed(new_amount: int) -> void: | ||
update_points_display() | ||
|
||
func _on_aspect_decoded(_card_id: String, _aspect: String) -> void: | ||
# Refresh the cards to show updated decode status | ||
populate_shop_cards() |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De decode_ui best ook nog even in de UI folder steken, i.p.v. rechtstreeks in de scripts folder. Ik ben aan het proberen om geen .gd files meer rechtstreeks onder de scripts folder te hebben staan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check