Compare commits
No commits in common. "main" and "LAWDev" have entirely different histories.
@ -1,104 +0,0 @@
|
||||
name: Deploy Promiscuity Auth API
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: self-hosted
|
||||
|
||||
env:
|
||||
IMAGE_NAME: promiscuity-auth:latest
|
||||
IMAGE_TAR: /tmp/promiscuity-auth.tar
|
||||
# All nodes that might run the pod (control-plane + workers)
|
||||
NODES: "192.168.86.64 192.168.86.66 192.168.86.72"
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# -----------------------------
|
||||
# Build Docker image
|
||||
# -----------------------------
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
cd microservices/Auth
|
||||
docker build -t "${IMAGE_NAME}" .
|
||||
|
||||
# -----------------------------
|
||||
# Save image as TAR on runner
|
||||
# -----------------------------
|
||||
- name: Save Docker image to TAR
|
||||
run: |
|
||||
docker save "${IMAGE_NAME}" -o "${IMAGE_TAR}"
|
||||
|
||||
# -----------------------------
|
||||
# Copy TAR to each Kubernetes node
|
||||
# -----------------------------
|
||||
- name: Copy TAR to nodes
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Copying image tar to $node ..."
|
||||
scp -o StrictHostKeyChecking=no "${IMAGE_TAR}" hz@"$node":/tmp/promiscuity-auth.tar
|
||||
done
|
||||
|
||||
# -----------------------------
|
||||
# Import image into containerd on each node
|
||||
# -----------------------------
|
||||
- name: Import image on nodes
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Importing image on $node ..."
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "sudo ctr -n k8s.io images import /tmp/promiscuity-auth.tar"
|
||||
done
|
||||
|
||||
# -----------------------------
|
||||
# CLEANUP: delete TAR from nodes
|
||||
# -----------------------------
|
||||
- name: Clean TAR from nodes
|
||||
run: |
|
||||
for node in ${NODES}; do
|
||||
echo "Removing image tar on $node ..."
|
||||
ssh -o StrictHostKeyChecking=no hz@"$node" "rm -f /tmp/promiscuity-auth.tar"
|
||||
done
|
||||
|
||||
# -----------------------------
|
||||
# CLEANUP: delete TAR from runner
|
||||
# -----------------------------
|
||||
- name: Clean TAR on runner
|
||||
run: |
|
||||
rm -f "${IMAGE_TAR}"
|
||||
|
||||
# -----------------------------
|
||||
# Write kubeconfig from secret
|
||||
# -----------------------------
|
||||
- name: Write kubeconfig from secret
|
||||
env:
|
||||
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG }}
|
||||
run: |
|
||||
mkdir -p /tmp/kube
|
||||
printf '%s\n' "$KUBECONFIG_CONTENT" > /tmp/kube/config
|
||||
|
||||
# -----------------------------
|
||||
# Apply Kubernetes manifests
|
||||
# (You create these files in your repo)
|
||||
# -----------------------------
|
||||
- name: Apply Auth deployment & service
|
||||
env:
|
||||
KUBECONFIG: /tmp/kube/config
|
||||
run: |
|
||||
kubectl apply -f microservices/Auth/k8s/deployment.yaml -n promiscuity-auth
|
||||
kubectl apply -f microservices/Auth/k8s/service.yaml -n promiscuity-auth
|
||||
|
||||
# -----------------------------
|
||||
# Rollout restart & wait
|
||||
# -----------------------------
|
||||
- name: Restart Auth deployment
|
||||
env:
|
||||
KUBECONFIG: /tmp/kube/config
|
||||
run: |
|
||||
kubectl rollout restart deployment/promiscuity-auth -n promiscuity-auth
|
||||
kubectl rollout status deployment/promiscuity-auth -n promiscuity-auth
|
||||
@ -1,27 +0,0 @@
|
||||
name: k8s smoke test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Write kubeconfig from secret
|
||||
env:
|
||||
KUBECONFIG_CONTENT: ${{ secrets.KUBECONFIG }}
|
||||
run: |
|
||||
mkdir -p /tmp/kube
|
||||
printf '%s\n' "$KUBECONFIG_CONTENT" > /tmp/kube/config
|
||||
|
||||
- name: Test kubectl connectivity
|
||||
env:
|
||||
KUBECONFIG: /tmp/kube/config
|
||||
run: |
|
||||
kubectl get nodes --kubeconfig "${KUBECONFIG}"
|
||||
0
game/.gitignore → .gitignore
vendored
0
game/.gitignore → .gitignore
vendored
14
README.txt
14
README.txt
@ -1,7 +1,9 @@
|
||||
Auth Microservice swagger is accessible at https://pauth.ranaze.com/swagger/index.html
|
||||
|
||||
Test Users:
|
||||
SUPER/SUPER - Super User
|
||||
test1/test1 - Super User
|
||||
test3/test3 - User
|
||||
Perforce Connection String: ssl:perforce.ranaze.com:443
|
||||
|
||||
Git ↔ Perforce quick map
|
||||
repo → depot (//depot/...)
|
||||
branch → stream (e.g., //depot/main, //depot/alice)
|
||||
clone → workspace/client (local view + metadata)
|
||||
commit → changelist (pending → submitted)
|
||||
PR/MR → shelve + review (with Swarm) or merge up from task stream
|
||||
.gitignore → P4IGNORE file (e.g., .p4ignore)
|
||||
|
||||
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
Binary file not shown.
@ -1,19 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://de2e8sy4x724m"
|
||||
path="res://.godot/imported/jump.ogg-09aff86a6f79a8fce2febb69902962cf.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/jump.ogg"
|
||||
dest_files=["res://.godot/imported/jump.ogg-09aff86a6f79a8fce2febb69902962cf.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
Binary file not shown.
@ -1,19 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://64dplcgx2icb"
|
||||
path="res://.godot/imported/silly-menu-hover-test.ogg-101de051c9810c756b28483653a4c618.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/silly-menu-hover-test.ogg"
|
||||
dest_files=["res://.godot/imported/silly-menu-hover-test.ogg-101de051c9810c756b28483653a4c618.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
Binary file not shown.
@ -1,19 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://txgki0ijeuud"
|
||||
path="res://.godot/imported/silly-test.ogg-4a08df8a26b9ee1e5d13235e013c7cfc.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/audio/silly-test.ogg"
|
||||
dest_files=["res://.godot/imported/silly-test.ogg-4a08df8a26b9ee1e5d13235e013c7cfc.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
Binary file not shown.
@ -1,59 +0,0 @@
|
||||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://bb6hj6l23043x"
|
||||
path="res://.godot/imported/human.blend-738fbf7b85a13f54d00c9db65cf59296.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/models/human.blend"
|
||||
dest_files=["res://.godot/imported/human.blend-738fbf7b85a13f54d00c9db65cf59296.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=1.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
nodes/use_node_type_suffixes=true
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=1
|
||||
meshes/lightmap_texel_size=0.2
|
||||
meshes/force_disable_compression=false
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/fps=30
|
||||
animation/trimming=false
|
||||
animation/remove_immutable_tracks=true
|
||||
animation/import_rest_as_RESET=false
|
||||
import_script/path=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
||||
blender/nodes/visible=0
|
||||
blender/nodes/active_collection_only=false
|
||||
blender/nodes/punctual_lights=true
|
||||
blender/nodes/cameras=true
|
||||
blender/nodes/custom_properties=true
|
||||
blender/nodes/modifiers=1
|
||||
blender/meshes/colors=false
|
||||
blender/meshes/uvs=true
|
||||
blender/meshes/normals=true
|
||||
blender/meshes/export_geometry_nodes_instances=false
|
||||
blender/meshes/tangents=true
|
||||
blender/meshes/skins=2
|
||||
blender/meshes/export_bones_deforming_mesh_only=false
|
||||
blender/materials/unpack_enabled=true
|
||||
blender/materials/export_materials=1
|
||||
blender/animation/limit_playback=true
|
||||
blender/animation/always_sample=true
|
||||
blender/animation/group_tracks=true
|
||||
gltf/naming_version=2
|
||||
@ -1,3 +0,0 @@
|
||||
[gd_scene format=3 uid="uid://cuyws13lbkmxb"]
|
||||
|
||||
[node name="Test" type="Node2D"]
|
||||
@ -1,12 +0,0 @@
|
||||
[gd_resource type="AudioBusLayout" format=3]
|
||||
|
||||
[resource]
|
||||
bus/0/name = "Master"
|
||||
bus/0/volume_db = 0.0
|
||||
bus/0/send = ""
|
||||
bus/1/name = "Music"
|
||||
bus/1/volume_db = 0.0
|
||||
bus/1/send = "Master"
|
||||
bus/2/name = "SFX"
|
||||
bus/2/volume_db = 0.0
|
||||
bus/2/send = "Master"
|
||||
@ -1,70 +0,0 @@
|
||||
[preset.0]
|
||||
|
||||
name="Windows Desktop"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="bin/test.exe"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=false
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
shader_baker/enabled=false
|
||||
binary_format/architecture="x86_64"
|
||||
codesign/enable=false
|
||||
codesign/timestamp=true
|
||||
codesign/timestamp_server_url=""
|
||||
codesign/digest_algorithm=1
|
||||
codesign/description=""
|
||||
codesign/custom_options=PackedStringArray()
|
||||
application/modify_resources=true
|
||||
application/icon=""
|
||||
application/console_wrapper_icon=""
|
||||
application/icon_interpolation=4
|
||||
application/file_version=""
|
||||
application/product_version=""
|
||||
application/company_name=""
|
||||
application/product_name=""
|
||||
application/file_description=""
|
||||
application/copyright=""
|
||||
application/trademarks=""
|
||||
application/export_angle=0
|
||||
application/export_d3d12=0
|
||||
application/d3d12_agility_sdk_multiarch=true
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||
Start-ScheduledTask -TaskName godot_remote_debug
|
||||
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
dotnet/include_scripts_content=false
|
||||
dotnet/include_debug_symbols=true
|
||||
dotnet/embed_build_outputs=false
|
||||
@ -1,122 +0,0 @@
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dchj6g2i8ebph"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bb6hj6l23043x" path="res://assets/models/human.blend" id="1_eg4yq"]
|
||||
[ext_resource type="Script" uid="uid://bpxggc8nr6tf6" path="res://scenes/player.gd" id="1_muv8p"]
|
||||
[ext_resource type="PackedScene" uid="uid://c5of6aaxop1hl" path="res://scenes/block.tscn" id="2_tc7dm"]
|
||||
[ext_resource type="Script" uid="uid://b7fopt7sx74g8" path="res://scenes/Levels/menu.gd" id="3_tc7dm"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_2q6dc"]
|
||||
bounce = 0.5
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_2q6dc"]
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_w7c3h"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_w8frs"]
|
||||
bounce = 0.5
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_mx8sn"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_2q6dc"]
|
||||
size = Vector3(1080, 2, 1080)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_w7c3h"]
|
||||
size = Vector3(1080, 2, 1080)
|
||||
|
||||
[node name="Node3D" type="Node3D"]
|
||||
|
||||
[node name="human" parent="." instance=ExtResource("1_eg4yq")]
|
||||
|
||||
[node name="Thing" type="RigidBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3.7986288)
|
||||
physics_material_override = SubResource("PhysicsMaterial_2q6dc")
|
||||
gravity_scale = 0.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 5
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Thing"]
|
||||
shape = SubResource("SphereShape3D_2q6dc")
|
||||
debug_color = Color(0.29772994, 0.6216631, 0.28140613, 0.41960785)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Thing"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
mesh = SubResource("SphereMesh_w7c3h")
|
||||
|
||||
[node name="Player" type="RigidBody3D" parent="."]
|
||||
physics_material_override = SubResource("PhysicsMaterial_w8frs")
|
||||
script = ExtResource("1_muv8p")
|
||||
camera_path = NodePath("Camera3D")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player"]
|
||||
shape = SubResource("SphereShape3D_mx8sn")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="Player"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.31670225, 0)
|
||||
|
||||
[node name="SpotLight3D" type="SpotLight3D" parent="Player"]
|
||||
|
||||
[node name="Ground" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
|
||||
shape = SubResource("BoxShape3D_2q6dc")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
|
||||
mesh = SubResource("BoxMesh_w7c3h")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.5, 0.8660253, 0, -0.8660253, 0.5, 0, 34, 0)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="Starter Blocks" type="Node3D" parent="."]
|
||||
|
||||
[node name="Block" parent="Starter Blocks" instance=ExtResource("2_tc7dm")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.298158, -7.0724635)
|
||||
|
||||
[node name="Block2" parent="Starter Blocks" instance=ExtResource("2_tc7dm")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.63255787, 2.596316, -6.980046)
|
||||
|
||||
[node name="Menu" type="CanvasLayer" parent="."]
|
||||
process_mode = 3
|
||||
visible = false
|
||||
script = ExtResource("3_tc7dm")
|
||||
|
||||
[node name="Control" type="Control" parent="Menu"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Menu/Control"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -39.5
|
||||
offset_top = -33.0
|
||||
offset_right = 39.5
|
||||
offset_bottom = 33.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ContinueButton" type="Button" parent="Menu/Control/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Continue"
|
||||
|
||||
[node name="MainMenuButton" type="Button" parent="Menu/Control/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Main Menu"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="Menu/Control/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Quit"
|
||||
|
||||
[connection signal="pressed" from="Menu/Control/VBoxContainer/ContinueButton" to="Menu" method="_on_continue_button_pressed"]
|
||||
[connection signal="pressed" from="Menu/Control/VBoxContainer/MainMenuButton" to="Menu" method="_on_main_menu_button_pressed"]
|
||||
[connection signal="pressed" from="Menu/Control/VBoxContainer/QuitButton" to="Menu" method="_on_quit_button_pressed"]
|
||||
@ -1,51 +0,0 @@
|
||||
extends CanvasLayer
|
||||
|
||||
const START_SCREEN_SCENE := "res://scenes/UI/start_screen.tscn"
|
||||
|
||||
@onready var pause_menu = $Control
|
||||
|
||||
func _ready() -> void:
|
||||
_register_focus_sounds()
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
if get_tree().paused:
|
||||
resume_game()
|
||||
else:
|
||||
pause_game()
|
||||
|
||||
func pause_game():
|
||||
get_tree().paused = true
|
||||
visible = true
|
||||
|
||||
func resume_game():
|
||||
get_tree().paused = false
|
||||
visible = false
|
||||
|
||||
func _on_quit_button_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
func _on_continue_button_pressed():
|
||||
resume_game()
|
||||
|
||||
func _on_main_menu_button_pressed():
|
||||
resume_game()
|
||||
get_tree().change_scene_to_file(START_SCREEN_SCENE)
|
||||
|
||||
func _register_focus_sounds() -> void:
|
||||
if pause_menu == null:
|
||||
return
|
||||
var vbox := pause_menu.get_node_or_null("VBoxContainer")
|
||||
if vbox == null:
|
||||
return
|
||||
for child in vbox.get_children():
|
||||
if child is BaseButton:
|
||||
var button: BaseButton = child
|
||||
if not button.is_connected("focus_entered", Callable(self, "_on_menu_item_focus")):
|
||||
button.focus_entered.connect(_on_menu_item_focus)
|
||||
if not button.is_connected("mouse_entered", Callable(self, "_on_menu_item_focus")):
|
||||
button.mouse_entered.connect(_on_menu_item_focus)
|
||||
|
||||
func _on_menu_item_focus() -> void:
|
||||
if MenuSfx:
|
||||
MenuSfx.play_hover()
|
||||
@ -1 +0,0 @@
|
||||
uid://b7fopt7sx74g8
|
||||
@ -1,112 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
@onready var _tab_bar: TabBar = $MarginContainer/VBoxContainer/TabBar
|
||||
@onready var _tab_container: TabContainer = $MarginContainer/VBoxContainer/TabContainer
|
||||
@onready var _music_volume_slider: HSlider = $MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/MusicVolumeGroup/MusicVolumeSlider
|
||||
@onready var _music_volume_value: Label = $MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/MusicVolumeGroup/MusicVolumeValue
|
||||
@onready var _music_mute_checkbox: CheckBox = $MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/MusicVolumeGroup/MusicMuteCheckBox
|
||||
@onready var _sfx_volume_slider: HSlider = $MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/SfxVolumeGroup/SfxVolumeSlider
|
||||
@onready var _sfx_volume_value: Label = $MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/SfxVolumeGroup/SfxVolumeValue
|
||||
@onready var _sfx_mute_checkbox: CheckBox = $MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/SfxVolumeGroup/SfxMuteCheckBox
|
||||
@onready var _menu_music: AudioStreamPlayer = get_tree().get_root().get_node_or_null("MenuMusic")
|
||||
@onready var _menu_sfx: AudioStreamPlayer = get_tree().get_root().get_node_or_null("MenuSfx")
|
||||
|
||||
func _ready() -> void:
|
||||
_tab_bar.tab_changed.connect(_on_tab_bar_tab_changed)
|
||||
_tab_container.tab_changed.connect(_on_tab_container_tab_changed)
|
||||
_tab_container.current_tab = _tab_bar.current_tab
|
||||
_music_volume_slider.value_changed.connect(_on_music_volume_changed)
|
||||
_music_mute_checkbox.toggled.connect(_on_music_mute_toggled)
|
||||
_sfx_volume_slider.value_changed.connect(_on_sfx_volume_changed)
|
||||
_sfx_mute_checkbox.toggled.connect(_on_sfx_mute_toggled)
|
||||
_sync_audio_controls()
|
||||
_register_focus_sounds()
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
get_tree().change_scene_to_file("uid://b4k81taauef4q")
|
||||
|
||||
func _on_tab_bar_tab_changed(tab_index: int) -> void:
|
||||
if _tab_container.current_tab != tab_index:
|
||||
_tab_container.current_tab = tab_index
|
||||
|
||||
func _on_tab_container_tab_changed(tab_index: int) -> void:
|
||||
if _tab_bar.current_tab != tab_index:
|
||||
_tab_bar.current_tab = tab_index
|
||||
|
||||
func _sync_audio_controls() -> void:
|
||||
var value: float = 0.7
|
||||
var muted: bool = false
|
||||
if _menu_music:
|
||||
if _menu_music.has_method("get_user_volume"):
|
||||
value = _menu_music.get_user_volume()
|
||||
if _menu_music.has_method("is_user_muted"):
|
||||
muted = _menu_music.is_user_muted()
|
||||
_apply_audio_control_state(_music_volume_slider, _music_mute_checkbox, _music_volume_value, value, muted)
|
||||
|
||||
var sfx_value: float = 0.7
|
||||
var sfx_muted: bool = false
|
||||
if _menu_sfx:
|
||||
if _menu_sfx.has_method("get_user_volume"):
|
||||
sfx_value = _menu_sfx.get_user_volume()
|
||||
if _menu_sfx.has_method("is_user_muted"):
|
||||
sfx_muted = _menu_sfx.is_user_muted()
|
||||
_apply_audio_control_state(_sfx_volume_slider, _sfx_mute_checkbox, _sfx_volume_value, sfx_value, sfx_muted)
|
||||
|
||||
func _on_music_volume_changed(value: float) -> void:
|
||||
if _menu_music and _menu_music.has_method("set_user_volume"):
|
||||
_menu_music.set_user_volume(value)
|
||||
_update_volume_label(_music_volume_value, value, _music_mute_checkbox.button_pressed)
|
||||
|
||||
func _on_music_mute_toggled(pressed: bool) -> void:
|
||||
if _menu_music and _menu_music.has_method("set_user_muted"):
|
||||
_menu_music.set_user_muted(pressed)
|
||||
_music_volume_slider.editable = not pressed
|
||||
_update_volume_label(_music_volume_value, _music_volume_slider.value, pressed)
|
||||
|
||||
func _on_sfx_volume_changed(value: float) -> void:
|
||||
if _menu_sfx and _menu_sfx.has_method("set_user_volume"):
|
||||
_menu_sfx.set_user_volume(value)
|
||||
_update_volume_label(_sfx_volume_value, value, _sfx_mute_checkbox.button_pressed)
|
||||
|
||||
func _on_sfx_mute_toggled(pressed: bool) -> void:
|
||||
if _menu_sfx and _menu_sfx.has_method("set_user_muted"):
|
||||
_menu_sfx.set_user_muted(pressed)
|
||||
_sfx_volume_slider.editable = not pressed
|
||||
_update_volume_label(_sfx_volume_value, _sfx_volume_slider.value, pressed)
|
||||
|
||||
func _apply_audio_control_state(slider: HSlider, checkbox: CheckBox, value_label: Label, value: float, muted: bool) -> void:
|
||||
slider.set_block_signals(true)
|
||||
slider.value = value
|
||||
slider.set_block_signals(false)
|
||||
slider.editable = not muted
|
||||
checkbox.set_block_signals(true)
|
||||
checkbox.button_pressed = muted
|
||||
checkbox.set_block_signals(false)
|
||||
_update_volume_label(value_label, value, muted)
|
||||
|
||||
func _update_volume_label(value_label: Label, value: float, muted: bool) -> void:
|
||||
if muted:
|
||||
value_label.text = "Muted"
|
||||
else:
|
||||
var percent: int = int(round(value * 100.0))
|
||||
value_label.text = str(percent) + "%"
|
||||
|
||||
func _register_focus_sounds() -> void:
|
||||
_connect_focus_recursive(self)
|
||||
|
||||
func _connect_focus_recursive(node: Node) -> void:
|
||||
if node is Control:
|
||||
var control: Control = node
|
||||
if control.focus_mode != Control.FOCUS_NONE:
|
||||
if not control.is_connected("focus_entered", Callable(self, "_on_menu_item_focus")):
|
||||
control.focus_entered.connect(_on_menu_item_focus)
|
||||
if control.has_signal("mouse_entered") and (control is BaseButton or control.focus_mode != Control.FOCUS_NONE):
|
||||
if not control.is_connected("mouse_entered", Callable(self, "_on_menu_item_focus")):
|
||||
control.mouse_entered.connect(_on_menu_item_focus)
|
||||
for child in node.get_children():
|
||||
_connect_focus_recursive(child)
|
||||
|
||||
func _on_menu_item_focus() -> void:
|
||||
if MenuSfx:
|
||||
MenuSfx.play_hover()
|
||||
@ -1,157 +0,0 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d3tqrm4ry4l88"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://h1slqbemgwvr" path="res://scenes/UI/Settings.gd" id="1_1dggd"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhuosr0p605gj" path="res://assets/images/pp_start_bg.png" id="1_i47rn"]
|
||||
[ext_resource type="FontFile" uid="uid://m5ceou0rk6j6" path="res://assets/fonts/PlayfairDisplay-VariableFont_wght.ttf" id="2_46duy"]
|
||||
[ext_resource type="Theme" uid="uid://wpxmub0n2dr3" path="res://themes/button_theme.tres" id="3_46duy"]
|
||||
|
||||
|
||||
[node name="settings_screen" type="Node2D"]
|
||||
script = ExtResource("1_1dggd")
|
||||
metadata/_edit_vertical_guides_ = [1152.0]
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
offset_left = -192.0
|
||||
offset_top = -188.0
|
||||
offset_right = 1344.0
|
||||
offset_bottom = 836.0
|
||||
texture = ExtResource("1_i47rn")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 648.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("2_46duy")
|
||||
theme_override_font_sizes/font_size = 42
|
||||
text = "Settings"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TabBar" type="TabBar" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_46duy")
|
||||
current_tab = 0
|
||||
tab_count = 4
|
||||
tab_0/title = "Gameplay"
|
||||
tab_1/title = "Video"
|
||||
tab_2/title = "Audio"
|
||||
tab_3/title = "Dev"
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
tabs_visible = false
|
||||
|
||||
[node name="Gameplay" type="Control" parent="MarginContainer/VBoxContainer/TabContainer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Video" type="Control" parent="MarginContainer/VBoxContainer/TabContainer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Audio" type="Control" parent="MarginContainer/VBoxContainer/TabContainer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="AudioVBox" type="VBoxContainer" parent="MarginContainer/VBoxContainer/TabContainer/Audio"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/separation = 10
|
||||
offset_left = 120.0
|
||||
offset_top = 240.0
|
||||
offset_right = -120.0
|
||||
offset_bottom = -40.0
|
||||
|
||||
[node name="MusicVolumeLabel" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox"]
|
||||
layout_mode = 2
|
||||
text = "Music Volume"
|
||||
horizontal_alignment = 1
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="MusicVolumeGroup" type="HBoxContainer" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 12
|
||||
alignment = 1
|
||||
custom_minimum_size = Vector2(0, 40)
|
||||
|
||||
[node name="MusicVolumeSlider" type="HSlider" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/MusicVolumeGroup"]
|
||||
layout_mode = 2
|
||||
min_value = 0.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
size_flags_horizontal = 3
|
||||
custom_minimum_size = Vector2(320, 0)
|
||||
|
||||
[node name="MusicVolumeValue" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/MusicVolumeGroup"]
|
||||
layout_mode = 2
|
||||
text = "70%"
|
||||
size_flags_horizontal = 1
|
||||
horizontal_alignment = 1
|
||||
custom_minimum_size = Vector2(60, 0)
|
||||
|
||||
[node name="MusicMuteCheckBox" type="CheckBox" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/MusicVolumeGroup"]
|
||||
layout_mode = 2
|
||||
text = "Mute"
|
||||
size_flags_horizontal = 1
|
||||
|
||||
[node name="SfxVolumeLabel" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox"]
|
||||
layout_mode = 2
|
||||
text = "Menu SFX Volume"
|
||||
horizontal_alignment = 1
|
||||
size_flags_horizontal = 4
|
||||
|
||||
[node name="SfxVolumeGroup" type="HBoxContainer" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 12
|
||||
alignment = 1
|
||||
custom_minimum_size = Vector2(0, 40)
|
||||
|
||||
[node name="SfxVolumeSlider" type="HSlider" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/SfxVolumeGroup"]
|
||||
layout_mode = 2
|
||||
min_value = 0.0
|
||||
max_value = 1.0
|
||||
step = 0.01
|
||||
size_flags_horizontal = 3
|
||||
custom_minimum_size = Vector2(320, 0)
|
||||
|
||||
[node name="SfxVolumeValue" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/SfxVolumeGroup"]
|
||||
layout_mode = 2
|
||||
text = "70%"
|
||||
size_flags_horizontal = 1
|
||||
horizontal_alignment = 1
|
||||
custom_minimum_size = Vector2(60, 0)
|
||||
|
||||
[node name="SfxMuteCheckBox" type="CheckBox" parent="MarginContainer/VBoxContainer/TabContainer/Audio/AudioVBox/SfxVolumeGroup"]
|
||||
layout_mode = 2
|
||||
text = "Mute"
|
||||
size_flags_horizontal = 1
|
||||
|
||||
[node name="Dev" type="Control" parent="MarginContainer/VBoxContainer/TabContainer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
@ -1,15 +0,0 @@
|
||||
extends Node
|
||||
|
||||
var is_logged_in: bool = false
|
||||
var access_token: String = ""
|
||||
var username: String = ""
|
||||
|
||||
func set_session(new_username: String, token: String) -> void:
|
||||
is_logged_in = true
|
||||
username = new_username
|
||||
access_token = token
|
||||
|
||||
func clear_session() -> void:
|
||||
is_logged_in = false
|
||||
username = ""
|
||||
access_token = ""
|
||||
@ -1 +0,0 @@
|
||||
uid://ccloj2rh4dche
|
||||
@ -1,48 +0,0 @@
|
||||
extends Control
|
||||
|
||||
const AUTH_LOGIN_URL := "https://pauth.ranaze.com/api/Auth/login"
|
||||
|
||||
@onready var _username_input: LineEdit = %UsernameInput
|
||||
@onready var _password_input: LineEdit = %PasswordInput
|
||||
@onready var _login_request: HTTPRequest = %LoginRequest
|
||||
@onready var _error_label: Label = %ErrorLabel
|
||||
|
||||
func _on_log_in_button_pressed() -> void:
|
||||
var username := _username_input.text.strip_edges()
|
||||
var password := _password_input.text
|
||||
if username.is_empty() or password.is_empty():
|
||||
_show_error("Username and password required.")
|
||||
return
|
||||
|
||||
var payload := {
|
||||
"username": username,
|
||||
"password": password,
|
||||
}
|
||||
var headers := PackedStringArray(["Content-Type: application/json"])
|
||||
var err := _login_request.request(AUTH_LOGIN_URL, headers, HTTPClient.METHOD_POST, JSON.stringify(payload))
|
||||
if err != OK:
|
||||
_show_error("Failed to send login request.")
|
||||
|
||||
func _on_login_request_completed(result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
var body_text := body.get_string_from_utf8()
|
||||
if result != HTTPRequest.RESULT_SUCCESS:
|
||||
_show_error("Network error. Please try again.")
|
||||
return
|
||||
|
||||
if response_code >= 200 and response_code < 300:
|
||||
var response: Variant = JSON.parse_string(body_text)
|
||||
if typeof(response) == TYPE_DICTIONARY:
|
||||
#print("Login success for %s" % response.get("username", "unknown"))
|
||||
#print("Access Token: %s" % response.get("accessToken", ""))
|
||||
var token := String(response.get("accessToken", ""))
|
||||
var username := String(response.get("username", ""))
|
||||
AuthState.set_session(username, token)
|
||||
get_tree().change_scene_to_file("res://scenes/UI/start_screen.tscn")
|
||||
else:
|
||||
_show_error("Login failed. Check your credentials.")
|
||||
|
||||
func _on_back_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/UI/start_screen.tscn")
|
||||
|
||||
func _show_error(message: String) -> void:
|
||||
_error_label.text = message
|
||||
@ -1 +0,0 @@
|
||||
uid://bnrhapdcfvp04
|
||||
@ -1,117 +0,0 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://fmp1tah03kew"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/UI/login_screen.gd" id="1_jqkpi"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhuosr0p605gj" path="res://assets/images/pp_start_bg.png" id="2_2n6di"]
|
||||
[ext_resource type="Theme" uid="uid://tn8qndst18d6" path="res://themes/title_font_theme.tres" id="3_c4k70"]
|
||||
[ext_resource type="Theme" uid="uid://wpxmub0n2dr3" path="res://themes/button_theme.tres" id="4_gx673"]
|
||||
|
||||
[node name="LoginScreen" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_jqkpi")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("2_2n6di")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_constants/margin_left = 80
|
||||
theme_override_constants/margin_top = 40
|
||||
theme_override_constants/margin_right = 80
|
||||
theme_override_constants/margin_bottom = 40
|
||||
|
||||
[node name="ContentCenter" type="CenterContainer" parent="MarginContainer"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ContentVBox" type="VBoxContainer" parent="MarginContainer/ContentCenter"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme_override_constants/separation = 24
|
||||
|
||||
[node name="TitleLabel" type="Label" parent="MarginContainer/ContentCenter/ContentVBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme = ExtResource("3_c4k70")
|
||||
text = "ACCOUNT LOGIN"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="FormVBox" type="VBoxContainer" parent="MarginContainer/ContentCenter/ContentVBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 8
|
||||
custom_minimum_size = Vector2(480, 0)
|
||||
|
||||
[node name="UsernameLabel" type="Label" parent="MarginContainer/ContentCenter/ContentVBox/FormVBox"]
|
||||
layout_mode = 2
|
||||
text = "Username"
|
||||
|
||||
[node name="UsernameInput" type="LineEdit" parent="MarginContainer/ContentCenter/ContentVBox/FormVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
placeholder_text = "enter username"
|
||||
caret_blink = true
|
||||
|
||||
[node name="PasswordLabel" type="Label" parent="MarginContainer/ContentCenter/ContentVBox/FormVBox"]
|
||||
layout_mode = 2
|
||||
text = "Password"
|
||||
|
||||
[node name="PasswordInput" type="LineEdit" parent="MarginContainer/ContentCenter/ContentVBox/FormVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
placeholder_text = "enter password"
|
||||
secret = true
|
||||
|
||||
[node name="ButtonVBox" type="VBoxContainer" parent="MarginContainer/ContentCenter/ContentVBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme_override_constants/separation = 12
|
||||
|
||||
[node name="ErrorLabel" type="Label" parent="MarginContainer/ContentCenter/ContentVBox/ButtonVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_c4k70")
|
||||
horizontal_alignment = 1
|
||||
theme_override_font_sizes/font_size = 26
|
||||
theme_override_colors/font_color = Color(1, 0.2, 0.2, 1)
|
||||
|
||||
[node name="LogInButton" type="Button" parent="MarginContainer/ContentCenter/ContentVBox/ButtonVBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme = ExtResource("4_gx673")
|
||||
text = "LOG IN"
|
||||
text_alignment = 1
|
||||
|
||||
[node name="BackButton" type="Button" parent="MarginContainer/ContentCenter/ContentVBox/ButtonVBox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme = ExtResource("4_gx673")
|
||||
text = "BACK"
|
||||
text_alignment = 1
|
||||
|
||||
[node name="LoginRequest" type="HTTPRequest" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/ContentCenter/ContentVBox/ButtonVBox/LogInButton" to="." method="_on_log_in_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/ContentCenter/ContentVBox/ButtonVBox/BackButton" to="." method="_on_back_button_pressed"]
|
||||
[connection signal="request_completed" from="LoginRequest" to="." method="_on_login_request_completed"]
|
||||
@ -1,107 +0,0 @@
|
||||
extends AudioStreamPlayer
|
||||
|
||||
const MENU_SCENES: Dictionary = {
|
||||
"res://scenes/UI/start_screen.tscn": true,
|
||||
"res://scenes/UI/Settings.tscn": true,
|
||||
"res://scenes/UI/login_screen.tscn": true,
|
||||
}
|
||||
|
||||
const CONFIG_PATH := "user://settings.cfg"
|
||||
const CONFIG_SECTION := "audio"
|
||||
const CONFIG_KEY_MUSIC_VOLUME := "menu_music_volume"
|
||||
const CONFIG_KEY_MUSIC_MUTED := "menu_music_muted"
|
||||
const DEFAULT_VOLUME := 0.7
|
||||
|
||||
var _last_scene: Node = null
|
||||
var _user_volume_linear: float = DEFAULT_VOLUME
|
||||
var _is_muted: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
set_process(true)
|
||||
_load_settings()
|
||||
_apply_volume()
|
||||
_update_playback(get_tree().current_scene)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
var current := get_tree().current_scene
|
||||
if current != _last_scene:
|
||||
_update_playback(current)
|
||||
elif _should_play_scene(current) and not playing and not _is_muted and _user_volume_linear > 0.0:
|
||||
play()
|
||||
|
||||
func _update_playback(scene: Node) -> void:
|
||||
if scene == null:
|
||||
_last_scene = null
|
||||
return
|
||||
_last_scene = scene
|
||||
if _should_play_scene(scene):
|
||||
if not playing:
|
||||
play()
|
||||
elif playing:
|
||||
stop()
|
||||
|
||||
func _should_play_scene(scene: Node) -> bool:
|
||||
if scene == null:
|
||||
return false
|
||||
var scene_path: String = scene.get_scene_file_path()
|
||||
if scene_path.is_empty():
|
||||
return false
|
||||
return MENU_SCENES.has(scene_path)
|
||||
|
||||
func set_user_volume(value: float) -> void:
|
||||
var clamped_value: float = clamp(value, 0.0, 1.0)
|
||||
if is_equal_approx(_user_volume_linear, clamped_value):
|
||||
return
|
||||
_user_volume_linear = clamped_value
|
||||
_apply_volume()
|
||||
_save_settings()
|
||||
|
||||
func get_user_volume() -> float:
|
||||
return _user_volume_linear
|
||||
|
||||
func set_user_muted(muted: bool) -> void:
|
||||
var new_muted: bool = muted
|
||||
if _is_muted == new_muted:
|
||||
return
|
||||
_is_muted = new_muted
|
||||
_apply_volume()
|
||||
_save_settings()
|
||||
|
||||
func is_user_muted() -> bool:
|
||||
return _is_muted
|
||||
|
||||
func _apply_volume() -> void:
|
||||
if _is_muted or _user_volume_linear <= 0.0:
|
||||
volume_db = -80.0
|
||||
else:
|
||||
volume_db = linear_to_db(_user_volume_linear)
|
||||
|
||||
func _load_settings() -> void:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
var err: int = config.load(CONFIG_PATH)
|
||||
if err == OK:
|
||||
var stored_volume: float = float(config.get_value(CONFIG_SECTION, CONFIG_KEY_MUSIC_VOLUME, DEFAULT_VOLUME))
|
||||
_user_volume_linear = clamp(stored_volume, 0.0, 1.0)
|
||||
var stored_muted: bool = bool(config.get_value(CONFIG_SECTION, CONFIG_KEY_MUSIC_MUTED, false))
|
||||
_is_muted = stored_muted
|
||||
elif err == ERR_DOES_NOT_EXIST:
|
||||
_user_volume_linear = DEFAULT_VOLUME
|
||||
_is_muted = false
|
||||
else:
|
||||
push_warning("Failed to load settings.cfg: %s" % err)
|
||||
_user_volume_linear = DEFAULT_VOLUME
|
||||
_is_muted = false
|
||||
|
||||
func _save_settings() -> void:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
var err: int = config.load(CONFIG_PATH)
|
||||
if err != OK and err != ERR_DOES_NOT_EXIST:
|
||||
push_warning("Failed to load settings.cfg before saving: %s" % err)
|
||||
config = ConfigFile.new()
|
||||
elif err != OK:
|
||||
config = ConfigFile.new()
|
||||
config.set_value(CONFIG_SECTION, CONFIG_KEY_MUSIC_VOLUME, _user_volume_linear)
|
||||
config.set_value(CONFIG_SECTION, CONFIG_KEY_MUSIC_MUTED, _is_muted)
|
||||
var save_err: int = config.save(CONFIG_PATH)
|
||||
if save_err != OK:
|
||||
push_warning("Failed to save settings.cfg: %s" % save_err)
|
||||
@ -1 +0,0 @@
|
||||
uid://l0cqi7dvoou3
|
||||
@ -1,13 +0,0 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dfmq1n507y7d3"]
|
||||
|
||||
[ext_resource type="AudioStream" uid="uid://txgki0ijeuud" path="res://assets/audio/silly-test.ogg" id="1_ek0t3"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/UI/menu_music.gd" id="2_21d4q"]
|
||||
|
||||
[node name="MenuMusic" type="AudioStreamPlayer"]
|
||||
bus = &"Music"
|
||||
stream = ExtResource("1_ek0t3")
|
||||
autoplay = true
|
||||
volume_db = -3.0
|
||||
priority = 10.0
|
||||
script = ExtResource("2_21d4q")
|
||||
@ -1,76 +0,0 @@
|
||||
extends AudioStreamPlayer
|
||||
|
||||
const CONFIG_PATH := "user://settings.cfg"
|
||||
const CONFIG_SECTION := "audio"
|
||||
const CONFIG_KEY_VOLUME := "menu_sfx_volume"
|
||||
const CONFIG_KEY_MUTED := "menu_sfx_muted"
|
||||
const DEFAULT_VOLUME := 0.7
|
||||
|
||||
var _user_volume_linear: float = DEFAULT_VOLUME
|
||||
var _is_muted: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
_load_settings()
|
||||
_apply_volume()
|
||||
|
||||
func play_hover() -> void:
|
||||
if stream == null or _is_muted or _user_volume_linear <= 0.0:
|
||||
return
|
||||
play(0.0)
|
||||
|
||||
func set_user_volume(value: float) -> void:
|
||||
var clamped_value: float = clamp(value, 0.0, 1.0)
|
||||
if is_equal_approx(_user_volume_linear, clamped_value):
|
||||
return
|
||||
_user_volume_linear = clamped_value
|
||||
_apply_volume()
|
||||
_save_settings()
|
||||
|
||||
func get_user_volume() -> float:
|
||||
return _user_volume_linear
|
||||
|
||||
func set_user_muted(muted: bool) -> void:
|
||||
if _is_muted == muted:
|
||||
return
|
||||
_is_muted = muted
|
||||
_apply_volume()
|
||||
_save_settings()
|
||||
if _is_muted:
|
||||
stop()
|
||||
|
||||
func is_user_muted() -> bool:
|
||||
return _is_muted
|
||||
|
||||
func _apply_volume() -> void:
|
||||
if _is_muted or _user_volume_linear <= 0.0:
|
||||
volume_db = -80.0
|
||||
else:
|
||||
volume_db = linear_to_db(_user_volume_linear)
|
||||
|
||||
func _load_settings() -> void:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
var err: int = config.load(CONFIG_PATH)
|
||||
if err == OK:
|
||||
_user_volume_linear = clamp(float(config.get_value(CONFIG_SECTION, CONFIG_KEY_VOLUME, DEFAULT_VOLUME)), 0.0, 1.0)
|
||||
_is_muted = bool(config.get_value(CONFIG_SECTION, CONFIG_KEY_MUTED, false))
|
||||
elif err == ERR_DOES_NOT_EXIST:
|
||||
_user_volume_linear = DEFAULT_VOLUME
|
||||
_is_muted = false
|
||||
else:
|
||||
push_warning("Failed to load settings.cfg: %s" % err)
|
||||
_user_volume_linear = DEFAULT_VOLUME
|
||||
_is_muted = false
|
||||
|
||||
func _save_settings() -> void:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
var err: int = config.load(CONFIG_PATH)
|
||||
if err != OK and err != ERR_DOES_NOT_EXIST:
|
||||
push_warning("Failed to load settings.cfg before saving: %s" % err)
|
||||
config = ConfigFile.new()
|
||||
elif err != OK:
|
||||
config = ConfigFile.new()
|
||||
config.set_value(CONFIG_SECTION, CONFIG_KEY_VOLUME, _user_volume_linear)
|
||||
config.set_value(CONFIG_SECTION, CONFIG_KEY_MUTED, _is_muted)
|
||||
var save_err: int = config.save(CONFIG_PATH)
|
||||
if save_err != OK:
|
||||
push_warning("Failed to save settings.cfg: %s" % save_err)
|
||||
@ -1 +0,0 @@
|
||||
uid://c7ixr4hbh5ad6
|
||||
@ -1,13 +0,0 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dt785sv7ie7uj"]
|
||||
|
||||
[ext_resource type="AudioStream" uid="uid://64dplcgx2icb" path="res://assets/audio/silly-menu-hover-test.ogg" id="1_a5j5k"]
|
||||
[ext_resource type="Script" path="res://scenes/UI/menu_sfx.gd" id="1_ijvfa"]
|
||||
|
||||
[node name="MenuSfx" type="AudioStreamPlayer"]
|
||||
bus = &"SFX"
|
||||
stream = ExtResource("1_a5j5k")
|
||||
volume_db = -6.0
|
||||
autoplay = false
|
||||
priority = 0.5
|
||||
max_polyphony = 4
|
||||
script = ExtResource("1_ijvfa")
|
||||
@ -1,66 +0,0 @@
|
||||
extends Control
|
||||
|
||||
const AUTH_LOGOUT_URL := "https://pauth.ranaze.com/api/Auth/logout"
|
||||
|
||||
@onready var _login_button: Button = $MarginContainer/CenterContainer/ContentVBox/VBoxContainer/LogInButton
|
||||
@onready var _logout_request: HTTPRequest = %LogoutRequest
|
||||
|
||||
func _ready():
|
||||
_register_focus_sounds()
|
||||
_update_login_button()
|
||||
|
||||
func _register_focus_sounds() -> void:
|
||||
var button_container := $MarginContainer/CenterContainer/ContentVBox/VBoxContainer
|
||||
for child in button_container.get_children():
|
||||
if child is BaseButton:
|
||||
var button: BaseButton = child
|
||||
if not button.is_connected("focus_entered", Callable(self, "_on_menu_item_focus")):
|
||||
button.focus_entered.connect(_on_menu_item_focus)
|
||||
if not button.is_connected("mouse_entered", Callable(self, "_on_menu_item_focus")):
|
||||
button.mouse_entered.connect(_on_menu_item_focus)
|
||||
|
||||
func _on_start_button_pressed():
|
||||
get_tree().change_scene_to_file("uid://dchj6g2i8ebph")
|
||||
|
||||
func _on_settings_button_pressed():
|
||||
get_tree().change_scene_to_file("uid://d3tqrm4ry4l88")
|
||||
|
||||
func _on_quit_button_pressed():
|
||||
get_tree().quit()
|
||||
|
||||
func _on_log_in_button_pressed():
|
||||
if AuthState.is_logged_in:
|
||||
_request_logout()
|
||||
else:
|
||||
get_tree().change_scene_to_file("res://scenes/UI/login_screen.tscn")
|
||||
|
||||
func _on_menu_item_focus() -> void:
|
||||
if MenuSfx:
|
||||
MenuSfx.play_hover()
|
||||
|
||||
func _request_logout() -> void:
|
||||
if AuthState.access_token.is_empty():
|
||||
AuthState.clear_session()
|
||||
_update_login_button()
|
||||
return
|
||||
var headers := PackedStringArray([
|
||||
"Authorization: Bearer %s" % AuthState.access_token,
|
||||
])
|
||||
var err := _logout_request.request(AUTH_LOGOUT_URL, headers, HTTPClient.METHOD_POST)
|
||||
if err != OK:
|
||||
push_warning("Failed to send logout request: %s" % err)
|
||||
AuthState.clear_session()
|
||||
_update_login_button()
|
||||
|
||||
func _on_logout_request_completed(result: int, response_code: int, _headers: PackedStringArray, body: PackedByteArray) -> void:
|
||||
var body_text := body.get_string_from_utf8()
|
||||
if result != HTTPRequest.RESULT_SUCCESS or response_code < 200 or response_code >= 300:
|
||||
push_warning("Logout failed (%s/%s): %s" % [result, response_code, body_text])
|
||||
AuthState.clear_session()
|
||||
_update_login_button()
|
||||
|
||||
func _update_login_button() -> void:
|
||||
if AuthState.is_logged_in:
|
||||
_login_button.text = "LOG OUT"
|
||||
else:
|
||||
_login_button.text = "LOG IN"
|
||||
@ -1,21 +0,0 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c5of6aaxop1hl"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_4du60"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_alp5v"]
|
||||
albedo_color = Color(0.290196, 0.698039, 0.227451, 1)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_kryjk"]
|
||||
material = SubResource("StandardMaterial3D_alp5v")
|
||||
|
||||
[node name="Block" type="Node3D"]
|
||||
|
||||
[node name="RigidBody3D" type="RigidBody3D" parent="."]
|
||||
collision_layer = 3
|
||||
collision_mask = 3
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
|
||||
shape = SubResource("BoxShape3D_4du60")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
|
||||
mesh = SubResource("BoxMesh_kryjk")
|
||||
@ -1,105 +0,0 @@
|
||||
extends RigidBody3D
|
||||
# Initially I used a CharacterBody3D, however, I wanted the player to bounce off
|
||||
# other objects in the environment and that would have required manual handling
|
||||
# of collisions. So that's why we're using a RigidBody3D instead.
|
||||
|
||||
const MOVE_SPEED := 8.0
|
||||
const ACCELLERATION := 30.0
|
||||
const DECELLERATION := 40.0
|
||||
const JUMP_SPEED := 4.0
|
||||
const MAX_NUMBER_OF_JUMPS := 2
|
||||
|
||||
const MIN_FOV := 10
|
||||
const MAX_FOV := 180
|
||||
const ZOOM_FACTOR := 1.1 # Zoom out when >1, in when < 1
|
||||
var mouse_sensitivity := 0.005
|
||||
var rotation_x := 0.0
|
||||
var rotation_y := 0.0
|
||||
var cameraMoveMode := false
|
||||
var current_number_of_jumps := 0
|
||||
|
||||
var jump_sound = preload("res://assets/audio/jump.ogg")
|
||||
var audio_player = AudioStreamPlayer.new()
|
||||
|
||||
@export var camera_path: NodePath
|
||||
@onready var cam: Camera3D = get_node(camera_path) if camera_path != NodePath("") else null
|
||||
|
||||
func _ready() -> void:
|
||||
axis_lock_angular_x = true
|
||||
axis_lock_angular_z = true
|
||||
angular_damp = 6.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 4
|
||||
add_child(audio_player)
|
||||
audio_player.stream = jump_sound
|
||||
audio_player.volume_db = -20
|
||||
|
||||
func _integrate_forces(state):
|
||||
# Input as 2D vector
|
||||
var input2v := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
|
||||
|
||||
# Camera based movement
|
||||
var forward := Vector3.FORWARD * -1.0
|
||||
var right := Vector3.RIGHT
|
||||
if cam:
|
||||
forward = cam.global_transform.basis.z
|
||||
right = cam.global_transform.basis.x
|
||||
# project onto ground plane so looking up/down doesn't tilt movement
|
||||
forward.y = 0.0
|
||||
right.y = 0.0
|
||||
if forward.length() > 0.0001:
|
||||
forward = forward.normalized()
|
||||
if right.length() > 0.0001:
|
||||
right = right.normalized()
|
||||
|
||||
var dir := (right * input2v.x + forward * input2v.y).normalized()
|
||||
var target_v := dir * MOVE_SPEED
|
||||
|
||||
var ax := ACCELLERATION if dir != Vector3.ZERO else DECELLERATION
|
||||
linear_velocity.x = move_toward(linear_velocity.x, target_v.x, ax * state.step)
|
||||
linear_velocity.z = move_toward(linear_velocity.z, target_v.z, ax * state.step)
|
||||
|
||||
# Jump Logic
|
||||
var on_floor = false
|
||||
for i in state.get_contact_count():
|
||||
var normal = state.get_contact_local_normal(i)
|
||||
if normal.y > 0.5:
|
||||
on_floor = true
|
||||
break
|
||||
|
||||
if Input.is_action_just_pressed("ui_accept") and (on_floor or current_number_of_jumps == 1):
|
||||
current_number_of_jumps = (current_number_of_jumps + 1) % 2
|
||||
linear_velocity.y = JUMP_SPEED
|
||||
audio_player.play()
|
||||
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_MIDDLE:
|
||||
if event.pressed:
|
||||
cameraMoveMode = true
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
else:
|
||||
cameraMoveMode = false
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
if event is InputEventMouseMotion and cameraMoveMode:
|
||||
rotation_x -= event.relative.y * mouse_sensitivity
|
||||
rotation_y -= event.relative.x * mouse_sensitivity
|
||||
rotation_x = clamp(rotation_x, deg_to_rad(-90), deg_to_rad(90)) # Prevent flipping
|
||||
|
||||
$Camera3D.rotation.x = rotation_x
|
||||
rotation.y = rotation_y
|
||||
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||
zoom_camera(1.0 / ZOOM_FACTOR) # Zoom in
|
||||
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
zoom_camera(ZOOM_FACTOR) # Zoom out
|
||||
|
||||
if event.is_action_pressed("player_light"):
|
||||
$SpotLight3D.visible = !$SpotLight3D.visible
|
||||
|
||||
func zoom_camera(factor):
|
||||
var new_fov = cam.fov * factor
|
||||
cam.fov = clamp(new_fov, MIN_FOV, MAX_FOV)
|
||||
|
||||
|
Before Width: | Height: | Size: 995 B After Width: | Height: | Size: 995 B |
14
microservices/.gitignore
vendored
14
microservices/.gitignore
vendored
@ -1,14 +0,0 @@
|
||||
# ---> VisualStudioCode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/*.code-snippets
|
||||
|
||||
# Local History for Visual Studio Code
|
||||
.history/
|
||||
|
||||
# Built Visual Studio Code Extensions
|
||||
*.vsix
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bcrypt.Net-Next" Version="4.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.4" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="3.4.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@ -1,6 +0,0 @@
|
||||
@Auth_HostAddress = http://localhost:5279
|
||||
|
||||
GET {{Auth_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
@ -1,113 +0,0 @@
|
||||
using Auth.Models;
|
||||
using Auth.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
||||
namespace Auth.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AuthController : ControllerBase
|
||||
{
|
||||
private readonly UserService _users;
|
||||
private readonly IConfiguration _cfg;
|
||||
private readonly BlacklistService _blacklist;
|
||||
|
||||
public AuthController(UserService users, IConfiguration cfg, BlacklistService blacklist)
|
||||
{
|
||||
_users = users; _cfg = cfg; _blacklist = blacklist;
|
||||
}
|
||||
|
||||
[HttpPost("register")]
|
||||
public async Task<IActionResult> Register([FromBody] RegisterRequest req)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(req.Username) || string.IsNullOrWhiteSpace(req.Password))
|
||||
return BadRequest("Username and password required");
|
||||
|
||||
if (await _users.GetByUsernameAsync(req.Username) != null)
|
||||
return BadRequest("User already exists");
|
||||
|
||||
var hash = BCrypt.Net.BCrypt.HashPassword(req.Password);
|
||||
var user = new User { Username = req.Username, PasswordHash = hash, Role = "USER", Email = req.Email };
|
||||
await _users.CreateAsync(user);
|
||||
return Ok("User created");
|
||||
}
|
||||
|
||||
[HttpPost("login")]
|
||||
public async Task<IActionResult> Login([FromBody] LoginRequest req)
|
||||
{
|
||||
var user = await _users.GetByUsernameAsync(req.Username);
|
||||
if (user == null || !BCrypt.Net.BCrypt.Verify(req.Password, user.PasswordHash))
|
||||
return Unauthorized();
|
||||
|
||||
var (accessToken, jti, expUtc) = GenerateJwtToken(user);
|
||||
user.RefreshToken = Guid.NewGuid().ToString("N");
|
||||
user.RefreshTokenExpiry = DateTime.UtcNow.AddDays(7);
|
||||
await _users.UpdateAsync(user);
|
||||
|
||||
return Ok(new { accessToken, refreshToken = user.RefreshToken, user.Username, user.Role, jti, exp = expUtc });
|
||||
}
|
||||
|
||||
[HttpPost("refresh")]
|
||||
public async Task<IActionResult> Refresh([FromBody] RefreshRequest req)
|
||||
{
|
||||
var user = await _users.GetByUsernameAsync(req.Username);
|
||||
if (user == null || user.RefreshToken != req.RefreshToken || user.RefreshTokenExpiry < DateTime.UtcNow)
|
||||
return Unauthorized("Invalid or expired refresh token");
|
||||
|
||||
var (accessToken, _, expUtc) = GenerateJwtToken(user);
|
||||
return Ok(new { accessToken, exp = expUtc });
|
||||
}
|
||||
|
||||
[HttpPost("logout")]
|
||||
[Authorize(Roles = "USER,SUPER")]
|
||||
public async Task<IActionResult> Logout()
|
||||
{
|
||||
var token = HttpContext.Request.Headers["Authorization"].FirstOrDefault()?.Replace("Bearer ", "");
|
||||
if (string.IsNullOrWhiteSpace(token)) return BadRequest("Token missing");
|
||||
var jwt = new JwtSecurityTokenHandler().ReadJwtToken(token);
|
||||
await _blacklist.AddToBlacklistAsync(jwt.Id, jwt.ValidTo);
|
||||
return Ok("Logged out.");
|
||||
}
|
||||
|
||||
[HttpPost("role")]
|
||||
[Authorize(Roles = "SUPER")]
|
||||
public async Task<IActionResult> ChangeUserRole([FromBody] ChangeRoleRequest req)
|
||||
{
|
||||
if (req.NewRole is not ("USER" or "SUPER")) return BadRequest("Role must be 'USER' or 'SUPER'");
|
||||
var user = await _users.GetByUsernameAsync(req.Username);
|
||||
if (user is null) return NotFound("User not found");
|
||||
user.Role = req.NewRole;
|
||||
await _users.UpdateAsync(user);
|
||||
return Ok($"{req.Username}'s role updated to {req.NewRole}");
|
||||
}
|
||||
|
||||
[HttpGet("users")]
|
||||
[Authorize(Roles = "SUPER")]
|
||||
public async Task<IActionResult> GetAllUsers() => Ok(await _users.GetAllAsync());
|
||||
|
||||
private (string token, string jti, DateTime expUtc) GenerateJwtToken(User user)
|
||||
{
|
||||
var key = Encoding.UTF8.GetBytes(_cfg["Jwt:Key"]!);
|
||||
var issuer = _cfg["Jwt:Issuer"] ?? "GameAuthApi";
|
||||
var audience = _cfg["Jwt:Audience"] ?? issuer;
|
||||
|
||||
var creds = new SigningCredentials(new SymmetricSecurityKey(key), SecurityAlgorithms.HmacSha256);
|
||||
var jti = Guid.NewGuid().ToString("N");
|
||||
var claims = new[]
|
||||
{
|
||||
new Claim(ClaimTypes.Name, user.Username),
|
||||
new Claim(ClaimTypes.NameIdentifier, user.Id),
|
||||
new Claim(ClaimTypes.Role, user.Role),
|
||||
new Claim(JwtRegisteredClaimNames.Jti, jti)
|
||||
};
|
||||
|
||||
var exp = DateTime.UtcNow.AddMinutes(15);
|
||||
var token = new JwtSecurityToken(issuer, audience, claims, expires: exp, signingCredentials: creds);
|
||||
return (new JwtSecurityTokenHandler().WriteToken(token), jti, exp);
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Copy project file first to take advantage of Docker layer caching
|
||||
COPY ["Auth.csproj", "./"]
|
||||
RUN dotnet restore "Auth.csproj"
|
||||
|
||||
# Copy the remaining source and publish
|
||||
COPY . .
|
||||
RUN dotnet publish "Auth.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
|
||||
WORKDIR /app
|
||||
COPY --from=build /app/publish .
|
||||
|
||||
ENV ASPNETCORE_URLS=http://+:8080 \
|
||||
ASPNETCORE_ENVIRONMENT=Production
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["dotnet", "Auth.dll"]
|
||||
@ -1,6 +0,0 @@
|
||||
namespace Auth.Models;
|
||||
|
||||
public class RegisterRequest { public string Username { get; set; } = ""; public string Password { get; set; } = ""; public string? Email { get; set; } }
|
||||
public class LoginRequest { public string Username { get; set; } = ""; public string Password { get; set; } = ""; }
|
||||
public class ChangeRoleRequest { public string Username { get; set; } = ""; public string NewRole { get; set; } = ""; }
|
||||
public class RefreshRequest { public string Username { get; set; } = ""; public string RefreshToken { get; set; } = ""; }
|
||||
@ -1,16 +0,0 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace Auth.Models;
|
||||
|
||||
public class User
|
||||
{
|
||||
[BsonId] [BsonRepresentation(BsonType.ObjectId)]
|
||||
public string Id { get; set; } = default!;
|
||||
public string Username { get; set; } = default!;
|
||||
public string PasswordHash { get; set; } = default!;
|
||||
public string Role { get; set; } = "USER";
|
||||
public string? Email { get; set; }
|
||||
public string? RefreshToken { get; set; }
|
||||
public DateTime? RefreshTokenExpiry { get; set; }
|
||||
}
|
||||
@ -1,86 +0,0 @@
|
||||
using Auth.Services;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddControllers();
|
||||
|
||||
// DI
|
||||
builder.Services.AddSingleton<UserService>();
|
||||
builder.Services.AddSingleton<BlacklistService>();
|
||||
|
||||
// Swagger + JWT auth in Swagger
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Auth API", Version = "v1" });
|
||||
c.AddSecurityDefinition("bearerAuth", new OpenApiSecurityScheme
|
||||
{
|
||||
Type = SecuritySchemeType.Http,
|
||||
Scheme = "bearer",
|
||||
BearerFormat = "JWT",
|
||||
Description = "Paste your access token here (no 'Bearer ' prefix needed)."
|
||||
});
|
||||
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||
{
|
||||
{
|
||||
new OpenApiSecurityScheme
|
||||
{
|
||||
Reference = new OpenApiReference
|
||||
{ Type = ReferenceType.SecurityScheme, Id = "bearerAuth" }
|
||||
},
|
||||
Array.Empty<string>()
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// AuthN/JWT
|
||||
var cfg = builder.Configuration;
|
||||
var jwtKey = cfg["Jwt:Key"] ?? throw new Exception("Jwt:Key missing");
|
||||
var issuer = cfg["Jwt:Issuer"] ?? "GameAuthApi";
|
||||
var aud = cfg["Jwt:Audience"] ?? issuer;
|
||||
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddJwtBearer(o =>
|
||||
{
|
||||
o.TokenValidationParameters = new TokenValidationParameters
|
||||
{
|
||||
ValidateIssuer = true, ValidIssuer = issuer,
|
||||
ValidateAudience = true, ValidAudience = aud,
|
||||
ValidateIssuerSigningKey = true,
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(jwtKey)),
|
||||
ValidateLifetime = true,
|
||||
ClockSkew = TimeSpan.FromSeconds(30)
|
||||
};
|
||||
o.Events = new JwtBearerEvents
|
||||
{
|
||||
OnTokenValidated = async ctx =>
|
||||
{
|
||||
var jti = ctx.Principal?.FindFirstValue(System.IdentityModel.Tokens.Jwt.JwtRegisteredClaimNames.Jti);
|
||||
if (!string.IsNullOrEmpty(jti))
|
||||
{
|
||||
var bl = ctx.HttpContext.RequestServices.GetRequiredService<BlacklistService>();
|
||||
if (await bl.IsBlacklistedAsync(jti)) ctx.Fail("Token revoked");
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
builder.Services.AddAuthorization();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/healthz", () => Results.Ok("ok"));
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(o =>
|
||||
{
|
||||
o.SwaggerEndpoint("/swagger/v1/swagger.json", "Auth API v1");
|
||||
o.RoutePrefix = "swagger";
|
||||
});
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
app.Run();
|
||||
@ -1,23 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://localhost:5279",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "https://localhost:7295;http://localhost:5279",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Auth.Services;
|
||||
|
||||
public class BlacklistedToken
|
||||
{
|
||||
[BsonId] public string Jti { get; set; } = default!;
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
}
|
||||
|
||||
public class BlacklistService
|
||||
{
|
||||
private readonly IMongoCollection<BlacklistedToken> _col;
|
||||
|
||||
public BlacklistService(IConfiguration cfg)
|
||||
{
|
||||
var cs = cfg["MongoDB:ConnectionString"] ?? "mongodb://127.0.0.1:27017";
|
||||
var dbName = cfg["MongoDB:DatabaseName"] ?? "GameDb";
|
||||
var client = new MongoClient(cs);
|
||||
var db = client.GetDatabase(dbName);
|
||||
_col = db.GetCollection<BlacklistedToken>("BlacklistedTokens");
|
||||
|
||||
// TTL index so revocations expire automatically
|
||||
var keys = Builders<BlacklistedToken>.IndexKeys.Ascending(x => x.ExpiresAt);
|
||||
_col.Indexes.CreateOne(new CreateIndexModel<BlacklistedToken>(keys, new CreateIndexOptions { ExpireAfter = TimeSpan.Zero }));
|
||||
}
|
||||
|
||||
public Task AddToBlacklistAsync(string jti, DateTime expiresAt) =>
|
||||
_col.ReplaceOneAsync(x => x.Jti == jti,
|
||||
new BlacklistedToken { Jti = jti, ExpiresAt = expiresAt },
|
||||
new ReplaceOptions { IsUpsert = true });
|
||||
|
||||
public Task<bool> IsBlacklistedAsync(string jti) =>
|
||||
_col.Find(x => x.Jti == jti).AnyAsync();
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
using Auth.Models;
|
||||
using MongoDB.Driver;
|
||||
|
||||
namespace Auth.Services;
|
||||
|
||||
public class UserService
|
||||
{
|
||||
private readonly IMongoCollection<User> _col;
|
||||
|
||||
public UserService(IConfiguration cfg)
|
||||
{
|
||||
var cs = cfg["MongoDB:ConnectionString"] ?? "mongodb://127.0.0.1:27017";
|
||||
var dbName = cfg["MongoDB:DatabaseName"] ?? "GameDb";
|
||||
var client = new MongoClient(cs);
|
||||
var db = client.GetDatabase(dbName);
|
||||
_col = db.GetCollection<User>("Users");
|
||||
|
||||
var keys = Builders<User>.IndexKeys.Ascending(u => u.Username);
|
||||
_col.Indexes.CreateOne(new CreateIndexModel<User>(keys, new CreateIndexOptions { Unique = true }));
|
||||
}
|
||||
|
||||
public Task<User?> GetByUsernameAsync(string username) =>
|
||||
_col.Find(u => u.Username == username).FirstOrDefaultAsync();
|
||||
|
||||
public Task CreateAsync(User user) => _col.InsertOneAsync(user);
|
||||
|
||||
public Task UpdateAsync(User user) =>
|
||||
_col.ReplaceOneAsync(u => u.Id == user.Id, user);
|
||||
|
||||
public Task<List<User>> GetAllAsync() =>
|
||||
_col.Find(FilterDefinition<User>.Empty).ToListAsync();
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"Kestrel": { "Endpoints": { "Http": { "Url": "http://0.0.0.0:5000" } } },
|
||||
"MongoDB": { "ConnectionString": "mongodb://192.168.86.50:27017", "DatabaseName": "promiscuity" },
|
||||
"Jwt": { "Key": "SuperUltraSecureJwtKeyWithAtLeast32Chars!!", "Issuer": "promiscuity", "Audience": "promiscuity-auth-api" },
|
||||
"Logging": { "LogLevel": { "Default": "Information" } },
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: promiscuity-auth
|
||||
labels:
|
||||
app: promiscuity-auth
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
app: promiscuity-auth
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: promiscuity-auth
|
||||
spec:
|
||||
containers:
|
||||
- name: promiscuity-auth
|
||||
image: promiscuity-auth:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: 5000
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
@ -1,15 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: promiscuity-auth
|
||||
labels:
|
||||
app: promiscuity-auth
|
||||
spec:
|
||||
selector:
|
||||
app: promiscuity-auth
|
||||
type: NodePort
|
||||
ports:
|
||||
- name: http
|
||||
port: 80 # cluster port
|
||||
targetPort: 5000 # container port
|
||||
nodePort: 30080 # same external port you've been using
|
||||
@ -1,88 +0,0 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\hz-vm\\Desktop\\micro-services\\Auth\\Auth.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\hz-vm\\Desktop\\micro-services\\Auth\\Auth.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\hz-vm\\Desktop\\micro-services\\Auth\\Auth.csproj",
|
||||
"projectName": "Auth",
|
||||
"projectPath": "C:\\Users\\hz-vm\\Desktop\\micro-services\\Auth\\Auth.csproj",
|
||||
"packagesPath": "C:\\Users\\hz-vm\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\hz-vm\\Desktop\\micro-services\\Auth\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\hz-vm\\AppData\\Roaming\\NuGet\\NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "9.0.200"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"targetAlias": "net9.0",
|
||||
"dependencies": {
|
||||
"Bcrypt.Net-Next": {
|
||||
"target": "Package",
|
||||
"version": "[4.0.3, )"
|
||||
},
|
||||
"Microsoft.AspNetCore.Authentication.JwtBearer": {
|
||||
"target": "Package",
|
||||
"version": "[9.0.8, )"
|
||||
},
|
||||
"Microsoft.AspNetCore.OpenApi": {
|
||||
"target": "Package",
|
||||
"version": "[9.0.4, )"
|
||||
},
|
||||
"MongoDB.Driver": {
|
||||
"target": "Package",
|
||||
"version": "[3.4.3, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"Microsoft.AspNetCore.App": {
|
||||
"privateAssets": "none"
|
||||
},
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.203/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\hz-vm\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.13.2</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\hz-vm\.nuget\packages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,34 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "eAAcl+OtbvI=",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\hz-vm\\Desktop\\micro-services\\Auth\\Auth.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\bcrypt.net-next\\4.0.3\\bcrypt.net-next.4.0.3.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\dnsclient\\1.6.1\\dnsclient.1.6.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.aspnetcore.authentication.jwtbearer\\9.0.8\\microsoft.aspnetcore.authentication.jwtbearer.9.0.8.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.aspnetcore.openapi\\9.0.4\\microsoft.aspnetcore.openapi.9.0.4.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\2.0.0\\microsoft.extensions.logging.abstractions.2.0.0.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.identitymodel.abstractions\\8.0.1\\microsoft.identitymodel.abstractions.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.identitymodel.jsonwebtokens\\8.0.1\\microsoft.identitymodel.jsonwebtokens.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.identitymodel.logging\\8.0.1\\microsoft.identitymodel.logging.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.identitymodel.protocols\\8.0.1\\microsoft.identitymodel.protocols.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.identitymodel.protocols.openidconnect\\8.0.1\\microsoft.identitymodel.protocols.openidconnect.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.identitymodel.tokens\\8.0.1\\microsoft.identitymodel.tokens.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.netcore.platforms\\5.0.0\\microsoft.netcore.platforms.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.openapi\\1.6.17\\microsoft.openapi.1.6.17.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\microsoft.win32.registry\\5.0.0\\microsoft.win32.registry.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\mongodb.bson\\3.4.3\\mongodb.bson.3.4.3.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\mongodb.driver\\3.4.3\\mongodb.driver.3.4.3.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\sharpcompress\\0.30.1\\sharpcompress.0.30.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\snappier\\1.0.0\\snappier.1.0.0.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\system.buffers\\4.5.1\\system.buffers.4.5.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\system.identitymodel.tokens.jwt\\8.0.1\\system.identitymodel.tokens.jwt.8.0.1.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\system.memory\\4.5.5\\system.memory.4.5.5.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\5.0.0\\system.runtime.compilerservices.unsafe.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\system.security.accesscontrol\\5.0.0\\system.security.accesscontrol.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\system.security.principal.windows\\5.0.0\\system.security.principal.windows.5.0.0.nupkg.sha512",
|
||||
"C:\\Users\\hz-vm\\.nuget\\packages\\zstdsharp.port\\0.7.3\\zstdsharp.port.0.7.3.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
# micro-services
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Auth", "Auth\Auth.csproj", "{334F3B23-EFE8-6F1A-5E5F-9A2275D56E28}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{334F3B23-EFE8-6F1A-5E5F-9A2275D56E28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{334F3B23-EFE8-6F1A-5E5F-9A2275D56E28}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{334F3B23-EFE8-6F1A-5E5F-9A2275D56E28}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{334F3B23-EFE8-6F1A-5E5F-9A2275D56E28}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F82C87CC-7411-493D-A138-491A81FBCC32}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@ -15,16 +15,6 @@ run/main_scene="uid://b4k81taauef4q"
|
||||
config/features=PackedStringArray("4.5", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[audio]
|
||||
|
||||
bus_layout="res://audio/bus_layout.tres"
|
||||
|
||||
[autoload]
|
||||
|
||||
MenuMusic="*res://scenes/UI/menu_music.tscn"
|
||||
MenuSfx="*res://scenes/UI/menu_sfx.tscn"
|
||||
AuthState="*res://scenes/UI/auth_state.gd"
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="Promiscuity"
|
||||
@ -63,8 +53,3 @@ ui_down={
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
player_light={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":70,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
5
scenes/Settings.gd
Normal file
5
scenes/Settings.gd
Normal file
@ -0,0 +1,5 @@
|
||||
extends Node
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("ui_cancel"): # 'ui_cancel' is a built-in action defined in Project > Project Settings > Input Map
|
||||
get_tree().change_scene_to_file("res://scenes/start_screen.tscn")
|
||||
44
scenes/Settings.tscn
Normal file
44
scenes/Settings.tscn
Normal file
@ -0,0 +1,44 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d3tqrm4ry4l88"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://h1slqbemgwvr" path="res://scenes/Settings.gd" id="1_1dggd"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhuosr0p605gj" path="res://assets/images/pp_start_bg.png" id="1_i47rn"]
|
||||
[ext_resource type="FontFile" uid="uid://m5ceou0rk6j6" path="res://assets/fonts/PlayfairDisplay-VariableFont_wght.ttf" id="2_46duy"]
|
||||
[ext_resource type="Theme" uid="uid://wpxmub0n2dr3" path="res://themes/button_theme.tres" id="3_46duy"]
|
||||
|
||||
[node name="settings_screen" type="Node2D"]
|
||||
script = ExtResource("1_1dggd")
|
||||
metadata/_edit_vertical_guides_ = [1152.0]
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
offset_left = -192.0
|
||||
offset_top = -188.0
|
||||
offset_right = 1344.0
|
||||
offset_bottom = 836.0
|
||||
texture = ExtResource("1_i47rn")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
offset_right = 1152.0
|
||||
offset_bottom = 648.0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_fonts/font = ExtResource("2_46duy")
|
||||
theme_override_font_sizes/font_size = 42
|
||||
text = "Settings"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TabBar" type="TabBar" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("3_46duy")
|
||||
current_tab = 0
|
||||
tab_count = 4
|
||||
tab_0/title = "Gameplay"
|
||||
tab_1/title = "Video"
|
||||
tab_2/title = "Audio"
|
||||
tab_3/title = "Dev"
|
||||
|
||||
[node name="TabContainer" type="TabContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
62
scenes/level.tscn
Normal file
62
scenes/level.tscn
Normal file
@ -0,0 +1,62 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://dchj6g2i8ebph"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bpxggc8nr6tf6" path="res://scenes/player.gd" id="2_w7c3h"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_2q6dc"]
|
||||
bounce = 0.5
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_2q6dc"]
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_w7c3h"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_w8frs"]
|
||||
bounce = 0.5
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_mx8sn"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_2q6dc"]
|
||||
size = Vector3(1080, 2, 1080)
|
||||
|
||||
[sub_resource type="BoxMesh" id="BoxMesh_w7c3h"]
|
||||
size = Vector3(1080, 2, 1080)
|
||||
|
||||
[node name="Node3D" type="Node3D"]
|
||||
|
||||
[node name="Thing" type="RigidBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3.7986288)
|
||||
physics_material_override = SubResource("PhysicsMaterial_2q6dc")
|
||||
gravity_scale = 0.0
|
||||
contact_monitor = true
|
||||
max_contacts_reported = 5
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Thing"]
|
||||
shape = SubResource("SphereShape3D_2q6dc")
|
||||
debug_color = Color(0.29772994, 0.6216631, 0.28140613, 0.41960785)
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Thing"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
mesh = SubResource("SphereMesh_w7c3h")
|
||||
|
||||
[node name="Player" type="RigidBody3D" parent="."]
|
||||
physics_material_override = SubResource("PhysicsMaterial_w8frs")
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource("2_w7c3h")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Player"]
|
||||
shape = SubResource("SphereShape3D_mx8sn")
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="Player"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
|
||||
[node name="Ground" type="StaticBody3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0)
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
|
||||
shape = SubResource("BoxShape3D_2q6dc")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
|
||||
mesh = SubResource("BoxMesh_w7c3h")
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.5, 0.8660253, 0, -0.8660253, 0.5, 0, 34, 0)
|
||||
shadow_enabled = true
|
||||
16
scenes/player.gd
Normal file
16
scenes/player.gd
Normal file
@ -0,0 +1,16 @@
|
||||
extends RigidBody3D
|
||||
|
||||
# Initially I used a CharacterBody3D, however, I wanted the player to bounce off
|
||||
# other objects in the environment and that would have required manual handling
|
||||
# of collisions. So that's why we're using a RigidBody3D instead.
|
||||
|
||||
const ACCELLERATION = 5.0
|
||||
|
||||
func _integrate_forces(state):
|
||||
var input_dir = Vector3.ZERO
|
||||
input_dir.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
|
||||
input_dir.z = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
|
||||
input_dir = input_dir.normalized()
|
||||
|
||||
linear_velocity.x += input_dir.x * (ACCELLERATION * state.step)
|
||||
linear_velocity.z += input_dir.z * (ACCELLERATION * state.step)
|
||||
11
scenes/start_screen.gd
Normal file
11
scenes/start_screen.gd
Normal file
@ -0,0 +1,11 @@
|
||||
extends Control
|
||||
|
||||
|
||||
func _on_start_button_pressed():
|
||||
get_tree().change_scene_to_file("res://scenes/level.tscn")
|
||||
|
||||
func _on_settings_button_pressed():
|
||||
get_tree().change_scene_to_file("res://scenes/Settings.tscn")
|
||||
|
||||
func _on_quit_button_pressed():
|
||||
get_tree().quit()
|
||||
@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://b4k81taauef4q"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cc8lskf7y74kh" path="res://scenes/UI/start_screen.gd" id="1_o7i0r"]
|
||||
[ext_resource type="Script" uid="uid://cc8lskf7y74kh" path="res://scenes/start_screen.gd" id="1_o7i0r"]
|
||||
[ext_resource type="Theme" uid="uid://wpxmub0n2dr3" path="res://themes/button_theme.tres" id="1_tx5wa"]
|
||||
[ext_resource type="Texture2D" uid="uid://dhuosr0p605gj" path="res://assets/images/pp_start_bg.png" id="2_r2jwc"]
|
||||
[ext_resource type="Theme" uid="uid://tn8qndst18d6" path="res://themes/title_font_theme.tres" id="4_hm208"]
|
||||
@ -35,16 +35,7 @@ theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ContentVBox" type="VBoxContainer" parent="MarginContainer/CenterContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/CenterContainer/ContentVBox"]
|
||||
[node name="Label" type="Label" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
theme = ExtResource("4_hm208")
|
||||
@ -52,49 +43,40 @@ text = "PROJECT
|
||||
PROMISCUOUS"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TitleSpacer" type="Control" parent="MarginContainer/CenterContainer/ContentVBox"]
|
||||
custom_minimum_size = Vector2(0, 40)
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_bottom = 60
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/CenterContainer/ContentVBox"]
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 8
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="LogInButton" type="Button" parent="MarginContainer/CenterContainer/ContentVBox/VBoxContainer"]
|
||||
[node name="StartButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource("1_tx5wa")
|
||||
text = "LOG IN"
|
||||
|
||||
[node name="StartButton" type="Button" parent="MarginContainer/CenterContainer/ContentVBox/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource("1_tx5wa")
|
||||
text = "START "
|
||||
|
||||
[node name="SettingsButton" type="Button" parent="MarginContainer/CenterContainer/ContentVBox/VBoxContainer"]
|
||||
[node name="SettingsButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource("1_tx5wa")
|
||||
text = "SETTINGS"
|
||||
|
||||
[node name="QuitButton" type="Button" parent="MarginContainer/CenterContainer/ContentVBox/VBoxContainer"]
|
||||
[node name="QuitButton" type="Button" parent="MarginContainer/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource("1_tx5wa")
|
||||
text = "QUIT"
|
||||
|
||||
[node name="LogoutRequest" type="HTTPRequest" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/CenterContainer/ContentVBox/VBoxContainer/LogInButton" to="." method="_on_log_in_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/CenterContainer/ContentVBox/VBoxContainer/StartButton" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/CenterContainer/ContentVBox/VBoxContainer/SettingsButton" to="." method="_on_settings_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/CenterContainer/ContentVBox/VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]
|
||||
[connection signal="request_completed" from="LogoutRequest" to="." method="_on_logout_request_completed"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/StartButton" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/SettingsButton" to="." method="_on_settings_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/MarginContainer/VBoxContainer/QuitButton" to="." method="_on_quit_button_pressed"]
|
||||
Loading…
x
Reference in New Issue
Block a user