Move files and folders to new repo format to enable multi-project format
This commit is contained in:
68
Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs
Normal file
68
Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IInGameUI : IControl
|
||||
{
|
||||
public void ShowInventoryScreen();
|
||||
|
||||
public void HideInventoryScreen();
|
||||
|
||||
public void ShowMiniMap();
|
||||
|
||||
public void HideMiniMap();
|
||||
|
||||
event InGameUI.MinimapButtonReleasedEventHandler MinimapButtonReleased;
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class InGameUI : Control, IInGameUI
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Node] public Control MiniMap { get; set; } = default!;
|
||||
|
||||
[Node] public IInventoryMenu InventoryMenu { get; set; } = default!;
|
||||
|
||||
[Node] public IPlayerInfoUI PlayerInfoUI { get; set; } = default!;
|
||||
|
||||
[Node] public IUseTeleportPrompt UseTeleportPrompt { get; set; } = default!;
|
||||
|
||||
[Signal]
|
||||
public delegate void MinimapButtonReleasedEventHandler();
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionReleased(GameInputs.MiniMap))
|
||||
{
|
||||
GD.Print("MiniMap button released");
|
||||
EmitSignal(SignalName.MinimapButtonReleased);
|
||||
}
|
||||
}
|
||||
|
||||
public void HideInventoryScreen()
|
||||
{
|
||||
InventoryMenu.Hide();
|
||||
}
|
||||
|
||||
public void HideMiniMap()
|
||||
{
|
||||
MiniMap.SetProcessUnhandledInput(false);
|
||||
MiniMap.Hide();
|
||||
}
|
||||
|
||||
public void ShowInventoryScreen()
|
||||
{
|
||||
InventoryMenu.RefreshInventoryScreen();
|
||||
InventoryMenu.Show();
|
||||
}
|
||||
|
||||
public void ShowMiniMap()
|
||||
{
|
||||
MiniMap.SetProcessUnhandledInput(true);
|
||||
MiniMap.Show();
|
||||
}
|
||||
}
|
||||
1
Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs.uid
Normal file
1
Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dlq2mkhl4pe7a
|
||||
50
Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn
Normal file
50
Zennysoft.Game.Ma/src/ui/in_game_ui/InGameUI.tscn
Normal file
@@ -0,0 +1,50 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://b1muxus5qdbeu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dlq2mkhl4pe7a" path="res://src/ui/in_game_ui/InGameUI.cs" id="1_sc13i"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwbofurcvf3yh" path="res://src/minimap/Minimap.tscn" id="2_6sfje"]
|
||||
[ext_resource type="PackedScene" uid="uid://dlj8qdg1c5048" path="res://src/inventory_menu/InventoryMenu.tscn" id="3_4vcdl"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxl8il8f13c2x" path="res://src/ui/player_ui/PlayerInfoUI.tscn" id="4_46s5l"]
|
||||
[ext_resource type="PackedScene" uid="uid://bea2waybmgd6u" path="res://src/ui/teleport_prompt/UseTeleportPrompt.tscn" id="5_h1hgq"]
|
||||
[ext_resource type="Script" uid="uid://dj6oqler47dqf" path="res://src/utils/FpsCounter.cs" id="7_c6o8j"]
|
||||
|
||||
[node name="InGameUI" type="Control"]
|
||||
process_mode = 3
|
||||
custom_minimum_size = Vector2(1280, 960)
|
||||
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_sc13i")
|
||||
|
||||
[node name="PlayerInfoUI" parent="." instance=ExtResource("4_46s5l")]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(1024, 768)
|
||||
layout_mode = 1
|
||||
|
||||
[node name="MiniMap" parent="." instance=ExtResource("2_6sfje")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="InventoryMenu" parent="." instance=ExtResource("3_4vcdl")]
|
||||
unique_name_in_owner = true
|
||||
process_mode = 3
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
||||
[node name="UseTeleportPrompt" parent="." instance=ExtResource("5_h1hgq")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 1
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
anchor_right = 0.021
|
||||
anchor_bottom = 0.021
|
||||
offset_right = -0.320004
|
||||
offset_bottom = 0.319998
|
||||
script = ExtResource("7_c6o8j")
|
||||
61
Zennysoft.Game.Ma/src/ui/in_game_ui/UseTeleportPrompt.cs
Normal file
61
Zennysoft.Game.Ma/src/ui/in_game_ui/UseTeleportPrompt.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IUseTeleportPrompt : IControl
|
||||
{
|
||||
event UseTeleportPrompt.TeleportToNextFloorEventHandler TeleportToNextFloor;
|
||||
event UseTeleportPrompt.CloseTeleportPromptEventHandler CloseTeleportPrompt;
|
||||
|
||||
public void FadeIn();
|
||||
|
||||
public void FadeOut();
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class UseTeleportPrompt : Control, IUseTeleportPrompt
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Signal]
|
||||
public delegate void TeleportToNextFloorEventHandler();
|
||||
[Signal]
|
||||
public delegate void CloseTeleportPromptEventHandler();
|
||||
|
||||
[Node] public Button YesButton { get; set; } = default!;
|
||||
|
||||
[Node] public Button NoButton { get; set; } = default!;
|
||||
|
||||
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
AnimationPlayer.AnimationFinished += AnimationPlayer_AnimationFinished;
|
||||
YesButton.Pressed += YesButton_Pressed;
|
||||
NoButton.Pressed += NoButton_Pressed;
|
||||
}
|
||||
|
||||
public void FadeIn() => AnimationPlayer.Play("fade_in");
|
||||
public void FadeOut() => AnimationPlayer.Play("fade_out");
|
||||
|
||||
private void NoButton_Pressed()
|
||||
{
|
||||
EmitSignal(SignalName.CloseTeleportPrompt);
|
||||
}
|
||||
|
||||
private void YesButton_Pressed()
|
||||
{
|
||||
EmitSignal(SignalName.TeleportToNextFloor);
|
||||
}
|
||||
|
||||
private void AnimationPlayer_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (animName == "fade_in")
|
||||
YesButton.CallDeferred(MethodName.GrabFocus);
|
||||
if (animName == "fade_out")
|
||||
CallDeferred(MethodName.ReleaseFocus);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dvn7g207w5jaj
|
||||
Reference in New Issue
Block a user