Add practice range: shooting, AK47, intro cinematic, dressed warehouse scene
- PortalTestDestination practice range: Valorant-style hitscan rifle (recoil, spray/bloom, reload, controller support), debug HUD, practice-dummy targets with head/body hitboxes, hit/death/respawn animations, procedural SFX/FX - AK47 model (Quaternius, CC0) held via Animator IK, with fire/reload/equip anims - Intro cinematic (camera shots, title card, target beam-in, GO hand-off) - Scene dressing editor pass: CC0 textures, props, warehouse roof, lighting and post-processing; custom stylized skybox shader - CharacterMovement: camera recoil, shoulder offset, cinematic control lock - Unity CLI pipeline package; plus in-progress chat/Rive/player changes Asset credits: Assets/Models/Props/PROPS_CREDITS.txt (3 CC-BY 3.0 props), Assets/Textures/Range/TEXTURES_LICENSE.txt, Assets/Resources/*/..._LICENSE.txt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c674d76549
commit
5fc9ebf1e6
@@ -37,22 +37,24 @@ public class ChatAuthenticator : NetworkAuthenticator
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
Debug.Log("[ChatAuthenticator] Server authentication started.");
|
||||
NetworkServer.RegisterHandler<AuthRequestMessage>(OnAuthRequestMessage, false);
|
||||
}
|
||||
|
||||
public override void OnStopServer()
|
||||
{
|
||||
Debug.Log("[ChatAuthenticator] Server authentication stopped.");
|
||||
NetworkServer.UnregisterHandler<AuthRequestMessage>();
|
||||
}
|
||||
|
||||
public override void OnServerAuthenticate(NetworkConnectionToClient conn)
|
||||
{
|
||||
|
||||
Debug.LogWarning($"[ChatAuthenticator] OnServerAuthenticate called for connection {conn.connectionId}; waiting for AuthRequestMessage.");
|
||||
}
|
||||
|
||||
public void OnAuthRequestMessage(NetworkConnectionToClient conn, AuthRequestMessage msg)
|
||||
{
|
||||
Debug.Log($"Authentication Request Username: {msg.authUsername}");
|
||||
Debug.Log($"[ChatAuthenticator] Authentication request received from connection {conn.connectionId}. Username length: {msg.authUsername?.Length ?? 0}");
|
||||
|
||||
if (connectionsPendingDisconnect.Contains(conn)) return;
|
||||
|
||||
@@ -70,6 +72,7 @@ public class ChatAuthenticator : NetworkAuthenticator
|
||||
|
||||
conn.Send(authResponseMessage);
|
||||
|
||||
Debug.Log($"[ChatAuthenticator] Authentication accepted for connection {conn.connectionId}.");
|
||||
ServerAccept(conn);
|
||||
}
|
||||
else
|
||||
@@ -86,6 +89,7 @@ public class ChatAuthenticator : NetworkAuthenticator
|
||||
|
||||
conn.isAuthenticated = false;
|
||||
|
||||
Debug.LogWarning($"[ChatAuthenticator] Authentication rejected for connection {conn.connectionId}: username already in use.");
|
||||
StartCoroutine(DelayedDisconnect(conn, 1f));
|
||||
}
|
||||
}
|
||||
@@ -108,6 +112,7 @@ public class ChatAuthenticator : NetworkAuthenticator
|
||||
public void SetPlayerName(string username)
|
||||
{
|
||||
playerName = username;
|
||||
Debug.Log($"[ChatAuthenticator] Client username set. Length: {playerName?.Length ?? 0}");
|
||||
if (LoginUI.instance != null && LoginUI.instance.errorText != null)
|
||||
{
|
||||
LoginUI.instance.errorText.text = string.Empty;
|
||||
@@ -117,30 +122,33 @@ public class ChatAuthenticator : NetworkAuthenticator
|
||||
|
||||
public override void OnStartClient()
|
||||
{
|
||||
Debug.Log("[ChatAuthenticator] Client authentication started.");
|
||||
NetworkClient.RegisterHandler<AuthResponseMessage>(OnAuthResponseMessage, false);
|
||||
}
|
||||
|
||||
public override void OnStopClient()
|
||||
{
|
||||
Debug.Log("[ChatAuthenticator] Client authentication stopped.");
|
||||
NetworkClient.UnregisterHandler<AuthResponseMessage>();
|
||||
}
|
||||
|
||||
public override void OnClientAuthenticate()
|
||||
{
|
||||
Debug.Log($"[ChatAuthenticator] Sending authentication request. Username length: {playerName?.Length ?? 0}");
|
||||
NetworkClient.Send(new AuthRequestMessage { authUsername = playerName });
|
||||
}
|
||||
|
||||
public void OnAuthResponseMessage(AuthResponseMessage msg)
|
||||
{
|
||||
Debug.Log($"[ChatAuthenticator] Authentication response received. Code: {msg.code}, Message: '{msg.message}'");
|
||||
if (msg.code == 100)
|
||||
{
|
||||
Debug.Log($"Authentication Response: {msg.code} {msg.message}");
|
||||
|
||||
ClientAccept();
|
||||
Debug.Log("[ChatAuthenticator] Client accepted by server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"Authentication Response: {msg.code} {msg.message}");
|
||||
Debug.LogError($"[ChatAuthenticator] Client authentication rejected. Code: {msg.code}, Message: '{msg.message}'");
|
||||
|
||||
NetworkManager.singleton.StopHost();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using Mirror;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
[AddComponentMenu("")]
|
||||
public class ChatNetworkManager : NetworkManager
|
||||
@@ -21,6 +22,8 @@ public class ChatNetworkManager : NetworkManager
|
||||
|
||||
public override void OnServerDisconnect(NetworkConnectionToClient conn)
|
||||
{
|
||||
Debug.Log($"[ChatNetworkManager] Server disconnecting connection {conn.connectionId}. Active scene: '{SceneManager.GetActiveScene().name}'");
|
||||
|
||||
if (conn.authenticationData != null)
|
||||
ChatAuthenticator.playerNames.Remove((string)conn.authenticationData);
|
||||
|
||||
@@ -31,6 +34,7 @@ public class ChatNetworkManager : NetworkManager
|
||||
|
||||
public override void OnClientDisconnect()
|
||||
{
|
||||
Debug.Log($"[ChatNetworkManager] Client disconnected. Active scene: '{SceneManager.GetActiveScene().name}'");
|
||||
base.OnClientDisconnect();
|
||||
|
||||
// Destroy ChatUI instance when disconnecting
|
||||
@@ -53,7 +57,7 @@ public class ChatNetworkManager : NetworkManager
|
||||
{
|
||||
base.OnClientConnect();
|
||||
|
||||
Debug.Log("ChatNetworkManager: OnClientConnect called");
|
||||
Debug.Log($"[ChatNetworkManager] OnClientConnect called. Active scene: '{SceneManager.GetActiveScene().name}'");
|
||||
|
||||
// Spawn ChatUI prefab locally when client successfully connects
|
||||
if (chatUIPrefab == null)
|
||||
@@ -89,6 +93,8 @@ public class ChatNetworkManager : NetworkManager
|
||||
|
||||
if (riveLoginCanvas != null)
|
||||
riveLoginCanvas.SetActive(false);
|
||||
|
||||
Debug.Log($"[ChatNetworkManager] Client connection setup completed. Active scene: '{SceneManager.GetActiveScene().name}'");
|
||||
}
|
||||
|
||||
[Server]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
@@ -35,6 +36,17 @@ public class ChatUI : MonoBehaviour
|
||||
// Expose whether the chat input is focused so other systems can disable input/movement
|
||||
public static bool IsInputFieldFocused => Instance != null && Instance.chatMessage != null && Instance.chatMessage.isFocused;
|
||||
|
||||
// Called by PlayerScript when Escape is pressed while chat is focused, so mouse-look/
|
||||
// cursor lock can resume immediately instead of waiting for a manual click-away.
|
||||
public void ExitChatFocus()
|
||||
{
|
||||
if (chatMessage != null)
|
||||
chatMessage.DeactivateInputField();
|
||||
|
||||
if (EventSystem.current != null)
|
||||
EventSystem.current.SetSelectedGameObject(null);
|
||||
}
|
||||
|
||||
// Called by Player.OnStartLocalPlayer to connect the UI to the player's network methods.
|
||||
public void Initialize(Player player)
|
||||
{
|
||||
|
||||
@@ -42,8 +42,11 @@ public class LoginUI : MonoBehaviour
|
||||
{
|
||||
var username = usernameInput.text.Trim();
|
||||
|
||||
Debug.Log($"[LoginUI] Client button pressed. Username length: {username.Length}");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(username))
|
||||
{
|
||||
Debug.LogWarning("[LoginUI] Client start blocked because the username is empty.");
|
||||
if (errorText != null) { errorText.text = "Enter a username"; errorText.gameObject.SetActive(true); }
|
||||
return;
|
||||
}
|
||||
@@ -51,11 +54,15 @@ public class LoginUI : MonoBehaviour
|
||||
// set the name on the ChatAuthenticator (if present)
|
||||
var auth = NetworkManager.singleton.GetComponent<ChatAuthenticator>();
|
||||
if (auth != null)
|
||||
{
|
||||
Debug.Log("[LoginUI] Assigning username to ChatAuthenticator.");
|
||||
auth.SetPlayerName(username);
|
||||
}
|
||||
else
|
||||
Debug.LogWarning("LoginUI: ChatAuthenticator not found on NetworkManager.");
|
||||
|
||||
// start client
|
||||
Debug.Log($"[LoginUI] Starting client. Network address: '{NetworkManager.singleton.networkAddress}'");
|
||||
NetworkManager.singleton.StartClient();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user