Odyssey is powered up!

This commit is contained in:
Hamcha 2020-07-10 02:09:54 +02:00
parent aca7f95a70
commit 7793ae2598
Signed by: hamcha
GPG key ID: 41467804B19A3315
18 changed files with 556 additions and 138 deletions

View file

@ -28,6 +28,18 @@ tracks/0/keys = {
"update": 0,
"values": [ Color( 0, 0, 0, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("computer/screen/Light2D:enabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=4]
length = 5.5
@ -45,6 +57,18 @@ tracks/0/keys = {
"update": 0,
"values": [ Color( 1, 1, 1, 1 ), Color( 0.682353, 0.682353, 0.682353, 1 ), Color( 1, 1, 1, 1 ), Color( 0.682353, 0.682353, 0.682353, 1 ), Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 1 ), Color( 0.584314, 0.584314, 0.584314, 1 ), Color( 1, 1, 1, 1 ), Color( 0.584314, 0.584314, 0.584314, 1 ), Color( 1, 1, 1, 1 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("computer/screen/Light2D:enabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ true ]
}
[sub_resource type="Animation" id=5]
length = 0.2
@ -115,7 +139,6 @@ region_enabled = true
region_rect = Rect2( 0, 0, 32, 32 )
[node name="screen" type="Sprite" parent="computer"]
modulate = Color( 0, 0, 0, 1 )
material = SubResource( 2 )
texture = ExtResource( 1 )
centered = false
@ -138,16 +161,14 @@ anims/fadein = SubResource( 5 )
anims/fadeout = SubResource( 6 )
[node name="Control" type="Node2D" parent="."]
modulate = Color( 1, 1, 1, 0 )
position = Vector2( 0, 10 )
z_index = 999
[node name="ControlComp" parent="Control" instance=ExtResource( 4 )]
visible = false
margin_left = -33.4261
margin_top = -72.3908
margin_right = 166.574
margin_bottom = 59.6092
margin_left = -42.0
margin_top = -58.0
margin_right = 193.0
margin_bottom = 47.0
rect_scale = Vector2( 0.5, 0.5 )
[node name="ActivationRange" type="Area2D" parent="."]

View file

@ -3,10 +3,10 @@ extends Control
onready var scene = $"/root/scene" as GameInstance
func _physics_process(_delta):
var speed_str = "(" + str(round(scene.world.map.current_ship_speed)) + " u/s)"
$Container/VelocityBox/HBoxContainer/CurrentSpeed.text = speed_str
var dir_str = "(" + str(round(rad2deg(scene.world.map.current_ship_direction))) + " deg)"
$Container/DirectionBox/HBoxContainer/CurrentDirection.text = dir_str
var speed_str = str(round(scene.world.map.current_ship_speed)) + " u/s"
$Container/VelocityBox/HBoxContainer3/CurrentSpeed.text = speed_str
var dir_str = str(round(rad2deg(scene.world.map.current_ship_direction))) + " deg"
$Container/VelocityBox/HBoxContainer2/CurrentDirection.text = dir_str
func _ship_velocity_changed(value):
scene.process_command(UICommand.new(UICommand.CommandType.SetShipSpeed, [value]))

View file

@ -7,9 +7,9 @@
[node name="ControlComp" type="Control"]
material = ExtResource( 4 )
margin_left = -100.0
margin_left = -121.0
margin_top = -150.0
margin_right = 100.0
margin_right = 121.0
margin_bottom = -20.0
mouse_filter = 1
script = ExtResource( 1 )
@ -20,11 +20,13 @@ __meta__ = {
[node name="TextureRect" type="TextureRect" parent="."]
material = ExtResource( 4 )
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -8.0
margin_top = 111.826
margin_top = -16.5409
margin_right = 8.27014
margin_bottom = 143.855
margin_bottom = 15.4881
texture = ExtResource( 2 )
stretch_mode = 3
__meta__ = {
@ -63,56 +65,7 @@ __meta__ = {
[node name="VelocityBox" type="VBoxContainer" parent="Container"]
material = ExtResource( 4 )
margin_right = 180.0
margin_bottom = 45.0
size_flags_horizontal = 3
size_flags_vertical = 3
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="Container/VelocityBox"]
margin_top = 3.0
margin_right = 180.0
margin_bottom = 21.0
custom_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ShipVelocityLabel" type="Label" parent="Container/VelocityBox/HBoxContainer"]
material = ExtResource( 4 )
margin_right = 88.0
margin_bottom = 18.0
mouse_filter = 1
theme = ExtResource( 3 )
text = "Ship velocity"
[node name="CurrentSpeed" type="Label" parent="Container/VelocityBox/HBoxContainer"]
material = ExtResource( 4 )
margin_left = 98.0
margin_right = 98.0
margin_bottom = 18.0
mouse_filter = 1
theme = ExtResource( 3 )
custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 )
[node name="HSlider" type="HSlider" parent="Container/VelocityBox"]
material = ExtResource( 4 )
margin_top = 25.0
margin_right = 180.0
margin_bottom = 41.0
mouse_filter = 1
max_value = 1000.0
value = 1000.0
tick_count = 10
ticks_on_borders = true
[node name="DirectionBox" type="VBoxContainer" parent="Container"]
material = ExtResource( 4 )
margin_top = 65.0
margin_right = 180.0
margin_right = 222.0
margin_bottom = 110.0
size_flags_horizontal = 3
size_flags_vertical = 3
@ -121,12 +74,98 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="Container/DirectionBox"]
margin_top = 3.0
margin_right = 180.0
margin_bottom = 21.0
[node name="HBoxContainer" type="HBoxContainer" parent="Container/VelocityBox"]
margin_top = 13.0
margin_right = 222.0
margin_bottom = 31.0
custom_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ShipDirectionLabel" type="Label" parent="Container/DirectionBox/HBoxContainer"]
[node name="ShipTarget" type="Label" parent="Container/VelocityBox/HBoxContainer"]
material = ExtResource( 4 )
margin_right = 98.0
margin_bottom = 18.0
mouse_filter = 1
theme = ExtResource( 3 )
text = "Current target"
[node name="CurrentTarget" type="Label" parent="Container/VelocityBox/HBoxContainer"]
material = ExtResource( 4 )
margin_left = 108.0
margin_right = 222.0
margin_bottom = 18.0
mouse_filter = 1
size_flags_horizontal = 3
theme = ExtResource( 3 )
custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 )
text = "2A.01/10"
align = 2
[node name="HBoxContainer4" type="HBoxContainer" parent="Container/VelocityBox"]
margin_top = 35.0
margin_right = 222.0
margin_bottom = 53.0
custom_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ShipTarget" type="Label" parent="Container/VelocityBox/HBoxContainer4"]
material = ExtResource( 4 )
margin_right = 110.0
margin_bottom = 18.0
mouse_filter = 1
theme = ExtResource( 3 )
text = "Current position"
[node name="CurrentPosition" type="Label" parent="Container/VelocityBox/HBoxContainer4"]
material = ExtResource( 4 )
margin_left = 120.0
margin_right = 222.0
margin_bottom = 18.0
mouse_filter = 1
size_flags_horizontal = 3
theme = ExtResource( 3 )
custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 )
text = "0A.00/00"
align = 2
[node name="HBoxContainer3" type="HBoxContainer" parent="Container/VelocityBox"]
margin_top = 57.0
margin_right = 222.0
margin_bottom = 75.0
custom_constants/separation = 10
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ShipVelocityLabel" type="Label" parent="Container/VelocityBox/HBoxContainer3"]
material = ExtResource( 4 )
margin_right = 88.0
margin_bottom = 18.0
mouse_filter = 1
theme = ExtResource( 3 )
text = "Ship velocity"
[node name="CurrentSpeed" type="Label" parent="Container/VelocityBox/HBoxContainer3"]
material = ExtResource( 4 )
margin_left = 98.0
margin_right = 222.0
margin_bottom = 18.0
mouse_filter = 1
size_flags_horizontal = 3
theme = ExtResource( 3 )
custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 )
align = 2
[node name="HBoxContainer2" type="HBoxContainer" parent="Container/VelocityBox"]
margin_top = 79.0
margin_right = 222.0
margin_bottom = 97.0
[node name="ShipDirectionLabel" type="Label" parent="Container/VelocityBox/HBoxContainer2"]
material = ExtResource( 4 )
margin_right = 94.0
margin_bottom = 18.0
@ -134,23 +173,13 @@ mouse_filter = 1
theme = ExtResource( 3 )
text = "Ship direction"
[node name="CurrentDirection" type="Label" parent="Container/DirectionBox/HBoxContainer"]
[node name="CurrentDirection" type="Label" parent="Container/VelocityBox/HBoxContainer2"]
material = ExtResource( 4 )
margin_left = 98.0
margin_right = 98.0
margin_right = 222.0
margin_bottom = 18.0
mouse_filter = 1
size_flags_horizontal = 3
theme = ExtResource( 3 )
custom_colors/font_color = Color( 0.494118, 0.52549, 0.737255, 1 )
[node name="HSlider" type="HSlider" parent="Container/DirectionBox"]
material = ExtResource( 4 )
margin_top = 25.0
margin_right = 180.0
margin_bottom = 41.0
mouse_filter = 1
max_value = 360.0
tick_count = 18
ticks_on_borders = true
[connection signal="value_changed" from="Container/VelocityBox/HSlider" to="." method="_ship_velocity_changed"]
[connection signal="value_changed" from="Container/DirectionBox/HSlider" to="." method="_ship_direction_changed"]
align = 2

View file

@ -10,10 +10,12 @@ export(Direction) var direction = Direction.DOWN setget set_direction
export var lit = true setget set_lit
onready var activationRange = $ActivationRange as ActivationRange
onready var manager = $PowerManager as PowerManager
func _ready():
if not Engine.editor_hint:
activationRange.visible = true
refresh_sprite()
func set_direction(dir):
direction = dir
@ -21,13 +23,13 @@ func set_direction(dir):
func set_lit(val):
lit = val
$Light2D.enabled = val
update_light()
refresh_sprite()
func refresh_sprite():
var rot = 0
var lit_offset = 0
if not lit:
if not lit or not (manager != null and manager.powered):
lit_offset = 32
match direction:
Direction.DOWN:
@ -52,3 +54,10 @@ func _input_event(_viewport, event, _shape_idx):
if event is InputEventMouseButton and event.pressed:
if activationRange.in_range():
set_lit(!lit)
func _power_status_changed(powered: bool) -> void:
update_light()
refresh_sprite()
func update_light():
$Light2D.enabled = lit and (manager != null and manager.powered)

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Graphics/light_shadow_light.png" type="Texture" id=1]
[ext_resource path="res://Graphics/tgstation/light.png" type="Texture" id=2]
[ext_resource path="res://Actors/Objects/Lightbulb/Lightbulb.gd" type="Script" id=3]
[ext_resource path="res://Actors/Components/ActivationRange.gd" type="Script" id=4]
[ext_resource path="res://Actors/Components/PowerManager.gd" type="Script" id=5]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 16 )
@ -20,9 +21,10 @@ shape = SubResource( 1 )
[node name="light" type="Sprite" parent="."]
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 32, 0, 32, 32 )
region_rect = Rect2( 32, 32, 32, 32 )
[node name="Light2D" type="Light2D" parent="."]
enabled = false
texture = ExtResource( 1 )
texture_scale = 3.5
energy = 1.2
@ -41,3 +43,9 @@ script = ExtResource( 4 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="ActivationRange"]
position = Vector2( 0, 16 )
shape = SubResource( 2 )
[node name="PowerManager" type="Node" parent="."]
script = ExtResource( 5 )
power_usage = 5.0
[connection signal="power_connected" from="PowerManager" to="." method="_power_status_changed" binds= [ true ]]
[connection signal="power_disconnected" from="PowerManager" to="." method="_power_status_changed" binds= [ false ]]

View file

@ -65,10 +65,12 @@ __meta__ = {
}
[node name="CurrentBox" type="VBoxContainer" parent="Container"]
material = ExtResource( 4 )
margin_right = 200.0
margin_bottom = 40.0
[node name="HBoxContainer" type="HBoxContainer" parent="Container/CurrentBox"]
material = ExtResource( 4 )
margin_right = 200.0
margin_bottom = 18.0
__meta__ = {
@ -76,6 +78,7 @@ __meta__ = {
}
[node name="Label" type="Label" parent="Container/CurrentBox/HBoxContainer"]
material = ExtResource( 4 )
margin_right = 102.0
margin_bottom = 18.0
mouse_filter = 1
@ -83,6 +86,7 @@ theme = ExtResource( 3 )
text = "Current charge"
[node name="CurrentChargeLabel" type="Label" parent="Container/CurrentBox/HBoxContainer"]
material = ExtResource( 4 )
margin_left = 106.0
margin_right = 106.0
margin_bottom = 18.0
@ -90,6 +94,7 @@ mouse_filter = 1
theme = ExtResource( 3 )
[node name="ProgressBar" type="ProgressBar" parent="Container/CurrentBox"]
material = ExtResource( 4 )
margin_top = 22.0
margin_right = 200.0
margin_bottom = 40.0
@ -99,6 +104,7 @@ size_flags_vertical = 3
theme = ExtResource( 3 )
[node name="ChargeBox" type="GridContainer" parent="Container"]
material = ExtResource( 4 )
margin_top = 60.0
margin_right = 200.0
margin_bottom = 120.0
@ -107,6 +113,7 @@ size_flags_vertical = 3
columns = 2
[node name="Charge rate" type="Label" parent="Container/ChargeBox"]
material = ExtResource( 4 )
margin_top = 5.0
margin_right = 84.0
margin_bottom = 23.0
@ -115,6 +122,7 @@ theme = ExtResource( 3 )
text = "Limit charge"
[node name="SpinBox" type="SpinBox" parent="Container/ChargeBox"]
material = ExtResource( 4 )
margin_left = 88.0
margin_right = 186.0
margin_bottom = 28.0
@ -124,6 +132,7 @@ max_value = 200.0
suffix = "W"
[node name="Discharge" type="Label" parent="Container/ChargeBox"]
material = ExtResource( 4 )
margin_top = 37.0
margin_right = 84.0
margin_bottom = 55.0
@ -132,6 +141,7 @@ theme = ExtResource( 3 )
text = "Limit output"
[node name="SpinBox2" type="SpinBox" parent="Container/ChargeBox"]
material = ExtResource( 4 )
margin_left = 88.0
margin_top = 32.0
margin_right = 186.0

View file

@ -1,6 +1,21 @@
[gd_resource type="Theme" load_steps=2 format=2]
[gd_resource type="Theme" load_steps=3 format=2]
[ext_resource path="res://Graphics/UI/uifont.tres" type="DynamicFont" id=1]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.133333, 0.12549, 0.203922, 1 )
border_width_left = 4
border_width_top = 4
border_width_right = 4
border_width_bottom = 4
border_color = Color( 0.0941176, 0.0823529, 0.180392, 1 )
border_blend = true
corner_radius_top_left = 4
corner_radius_top_right = 4
corner_radius_bottom_right = 4
corner_radius_bottom_left = 4
[resource]
default_font = ExtResource( 1 )
Panel/styles/panel = SubResource( 1 )
PopupDialog/styles/panel = SubResource( 1 )

View file

@ -2,7 +2,7 @@ extends Node
class_name GameInstance
onready var ui = $CanvasLayer/ui as GameUI
onready var ui = $CanvasLayer/ui
onready var world = $world as GameWorld
onready var systems = $systems
@ -10,7 +10,7 @@ func _ready():
randomize()
ui.connect("command", world, "process_command")
$world/odyssey.queue_free()
$world/runtime.queue_free()
func process_command(cmd: UICommand):
match cmd.cmd_type:

View file

@ -2,7 +2,7 @@
[ext_resource path="res://Scenes/Maps/odyssey.tscn" type="PackedScene" id=1]
[ext_resource path="res://Actors/Player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scenes/ui.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/UI.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/World.gd" type="Script" id=4]
[ext_resource path="res://Scenes/Game.gd" type="Script" id=5]
[ext_resource path="res://Scenes/UI.gd" type="Script" id=6]
@ -15,28 +15,22 @@ script = ExtResource( 5 )
scale = Vector2( 2, 2 )
script = ExtResource( 4 )
player_path = NodePath("player")
map_path = NodePath("runtime")
map_path = NodePath("odyssey")
[node name="runtime" parent="world" instance=ExtResource( 7 )]
visible = false
[node name="odyssey" parent="world" instance=ExtResource( 1 )]
visible = false
[node name="player" parent="world" instance=ExtResource( 2 )]
position = Vector2( 206.017, 250.966 )
z_index = 1
z_index = 10
is_controlled = true
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="ui" parent="CanvasLayer" instance=ExtResource( 3 )]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 0.0
margin_bottom = 0.0
mouse_filter = 2
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 6 )
[node name="systems" type="Node" parent="."]

View file

@ -4,7 +4,7 @@ extends Node2D
class_name GameMap
var ship_direction = 0
var ship_speed = 1000
var ship_speed = 0
var current_ship_direction = 0
var current_ship_speed = 0

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=2]
[gd_scene load_steps=14 format=2]
[ext_resource path="res://Graphics/tgstation/walls.tres" type="TileSet" id=1]
[ext_resource path="res://Graphics/tgstation/1x1.tres" type="TileSet" id=2]
@ -7,7 +7,6 @@
[ext_resource path="res://Scenes/Maps/runtime.gd" type="Script" id=5]
[ext_resource path="res://Actors/Objects/Computer/Computer.tscn" type="PackedScene" id=6]
[ext_resource path="res://Graphics/space.png" type="Texture" id=7]
[ext_resource path="res://Actors/Objects/Scanner/Scanner.tscn" type="PackedScene" id=8]
[ext_resource path="res://Graphics/tgstation/floor.tres" type="TileSet" id=9]
[ext_resource path="res://Actors/Objects/Engine/Engine.tscn" type="PackedScene" id=10]
[ext_resource path="res://Graphics/tgstation/base.tres" type="TileSet" id=11]
@ -50,7 +49,7 @@ cell_size = Vector2( 32, 32 )
cell_quadrant_size = 32
occluder_light_mask = -2147483647
format = 1
tile_data = PoolIntArray( 393212, 0, 131072, 393213, 0, 65536, 393214, 0, 65536, 393215, 0, 65536, 327680, 0, 65536, 327681, 0, 65536, 327682, 0, 65536, 327683, 0, 65536, 327684, 0, 262144, 589828, 0, 131073, 655364, 0, 65538, 655365, 0, 65536, 655366, 0, 65536, 655367, 0, 1, 655368, 0, 262144, 720903, 0, 131075 )
tile_data = PoolIntArray( 393212, 0, 131072, 393213, 0, 65536, 393214, 0, 65536, 393215, 0, 65536, 327680, 0, 65536, 327681, 0, 65536, 327682, 0, 65536, 327683, 0, 65536, 327684, 0, 262144 )
[node name="floor" type="TileMap" parent="."]
tile_set = ExtResource( 9 )
@ -124,27 +123,10 @@ computer_type = 5
[node name="SMES2" parent="objects" instance=ExtResource( 12 )]
position = Vector2( 128, 128 )
[node name="SMES1" parent="objects" instance=ExtResource( 12 )]
position = Vector2( 128, 256 )
[node name="Computer7" parent="objects" instance=ExtResource( 6 )]
position = Vector2( 64, 128 )
computer_type = 6
[node name="Scanner" parent="objects" instance=ExtResource( 8 )]
position = Vector2( 288, 320 )
[node name="ElectricSocket" parent="objects" instance=ExtResource( 13 )]
position = Vector2( 128, 288 )
connectionPaths = [ NodePath("../SMES1") ]
flow = 0
[node name="ElectricSocket2" parent="objects" instance=ExtResource( 13 )]
position = Vector2( 256, 320 )
direction = 1
connectionPaths = [ NodePath("../Scanner") ]
flow = 1
[node name="ElectricSocket4" parent="objects" instance=ExtResource( 13 )]
position = Vector2( -128, 160 )
connectionPaths = [ NodePath("../Computer6") ]

View file

@ -2,12 +2,13 @@
[ext_resource path="res://Scenes/Maps/odyssey.tscn" type="PackedScene" id=1]
[ext_resource path="res://Actors/Player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scenes/ui.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/UI.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/World.gd" type="Script" id=4]
[ext_resource path="res://Scenes/Game.gd" type="Script" id=5]
[ext_resource path="res://Scenes/UI.gd" type="Script" id=6]
[ext_resource path="res://Scenes/Maps/runtime.tscn" type="PackedScene" id=7]
[node name="scene" type="Node"]
script = ExtResource( 5 )

View file

@ -1,5 +1,6 @@
extends Control
class_name GameUI
signal command(command)
#func _ready():
#$MapPopup.popup_centered_ratio()

52
Scenes/UI/SpaceMap.tscn Normal file
View file

@ -0,0 +1,52 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Graphics/UI/ui_theme.tres" type="Theme" id=1]
[ext_resource path="res://Graphics/space.png" type="Texture" id=2]
[ext_resource path="res://Graphics/UI/uifont.tres" type="DynamicFont" id=3]
[ext_resource path="res://Scenes/UI/SpaceMapInside.gd" type="Script" id=4]
[node name="MapPopup" type="PopupDialog"]
margin_right = 558.0
margin_bottom = 476.0
theme = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 15.0
margin_top = 15.0
margin_right = -15.0
margin_bottom = -15.0
size_flags_horizontal = 3
size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
margin_right = 528.0
margin_bottom = 446.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 10
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
margin_right = 528.0
margin_bottom = 18.0
text = "S01\\AR SYSTEM"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Map" type="Control" parent="MarginContainer/VBoxContainer"]
margin_top = 28.0
margin_bottom = 28.0
rect_clip_content = true
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 4 )
background = ExtResource( 2 )
font = ExtResource( 3 )

View file

@ -0,0 +1,60 @@
extends Control
export var cell_size = 100
export var bgzoom = 50
export(Texture) var background
export(Font) var font
var dragging = false
var origin = Vector2(randf() * -1e4, randf() * -1e4)
var last_origin = origin
var last_mouse_pos = Vector2.ZERO
func _draw():
var win_size = get_global_rect().size
var cols = int(ceil(win_size.x/cell_size))
var rows = int(ceil(win_size.y/cell_size))
var xoffset = float(int(origin.x) % cell_size)
var yoffset = float(int(origin.y) % cell_size)
draw_texture_rect_region(background, Rect2(Vector2.ZERO, win_size), Rect2(-origin*bgzoom, win_size*bgzoom), Color(0.5,0.5,0.5,1))
for i in range(0, cols+1):
draw_line(Vector2(i * cell_size+xoffset, 0), Vector2(i * cell_size+xoffset, win_size.y), Color.white * 0.5)
for i in range(0, rows):
draw_line(Vector2(0, i * cell_size+yoffset), Vector2(win_size.x, i * cell_size+yoffset), Color.white * 0.5)
for x in range(-1, cols+1):
for y in range(-1, rows+1):
var real_x = x - int(origin.x/cell_size)
var real_y = y - int(origin.y/cell_size)
var sector_name = to_letter(real_x)
if real_y < 0:
sector_name += to_letter(real_y)
else:
sector_name += str(real_y)
draw_string(font, Vector2(x * cell_size + 6 + xoffset, y * cell_size + 20 + yoffset), sector_name, Color(1,1,1,0.5))
func _input(event):
if event is InputEventMouseButton:
dragging = event.pressed
last_origin = origin
last_mouse_pos = event.position
update()
elif event is InputEventMouseMotion:
if dragging:
origin = last_origin + (event.position - last_mouse_pos)
update()
func to_letter(num: int) -> String:
#var letters = "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ"
var letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if num == 0:
return "Α"
elif num < 0:
letters = "αβγδεζηθικλμνξοπρστυφχψω"
num = abs(num)
var out = ""
var base = letters.length()
while num > 0:
out += letters.substr(num % base, 1)
num /= base
return out

View file

@ -1,8 +1,16 @@
[gd_scene format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/UI/SpaceMap.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/ui.gd" type="Script" id=2]
[node name="ui" type="Control"]
margin_right = 40.0
margin_bottom = 40.0
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MapPopup" parent="." instance=ExtResource( 1 )]

View file

@ -59,11 +59,6 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://Actors/Objects/Scanner/Scanner.gd"
}, {
"base": "Control",
"class": "GameUI",
"language": "GDScript",
"path": "res://Scenes/UI.gd"
}, {
"base": "Node2D",
"class": "GameWorld",
"language": "GDScript",
@ -110,7 +105,6 @@ _global_script_class_icons={
"GameObjectLightbulb": "",
"GameObjectPowerStorage": "",
"GameObjectScanner": "",
"GameUI": "",
"GameWorld": "",
"MapTiles": "",
"Occluder": "",
@ -131,6 +125,10 @@ config/icon="res://icon.png"
window/size/width=1280
window/size/height=800
[gui]
theme/custom="res://Graphics/UI/ui_theme.tres"
[input]
ui_accept={