From a2d2714ea79a6fa222a8ee8c6560593fb1eef6b7 Mon Sep 17 00:00:00 2001 From: myin Date: Sun, 27 Aug 2023 17:04:34 +0200 Subject: [PATCH] feat: fix gacha showcase + show collection --- godot/shared/TweenCreator.gd | 51 +++++++++++++ godot/src/StartMenu.gd | 7 ++ godot/src/clip_texture.gdshader | 22 +----- godot/src/electric_bg.gdshader | 41 ----------- godot/src/fade_wave.gdshader | 25 +++++++ godot/src/game_manager.gd | 23 +++--- godot/src/menu/Collection.gd | 25 +++++++ godot/src/menu/Showcase.gd | 32 ++++++++ godot/src/menu/collection.tscn | 49 +++++++++++++ godot/src/menu/overlay.gd | 1 + godot/src/menu/store.gd | 6 -- godot/src/menu/store.tscn | 7 +- godot/src/menu/store/Store.gd | 42 +++-------- godot/src/rainbow.gdshader | 24 ++++++ godot/src/start.tscn | 125 ++++++++++++++++++++++---------- godot/src/stripes.gdshader | 17 ----- 16 files changed, 333 insertions(+), 164 deletions(-) create mode 100644 godot/shared/TweenCreator.gd delete mode 100644 godot/src/electric_bg.gdshader create mode 100644 godot/src/fade_wave.gdshader create mode 100644 godot/src/menu/Collection.gd create mode 100644 godot/src/menu/Showcase.gd create mode 100644 godot/src/menu/collection.tscn delete mode 100644 godot/src/menu/store.gd create mode 100644 godot/src/rainbow.gdshader delete mode 100644 godot/src/stripes.gdshader diff --git a/godot/shared/TweenCreator.gd b/godot/shared/TweenCreator.gd new file mode 100644 index 0000000..94dffc3 --- /dev/null +++ b/godot/shared/TweenCreator.gd @@ -0,0 +1,51 @@ +class_name TweenCreator + +var node: Node +var tw: Tween +var default_duration := 0.5 +var block = true +var trans = Tween.TRANS_CUBIC +var ease = Tween.EASE_IN_OUT + +static func create(n): + return TweenCreator.new(n) + +func _init(n: Node): + node = n + +func new_tween(on_finish = null): + if tw and tw.is_running(): + if block: + return false + else: + tw.kill() + + tw = node.create_tween() + tw.set_parallel() + tw.set_trans(trans) + tw.set_ease(ease) + if on_finish: + tw.finished.connect(on_finish) + return true + +func fade_out(node, duration = default_duration): + return tw.tween_property(node, "modulate", Color.TRANSPARENT, duration).from(Color.WHITE).set_ease(Tween.EASE_IN) + +func fade_in(node, duration = default_duration): + return tw.tween_property(node, "modulate", Color.WHITE, duration).from(Color.TRANSPARENT).set_ease(Tween.EASE_OUT) + +func slide_in(node, dir: Vector2, pos = Vector2.ZERO, dist = node.size, duration = default_duration): + return tw.tween_property(node, "position", pos, duration).from(pos - dir * dist).set_ease(Tween.EASE_OUT) + +func slide_out(node, dir: Vector2, dist = node.size, duration = default_duration): + return tw.tween_property(node, "position", node.position + dir * dist, duration).from(node.position).set_ease(Tween.EASE_IN) + +func scale_in(node, target_scale = Vector2(1, 1), duration = default_duration): + if node is Control: + node.pivot_offset = node.size / 2 + return tw.tween_property(node, "scale", target_scale, duration).from(Vector2.ZERO).set_ease(Tween.EASE_OUT) + +func scale_out(node, init_scale = Vector2(1, 1), duration = default_duration): + if node is Control: + node.pivot_offset = node.size / 2 + return tw.tween_property(node, "scale", Vector2.ZERO, duration).from(init_scale).set_ease(Tween.EASE_IN) diff --git a/godot/src/StartMenu.gd b/godot/src/StartMenu.gd index 44b1da6..56416ec 100644 --- a/godot/src/StartMenu.gd +++ b/godot/src/StartMenu.gd @@ -2,6 +2,7 @@ extends MenuSystem @export var settings: Control @export var store: Control +@export var collection: Control func _ready(): super._ready() @@ -10,9 +11,15 @@ func _ready(): store.hide() store.close.connect(func(): _hide_node(store)) + + collection.hide() + collection.close.connect(func(): _hide_node(collection)) func _on_store_pressed(): _show_node(store) func _on_settings_pressed(): _show_node(settings) + +func _on_collection_pressed(): + _show_node(collection) diff --git a/godot/src/clip_texture.gdshader b/godot/src/clip_texture.gdshader index c4e03a6..34a849d 100644 --- a/godot/src/clip_texture.gdshader +++ b/godot/src/clip_texture.gdshader @@ -4,13 +4,12 @@ uniform sampler2D clip_texture; uniform vec2 clip_texture_size; uniform vec2 clip_texture_offset; -void fragment(){ - COLOR=COLOR; - + +void fragment() { vec2 texture_size = (1.0 / TEXTURE_PIXEL_SIZE); vec2 texture_ratio = texture_size / clip_texture_size; vec2 clip_UV = UV * texture_ratio + clip_texture_offset; - + vec4 color = COLOR; vec4 tex = texture(clip_texture, clip_UV); if (clip_UV.x > 1.0 || clip_UV.x < 0.0 || clip_UV.y > 1.0 || clip_UV.y < 0.0) { @@ -18,20 +17,7 @@ void fragment(){ } float mix_tex = 1.0 - step(color.r, 1.0-tex.a); if (mix_tex == 0.0 && color.b > 0.0) { - mix_tex = 1.0; + mix_tex = color.a; } COLOR=vec4(mix(tex.rgb, color.rgb, mix_tex), color.a); - -// vec4 color; -// if (clip_UV.x > 1.0 || clip_UV.x < 0.0 || clip_UV.y > 1.0 || clip_UV.y < 0.0) { -// color = vec4(0.0, 0.0, 0.0, 0.0); -// } -// else { -// color = texture(clip_texture, clip_UV); -// } -// -// if(color.a == 0.0) -// COLOR=vec4(0.0, 0.0, 0.0, 0.0); -// else -// COLOR=color; } \ No newline at end of file diff --git a/godot/src/electric_bg.gdshader b/godot/src/electric_bg.gdshader deleted file mode 100644 index 53325d5..0000000 --- a/godot/src/electric_bg.gdshader +++ /dev/null @@ -1,41 +0,0 @@ -/* - 動的電子背景シェーダー by あるる(きのもと 結衣) @arlez80 - Procedural Electric Background Shader by Yui Kinomoto @arlez80 - - MIT License -*/ -shader_type canvas_item; - -uniform vec4 background_color : source_color = vec4( 0.0, 0.0, 0.0, 1.0 ); -uniform vec4 line_color : source_color = vec4( 0.0, 1.0, 1.0, 1.0 ); -uniform float line_freq = 9.56; -uniform float height = 0.6; -uniform float speed = 0.8; -uniform vec2 scale = vec2( 2.0, 16.0 ); -uniform float dissolve_amount : hint_range(0.0, 1.0) = 0.5; -uniform sampler2D dissolve_texture; -uniform bool inverted = false; - -void fragment( ) -{ - vec2 uv = UV * scale; - float shift = cos( floor( uv.y ) ); - uv.x += shift; - - float freq = clamp( cos( uv.x * line_freq ) * 3.0, 0.0, 1.0 ) * height; - float line = 1.0 - clamp( abs( freq - mod( uv.y, 1.0 ) ) * 11.0, 0.0, 1.0 ); - - COLOR = mix( background_color, line_color, line * mod( uv.x - TIME * speed * abs( shift ), 1.0) /* * mod( TIME + shift, 1.0 ) */ ); - - if (dissolve_amount < 0.0001 || dissolve_amount > 0.9999) { - COLOR = vec4(COLOR.rgb, dissolve_amount); - } else { - float sample = texture(dissolve_texture, UV).r; - if (inverted) { - sample = 1.0 - sample; - } - COLOR = vec4(COLOR.rgb, smoothstep(0.0, sample, dissolve_amount)); - } - - -} diff --git a/godot/src/fade_wave.gdshader b/godot/src/fade_wave.gdshader new file mode 100644 index 0000000..67bfe16 --- /dev/null +++ b/godot/src/fade_wave.gdshader @@ -0,0 +1,25 @@ +shader_type canvas_item; + +uniform vec2 center = vec2(0.5, 0.5); +uniform float scale: hint_range(0.0, 2.0, 0.01) = 1.0; + +uniform sampler2D mask; + +vec2 scale_uv(vec2 uv, vec2 origin, vec2 scale_factor) +{ + vec2 scaled_coord = uv - origin; + mat2 s = mat2(vec2(scale_factor.x, 0.0), vec2(0.0, scale_factor.y)); + scaled_coord *= s; + scaled_coord += origin; + return scaled_coord; +} + +void fragment() { + vec2 uv = scale_uv(UV, center, vec2(scale, scale)); + vec4 color = texture(mask, uv); + if (uv.x > 1.0 || uv.y > 1.0 || uv.x < 0.0 || uv.y < 0.0) { + color = vec4(0.0); + } + + COLOR=vec4(step(1.0, color.r) * color.a * step(0.0, UV.y)); +} diff --git a/godot/src/game_manager.gd b/godot/src/game_manager.gd index fe3d266..e28e82b 100644 --- a/godot/src/game_manager.gd +++ b/godot/src/game_manager.gd @@ -32,6 +32,7 @@ var default_pieces = [ var unlocked_pieces = [] var selected_pieces = [] +var selected_piece = null func _ready(): _load_game() @@ -39,7 +40,6 @@ func _ready(): if selected_pieces.size() > 0: selected_pieces = [] - if selected_pieces.size() == 0: selected_pieces.append_array(default_pieces) @@ -77,10 +77,11 @@ func back_to_start(): func _save_game(): save_manager.save_to_slot(SAVE_SLOT, { "energy": energy.energy, - "energyUsedTime": energy.get_last_used_time(), + "energy_used_time": energy.get_last_used_time(), "points": points.get_points(), - "unlockedPieces": unlocked_pieces, - "selectedPieces": selected_pieces, + "unlocked_pieces": unlocked_pieces, + "selected_piece": selected_piece, + #"selectedPieces": selected_pieces, }) func _load_game(): @@ -90,11 +91,13 @@ func _load_game(): if "energy" in data: energy.energy = data.energy - if "energyUsedTime" in data: - energy.set_last_used_time(data.energyUsedTime) + if "energy_used_time" in data: + energy.set_last_used_time(data.energy_used_time) if "points" in data: points.set_points(data.points) - if "unlockedPieces" in data: - unlocked_pieces = data.unlockedPieces - if "selectedPieces" in data: - selected_pieces = data.selectedPieces + if "unlocked_pieces" in data: + unlocked_pieces = data.unlocked_pieces + if "selected_piece" in data: + selected_piece = data.selected_piece + #if "selectedPieces" in data: + # selected_pieces = data.selectedPieces diff --git a/godot/src/menu/Collection.gd b/godot/src/menu/Collection.gd new file mode 100644 index 0000000..0ca24fb --- /dev/null +++ b/godot/src/menu/Collection.gd @@ -0,0 +1,25 @@ +extends CenterContainer + +signal close + +@export var grid: GridContainer + +func _ready(): + _update() + visibility_changed.connect(_update) + +func _update(): + for child in grid.get_children(): + grid.remove_child(child) + + for p in Piece.Type.values(): + if p in GameManager.default_pieces: + continue + + var l = Label.new() + l.text = Piece.Type.keys()[p] + l.modulate = Color.WHITE if p in GameManager.unlocked_pieces else Color(0.3, 0.3, 0.3, 1.0) + grid.add_child(l) + +func _on_texture_button_pressed(): + close.emit() diff --git a/godot/src/menu/Showcase.gd b/godot/src/menu/Showcase.gd new file mode 100644 index 0000000..e114c23 --- /dev/null +++ b/godot/src/menu/Showcase.gd @@ -0,0 +1,32 @@ +extends Overlay + +const PIECE_TEX = { + Piece.Type.GURA: preload("res://assets/gacha/Myth_Gura.png") +} + +@export var tex: TextureRect +@export var overlay: ColorRect +@export var shine: ColorRect + +var tw: TweenCreator + +func _ready(): + tw = TweenCreator.create(self) + + hide() + on_hide.connect(func(): + if tw.new_tween(func(): hide()): + tw.fade_out(overlay) + tw.fade_out(shine).set_ease(Tween.EASE_OUT) + tw.scale_out(tex) + ) + +func show_piece(piece): + if tw.new_tween(): + if piece in PIECE_TEX: + tex.texture = PIECE_TEX[piece] + + tw.fade_in(overlay) + tw.fade_in(shine).set_ease(Tween.EASE_IN) + tw.scale_in(tex) + show() diff --git a/godot/src/menu/collection.tscn b/godot/src/menu/collection.tscn new file mode 100644 index 0000000..972016f --- /dev/null +++ b/godot/src/menu/collection.tscn @@ -0,0 +1,49 @@ +[gd_scene load_steps=5 format=3 uid="uid://pgikighgyjyb"] + +[ext_resource type="Script" path="res://src/menu/Collection.gd" id="1_ex6bl"] +[ext_resource type="StyleBox" uid="uid://bd0c76q5d7ocf" path="res://theme/dialog.tres" id="2_6nmk1"] +[ext_resource type="Texture2D" uid="uid://bdotu11c1jmm" path="res://assets/ui/close.svg" id="3_bkctx"] +[ext_resource type="Script" path="res://src/menu/UIButton.gd" id="4_nk2lk"] + +[node name="Collection" type="CenterContainer" node_paths=PackedStringArray("grid")] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_ex6bl") +grid = NodePath("PanelContainer/MarginContainer/GridContainer") + +[node name="PanelContainer" type="PanelContainer" parent="."] +layout_mode = 2 +theme_override_styles/panel = ExtResource("2_6nmk1") + +[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 30 +theme_override_constants/margin_top = 30 +theme_override_constants/margin_right = 30 +theme_override_constants/margin_bottom = 30 + +[node name="GridContainer" type="GridContainer" parent="PanelContainer/MarginContainer"] +layout_mode = 2 +theme_override_constants/h_separation = 30 +theme_override_constants/v_separation = 30 +columns = 5 + +[node name="MarginContainer2" type="MarginContainer" parent="PanelContainer"] +layout_mode = 2 +size_flags_horizontal = 8 +size_flags_vertical = 0 +theme_override_constants/margin_top = -25 +theme_override_constants/margin_right = -25 + +[node name="TextureButton" type="TextureButton" parent="PanelContainer/MarginContainer2"] +custom_minimum_size = Vector2(50, 50) +layout_mode = 2 +texture_normal = ExtResource("3_bkctx") +ignore_texture_size = true +stretch_mode = 5 +script = ExtResource("4_nk2lk") + +[connection signal="pressed" from="PanelContainer/MarginContainer2/TextureButton" to="." method="_on_texture_button_pressed"] diff --git a/godot/src/menu/overlay.gd b/godot/src/menu/overlay.gd index 9e0ad54..56ebdfc 100644 --- a/godot/src/menu/overlay.gd +++ b/godot/src/menu/overlay.gd @@ -1,3 +1,4 @@ +class_name Overlay extends Control signal on_hide() diff --git a/godot/src/menu/store.gd b/godot/src/menu/store.gd deleted file mode 100644 index 4b70710..0000000 --- a/godot/src/menu/store.gd +++ /dev/null @@ -1,6 +0,0 @@ -extends CenterContainer - -signal close() - -func _on_texture_button_pressed(): - close.emit() diff --git a/godot/src/menu/store.tscn b/godot/src/menu/store.tscn index c491b44..f2fa023 100644 --- a/godot/src/menu/store.tscn +++ b/godot/src/menu/store.tscn @@ -1,15 +1,16 @@ [gd_scene load_steps=6 format=3 uid="uid://dx3pmih1fkpfe"] +[ext_resource type="Script" path="res://src/menu/store/Store.gd" id="1_7cxv8"] [ext_resource type="StyleBox" uid="uid://bd0c76q5d7ocf" path="res://theme/dialog.tres" id="1_16mmg"] -[ext_resource type="Script" path="res://src/menu/store.gd" id="1_oiq8j"] [ext_resource type="PackedScene" uid="uid://hbh72ag1wvh" path="res://src/menu/store/gacha_pack.tscn" id="2_2e1y3"] [ext_resource type="Texture2D" uid="uid://bdotu11c1jmm" path="res://assets/ui/close.svg" id="3_wepua"] [ext_resource type="Script" path="res://src/menu/UIButton.gd" id="4_3mes3"] -[node name="Store" type="CenterContainer"] +[node name="Store" type="CenterContainer" node_paths=PackedStringArray("pack_container")] offset_right = 1080.0 offset_bottom = 1920.0 -script = ExtResource("1_oiq8j") +script = ExtResource("1_7cxv8") +pack_container = NodePath("PanelContainer/MarginContainer/VBoxContainer") [node name="PanelContainer" type="PanelContainer" parent="."] layout_mode = 2 diff --git a/godot/src/menu/store/Store.gd b/godot/src/menu/store/Store.gd index dc65d48..c7f5c55 100644 --- a/godot/src/menu/store/Store.gd +++ b/godot/src/menu/store/Store.gd @@ -1,49 +1,27 @@ -extends Control +extends CenterContainer -@export var pack_container: Control -@export var showcase_container: Control - -@onready var showcase := $Showcase -@onready var store_container := $PanelContainer -@onready var anim := $AnimationPlayer +signal close() +signal unlocked(piece) -@onready var store_pos = store_container.position +@export var pack_container: Control +@export var showcase: Control +@export var showcase_tex: TextureRect var showing_showcase = false +var tw: Tween func _ready(): - anim.play("RESET") - for child in pack_container.get_children(): child.pressed.connect(func(): _unpack_gacha(child)) -func _on_store_pressed(): - if anim.is_playing(): - return - - if store_container.position.y < 0: - anim.play("show_store") - else: - anim.play_backwards("show_store") - - func _unpack_gacha(pack: GachaPack): if GameManager.points.use_points(pack.price): var new_piece = pack.get_pieces().pick_random() GameManager.unlock_piece(new_piece) print("unlocked %s" % Piece.Type.keys()[new_piece]) - showcase_container.pivot_offset = showcase_container.size / 2 - anim.play("showcase") - await anim.animation_finished - showing_showcase = true + unlocked.emit(new_piece) else: print("No money") -func _on_showcase_on_hide(): - if not showing_showcase: - return - - anim.play_backwards("showcase") - await anim.animation_finished - showcase.hide() - showing_showcase = false +func _on_texture_button_pressed(): + close.emit() diff --git a/godot/src/rainbow.gdshader b/godot/src/rainbow.gdshader new file mode 100644 index 0000000..3ef4180 --- /dev/null +++ b/godot/src/rainbow.gdshader @@ -0,0 +1,24 @@ +shader_type canvas_item; + +uniform float speed = 1.0; +uniform float count = 5.0; +uniform float strength = 0.5; +uniform float smoothing = 0.5; +uniform float size = 2.0; +uniform vec2 scale = vec2(1, 1); +uniform sampler2D color_gradient; + +void fragment() { + vec4 color = COLOR; + float time = TIME * speed; + + vec2 uv = (UV - vec2(0.5)) / vec2(size) * scale; + float dist = length(uv); + float angle = atan(uv.y, uv.x); + + float opacity = sin(angle * count + time) * strength + smoothing; + opacity *= smoothstep(0.0, 1.0, 1.0 - dist); + + COLOR = texture(color_gradient, vec2(dist, 0)); + COLOR.a *= opacity * color.a; +} \ No newline at end of file diff --git a/godot/src/start.tscn b/godot/src/start.tscn index 7714f48..cedaf36 100644 --- a/godot/src/start.tscn +++ b/godot/src/start.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=32 format=3 uid="uid://qdwfqb2qwrxb"] +[gd_scene load_steps=39 format=3 uid="uid://qdwfqb2qwrxb"] [ext_resource type="Theme" uid="uid://cvvavdkxk7llv" path="res://theme/theme.tres" id="1_rg8bf"] [ext_resource type="Script" path="res://src/start.gd" id="2_af8bd"] @@ -23,6 +23,10 @@ [ext_resource type="Script" path="res://src/menu/UIButton.gd" id="14_6yhda"] [ext_resource type="Texture2D" uid="uid://cj851nf6ocius" path="res://assets/ui/store.svg" id="15_br8ph"] [ext_resource type="PackedScene" uid="uid://dx3pmih1fkpfe" path="res://src/menu/store.tscn" id="17_bi2tb"] +[ext_resource type="PackedScene" uid="uid://pgikighgyjyb" path="res://src/menu/collection.tscn" id="17_oxj4r"] +[ext_resource type="Script" path="res://src/menu/Showcase.gd" id="18_fmxbm"] +[ext_resource type="Texture2D" uid="uid://cx267vinn3mfm" path="res://assets/gacha/Myth_Gura.png" id="18_mh04n"] +[ext_resource type="Shader" path="res://src/rainbow.gdshader" id="19_uhv8d"] [sub_resource type="Gradient" id="Gradient_h65kn"] colors = PackedColorArray(0.0468, 0.22428, 0.36, 1, 0.308, 0.8514, 0.88, 1) @@ -36,12 +40,29 @@ fill_to = Vector2(0, 0) shader = ExtResource("4_samfo") shader_parameter/background = SubResource("GradientTexture2D_jd218") -[sub_resource type="ShaderMaterial" id="ShaderMaterial_unebo"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_k25ma"] shader = ExtResource("7_nxbx0") shader_parameter/clip_texture_size = Vector2(256, 256) -shader_parameter/clip_texture_offset = Vector2(-0.085, 0.025) +shader_parameter/clip_texture_offset = Vector2(-0.1, 0.02) shader_parameter/clip_texture = ExtResource("9_ys5c6") +[sub_resource type="Gradient" id="Gradient_4lcoj"] +offsets = PackedFloat32Array(0.365854, 1) +colors = PackedColorArray(1, 1, 1, 1, 0, 0.683333, 1, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_xos2y"] +gradient = SubResource("Gradient_4lcoj") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_cmoea"] +shader = ExtResource("19_uhv8d") +shader_parameter/speed = 1.0 +shader_parameter/count = 11.955 +shader_parameter/strength = 0.5 +shader_parameter/smoothing = 0.42 +shader_parameter/size = 0.55 +shader_parameter/scale = Vector2(1, 1.6) +shader_parameter/color_gradient = SubResource("GradientTexture1D_xos2y") + [sub_resource type="Animation" id="Animation_0sthp"] length = 0.001 tracks/0/type = "value" @@ -263,49 +284,47 @@ layout_mode = 2 [node name="Points" parent="Top/Top" instance=ExtResource("7_oie0n")] layout_mode = 2 -[node name="Hexagon" type="MarginContainer" parent="."] -layout_mode = 1 -anchors_preset = 10 -anchor_right = 1.0 -offset_bottom = 182.0 -grow_horizontal = 2 - -[node name="TextureRect" type="TextureRect" parent="Hexagon"] -material = SubResource("ShaderMaterial_unebo") -clip_contents = true -layout_mode = 2 -texture = ExtResource("7_qqkgn") -expand_mode = 2 -stretch_mode = 5 - [node name="Menu" type="CenterContainer" parent="."] layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -165.5 +offset_top = -181.5 +offset_right = 165.5 +offset_bottom = 181.5 grow_horizontal = 2 grow_vertical = 2 -[node name="VBoxContainer" type="VBoxContainer" parent="Menu"] -layout_mode = 2 - -[node name="Play" type="TextureButton" parent="Menu/VBoxContainer"] +[node name="Play" type="TextureButton" parent="Menu"] layout_mode = 2 texture_normal = ExtResource("8_dqte7") script = ExtResource("14_6yhda") -[node name="Play2" type="Button" parent="Menu/VBoxContainer"] -visible = false -layout_mode = 2 -text = "Play" +[node name="Hexagon" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -152.5 +offset_right = 152.5 +offset_bottom = 246.0 +grow_horizontal = 2 -[node name="Store" type="Button" parent="Menu/VBoxContainer"] -visible = false +[node name="Collection" type="TextureButton" parent="Hexagon"] +material = SubResource("ShaderMaterial_k25ma") +custom_minimum_size = Vector2(256, 183) layout_mode = 2 -disabled = true -text = "Store" +size_flags_horizontal = 4 +size_flags_vertical = 0 +texture_normal = ExtResource("7_qqkgn") +ignore_texture_size = true +stretch_mode = 5 +script = ExtResource("14_6yhda") -[node name="MenuContainer" type="Control" parent="." node_paths=PackedStringArray("settings", "store", "overlay")] +[node name="MenuContainer" type="Control" parent="." node_paths=PackedStringArray("settings", "store", "collection", "overlay")] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -316,6 +335,7 @@ mouse_filter = 2 script = ExtResource("12_fdvxc") settings = NodePath("Settings") store = NodePath("Store") +collection = NodePath("Collection") overlay = NodePath("Overlay") [node name="Bottom" type="VBoxContainer" parent="MenuContainer"] @@ -374,9 +394,39 @@ visible = false layout_mode = 1 [node name="Store" parent="MenuContainer" instance=ExtResource("17_bi2tb")] -visible = false layout_mode = 0 +[node name="Collection" parent="MenuContainer" instance=ExtResource("17_oxj4r")] +layout_mode = 1 + +[node name="Showcase" type="MarginContainer" parent="MenuContainer" node_paths=PackedStringArray("tex", "overlay", "shine")] +visible = false +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("18_fmxbm") +tex = NodePath("TextureRect") +overlay = NodePath("Overlay") +shine = NodePath("Shine") +external = true + +[node name="Overlay" type="ColorRect" parent="MenuContainer/Showcase"] +layout_mode = 2 +color = Color(0, 0, 0, 0.705882) + +[node name="Shine" type="ColorRect" parent="MenuContainer/Showcase"] +material = SubResource("ShaderMaterial_cmoea") +layout_mode = 2 + +[node name="TextureRect" type="TextureRect" parent="MenuContainer/Showcase"] +layout_mode = 2 +texture = ExtResource("18_mh04n") +expand_mode = 4 +stretch_mode = 5 + [node name="PieceSelect" type="Control" parent="."] visible = false layout_mode = 1 @@ -471,10 +521,11 @@ libraries = { "": SubResource("AnimationLibrary_j8rit") } -[connection signal="pressed" from="Menu/VBoxContainer/Play" to="." method="_on_play_pressed"] -[connection signal="pressed" from="Menu/VBoxContainer/Play2" to="." method="_on_play_pressed"] +[connection signal="pressed" from="Menu/Play" to="." method="_on_play_pressed"] +[connection signal="pressed" from="Hexagon/Collection" to="MenuContainer" method="_on_collection_pressed"] [connection signal="pressed" from="MenuContainer/Bottom/StoreBtn/Store" to="MenuContainer" method="_on_store_pressed"] [connection signal="pressed" from="MenuContainer/Bottom/SettingsBtn/Settings" to="MenuContainer" method="_on_settings_pressed"] +[connection signal="unlocked" from="MenuContainer/Store" to="MenuContainer/Showcase" method="show_piece"] [connection signal="hidden" from="PieceSelect" to="PieceSelect/Selectables" method="close"] [connection signal="on_hide" from="PieceSelect" to="." method="_on_piece_select_on_hide"] [connection signal="pressed" from="PieceSelect/PieceSelect/MarginContainer/VBoxContainer/Start" to="." method="_on_start_pressed"] diff --git a/godot/src/stripes.gdshader b/godot/src/stripes.gdshader deleted file mode 100644 index 0812a89..0000000 --- a/godot/src/stripes.gdshader +++ /dev/null @@ -1,17 +0,0 @@ -shader_type canvas_item; - -uniform vec4 color_gap: source_color = vec4(0.25); -uniform vec4 color_stripe: source_color = vec4(1.0, 0.75, 0.0, 1.0); -uniform float divisions = 8.0; // increase for more stripe density -uniform float stripe_bias = 2.5; // 1.0 means no stripes; 2.0 means stripes and gaps are equal size -uniform float speed = 0.1; -uniform float angle = 0.7854; // in radians - -void fragment() { - float w = cos(angle) * UV.x + sin(angle) * UV.y - speed * TIME; - if (floor(mod(w * divisions, stripe_bias)) < 0.0001) { - COLOR = color_gap; - } else { - COLOR = color_stripe; - } -} \ No newline at end of file