Barebones inventory menu addition
This commit is contained in:
@@ -24,6 +24,8 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
[Dependency] public IAppRepo AppRepo => this.DependOn<IAppRepo>();
|
||||
|
||||
[Node] public IInventoryMenu InventoryMenu { get; set; } = default!;
|
||||
|
||||
[Node] public Control MiniMap { get; set; } = default!;
|
||||
|
||||
public void Setup()
|
||||
@@ -40,6 +42,8 @@ public partial class Game : Node3D, IGame
|
||||
GameBinding
|
||||
.Handle((in GameLogic.Output.StartGame _) => { GameRepo.Resume(); })
|
||||
.Handle((in GameLogic.Output.SetPauseMode output) => { CallDeferred(nameof(SetPauseMode), output.IsPaused); })
|
||||
.Handle((in GameLogic.Output.SetInventoryMode _) => { InventoryMenu.PopulateItems(_.Inventory); InventoryMenu.Show(); })
|
||||
.Handle((in GameLogic.Output.HideInventory _) => { InventoryMenu.Hide(); InventoryMenu.ClearItems(); })
|
||||
.Handle((in GameLogic.Output.ShowMiniMap _) => { MiniMap.Show(); })
|
||||
.Handle((in GameLogic.Output.HideMiniMap _) => { MiniMap.Hide(); })
|
||||
.Handle((in GameLogic.Output.GameOver _) => { AppRepo.OnGameOver(); });
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://33ek675mfb5n"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://33ek675mfb5n"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/game/Game.cs" id="1_ytcii"]
|
||||
[ext_resource type="PackedScene" uid="uid://wg25dg65ksgg" path="res://src/map/dungeon/DungeonGenerator.tscn" id="2_cgboj"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfecvvav8kkp6" path="res://src/player/Player.tscn" id="3_kk6ly"]
|
||||
[ext_resource type="PackedScene" uid="uid://dhpwwqow1ahrc" path="res://src/map/dungeon/rooms/Room1.tscn" id="4_56rmd"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbwgmqy3evhh2" path="res://src/map/dungeon/rooms/Room2.tscn" id="4_clpvl"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlj8qdg1c5048" path="res://src/inventory_menu/InventoryMenu.tscn" id="4_wk8gw"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="6_owlf4"]
|
||||
|
||||
[sub_resource type="Environment" id="Environment_fke5g"]
|
||||
@@ -40,6 +41,10 @@ shape = SubResource("BoxShape3D_s2hwi")
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="InventoryMenu" parent="." instance=ExtResource("4_wk8gw")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="OmniLight3D" type="OmniLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 24.5244, 0)
|
||||
layers = 3
|
||||
|
||||
@@ -23,10 +23,6 @@ public interface IGameRepo : IDisposable
|
||||
|
||||
void SetPlayerGlobalPosition(Vector3 playerGlobalPosition);
|
||||
|
||||
void SetNavigationRegion(NavigationRegion3D region);
|
||||
|
||||
IAutoProp<NavigationRegion3D> NavigationRegion3D { get; }
|
||||
|
||||
public Weapon EquippedWeapon { get; }
|
||||
}
|
||||
|
||||
@@ -50,9 +46,6 @@ public class GameRepo : IGameRepo
|
||||
private Weapon _equippedWeapon;
|
||||
public Weapon EquippedWeapon => _equippedWeapon;
|
||||
|
||||
private AutoProp<NavigationRegion3D> _navigationRegion3D;
|
||||
public IAutoProp<NavigationRegion3D> NavigationRegion3D => _navigationRegion3D;
|
||||
|
||||
private bool _disposedValue;
|
||||
|
||||
public GameRepo()
|
||||
@@ -62,7 +55,6 @@ public class GameRepo : IGameRepo
|
||||
_isPaused = new AutoProp<bool>(false);
|
||||
_playerGlobalPosition = new AutoProp<Vector3>(Vector3.Zero);
|
||||
_equippedWeapon = new Weapon() { InventoryInfo = WeaponInfo.Default };
|
||||
_navigationRegion3D = new AutoProp<NavigationRegion3D>(new NavigationRegion3D());
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
@@ -79,8 +71,6 @@ public class GameRepo : IGameRepo
|
||||
|
||||
public void SetPlayerGlobalPosition(Vector3 playerGlobalPosition) => _playerGlobalPosition.OnNext(playerGlobalPosition);
|
||||
|
||||
public void SetNavigationRegion(NavigationRegion3D region) => _navigationRegion3D.OnNext(region);
|
||||
|
||||
public void OnGameEnded()
|
||||
{
|
||||
Pause();
|
||||
|
||||
45
src/inventory_menu/InventoryMenu.tscn
Normal file
45
src/inventory_menu/InventoryMenu.tscn
Normal file
@@ -0,0 +1,45 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dlj8qdg1c5048"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dr8mjn3wahdvp" path="res://src/inventory_menu/cursor.png" id="1_efrp8"]
|
||||
[ext_resource type="Script" path="res://src/inventory_menu/InventoryMenu.cs" id="1_l64wl"]
|
||||
|
||||
[node name="InventoryMenu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_l64wl")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ItemList" type="VBoxContainer" parent="CenterContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Cursor" type="TextureRect" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_left = -88.0
|
||||
offset_top = -47.0
|
||||
offset_right = -48.0
|
||||
offset_bottom = -7.0
|
||||
texture = ExtResource("1_efrp8")
|
||||
|
||||
[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
|
||||
color = Color(0, 0, 0, 1)
|
||||
BIN
src/inventory_menu/cursor.png
Normal file
BIN
src/inventory_menu/cursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 474 B |
34
src/inventory_menu/cursor.png.import
Normal file
34
src/inventory_menu/cursor.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dr8mjn3wahdvp"
|
||||
path="res://.godot/imported/cursor.png-0fec02edb5cdc5cc9912cb19d5a7e260.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://src/inventory_menu/cursor.png"
|
||||
dest_files=["res://.godot/imported/cursor.png-0fec02edb5cdc5cc9912cb19d5a7e260.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
|
||||
Reference in New Issue
Block a user