diff --git a/.editorconfig b/.editorconfig index dbc22c1d..a6eaa5dc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -32,4 +32,40 @@ dotnet_naming_symbols.public_symbols.applicable_accessibilities = public, protec dotnet_naming_style.first_word_upper.capitalization = pascal_case # Code quality rules -dotnet_diagnostic.CA1822.severity = warning \ No newline at end of file +dotnet_diagnostic.CA1822.severity = warning +csharp_using_directive_placement = outside_namespace:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_prefer_braces = true:silent +csharp_style_namespace_declarations = block_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent +csharp_style_prefer_primary_constructors = true:suggestion +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_indent_labels = one_less_than_current +csharp_space_around_binary_operators = before_and_after +[*.{cs,vb}] +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion +dotnet_style_operator_placement_when_wrapping = beginning_of_line +tab_width = 4 +indent_size = 4 +end_of_line = crlf \ No newline at end of file diff --git a/Connect-A-Pic-Core/ExternalPorts/ExternalInput.cs b/Connect-A-Pic-Core/ExternalPorts/ExternalInput.cs index 41913209..780fbe1f 100644 --- a/Connect-A-Pic-Core/ExternalPorts/ExternalInput.cs +++ b/Connect-A-Pic-Core/ExternalPorts/ExternalInput.cs @@ -5,8 +5,26 @@ namespace CAP_Core.ExternalPorts { public class ExternalInput : ExternalPort { - public LaserType LaserType { get; } - public Complex InFlowPower { get; set; } + private LaserType _laserType; + public LaserType LaserType + { + get => _laserType; + set + { + _laserType = value; + OnPropertyChanged(); + } + } + public Complex _inFlowPower; + public Complex InFlowPower + { + get => _inFlowPower; + set + { + _inFlowPower = value; + OnPropertyChanged(); + } + } public Complex InFlowField => Complex.FromPolarCoordinates(Math.Sqrt(InFlowPower.Magnitude), InFlowPower.Phase); public ExternalInput(string pinName, LaserType inputLaserType, int tilePositionY, Complex inflowPower) : base(pinName, tilePositionY) { diff --git a/Connect-A-Pic-Core/ExternalPorts/ExternalPort.cs b/Connect-A-Pic-Core/ExternalPorts/ExternalPort.cs index 5b38ca64..39f9ec5b 100644 --- a/Connect-A-Pic-Core/ExternalPorts/ExternalPort.cs +++ b/Connect-A-Pic-Core/ExternalPorts/ExternalPort.cs @@ -1,7 +1,16 @@ -namespace CAP_Core.ExternalPorts +using System.ComponentModel; +using System.Runtime.CompilerServices; + +namespace CAP_Core.ExternalPorts { - public abstract class ExternalPort + public abstract class ExternalPort: INotifyPropertyChanged { + public event PropertyChangedEventHandler? PropertyChanged; + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + public ExternalPort(string pinName, int tilePositionY) { PinName = pinName; @@ -10,5 +19,7 @@ public ExternalPort(string pinName, int tilePositionY) public string PinName { get; } public int TilePositionY { get; } + + } -} \ No newline at end of file +} diff --git a/Connect-A-Pic-Core/Grid/GridManager.cs b/Connect-A-Pic-Core/Grid/GridManager.cs index 8f8e805f..b9f49f29 100644 --- a/Connect-A-Pic-Core/Grid/GridManager.cs +++ b/Connect-A-Pic-Core/Grid/GridManager.cs @@ -12,14 +12,16 @@ public class GridManager public IExternalPortManager ExternalPortManager { get; } public IComponentRotator ComponentRotator { get; } public IComponentRelationshipManager ComponentRelationshipManager { get; } + public LightManager LightManager { get; } - public GridManager(ITileManager tileManager, IComponentMover componentMover, IExternalPortManager externalPortManager, IComponentRotator componentRotator, IComponentRelationshipManager componentRelationshipManager) + public GridManager(ITileManager tileManager, IComponentMover componentMover, IExternalPortManager externalPortManager, IComponentRotator componentRotator, IComponentRelationshipManager componentRelationshipManager, LightManager lightManager) { TileManager = tileManager; ComponentMover = componentMover; ExternalPortManager = externalPortManager; ComponentRotator = componentRotator; ComponentRelationshipManager = componentRelationshipManager; + LightManager = lightManager; } public GridManager (int width , int height) { @@ -28,6 +30,7 @@ public GridManager (int width , int height) ExternalPortManager = new ExternalPortManager(TileManager); ComponentRotator = new ComponentRotator(TileManager,ComponentMover); ComponentRelationshipManager = new ComponentRelationshipManager(TileManager); + LightManager = new LightManager(); } } diff --git a/Connect-A-Pic-Core/LightCalculation/LightCalculationChangeEventArgs.cs b/Connect-A-Pic-Core/LightCalculation/LightCalculationChangeEventArgs.cs index ba339fca..ca3b4381 100644 --- a/Connect-A-Pic-Core/LightCalculation/LightCalculationChangeEventArgs.cs +++ b/Connect-A-Pic-Core/LightCalculation/LightCalculationChangeEventArgs.cs @@ -1,4 +1,4 @@ -using CAP_Core.ExternalPorts; +using CAP_Core.ExternalPorts; using System.Numerics; namespace CAP_Core.LightCalculation diff --git a/Connect-A-Pic-Core/LightCalculation/LightCalculationService.cs b/Connect-A-Pic-Core/LightCalculation/LightCalculationService.cs index 5ea440a6..e13f80ca 100644 --- a/Connect-A-Pic-Core/LightCalculation/LightCalculationService.cs +++ b/Connect-A-Pic-Core/LightCalculation/LightCalculationService.cs @@ -24,13 +24,13 @@ public class LightCalculationService private SemaphoreSlim Semaphore = new (1, 1); - public LightCalculationService(GridManager grid, LightManager lightManager, ILightCalculator gridSMatrixAnalyzer) + public LightCalculationService(GridManager grid, ILightCalculator gridSMatrixAnalyzer) { LightInputs = grid.ExternalPortManager.GetAllExternalInputs(); grid.ExternalPortManager.ExternalPorts.CollectionChanged += async (object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) => { LightInputs = grid.ExternalPortManager.GetAllExternalInputs(); - if (lightManager.IsLightOn) + if (grid.LightManager.IsLightOn) { await ShowLightPropagationAsync(); } diff --git a/Scenes/ExternalPortContainer/PortsContainer.cs b/Scenes/ExternalPortContainer/PortsContainer.cs index ab12d20f..4a52b7a7 100644 --- a/Scenes/ExternalPortContainer/PortsContainer.cs +++ b/Scenes/ExternalPortContainer/PortsContainer.cs @@ -9,60 +9,68 @@ using CAP_Core.ExternalPorts; using System.Diagnostics; using CAP_Core.LightCalculation; +using System.ComponentModel; +using ConnectAPIC.Scripts.ViewModel; +using ConnectAPIC.LayoutWindow.ViewModel.Commands; +using ConnectAPIC.Scripts.ViewModel.Commands; using ConnectAPic.LayoutWindow; +using ConnectAPIC.Scenes.RightClickMenu; + + [SuperNode(typeof(Dependent))] public partial class PortsContainer : Node2D { public override partial void _Notification(int what); - [Dependency] public GridManager GridManager => DependOn(); - [Dependency] public LightManager LightManager => DependOn(); + [Dependency] public GridManager Grid => DependOn(); [Dependency] public LightCalculationService LightCalculator => DependOn(); [Export] public PackedScene ExternalPortViewTemplate { get; set; } - [Export] public PackedScene RightClickMenu { get; set; } + [Export] public PackedScene RightClickMenuTemplate { get; set; } + public SimpleControlMenu ControlMenu { get; set; } public ExternalPortViewFactory PortViewFactory { get; set; } - public List Views { get; set; } = new(); + public List PortViewModels { get; set; } = new(); + //Commands + public static InputPowerAdjustCommand inputPowerAdjustCommand; + public static InputColorChangeCommand inputColorChangeCommand; + public static InputOutputChangeCommand inputOutputChangeCommand; public void OnResolved() { - PortViewFactory = new ExternalPortViewFactory(this, GridManager, LightCalculator, LightManager); + InitializeCommands(); + InitializePortsAndPortsFactory(); + InitializeControlMenuAndConnectToPorts(); + } - GridManager.ExternalPortManager.ExternalPorts.CollectionChanged += (object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) => + private void InitializeControlMenuAndConnectToPorts() + { + foreach (ExternalPortViewModel viewModel in PortViewModels) { - ExternalPortView tmpView; - foreach (ExternalPort port in e.OldItems) - { - tmpView = Views.Find((view) => port.TilePositionY == view.ViewModel.TilePositionY); - Views.Remove(tmpView); - tmpView.RightClicked -= View_RightClicked; - tmpView.QueueFree(); - } - foreach (ExternalPort port in e.NewItems) - { - tmpView = PortViewFactory?.InitializeExternalPortView(port); - tmpView.RightClicked += View_RightClicked; - Views.Add(tmpView); - } - }; - - Views = PortViewFactory?.InitializeExternalPortViewList(GridManager.ExternalPortManager.ExternalPorts); - - foreach (ExternalPortView view in Views) { - view.RightClicked += View_RightClicked; + viewModel.Clicked += ViewModel_Clicked; } + ControlMenu = RightClickMenuTemplate.Instantiate(); + ControlMenu.SetPortContainer(this); + this.AddChild(ControlMenu); } - - private void View_RightClicked(object sender, EventArgs e) + private void InitializePortsAndPortsFactory() + { + PortViewFactory = new ExternalPortViewFactory(this, Grid, LightCalculator); + PortViewModels = PortViewFactory?.InitializeExternalPortViewList(Grid.ExternalPortManager.ExternalPorts); + } + private void InitializeCommands() { - ExternalPortView view = sender as ExternalPortView; - if (view == null) return; + inputPowerAdjustCommand = new InputPowerAdjustCommand(Grid); + inputColorChangeCommand = new InputColorChangeCommand(Grid); + inputOutputChangeCommand = new InputOutputChangeCommand(Grid); + } - //TODO: find out if view is input or output - //TODO: build right click menu accordingly (if haven't done it already) - //TODO: open right click menu on that ports position (with some offset) + private void ViewModel_Clicked(object sender, EventArgs e) + { + ExternalPortViewModel viewModel = sender as ExternalPortViewModel; + if (viewModel == null) return; + ControlMenu.ConnectToPort(viewModel); } } diff --git a/Scenes/PICEditor/PICEditor.tscn b/Scenes/PICEditor/PICEditor.tscn index 1341350b..409f21b7 100644 --- a/Scenes/PICEditor/PICEditor.tscn +++ b/Scenes/PICEditor/PICEditor.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://cu6wqy6xwjfo1"] +[gd_scene load_steps=24 format=3 uid="uid://cu6wqy6xwjfo1"] [ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_c0scx"] [ext_resource type="Script" path="res://Scripts/View/ComponentFactory/ComponentViewFactory.cs" id="2_7hjmy"] @@ -11,6 +11,7 @@ [ext_resource type="Script" path="res://Scripts/View/DragDropProxy.cs" id="8_h35r3"] [ext_resource type="Script" path="res://Scripts/View/StandardDialogs/NotificationManager.cs" id="9_gj54m"] [ext_resource type="PackedScene" uid="uid://bscqmaslppyt8" path="res://Scenes/NotificationBox.tscn" id="10_06t00"] +[ext_resource type="PackedScene" uid="uid://dx13abdux2230" path="res://Scenes/RightClickMenu/ControlMenu.tscn" id="11_ylcdl"] [ext_resource type="PackedScene" uid="uid://bd8isg4mddv21" path="res://Scenes/InGameConsole/InGameConsole.tscn" id="16_7rcst"] [ext_resource type="Texture2D" uid="uid://djdwbxfnvfvfb" path="res://Scenes/MenuBar/SaveIcon.png" id="17_q4e7w"] [ext_resource type="Texture2D" uid="uid://qtdana7kc4y" path="res://Scenes/MenuBar/LoadIcon.png" id="18_17x6l"] @@ -57,6 +58,7 @@ metadata/_edit_use_anchors_ = true [node name="PortContainer" parent="GridView" instance=ExtResource("22_75h2p")] ExternalPortViewTemplate = ExtResource("2_dn85u") +RightClickMenuTemplate = ExtResource("11_ylcdl") [node name="Control" type="Control" parent="."] layout_mode = 3 @@ -199,3 +201,6 @@ NotificationBoxScene = ExtResource("10_06t00") [connection signal="toggled" from="GUILayer/MenuBar/HBoxContainer/btnShowLightPropagation" to="GridView" method="_on_btn_show_light_propagation_toggled"] [connection signal="pressed" from="GUILayer/MenuBar/HBoxContainer/btnExportNazca" to="GridView" method="_on_btn_export_nazca_pressed"] [connection signal="toggled" from="GUILayer/ToolboxControl/MarginContainer/VBoxContainer/HideToggle" to="GUILayer/ToolboxControl" method="OnToggleButtonPressed"] +[connection signal="WindowClosed" from="GUILayer/HelpWindow" to="MainCamera" method="OnMouseExitedTutorialWindow"] +[connection signal="mouse_entered" from="GUILayer/HelpWindow" to="MainCamera" method="OnMouseEnteredTutorialWindow"] +[connection signal="mouse_exited" from="GUILayer/HelpWindow" to="MainCamera" method="OnMouseExitedTutorialWindow"] diff --git a/Scenes/PopUpWindow/ComponentPlacement.ogv b/Scenes/PopUpWindow/ComponentPlacement.ogv new file mode 100644 index 00000000..2aad036c Binary files /dev/null and b/Scenes/PopUpWindow/ComponentPlacement.ogv differ diff --git a/Scenes/PopUpWindow/ExitButton.png b/Scenes/PopUpWindow/ExitButton.png new file mode 100644 index 00000000..de96bcc1 Binary files /dev/null and b/Scenes/PopUpWindow/ExitButton.png differ diff --git a/Scenes/RightClickMenu/TopBar.png.import b/Scenes/PopUpWindow/ExitButton.png.import similarity index 67% rename from Scenes/RightClickMenu/TopBar.png.import rename to Scenes/PopUpWindow/ExitButton.png.import index 472362bb..639bfea2 100644 --- a/Scenes/RightClickMenu/TopBar.png.import +++ b/Scenes/PopUpWindow/ExitButton.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://cxa7n5a2grbq6" -path="res://.godot/imported/TopBar.png-ec389bda0865d131c0b24dbb29cb3ea5.ctex" +uid="uid://bwofnv3cggxhh" +path="res://.godot/imported/ExitButton.png-fc507b5e0a2c39f38b65afe60146ead0.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Scenes/RightClickMenu/TopBar.png" -dest_files=["res://.godot/imported/TopBar.png-ec389bda0865d131c0b24dbb29cb3ea5.ctex"] +source_file="res://Scenes/PopUpWindow/ExitButton.png" +dest_files=["res://.godot/imported/ExitButton.png-fc507b5e0a2c39f38b65afe60146ead0.ctex"] [params] diff --git a/Scenes/PopUpWindow/PopUpWindow.cs b/Scenes/PopUpWindow/PopUpWindow.cs index e54bc35a..b4c7d645 100644 --- a/Scenes/PopUpWindow/PopUpWindow.cs +++ b/Scenes/PopUpWindow/PopUpWindow.cs @@ -8,6 +8,8 @@ public partial class PopUpWindow : Control { [Export] public Button ToggleButton { get; set; } + //Godot signal for easier handling from gui + [Signal] public delegate void WindowClosedEventHandler(); public override void _Ready() { @@ -23,12 +25,14 @@ public override void _Ready() private void OnToggleButtonPressed(bool toggledOn) { Visible = toggledOn; + if (!Visible) EmitSignal(SignalName.WindowClosed); } private void OnCloseButtonPressed() { Visible = false; ToggleButton.ButtonPressed = false; + EmitSignal(SignalName.WindowClosed); } } diff --git a/Scenes/PopUpWindow/PopUpWindow.tscn b/Scenes/PopUpWindow/PopUpWindow.tscn index 9dba5bb5..73e6946a 100644 --- a/Scenes/PopUpWindow/PopUpWindow.tscn +++ b/Scenes/PopUpWindow/PopUpWindow.tscn @@ -1,17 +1,19 @@ -[gd_scene load_steps=3 format=3 uid="uid://cpu4bmee8crlg"] +[gd_scene load_steps=5 format=3 uid="uid://cpu4bmee8crlg"] [ext_resource type="Script" path="res://Scenes/PopUpWindow/PopUpWindow.cs" id="1_jmlt2"] [ext_resource type="Texture2D" uid="uid://cag00ywoyr8q7" path="res://Scenes/PopUpWindow/window.png" id="1_u8fof"] +[ext_resource type="Texture2D" uid="uid://bwofnv3cggxhh" path="res://Scenes/PopUpWindow/ExitButton.png" id="3_guuwr"] +[ext_resource type="Theme" uid="uid://b2f4xgnx0xy5e" path="res://Scenes/Assets/Themes/MainTheme.tres" id="3_nygil"] [node name="PopUpWindow" type="Control"] layout_mode = 3 -anchor_right = 0.295833 -anchor_bottom = 0.300926 -offset_bottom = -3.05176e-05 +anchor_right = 0.501953 +anchor_bottom = 0.41276 +offset_right = 61.0001 +offset_bottom = 51.0003 grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_jmlt2") -metadata/_edit_use_anchors_ = true [node name="NinePatchRect" type="NinePatchRect" parent="."] texture_filter = 1 @@ -21,63 +23,146 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +mouse_filter = 1 texture = ExtResource("1_u8fof") patch_margin_left = 28 patch_margin_top = 28 patch_margin_right = 28 patch_margin_bottom = 28 -metadata/_edit_use_anchors_ = true -[node name="VBoxContainer" type="VBoxContainer" parent="NinePatchRect"] +[node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 1 -anchors_preset = -1 -anchor_left = 0.0528169 -anchor_top = 0.0923077 -anchor_right = 0.950704 -anchor_bottom = 0.907692 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = -0.999878 +offset_bottom = 0.000366211 grow_horizontal = 2 grow_vertical = 2 +theme_override_constants/margin_left = 35 +theme_override_constants/margin_top = 28 +theme_override_constants/margin_right = 28 +theme_override_constants/margin_bottom = 28 + +[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer"] +layout_mode = 2 +horizontal_scroll_mode = 0 +vertical_scroll_mode = 3 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/ScrollContainer"] +layout_mode = 2 metadata/_edit_use_anchors_ = true -[node name="tip1" type="Label" parent="NinePatchRect/VBoxContainer"] +[node name="Segment" type="Control" parent="MarginContainer/ScrollContainer/VBoxContainer"] +custom_minimum_size = Vector2(518, 35) layout_mode = 2 -text = "left click and hold to drag components" +mouse_filter = 1 -[node name="tip2" type="Label" parent="NinePatchRect/VBoxContainer"] +[node name="tip1" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer/Segment"] +custom_minimum_size = Vector2(518, 0) layout_mode = 2 -text = "right click on component to rotate -" +offset_right = 3440.0 +offset_bottom = 233.0 +grow_horizontal = 2 +grow_vertical = 2 +scale = Vector2(0.15, 0.15) +mouse_filter = 1 +theme = ExtResource("3_nygil") +text = "left click the component in toolbar to use it" +autowrap_mode = 2 -[node name="tip3" type="Label" parent="NinePatchRect/VBoxContainer"] +[node name="Segment2" type="Control" parent="MarginContainer/ScrollContainer/VBoxContainer"] +custom_minimum_size = Vector2(518, 35) layout_mode = 2 -text = "click middle mouse button to delet components +mouse_filter = 1 + +[node name="tip1" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer/Segment2"] +layout_mode = 2 +offset_top = -4.0 +offset_right = 3460.0 +offset_bottom = 409.0 +grow_horizontal = 2 +grow_vertical = 2 +scale = Vector2(0.15, 0.15) +mouse_filter = 1 +theme = ExtResource("3_nygil") +text = "left click to place one component, +left click and drag to place multiple. " +autowrap_mode = 2 -[node name="tip4" type="Label" parent="NinePatchRect/VBoxContainer"] +[node name="Segment3" type="Control" parent="MarginContainer/ScrollContainer/VBoxContainer"] +custom_minimum_size = Vector2(518, 35) layout_mode = 2 +mouse_filter = 1 + +[node name="tip1" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer/Segment3"] +layout_mode = 2 +offset_top = 20.0 +offset_right = 3440.0 +offset_bottom = 433.0 +grow_horizontal = 2 +grow_vertical = 2 +scale = Vector2(0.15, 0.15) +mouse_filter = 1 +theme = ExtResource("3_nygil") +text = "click middle mouse button to delete the components" +autowrap_mode = 2 + +[node name="Segment4" type="Control" parent="MarginContainer/ScrollContainer/VBoxContainer"] +custom_minimum_size = Vector2(518, 35) +layout_mode = 2 +mouse_filter = 1 + +[node name="tip1" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer/Segment4"] +layout_mode = 2 +offset_top = 41.0 +offset_right = 3440.0 +offset_bottom = 274.0 +grow_horizontal = 2 +grow_vertical = 2 +scale = Vector2(0.15, 0.15) +mouse_filter = 1 +theme = ExtResource("3_nygil") text = "right click and hold to pan" +autowrap_mode = 2 + +[node name="Segment5" type="Control" parent="MarginContainer/ScrollContainer/VBoxContainer"] +custom_minimum_size = Vector2(518, 35) +layout_mode = 2 +mouse_filter = 1 -[node name="tip5" type="Label" parent="NinePatchRect/VBoxContainer"] +[node name="tip1" type="Label" parent="MarginContainer/ScrollContainer/VBoxContainer/Segment5"] layout_mode = 2 +offset_top = 37.0 +offset_right = 3440.0 +offset_bottom = 270.0 +grow_horizontal = 2 +grow_vertical = 2 +scale = Vector2(0.15, 0.15) +mouse_filter = 1 +theme = ExtResource("3_nygil") text = "scroll to zoom" +autowrap_mode = 2 -[node name="Button" type="Button" parent="NinePatchRect"] +[node name="Button" type="Button" parent="."] texture_filter = 1 layout_mode = 1 -anchors_preset = -1 +anchors_preset = 1 anchor_left = 1.0 -anchor_top = 1.0 anchor_right = 1.0 -anchor_bottom = 1.0 -offset_left = -129.0 -offset_top = -84.0 -offset_right = -79.0 -offset_bottom = -53.0 +offset_left = -33.0 +offset_top = -8.0 +offset_right = -5.0 +offset_bottom = 23.0 grow_horizontal = 0 -grow_vertical = 0 scale = Vector2(1.5, 1.5) -text = "Close" +focus_mode = 0 +mouse_filter = 1 +text = " +" +icon = ExtResource("3_guuwr") flat = true -[connection signal="pressed" from="NinePatchRect/Button" to="." method="OnCloseButtonPressed"] -[connection signal="toggled" from="NinePatchRect/Button" to="." method="_on_button_toggled"] +[connection signal="pressed" from="Button" to="." method="OnCloseButtonPressed"] +[connection signal="toggled" from="Button" to="." method="_on_button_toggled"] diff --git a/Scenes/PopUpWindow/window.png b/Scenes/PopUpWindow/window.png index b8a097c4..2330550b 100644 Binary files a/Scenes/PopUpWindow/window.png and b/Scenes/PopUpWindow/window.png differ diff --git a/Scenes/RightClickMenu/BlueInputIcon.png b/Scenes/RightClickMenu/BlueInputIcon.png new file mode 100644 index 00000000..48b0df82 Binary files /dev/null and b/Scenes/RightClickMenu/BlueInputIcon.png differ diff --git a/Scenes/RightClickMenu/ExitButton.png.import b/Scenes/RightClickMenu/BlueInputIcon.png.import similarity index 66% rename from Scenes/RightClickMenu/ExitButton.png.import rename to Scenes/RightClickMenu/BlueInputIcon.png.import index e508f3f1..2527fcf9 100644 --- a/Scenes/RightClickMenu/ExitButton.png.import +++ b/Scenes/RightClickMenu/BlueInputIcon.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://do8y035em52gm" -path="res://.godot/imported/ExitButton.png-a226ab88421c3a065cf5ed5f55367c82.ctex" +uid="uid://civbgw8ohuxul" +path="res://.godot/imported/BlueInputIcon.png-2d776c8c9ab14df9d8da35743bd2bac2.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Scenes/RightClickMenu/ExitButton.png" -dest_files=["res://.godot/imported/ExitButton.png-a226ab88421c3a065cf5ed5f55367c82.ctex"] +source_file="res://Scenes/RightClickMenu/BlueInputIcon.png" +dest_files=["res://.godot/imported/BlueInputIcon.png-2d776c8c9ab14df9d8da35743bd2bac2.ctex"] [params] diff --git a/Scenes/RightClickMenu/ControlMenu.tscn b/Scenes/RightClickMenu/ControlMenu.tscn new file mode 100644 index 00000000..6248abfc --- /dev/null +++ b/Scenes/RightClickMenu/ControlMenu.tscn @@ -0,0 +1,227 @@ +[gd_scene load_steps=14 format=3 uid="uid://dx13abdux2230"] + +[ext_resource type="Script" path="res://Scenes/RightClickMenu/SimpleControlMenu.cs" id="1_52xip"] +[ext_resource type="Texture2D" uid="uid://bnhwsteqou1xj" path="res://Scenes/RightClickMenu/ExternalOutputIcon.png" id="4_bggqw"] +[ext_resource type="Texture2D" uid="uid://1g5psmv4aj8a" path="res://Scenes/RightClickMenu/RedInputIcon.png" id="4_dyqqw"] +[ext_resource type="PackedScene" uid="uid://cbnwjaf2rjctr" path="res://Scenes/RightClickMenu/Sections/slider_section.tscn" id="4_lktol"] +[ext_resource type="ButtonGroup" uid="uid://cxi5vciu5p82o" path="res://Scenes/RightClickMenu/InputModeSelectionButtonGroup.tres" id="4_p1asi"] +[ext_resource type="PackedScene" uid="uid://bibqhya7kmikv" path="res://Scenes/RightClickMenu/Sections/info_section.tscn" id="5_50guf"] +[ext_resource type="Texture2D" uid="uid://cab2i6pa52wbr" path="res://Scenes/RightClickMenu/GreenInputIcon.png" id="5_aecc8"] +[ext_resource type="Texture2D" uid="uid://civbgw8ohuxul" path="res://Scenes/RightClickMenu/BlueInputIcon.png" id="6_hkhch"] +[ext_resource type="Texture2D" uid="uid://bseakecs4865n" path="res://Scenes/RightClickMenu/Body.png" id="8_7xmtp"] + +[sub_resource type="Curve" id="Curve_dlfrx"] +_data = [Vector2(0, 0), 0.0, 3.40635, 0, 0, Vector2(0.996078, 1), 0.0730049, 0.0, 0, 0] +point_count = 2 + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ko678"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.6, 0.6, 0.6, 0) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.8, 0.8, 0.8, 0) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vhgit"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.6, 0.6, 0.6, 0) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.8, 0.8, 0.8, 0) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_liije"] +content_margin_left = 4.0 +content_margin_top = 4.0 +content_margin_right = 4.0 +content_margin_bottom = 4.0 +bg_color = Color(0.6, 0.6, 0.6, 0) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.8, 0.8, 0.8, 0) +corner_radius_top_left = 20 +corner_radius_top_right = 20 +corner_radius_bottom_right = 20 +corner_radius_bottom_left = 20 +anti_aliasing = false + +[node name="ControlMenu" type="Control"] +light_mask = 0 +texture_filter = 1 +layout_mode = 3 +anchors_preset = 0 +size_flags_horizontal = 0 +mouse_filter = 1 +script = ExtResource("1_52xip") +ButtonGroup = ExtResource("4_p1asi") +animationCurve = SubResource("Curve_dlfrx") + +[node name="ControlMenu" type="Control" parent="."] +custom_minimum_size = Vector2(200, 100) +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -200.0 +offset_bottom = 100.0 +grow_horizontal = 0 + +[node name="Body" type="NinePatchRect" parent="ControlMenu"] +modulate = Color(1, 1, 1, 0.784314) +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +mouse_filter = 1 +texture = ExtResource("8_7xmtp") +region_rect = Rect2(0, 0, 128, 128) +patch_margin_left = 3 +patch_margin_right = 3 +patch_margin_bottom = 20 + +[node name="SectionContainer" type="VBoxContainer" parent="ControlMenu"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 0 + +[node name="HBoxContainer" type="HBoxContainer" parent="ControlMenu/SectionContainer"] +layout_mode = 2 +theme_override_constants/separation = 2 +alignment = 1 + +[node name="Red" type="Button" parent="ControlMenu/SectionContainer/HBoxContainer"] +layout_mode = 2 +focus_mode = 0 +mouse_filter = 1 +theme_override_colors/icon_normal_color = Color(1, 1, 1, 0.588235) +theme_override_colors/icon_pressed_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_pressed_color = Color(1, 1, 1, 0.705882) +theme_override_styles/normal = SubResource("StyleBoxFlat_ko678") +theme_override_styles/hover = SubResource("StyleBoxFlat_vhgit") +theme_override_styles/pressed = SubResource("StyleBoxFlat_liije") +toggle_mode = true +button_group = ExtResource("4_p1asi") +icon = ExtResource("4_dyqqw") +icon_alignment = 1 + +[node name="Green" type="Button" parent="ControlMenu/SectionContainer/HBoxContainer"] +layout_mode = 2 +focus_mode = 0 +mouse_filter = 1 +theme_override_colors/icon_normal_color = Color(1, 1, 1, 0.588235) +theme_override_colors/icon_pressed_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_pressed_color = Color(1, 1, 1, 0.705882) +theme_override_styles/normal = SubResource("StyleBoxFlat_ko678") +theme_override_styles/hover = SubResource("StyleBoxFlat_vhgit") +theme_override_styles/pressed = SubResource("StyleBoxFlat_liije") +toggle_mode = true +button_group = ExtResource("4_p1asi") +icon = ExtResource("5_aecc8") + +[node name="Blue" type="Button" parent="ControlMenu/SectionContainer/HBoxContainer"] +layout_mode = 2 +focus_mode = 0 +mouse_filter = 1 +theme_override_colors/icon_normal_color = Color(1, 1, 1, 0.588235) +theme_override_colors/icon_pressed_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_pressed_color = Color(1, 1, 1, 0.705882) +theme_override_styles/normal = SubResource("StyleBoxFlat_ko678") +theme_override_styles/hover = SubResource("StyleBoxFlat_vhgit") +theme_override_styles/pressed = SubResource("StyleBoxFlat_liije") +toggle_mode = true +button_group = ExtResource("4_p1asi") +icon = ExtResource("6_hkhch") + +[node name="Input" type="Button" parent="ControlMenu/SectionContainer/HBoxContainer"] +layout_mode = 2 +focus_mode = 0 +mouse_filter = 1 +theme_override_colors/icon_normal_color = Color(1, 1, 1, 0.588235) +theme_override_colors/icon_pressed_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_color = Color(1, 1, 1, 1) +theme_override_colors/icon_hover_pressed_color = Color(1, 1, 1, 0.705882) +theme_override_styles/normal = SubResource("StyleBoxFlat_ko678") +theme_override_styles/hover = SubResource("StyleBoxFlat_vhgit") +theme_override_styles/pressed = SubResource("StyleBoxFlat_liije") +toggle_mode = true +button_group = ExtResource("4_p1asi") +icon = ExtResource("4_bggqw") + +[node name="OutputMenu" type="Control" parent="ControlMenu/SectionContainer"] +unique_name_in_owner = true +visible = false +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +mouse_filter = 1 + +[node name="Power" parent="ControlMenu/SectionContainer/OutputMenu" instance=ExtResource("5_50guf")] +layout_mode = 2 +offset_right = 200.0 +offset_bottom = 20.0 +metadata/_edit_vertical_guides_ = [237.0] + +[node name="PhaseShift" parent="ControlMenu/SectionContainer/OutputMenu" instance=ExtResource("5_50guf")] +layout_mode = 2 +offset_top = 20.0 +offset_right = 200.0 +offset_bottom = 40.0 +metadata/_edit_vertical_guides_ = [237.0] + +[node name="PointerToPort" type="Line2D" parent="ControlMenu/SectionContainer/OutputMenu"] +position = Vector2(200, -49) +points = PackedVector2Array(0, 1, 7, 1, 17, 10) +width = 6.0 +default_color = Color(0.760784, 0.658824, 0.254902, 1) + +[node name="InputMenu" type="Control" parent="ControlMenu/SectionContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(0, 40) +layout_mode = 2 +mouse_filter = 1 + +[node name="SliderSection" parent="ControlMenu/SectionContainer/InputMenu" instance=ExtResource("4_lktol")] +layout_mode = 1 +anchors_preset = -1 +anchor_top = -0.125 +anchor_right = 1.0 +anchor_bottom = 1.125 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="PointerToPort" type="Line2D" parent="ControlMenu/SectionContainer/InputMenu"] +position = Vector2(200, -49) +points = PackedVector2Array(0, 1, 11, 1, 29, 17) +width = 6.0 +default_color = Color(0.760784, 0.658824, 0.254902, 1) + +[connection signal="mouse_entered" from="ControlMenu" to="." method="OnMouseEntered"] +[connection signal="mouse_exited" from="ControlMenu" to="." method="OnMouseExited"] diff --git a/Scenes/RightClickMenu/ExitButton.png b/Scenes/RightClickMenu/ExitButton.png deleted file mode 100644 index d6951cab..00000000 Binary files a/Scenes/RightClickMenu/ExitButton.png and /dev/null differ diff --git a/Scenes/RightClickMenu/ExternalOutputIcon.png b/Scenes/RightClickMenu/ExternalOutputIcon.png new file mode 100644 index 00000000..aef0095e Binary files /dev/null and b/Scenes/RightClickMenu/ExternalOutputIcon.png differ diff --git a/Scenes/RightClickMenu/SectionTextureOff.png.import b/Scenes/RightClickMenu/ExternalOutputIcon.png.import similarity index 65% rename from Scenes/RightClickMenu/SectionTextureOff.png.import rename to Scenes/RightClickMenu/ExternalOutputIcon.png.import index d67767e7..b6959af4 100644 --- a/Scenes/RightClickMenu/SectionTextureOff.png.import +++ b/Scenes/RightClickMenu/ExternalOutputIcon.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://q76vpqkoamcu" -path="res://.godot/imported/SectionTextureOff.png-f9e0bace97ca355fc4ce1a6a418104bf.ctex" +uid="uid://bnhwsteqou1xj" +path="res://.godot/imported/ExternalOutputIcon.png-3bdd3299ab51890b9df9de609cc49253.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Scenes/RightClickMenu/SectionTextureOff.png" -dest_files=["res://.godot/imported/SectionTextureOff.png-f9e0bace97ca355fc4ce1a6a418104bf.ctex"] +source_file="res://Scenes/RightClickMenu/ExternalOutputIcon.png" +dest_files=["res://.godot/imported/ExternalOutputIcon.png-3bdd3299ab51890b9df9de609cc49253.ctex"] [params] diff --git a/Scenes/RightClickMenu/GreenInputIcon.png b/Scenes/RightClickMenu/GreenInputIcon.png new file mode 100644 index 00000000..72687d35 Binary files /dev/null and b/Scenes/RightClickMenu/GreenInputIcon.png differ diff --git a/Scenes/RightClickMenu/PinButtonOff.png.import b/Scenes/RightClickMenu/GreenInputIcon.png.import similarity index 66% rename from Scenes/RightClickMenu/PinButtonOff.png.import rename to Scenes/RightClickMenu/GreenInputIcon.png.import index 8710643e..52b9b3b6 100644 --- a/Scenes/RightClickMenu/PinButtonOff.png.import +++ b/Scenes/RightClickMenu/GreenInputIcon.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://ds3bi6wq0upnc" -path="res://.godot/imported/PinButtonOff.png-263bfc96cc95cf5431ec0b2bdfa6dee5.ctex" +uid="uid://cab2i6pa52wbr" +path="res://.godot/imported/GreenInputIcon.png-59c0bfae7a4e38d2a48da696275e99d3.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Scenes/RightClickMenu/PinButtonOff.png" -dest_files=["res://.godot/imported/PinButtonOff.png-263bfc96cc95cf5431ec0b2bdfa6dee5.ctex"] +source_file="res://Scenes/RightClickMenu/GreenInputIcon.png" +dest_files=["res://.godot/imported/GreenInputIcon.png-59c0bfae7a4e38d2a48da696275e99d3.ctex"] [params] diff --git a/Scenes/RightClickMenu/InputModeSelectionButtonGroup.tres b/Scenes/RightClickMenu/InputModeSelectionButtonGroup.tres new file mode 100644 index 00000000..66579104 --- /dev/null +++ b/Scenes/RightClickMenu/InputModeSelectionButtonGroup.tres @@ -0,0 +1,3 @@ +[gd_resource type="ButtonGroup" format=3 uid="uid://cxi5vciu5p82o"] + +[resource] diff --git a/Scenes/RightClickMenu/PinButtonOff.png b/Scenes/RightClickMenu/PinButtonOff.png deleted file mode 100644 index 0f1174a5..00000000 Binary files a/Scenes/RightClickMenu/PinButtonOff.png and /dev/null differ diff --git a/Scenes/RightClickMenu/PinButtonOn.png b/Scenes/RightClickMenu/PinButtonOn.png deleted file mode 100644 index 14d5e3a1..00000000 Binary files a/Scenes/RightClickMenu/PinButtonOn.png and /dev/null differ diff --git a/Scenes/RightClickMenu/RedInputIcon.png b/Scenes/RightClickMenu/RedInputIcon.png new file mode 100644 index 00000000..35de8a67 Binary files /dev/null and b/Scenes/RightClickMenu/RedInputIcon.png differ diff --git a/Scenes/RightClickMenu/PinButtonOn.png.import b/Scenes/RightClickMenu/RedInputIcon.png.import similarity index 67% rename from Scenes/RightClickMenu/PinButtonOn.png.import rename to Scenes/RightClickMenu/RedInputIcon.png.import index 35b70647..3a028219 100644 --- a/Scenes/RightClickMenu/PinButtonOn.png.import +++ b/Scenes/RightClickMenu/RedInputIcon.png.import @@ -2,16 +2,16 @@ importer="texture" type="CompressedTexture2D" -uid="uid://cw41lh7tdi071" -path="res://.godot/imported/PinButtonOn.png-85629caee7bac1b5435148802ef0bf48.ctex" +uid="uid://1g5psmv4aj8a" +path="res://.godot/imported/RedInputIcon.png-d0467d83b5cab35a931b20cabc3ff4cc.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://Scenes/RightClickMenu/PinButtonOn.png" -dest_files=["res://.godot/imported/PinButtonOn.png-85629caee7bac1b5435148802ef0bf48.ctex"] +source_file="res://Scenes/RightClickMenu/RedInputIcon.png" +dest_files=["res://.godot/imported/RedInputIcon.png-d0467d83b5cab35a931b20cabc3ff4cc.ctex"] [params] diff --git a/Scenes/RightClickMenu/RightClickMenu.cs b/Scenes/RightClickMenu/RightClickMenu.cs deleted file mode 100644 index 24efdd38..00000000 --- a/Scenes/RightClickMenu/RightClickMenu.cs +++ /dev/null @@ -1,80 +0,0 @@ -using Godot; -using System; -using System.Diagnostics; - -public partial class RightClickMenu : CharacterBody2D -{ - bool dragging; - bool mouseIn = false; - Vector2 direction; - Vector2 newPosition; - float draggingDistance; - float draggingSpeed = 50; - - Area2D area; - - public override void _Ready() - { - area = GetChild(1); - area.MouseShapeEntered += (long shapeIdx) => - { - mouseIn = true; - Debug.Print("mouse entered"); - }; - - area.MouseShapeExited += (long shapeIdx) => { - mouseIn = false; - Debug.Print("mouse exited"); - }; - } - - - public override void _UnhandledInput(InputEvent @event) - { - if (@event is InputEventMouseButton mouseButton) { - if (mouseButton.IsPressed() && mouseIn) { - draggingDistance = Position.DistanceTo(GetViewport().GetMousePosition()); - direction = (GetViewport().GetMousePosition() - Position).Normalized(); - dragging = true; - newPosition = GetViewport().GetMousePosition() - Position - draggingDistance*direction; - } - else - { - dragging = false; - } - } - else if (@event is InputEventMouseMotion mouseMotion && dragging) - { - newPosition = GetViewport().GetMousePosition() - Position - draggingDistance * direction; - } - } - - - public override void _PhysicsProcess(double delta) - { - if (dragging) - { - Velocity = (newPosition - Position) * (new Vector2(draggingSpeed, draggingSpeed)); - MoveAndSlide(); - } - } - - - private void MouseEnteredInDragArea() - { - mouseIn = true; - Debug.Print("mouse entered"); - } - - - private void MouseExitedDragArea() - { - mouseIn = false; - Debug.Print("mouse exited"); - } - - -} - - - diff --git a/Scenes/RightClickMenu/RightClickMenu.tscn b/Scenes/RightClickMenu/RightClickMenu.tscn deleted file mode 100644 index 42090ace..00000000 --- a/Scenes/RightClickMenu/RightClickMenu.tscn +++ /dev/null @@ -1,340 +0,0 @@ -[gd_scene load_steps=10 format=3 uid="uid://tnmccvafekjl"] - -[ext_resource type="Script" path="res://Scenes/RightClickMenu/RightClickMenu.cs" id="1_egxol"] -[ext_resource type="Texture2D" uid="uid://bseakecs4865n" path="res://Scenes/RightClickMenu/Body.png" id="2_0xr5l"] -[ext_resource type="Texture2D" uid="uid://cxa7n5a2grbq6" path="res://Scenes/RightClickMenu/TopBar.png" id="3_it7mt"] -[ext_resource type="Texture2D" uid="uid://do8y035em52gm" path="res://Scenes/RightClickMenu/ExitButton.png" id="4_mrron"] -[ext_resource type="Theme" uid="uid://b2f4xgnx0xy5e" path="res://Scenes/Assets/Themes/MainTheme.tres" id="5_fel5w"] -[ext_resource type="Texture2D" uid="uid://q76vpqkoamcu" path="res://Scenes/RightClickMenu/SectionTextureOff.png" id="6_rd3o7"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_tyuhw"] -bg_color = Color(0.733333, 0.580392, 0, 1) -border_width_left = 2 -border_width_top = 2 -border_width_right = 2 -border_width_bottom = 2 -border_color = Color(0.380392, 0.329412, 0, 1) -corner_radius_top_left = 2 -corner_radius_top_right = 2 -corner_radius_bottom_right = 2 -corner_radius_bottom_left = 2 -anti_aliasing = false - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_xc2v1"] -size = Vector2(211, 25) - -[sub_resource type="RectangleShape2D" id="RectangleShape2D_00a0n"] -size = Vector2(174, 18) - -[node name="RightClickMenu" type="CharacterBody2D"] -script = ExtResource("1_egxol") -metadata/_edit_vertical_guides_ = [231.0] - -[node name="Window" type="Control" parent="."] -texture_filter = 1 -layout_mode = 3 -anchors_preset = 0 -offset_right = 237.0 -offset_bottom = 292.0 -mouse_filter = 1 - -[node name="WindowHeader" type="Control" parent="Window"] -custom_minimum_size = Vector2(10, 0) -layout_mode = 2 -anchors_preset = 0 -anchor_right = 1.0 -anchor_bottom = 0.086 -offset_bottom = -0.112001 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 1 -metadata/_edit_use_anchors_ = true - -[node name="Header" type="NinePatchRect" parent="Window/WindowHeader"] -layout_mode = 1 -anchors_preset = -1 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -mouse_filter = 1 -texture = ExtResource("3_it7mt") -region_rect = Rect2(0, 0, 128, 32) -patch_margin_left = 4 -patch_margin_top = 9 -metadata/_edit_use_anchors_ = true - -[node name="TextureButton" type="TextureButton" parent="Window/WindowHeader"] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -28.0 -offset_bottom = 25.0 -grow_horizontal = 0 -mouse_filter = 1 -texture_normal = ExtResource("4_mrron") -ignore_texture_size = true -stretch_mode = 4 - -[node name="BodyContainer" type="Control" parent="Window"] -layout_mode = 2 -anchors_preset = 0 -anchor_top = 0.0853081 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_vertical = 3 -mouse_filter = 1 -metadata/_edit_use_anchors_ = true - -[node name="Body" type="NinePatchRect" parent="Window/BodyContainer"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -mouse_filter = 1 -texture = ExtResource("2_0xr5l") -region_rect = Rect2(0, 0, 128, 128) -patch_margin_left = 3 -patch_margin_right = 3 -patch_margin_bottom = 20 -metadata/_edit_use_anchors_ = true - -[node name="SectionContainer" type="VBoxContainer" parent="Window/BodyContainer"] -unique_name_in_owner = true -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/separation = 0 -metadata/_edit_use_anchors_ = true - -[node name="ToggleSection" type="Control" parent="Window/BodyContainer/SectionContainer"] -custom_minimum_size = Vector2(0, 40) -layout_mode = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="Window/BodyContainer/SectionContainer/ToggleSection"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/separation = 0 - -[node name="Title" type="Control" parent="Window/BodyContainer/SectionContainer/ToggleSection/VBoxContainer"] -custom_minimum_size = Vector2(0, 20) -layout_mode = 2 - -[node name="MarginContainer" type="MarginContainer" parent="Window/BodyContainer/SectionContainer/ToggleSection/VBoxContainer/Title"] -layout_mode = 1 -offset_right = 415.0 -offset_bottom = 205.0 -scale = Vector2(0.1, 0.1) -theme_override_constants/margin_left = 60 -theme_override_constants/margin_top = 0 - -[node name="Title" type="Label" parent="Window/BodyContainer/SectionContainer/ToggleSection/VBoxContainer/Title/MarginContainer"] -layout_mode = 2 -size_flags_horizontal = 0 -theme = ExtResource("5_fel5w") -text = "Toggle Section:" - -[node name="Body" type="Control" parent="Window/BodyContainer/SectionContainer/ToggleSection/VBoxContainer"] -custom_minimum_size = Vector2(0, 20) -layout_mode = 2 - -[node name="MarginContainer" type="MarginContainer" parent="Window/BodyContainer/SectionContainer/ToggleSection/VBoxContainer/Body"] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -35.0 -offset_top = -4.90995 -offset_bottom = 25.09 -grow_horizontal = 0 -theme_override_constants/margin_top = 7 -theme_override_constants/margin_right = 5 -theme_override_constants/margin_bottom = 7 - -[node name="Button" type="Button" parent="Window/BodyContainer/SectionContainer/ToggleSection/VBoxContainer/Body/MarginContainer"] -layout_mode = 2 -theme_override_styles/normal = SubResource("StyleBoxFlat_tyuhw") - -[node name="Title" type="Label" parent="Window/BodyContainer/SectionContainer/ToggleSection/VBoxContainer/Body"] -layout_mode = 2 -offset_left = 6.0 -offset_top = -1.90995 -offset_right = 1526.0 -offset_bottom = 203.09 -scale = Vector2(0.1, 0.1) -theme = ExtResource("5_fel5w") -theme_override_font_sizes/font_size = 0 -text = "Value" - -[node name="OnOffSection" type="Control" parent="Window/BodyContainer/SectionContainer"] -custom_minimum_size = Vector2(0, 40) -layout_mode = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="Window/BodyContainer/SectionContainer/OnOffSection"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/separation = 0 - -[node name="Title" type="Control" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer"] -custom_minimum_size = Vector2(0, 20) -layout_mode = 2 - -[node name="MarginContainer" type="MarginContainer" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer/Title"] -layout_mode = 1 -offset_right = 415.0 -offset_bottom = 205.0 -scale = Vector2(0.1, 0.1) -theme_override_constants/margin_left = 60 -theme_override_constants/margin_top = 0 - -[node name="Title" type="Label" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer/Title/MarginContainer"] -layout_mode = 2 -size_flags_horizontal = 0 -theme = ExtResource("5_fel5w") -text = "On/Off Section:" - -[node name="Body" type="Control" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer"] -custom_minimum_size = Vector2(0, 20) -layout_mode = 2 - -[node name="Title" type="Label" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer/Body"] -layout_mode = 2 -offset_left = 35.0 -offset_top = -0.819916 -offset_right = 1555.0 -offset_bottom = 204.18 -scale = Vector2(0.1, 0.1) -theme = ExtResource("5_fel5w") -theme_override_font_sizes/font_size = 0 -text = "Off" - -[node name="MarginContainer" type="MarginContainer" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer/Body"] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -35.0 -offset_top = -3.90996 -offset_bottom = 26.09 -grow_horizontal = 0 -theme_override_constants/margin_top = 7 -theme_override_constants/margin_right = 5 -theme_override_constants/margin_bottom = 7 - -[node name="Button" type="Button" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer/Body/MarginContainer"] -layout_mode = 2 -theme_override_styles/normal = SubResource("StyleBoxFlat_tyuhw") - -[node name="TextureRect" type="TextureRect" parent="Window/BodyContainer/SectionContainer/OnOffSection/VBoxContainer/Body"] -layout_mode = 0 -offset_left = 12.0 -offset_top = 2.18008 -offset_right = 28.0 -offset_bottom = 18.1801 -texture = ExtResource("6_rd3o7") -expand_mode = 1 - -[node name="ScrollSection" type="Control" parent="Window/BodyContainer/SectionContainer"] -custom_minimum_size = Vector2(0, 50) -layout_mode = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="Window/BodyContainer/SectionContainer/ScrollSection"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -theme_override_constants/separation = 0 - -[node name="Title" type="Control" parent="Window/BodyContainer/SectionContainer/ScrollSection/VBoxContainer"] -custom_minimum_size = Vector2(0, 20) -layout_mode = 2 - -[node name="MarginContainer" type="MarginContainer" parent="Window/BodyContainer/SectionContainer/ScrollSection/VBoxContainer/Title"] -layout_mode = 1 -offset_right = 415.0 -offset_bottom = 205.0 -scale = Vector2(0.1, 0.1) -theme_override_constants/margin_left = 60 -theme_override_constants/margin_top = 0 - -[node name="Title" type="Label" parent="Window/BodyContainer/SectionContainer/ScrollSection/VBoxContainer/Title/MarginContainer"] -layout_mode = 2 -size_flags_horizontal = 0 -theme = ExtResource("5_fel5w") -text = "Scroll Bar Section:" - -[node name="Body" type="Control" parent="Window/BodyContainer/SectionContainer/ScrollSection/VBoxContainer"] -custom_minimum_size = Vector2(0, 30) -layout_mode = 2 - -[node name="Title" type="Label" parent="Window/BodyContainer/SectionContainer/ScrollSection/VBoxContainer/Body"] -layout_mode = 2 -offset_left = 6.0 -offset_top = -3.90996 -offset_right = 1706.0 -offset_bottom = 201.09 -scale = Vector2(0.1, 0.1) -theme = ExtResource("5_fel5w") -text = "Value" - -[node name="HScrollBar" type="HScrollBar" parent="Window/BodyContainer/SectionContainer/ScrollSection/VBoxContainer/Body"] -layout_mode = 0 -offset_left = 6.0 -offset_top = 17.09 -offset_right = 231.0 -offset_bottom = 25.09 - -[node name="InfoSection" type="Control" parent="Window/BodyContainer/SectionContainer"] -custom_minimum_size = Vector2(0, 20) -layout_mode = 2 - -[node name="Title" type="Control" parent="Window/BodyContainer/SectionContainer/InfoSection"] -custom_minimum_size = Vector2(0, 20) -layout_mode = 2 -anchors_preset = 0 -offset_right = 237.0 -offset_bottom = 20.0 - -[node name="MarginContainer" type="MarginContainer" parent="Window/BodyContainer/SectionContainer/InfoSection/Title"] -layout_mode = 1 -offset_right = 2310.0 -offset_bottom = 205.0 -scale = Vector2(0.1, 0.1) -theme_override_constants/margin_left = 60 -theme_override_constants/margin_top = 0 -theme_override_constants/margin_right = 60 - -[node name="Title" type="Label" parent="Window/BodyContainer/SectionContainer/InfoSection/Title/MarginContainer"] -layout_mode = 2 -size_flags_horizontal = 0 -theme = ExtResource("5_fel5w") -text = "Title: Value" - -[node name="Area2D" type="Area2D" parent="."] -disable_mode = 2 - -[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2(105.5, 12.5) -shape = SubResource("RectangleShape2D_xc2v1") - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -visible = false -position = Vector2(87, 9) -shape = SubResource("RectangleShape2D_00a0n") diff --git a/Scenes/RightClickMenu/SectionTextureOff.ase b/Scenes/RightClickMenu/SectionTextureOff.ase deleted file mode 100644 index 36d3c27f..00000000 Binary files a/Scenes/RightClickMenu/SectionTextureOff.ase and /dev/null differ diff --git a/Scenes/RightClickMenu/SectionTextureOff.png b/Scenes/RightClickMenu/SectionTextureOff.png deleted file mode 100644 index 0ac0e1ae..00000000 Binary files a/Scenes/RightClickMenu/SectionTextureOff.png and /dev/null differ diff --git a/Scenes/RightClickMenu/Sections/ISection.cs b/Scenes/RightClickMenu/Sections/ISection.cs new file mode 100644 index 00000000..85b21629 --- /dev/null +++ b/Scenes/RightClickMenu/Sections/ISection.cs @@ -0,0 +1,47 @@ +using Godot; +using System; +using System.ComponentModel; +using System.Diagnostics; +namespace ConnectAPIC.Scenes.RightClickMenu.Sections { + public abstract partial class ISection : Node, INotifyPropertyChanged { + //To notify if some property of section changed (like if button is pressed to toggle) + public event PropertyChangedEventHandler PropertyChanged; + private String _title; + private String _value; + private bool ready = false; + public String Title { + get => _title; + set { + _title = value; + if (ready) + titleLabel.Text = value; + } + } + public String Value { + get => _value; + set { + _value = value; + if (ready) + valueLabel.Text = value; + } + } + + public PropertyChangedEventHandler PropertyChangeHandler { get; set; } + + private Label titleLabel; + private Label valueLabel; + + public override void _Ready() { + titleLabel = GetNode