diff --git a/.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.md5 b/.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.md5 new file mode 100644 index 00000000..0160b85a --- /dev/null +++ b/.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.md5 @@ -0,0 +1,3 @@ +source_md5="5af8d800314babecccc487fe554ad7c9" +dest_md5="6fdb71a36f05c72dc727140ad9a18232" + diff --git a/.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.stex b/.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.stex new file mode 100644 index 00000000..3ab8473e Binary files /dev/null and b/.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.stex differ diff --git a/.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.md5 b/.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.md5 new file mode 100644 index 00000000..5ac8c850 --- /dev/null +++ b/.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.md5 @@ -0,0 +1,3 @@ +source_md5="a5c32aa00d965ca952623d1b3fe45610" +dest_md5="5377adfcfa3dabf2693b9ab22d876fc9" + diff --git a/.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.stex b/.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.stex new file mode 100644 index 00000000..a5b9c0cf Binary files /dev/null and b/.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.stex differ diff --git a/assets/05_map/adminIcon.png b/assets/05_map/adminIcon.png index 83db6d1f..b75d131a 100644 Binary files a/assets/05_map/adminIcon.png and b/assets/05_map/adminIcon.png differ diff --git a/assets/05_map/adminIcon.png.import b/assets/05_map/adminIcon.png.import new file mode 100644 index 00000000..6f012588 --- /dev/null +++ b/assets/05_map/adminIcon.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/05_map/adminIcon.png" +dest_files=[ "res://.import/adminIcon.png-3688bd3c074b54dd0cdc871d8dcdd8ce.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/assets/05_map/breweryIcon.png b/assets/05_map/breweryIcon.png index 78653342..a55e4e7a 100644 Binary files a/assets/05_map/breweryIcon.png and b/assets/05_map/breweryIcon.png differ diff --git a/assets/05_map/breweryIcon.png.import b/assets/05_map/breweryIcon.png.import new file mode 100644 index 00000000..50c348ec --- /dev/null +++ b/assets/05_map/breweryIcon.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/05_map/breweryIcon.png" +dest_files=[ "res://.import/breweryIcon.png-342c5fb510f55800453b35945f1f0115.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/assets/wasd.aseprite b/assets/06_UI_menus/wasd.aseprite similarity index 100% rename from assets/wasd.aseprite rename to assets/06_UI_menus/wasd.aseprite diff --git a/scenes/Notebook/Map.tscn b/scenes/Notebook/Map.tscn index 384f63f5..0d1f0a06 100644 --- a/scenes/Notebook/Map.tscn +++ b/scenes/Notebook/Map.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://scenes/Notebook/MapIcon.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/05_map/map.png" type="Texture" id=2] @@ -13,8 +13,10 @@ [ext_resource path="res://assets/05_map/adminIcon.png" type="Texture" id=11] [ext_resource path="res://assets/05_map/casinoIcon-hover-export.png" type="Texture" id=12] [ext_resource path="res://assets/05_map/breweryIcon-Hover.png" type="Texture" id=13] +[ext_resource path="res://src/Map.cs" type="Script" id=14] [node name="Map" type="Node2D"] +script = ExtResource( 14 ) [node name="Map" type="Sprite" parent="."] position = Vector2( 224, 132 ) @@ -72,11 +74,14 @@ id = "Brasserie/Brasserie" text = "" [node name="brasserie_button" parent="." instance=ExtResource( 1 )] -margin_left = 120.0 -margin_top = 88.0 -margin_right = 171.0 -margin_bottom = 98.0 +margin_left = 132.0 +margin_top = 86.0 +margin_right = 182.0 +margin_bottom = 102.0 +focus_neighbour_right = NodePath("../palud_button") +focus_neighbour_bottom = NodePath("../palud_button") texture_hover = ExtResource( 13 ) +texture_focused = ExtResource( 13 ) id = "Brasserie/Brasserie" [node name="moulin_button" parent="." instance=ExtResource( 1 )] @@ -84,8 +89,11 @@ margin_left = 163.0 margin_top = 199.0 margin_right = 208.0 margin_bottom = 214.0 +focus_neighbour_top = NodePath("../palud_button") +focus_neighbour_right = NodePath("../casino_button") texture_normal = ExtResource( 4 ) texture_hover = ExtResource( 3 ) +texture_focused = ExtResource( 3 ) id = "Flon/Flon" text = "Flon" @@ -94,8 +102,13 @@ margin_left = 190.0 margin_top = 124.0 margin_right = 234.0 margin_bottom = 148.0 +focus_neighbour_left = NodePath("../brasserie_button") +focus_neighbour_top = NodePath("../brasserie_button") +focus_neighbour_right = NodePath("../office_button") +focus_neighbour_bottom = NodePath("../moulin_button") texture_normal = ExtResource( 5 ) texture_hover = ExtResource( 10 ) +texture_focused = ExtResource( 10 ) id = "Palud/ProtoPalud" text = "Palud" @@ -104,8 +117,11 @@ margin_left = 263.0 margin_top = 204.0 margin_right = 331.0 margin_bottom = 227.0 +focus_neighbour_left = NodePath("../moulin_button") +focus_neighbour_top = NodePath("../office_button") texture_normal = ExtResource( 6 ) texture_hover = ExtResource( 12 ) +texture_focused = ExtResource( 12 ) id = "Casino/Casino" text = "Casino" @@ -115,10 +131,15 @@ texture = ExtResource( 8 ) [node name="office_button" parent="." instance=ExtResource( 1 )] margin_left = 269.0 -margin_top = 111.0 +margin_top = 113.0 margin_right = 336.0 -margin_bottom = 128.0 +margin_bottom = 130.0 +focus_neighbour_left = NodePath("../palud_button") +focus_neighbour_bottom = NodePath("../casino_button") texture_normal = ExtResource( 11 ) texture_hover = ExtResource( 9 ) +texture_focused = ExtResource( 9 ) id = "Intro/Intro" text = "Bureau" + +[connection signal="visibility_changed" from="." to="." method="_on_Map_visibility_changed"] diff --git a/src/Map.cs b/src/Map.cs index c09f4030..a331365a 100644 --- a/src/Map.cs +++ b/src/Map.cs @@ -1,51 +1,57 @@ -/* -Historically accurate educational video game based in 1830s Lausanne. -Copyright (C) 2021 GameLab UNIL-EPFL - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ using Godot; using System; public class Map : Node2D { - private bool hidden = true; - - private AudioStreamPlayer ASP; - private Sprite S; - + private TextureButton office; + private TextureButton brasserie; + private TextureButton moulin; + private TextureButton palud; + private TextureButton casino; + private Context context; + // Called when the node enters the scene tree for the first time. public override void _Ready() { - ASP = GetNode("../ButtonSound"); - S = GetNode("../TabMap"); + office = GetNode("office_button"); + brasserie = GetNode("brasserie_button"); + moulin = GetNode("moulin_button"); + palud = GetNode("palud_button"); + casino = GetNode("casino_button"); + context = GetNode("/root/Context"); + } - - public void _on_MapButton_pressed() { - if(ASP.Playing == false) { - ASP.Play(); - } - if(hidden) { - Show(); - S.Frame = 0; - } else { - Hide(); - S.Frame = 1; + + private void GrabFocusPos(Locations l) { + switch(l) { + case Locations.INTRO: + office.GrabFocus(); + break; + case Locations.PALUD: + palud.GrabFocus(); + break; + case Locations.CASINO: + casino.GrabFocus(); + break; + case Locations.BRASSERIE: + brasserie.GrabFocus(); + break; + case Locations.MOULIN: + case Locations.FLON: + moulin.GrabFocus(); + break; + default: + break; } - hidden = !hidden; } + + private void _on_Map_visibility_changed() { + if(Visible) { + GrabFocusPos(context._GetLocation()); + } + } } +