Compare commits

..

5 Commits

10 changed files with 220 additions and 52 deletions

View File

@ -18,11 +18,10 @@ Doc, The Two Time: Nothing but success.
Doc, The Two Time: That's what my life's about. Period.
Doc, The Two Time: And the arena today, ladies and gentlemen...
Doc, The Two Time: is wide open, and the crowds are flooding in. VIP seating. Skybox section. Reserved for the Slick Daddy Club.
Doc, The Two Time: The Slick Daddy Club lofoking so damn good today. I'm feeling so damn good. It's obvious.
Doc, The Two Time: The V of success.
Doc, The Two Time: The Slick Daddy Club looking so damn good today. I'm feeling so damn good. It's obvious.
Challenge [b]Doc, The Two Time[/b] to a duel?
- Yes
do emit("SummonBoss", "Doc")
- No => END
- No, I'm a little chubby cheek wannabe punk kid. => END
=> END

View File

@ -87,7 +87,7 @@ public sealed partial class DebugConsole : Control
while (fs.GetPosition() < fs.GetLength())
{
string line = fs.GetLine();
_output.Text += line;
_output.Text += line + "\n";
}
};
timer.Start(DEBUG_REFRESH_INTERVAL);

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=3 uid="uid://cumi1cbg6xfdd"]
[gd_scene load_steps=23 format=3 uid="uid://cumi1cbg6xfdd"]
[ext_resource type="PackedScene" uid="uid://clwv2owvk6abe" path="res://Scenes/BaseMap.tscn" id="1_oy3cp"]
[ext_resource type="Texture2D" uid="uid://c70cn53osy56w" path="res://Assets/Sprites/dev-tileset.png" id="2_2gdry"]
@ -11,6 +11,7 @@
[ext_resource type="Texture2D" uid="uid://chwwo6vmf8iri" path="res://Assets/Sprites/Props/tree-autumn-leaves-2.png" id="8_4laic"]
[ext_resource type="Texture2D" uid="uid://dhf2f5a1ty502" path="res://Assets/Sprites/Props/tree-autumn-leaves-1.png" id="8_hyhpu"]
[ext_resource type="Texture2D" uid="uid://crvbsxrda5gcj" path="res://Assets/Sprites/Props/tree-autumn-leaves-3.png" id="9_exvkw"]
[ext_resource type="PackedScene" uid="uid://rd08pot25h00" path="res://Characters/SnusDealer.tscn" id="12_eyny2"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_s1h2f"]
texture = ExtResource("2_2gdry")
@ -458,8 +459,8 @@ cell_size = 16.0
agent_radius = 8.0
[sub_resource type="NavigationPolygon" id="NavigationPolygon_8xwo5"]
vertices = PackedVector2Array(280, -232, 280, -120, 276, -120, 216, -232, 216, -40, 276, -72, 296, -72, 296, -88, 392, -88, 392, -136, 472, -136, 472, -40, 440, -40, 440, 8, 488, 8, 488, 24, 440, 24, 440, 72, 424, 72, 424, 24, 424, 8, 376, 24, 376, 8, 424, -40, 296, -40, 296, -56, 276, -56, 276, -40)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3), PackedInt32Array(4, 3, 2, 5), PackedInt32Array(6, 7, 8), PackedInt32Array(8, 9, 10, 11, 12), PackedInt32Array(13, 14, 15, 16), PackedInt32Array(16, 17, 18, 19), PackedInt32Array(13, 16, 19, 20), PackedInt32Array(19, 21, 22, 20), PackedInt32Array(12, 13, 20, 23), PackedInt32Array(8, 12, 23), PackedInt32Array(8, 23, 24, 25), PackedInt32Array(6, 8, 25), PackedInt32Array(5, 6, 25, 26), PackedInt32Array(4, 5, 26), PackedInt32Array(4, 26, 27)])
vertices = PackedVector2Array(392, -88, 392, -136, 472, -136, 472, -40, 440, -40, 440, 8, 488, 8, 488, 24, 440, 24, 440, 72, 424, 72, 424, 24, 424, 8, 376, 24, 376, 8, 424, -40, 216, -40, 280, -88, 216, -232, 280, -232)
polygons = Array[PackedInt32Array]([PackedInt32Array(0, 1, 2, 3, 4), PackedInt32Array(5, 6, 7, 8), PackedInt32Array(8, 9, 10, 11), PackedInt32Array(5, 8, 11, 12), PackedInt32Array(11, 13, 14, 12), PackedInt32Array(4, 5, 12, 15), PackedInt32Array(0, 4, 15), PackedInt32Array(0, 15, 16, 17), PackedInt32Array(17, 16, 18, 19)])
outlines = Array[PackedVector2Array]([PackedVector2Array(208, -240, 208, -32, 416, -32, 416.001, -15.9759, 368.001, -15.9787, 368, 32, 416, 32, 416, 80, 448, 80, 448, 32, 496, 32, 496.001, -15.9713, 448.001, -15.9741, 448, -32, 480, -32, 480.008, -143.972, 384.008, -143.978, 384.006, -95.9778, 288, -96, 288, -240)])
source_geometry_mode = 1
source_geometry_group_name = &"navigation"
@ -479,6 +480,9 @@ Markers = NodePath("Markers")
AreaName = "Forest"
MapName = "Forest"
[node name="CanvasModulate" parent="." index="7"]
position = Vector2(0, 1)
[node name="StaticBody2D" type="StaticBody2D" parent="Props" index="0"]
y_sort_enabled = true
position = Vector2(0, -96)
@ -843,6 +847,13 @@ position = Vector2(1272, 0)
[node name="Campfire" parent="Entities" index="0" instance=ExtResource("3_ve4i2")]
position = Vector2(-24, -8)
[node name="SnusDealer" parent="Entities" index="1" node_paths=PackedStringArray("ThinkerStateMachine", "Sprite", "Inventory", "StateMachine") instance=ExtResource("12_eyny2")]
position = Vector2(79, -6)
ThinkerStateMachine = NodePath("Thinker")
Sprite = NodePath("Sprites/Sprite")
Inventory = NodePath("Inventory")
StateMachine = NodePath("StateMachine")
[node name="Areas" parent="." index="10"]
visible = false

View File

@ -3,9 +3,5 @@ shader_type canvas_item;
uniform float amount : hint_range(0.5, 1.0, 0.01) = 1;
void fragment() {
// Place fragment code here.
//COLOR = texture(TEXTURE, UV);
if (UV.x > amount || UV.x < 1.0 - amount) {
COLOR.a = 0.0;
}
COLOR.a *= step(UV.x, amount) * step(1.0 - amount, UV.x);
}

View File

@ -0,0 +1,10 @@
shader_type canvas_item;
uniform float x_amount : hint_range(0.5, 1.0, 0.01) = 1;
uniform float y_amount : hint_range(0.5, 1.0, 0.01) = 0.5;
void fragment() {
COLOR.a *= step(UV.x, x_amount) * step(1.0 - x_amount, UV.x);
//COLOR.a *= step(1.0 - y_amount, UV.y) * step(UV.y, y_amount);
COLOR.a *= 1.0 - (step(1.0 - y_amount, UV.y) * step(UV.y, y_amount));
}

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=3 uid="uid://c271rdjhd1gfo"]
[gd_scene load_steps=14 format=3 uid="uid://c271rdjhd1gfo"]
[ext_resource type="Script" path="res://UI/UIController.cs" id="2_b4b6l"]
[ext_resource type="PackedScene" uid="uid://bxo553hblp6nf" path="res://UI/HealthBar.tscn" id="3_j1j6h"]
@ -11,18 +11,8 @@
[ext_resource type="PackedScene" uid="uid://2afbrf8asy2a" path="res://UI/PostProcessing/Vignette.tscn" id="9_p1ubd"]
[ext_resource type="PackedScene" uid="uid://b1wsryv4bn0cn" path="res://UI/PostProcessing/StunEffect.tscn" id="10_646ma"]
[ext_resource type="Shader" path="res://Shaders/Grayscale.gdshader" id="11_w4gn1"]
[ext_resource type="Theme" uid="uid://cksjbu3vrup5" path="res://UI/Themes/supalidl.tres" id="11_wtdum"]
[ext_resource type="Texture2D" uid="uid://bw052v8ikfget" path="res://icon.svg" id="12_tyv35"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_a504f"]
bg_color = Color(0.906763, 0, 0.280984, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gheod"]
bg_color = Color(1, 0.315507, 0.447521, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1nm23"]
bg_color = Color(0.951511, 0.387714, 0.416256, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_kbd61"]
shader = ExtResource("11_w4gn1")
shader_parameter/grayscale_intensity = 0.0
@ -30,15 +20,6 @@ shader_parameter/grayscale_intensity = 0.0
[node name="BaseUI" type="CanvasLayer"]
process_mode = 3
[node name="Button" type="Button" parent="."]
offset_left = 536.0
offset_right = 592.0
offset_bottom = 31.0
theme_override_styles/focus = SubResource("StyleBoxFlat_a504f")
theme_override_styles/hover = SubResource("StyleBoxFlat_gheod")
theme_override_styles/normal = SubResource("StyleBoxFlat_1nm23")
text = "sdfsdf"
[node name="PostProcessing" type="CanvasLayer" parent="."]
[node name="Vignette" parent="PostProcessing" instance=ExtResource("9_p1ubd")]
@ -139,7 +120,9 @@ grow_horizontal = 0
grow_vertical = 2
alignment = 2
[node name="Panel" parent="SubViewportContainer/UIViewport/MainUILayer/Main/BoxContainer" node_paths=PackedStringArray("_inventoryGrid") instance=ExtResource("8_ep3ae")]
[node name="ShopMenu" parent="SubViewportContainer/UIViewport/MainUILayer/Main/BoxContainer" node_paths=PackedStringArray("_inventoryGrid") instance=ExtResource("8_ep3ae")]
unique_name_in_owner = true
visible = false
layout_mode = 2
_inventoryGrid = NodePath("PanelContainer/VBoxContainer/ScrollContainer/InventoryGrid")
@ -158,13 +141,6 @@ alignment = 1
visible = false
layout_mode = 2
[node name="Button" type="Button" parent="SubViewportContainer/UIViewport/MainUILayer/Main/Bottom"]
layout_mode = 2
theme = ExtResource("11_wtdum")
theme_type_variation = &"InventorySlotButton"
theme_override_styles/hover = SubResource("StyleBoxFlat_gheod")
text = "sdfsdfa"
[node name="VBoxContainer" type="VBoxContainer" parent="SubViewportContainer/UIViewport/MainUILayer/Main"]
visible = false
layout_mode = 0

6
UI/IModal.cs 100644
View File

@ -0,0 +1,6 @@
namespace SupaLidlGame.UI;
public interface IModal
{
public void HideModal();
}

View File

@ -12,7 +12,6 @@ public partial class ShopMenu : Control, IModal
get => _source;
set
{
GD.Print("Set ShopMenu source");
_source = value;
_inventoryGrid.Source = value;
}
@ -23,24 +22,31 @@ public partial class ShopMenu : Control, IModal
private InventorySlot _selected;
public void ShowModal()
{
Show();
var animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
animPlayer.Play("open");
}
public void HideModal()
{
Hide();
_source = null;
}
public async void Close()
{
var animPlayer = GetNode<AnimationPlayer>("%AnimationPlayer");
animPlayer.Play("close");
await ToSignal(animPlayer, AnimationPlayer.SignalName.AnimationFinished);
HideModal();
}
public override void _Ready()
{
Events.EventBus.Instance.EnterShop += (string path) =>
{
var shop = ResourceLoader.Load<Items.Shop>(path);
GD.Print("Loaded shop");
Source = shop;
};
_inventoryGrid.SlotFocused += (InventorySlot slot) =>
{
GD.Print("SlotFocused " + slot.Name);
if (slot.Item is not null)
{
SetTooltipItem(slot);
@ -59,10 +65,11 @@ public partial class ShopMenu : Control, IModal
GetNode<Button>("%BuyButton").GrabFocus();
};
GetNode<Button>("%BuyButton").GuiInput += (Godot.InputEvent @event) =>
GetNode<Button>("%BuyButton").GuiInput += (InputEvent @event) =>
{
if (@event.IsAction("ui_cancel"))
if (@event.IsActionPressed("ui_cancel"))
{
GetViewport().SetInputAsHandled();
_selected?.GrabFocus();
}
};
@ -81,4 +88,13 @@ public partial class ShopMenu : Control, IModal
GetNode<Button>("%BuyButton").Disabled = true;
}
}
public override void _UnhandledInput(InputEvent @event)
{
if (@event.IsActionPressed("ui_cancel"))
{
GetViewport().SetInputAsHandled();
Close();
}
}
}

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=9 format=3 uid="uid://cyggkyqosjk36"]
[gd_scene load_steps=15 format=3 uid="uid://cyggkyqosjk36"]
[ext_resource type="StyleBox" uid="uid://bqhotx2ogucye" path="res://UI/Themes/Panel.tres" id="1_2ffty"]
[ext_resource type="Script" path="res://UI/Inventory/ShopMenu.cs" id="1_8c1y7"]
[ext_resource type="Shader" path="res://Shaders/WipeXY.gdshader" id="2_jqery"]
[ext_resource type="FontFile" uid="uid://cgwa8bjiyv534" path="res://Assets/Fonts/alagard.ttf" id="3_aj4jx"]
[ext_resource type="PackedScene" uid="uid://bsheehtfcdwhh" path="res://UI/Inventory/ItemTooltip.tscn" id="4_n61n7"]
[ext_resource type="PackedScene" uid="uid://chmokkxsy5vas" path="res://UI/Inventory/InventoryGrid.tscn" id="4_sl632"]
@ -21,6 +22,138 @@ corner_radius_top_right = 16
corner_radius_bottom_right = 16
corner_radius_bottom_left = 16
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2hdh3"]
shader = ExtResource("2_jqery")
shader_parameter/x_amount = 1.0
shader_parameter/y_amount = 0.5
[sub_resource type="Animation" id="Animation_yj24f"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PanelContainer:material:shader_parameter/y_amount")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("PanelContainer:material:shader_parameter/x_amount")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.0]
}
[sub_resource type="Animation" id="Animation_tm2as"]
resource_name = "close"
length = 0.5
step = 0.05
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PanelContainer:material:shader_parameter/y_amount")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.5, 1.0]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("PanelContainer:material:shader_parameter/x_amount")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.05, 0.15),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.5]
}
[sub_resource type="Animation" id="Animation_fgj27"]
resource_name = "open"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("PanelContainer:material:shader_parameter/y_amount")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.5]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("PanelContainer:material:shader_parameter/x_amount")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.5, 1.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_0glcp"]
_data = {
"RESET": SubResource("Animation_yj24f"),
"close": SubResource("Animation_tm2as"),
"open": SubResource("Animation_fgj27")
}
[node name="Panel" type="PanelContainer" node_paths=PackedStringArray("_inventoryGrid")]
anchors_preset = 6
anchor_left = 1.0
@ -37,6 +170,7 @@ script = ExtResource("1_8c1y7")
_inventoryGrid = NodePath("PanelContainer/VBoxContainer/ScrollContainer/InventoryGrid")
[node name="PanelContainer" type="PanelContainer" parent="."]
material = SubResource("ShaderMaterial_2hdh3")
layout_mode = 2
theme_override_styles/panel = ExtResource("1_2ffty")
@ -75,3 +209,9 @@ layout_mode = 2
size_flags_horizontal = 3
theme = ExtResource("7_rvp1r")
text = "Buy"
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_0glcp")
}

View File

@ -1,4 +1,5 @@
using Godot;
using System.Collections.Generic;
namespace SupaLidlGame.UI;
@ -9,4 +10,17 @@ public partial class UIController : Control
[Export]
public BossBar BossBar { get; set; }
private Stack<IModal> _modals;
public override void _Ready()
{
Events.EventBus.Instance.EnterShop += (string path) =>
{
var shop = ResourceLoader.Load<Items.Shop>(path);
var shopMenu = GetNode<Inventory.ShopMenu>("%ShopMenu");
shopMenu.Source = shop;
shopMenu.ShowModal();
};
}
}