Jo Jo funguje Kappa
This commit is contained in:
@@ -13,4 +13,14 @@ MonoBehaviour:
|
|||||||
m_Name: DefaultNetworkPrefabs
|
m_Name: DefaultNetworkPrefabs
|
||||||
m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkPrefabsList
|
m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkPrefabsList
|
||||||
IsDefault: 1
|
IsDefault: 1
|
||||||
List: []
|
List:
|
||||||
|
- Override: 0
|
||||||
|
Prefab: {fileID: 7059514996416789454, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
||||||
|
SourcePrefabToOverride: {fileID: 0}
|
||||||
|
SourceHashToOverride: 0
|
||||||
|
OverridingTargetPrefab: {fileID: 0}
|
||||||
|
- Override: 0
|
||||||
|
Prefab: {fileID: 2809934685114486836, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
SourcePrefabToOverride: {fileID: 0}
|
||||||
|
SourceHashToOverride: 0
|
||||||
|
OverridingTargetPrefab: {fileID: 0}
|
||||||
|
|||||||
133
Editor/CharacterSceneSetupGenerator.cs
Normal file
133
Editor/CharacterSceneSetupGenerator.cs
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.SceneManagement;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
|
// Project namespaces
|
||||||
|
using MegaKoop.Steam; // SteamManager, SteamLobbyService
|
||||||
|
using MegaKoop.Game.Networking; // SteamCoopNetworkManager, SteamP2PTransport, LobbyGameSceneCoordinator
|
||||||
|
|
||||||
|
public static class CharacterSceneSetupGenerator
|
||||||
|
{
|
||||||
|
private const string WizardPrefabPath = "Assets/Game/Hero/Wizard.prefab";
|
||||||
|
|
||||||
|
[MenuItem("Tools/MegaKoop/Setup Character Scene Objects", priority = 1000)]
|
||||||
|
public static void SetupCharacterScene()
|
||||||
|
{
|
||||||
|
var scene = SceneManager.GetActiveScene();
|
||||||
|
if (!scene.IsValid())
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("Character Scene Setup", "No valid scene is open. Please open your CharacterScene and run again.", "OK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Undo.IncrementCurrentGroup();
|
||||||
|
int group = Undo.GetCurrentGroup();
|
||||||
|
|
||||||
|
// 1) Ensure SteamServices root and required components
|
||||||
|
var servicesRoot = GameObject.Find("SteamServices");
|
||||||
|
if (servicesRoot == null)
|
||||||
|
{
|
||||||
|
servicesRoot = new GameObject("SteamServices");
|
||||||
|
Undo.RegisterCreatedObjectUndo(servicesRoot, "Create SteamServices");
|
||||||
|
}
|
||||||
|
|
||||||
|
EnsureComponent<SteamManager>(servicesRoot, "Add SteamManager");
|
||||||
|
var lobby = EnsureComponent<SteamLobbyService>(servicesRoot, "Add SteamLobbyService");
|
||||||
|
var coop = EnsureComponent<SteamCoopNetworkManager>(servicesRoot, "Add SteamCoopNetworkManager");
|
||||||
|
EnsureComponent<SteamP2PTransport>(servicesRoot, "Add SteamP2PTransport");
|
||||||
|
var coordinator = EnsureComponent<LobbyGameSceneCoordinator>(servicesRoot, "Add LobbyGameSceneCoordinator");
|
||||||
|
|
||||||
|
// Keep servicesRoot persistent across scenes to match runtime behavior
|
||||||
|
if (!Application.isPlaying)
|
||||||
|
{
|
||||||
|
// Editor-time: mark as DontSaveInBuild is not needed; users expect this object in scene.
|
||||||
|
// At runtime, code calls DontDestroyOnLoad itself.
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2) Ensure Wizard template exists in scene root
|
||||||
|
var wizardInScene = GameObject.Find("Wizard");
|
||||||
|
if (wizardInScene == null)
|
||||||
|
{
|
||||||
|
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(WizardPrefabPath);
|
||||||
|
if (prefab != null)
|
||||||
|
{
|
||||||
|
var instantiated = PrefabUtility.InstantiatePrefab(prefab, scene) as GameObject;
|
||||||
|
if (instantiated != null)
|
||||||
|
{
|
||||||
|
Undo.RegisterCreatedObjectUndo(instantiated, "Instantiate Wizard Template");
|
||||||
|
instantiated.name = "Wizard"; // Ensure exact name for coordinator lookup
|
||||||
|
instantiated.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Fallback: create a simple placeholder
|
||||||
|
var placeholder = GameObject.CreatePrimitive(PrimitiveType.Capsule);
|
||||||
|
Undo.RegisterCreatedObjectUndo(placeholder, "Create Wizard Placeholder");
|
||||||
|
placeholder.name = "Wizard";
|
||||||
|
placeholder.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
|
||||||
|
// Controller components are optional for template; coordinator will add bridges on clones.
|
||||||
|
placeholder.AddComponent<CharacterController>();
|
||||||
|
placeholder.AddComponent<MegaKoop.Game.ThirdPersonCharacterController>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3) Optional: ensure a basic ground so CharacterController can stand
|
||||||
|
if (GameObject.Find("Ground") == null)
|
||||||
|
{
|
||||||
|
var ground = GameObject.CreatePrimitive(PrimitiveType.Plane);
|
||||||
|
Undo.RegisterCreatedObjectUndo(ground, "Create Ground");
|
||||||
|
ground.name = "Ground";
|
||||||
|
ground.transform.position = Vector3.zero;
|
||||||
|
ground.transform.localScale = Vector3.one * 2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4) Optional: ensure there is at least one light
|
||||||
|
if (Object.FindObjectOfType<Light>() == null)
|
||||||
|
{
|
||||||
|
var lightGO = new GameObject("Directional Light");
|
||||||
|
Undo.RegisterCreatedObjectUndo(lightGO, "Create Directional Light");
|
||||||
|
var light = lightGO.AddComponent<Light>();
|
||||||
|
light.type = LightType.Directional;
|
||||||
|
light.intensity = 1.1f;
|
||||||
|
lightGO.transform.rotation = Quaternion.Euler(50f, -30f, 0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5) Hint coordinator to use current scene name if it differs
|
||||||
|
if (coordinator != null)
|
||||||
|
{
|
||||||
|
// If you want the coordinator to target this scene specifically, uncomment the next line:
|
||||||
|
// SetPrivateField(coordinator, "characterSceneName", scene.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorSceneManager.MarkSceneDirty(scene);
|
||||||
|
Undo.CollapseUndoOperations(group);
|
||||||
|
|
||||||
|
EditorUtility.DisplayDialog("Character Scene Setup", "Character scene objects have been set up successfully.", "OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static T EnsureComponent<T>(GameObject go, string undoName) where T : Component
|
||||||
|
{
|
||||||
|
var c = go.GetComponent<T>();
|
||||||
|
if (c == null)
|
||||||
|
{
|
||||||
|
c = Undo.AddComponent<T>(go);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example helper if you later want to set private serialized fields via reflection
|
||||||
|
private static void SetPrivateField(object target, string fieldName, object value)
|
||||||
|
{
|
||||||
|
var t = target.GetType();
|
||||||
|
var f = t.GetField(fieldName, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||||
|
if (f != null)
|
||||||
|
{
|
||||||
|
f.SetValue(target, value);
|
||||||
|
EditorUtility.SetDirty((Object)target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
2
Editor/CharacterSceneSetupGenerator.cs.meta
Normal file
2
Editor/CharacterSceneSetupGenerator.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 78e4bcab8a4eb484f99e4ef14054c921
|
||||||
2602
Game/Hero/Wizard 2.0.prefab
Normal file
2602
Game/Hero/Wizard 2.0.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
Game/Hero/Wizard 2.0.prefab.meta
Normal file
7
Game/Hero/Wizard 2.0.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ae082cf2d3a36684fb23d8ec0e643150
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1857,6 +1857,8 @@ GameObject:
|
|||||||
- component: {fileID: -6761485100369211516}
|
- component: {fileID: -6761485100369211516}
|
||||||
- component: {fileID: -2990689074187600234}
|
- component: {fileID: -2990689074187600234}
|
||||||
- component: {fileID: 7618815643042096284}
|
- component: {fileID: 7618815643042096284}
|
||||||
|
- component: {fileID: 2662658783078050447}
|
||||||
|
- component: {fileID: 2417536914360261273}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Wizard
|
m_Name: Wizard
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -2019,6 +2021,77 @@ CapsuleCollider:
|
|||||||
m_Height: 2.0070767
|
m_Height: 2.0070767
|
||||||
m_Direction: 1
|
m_Direction: 1
|
||||||
m_Center: {x: 0, y: 0.9898484, z: 0}
|
m_Center: {x: 0, y: 0.9898484, z: 0}
|
||||||
|
--- !u!114 &2662658783078050447
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7059514996416789454}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.NetworkObject
|
||||||
|
GlobalObjectIdHash: 913186323
|
||||||
|
InScenePlacedSourceGlobalObjectIdHash: 0
|
||||||
|
DeferredDespawnTick: 0
|
||||||
|
Ownership: 1
|
||||||
|
AlwaysReplicateAsRoot: 0
|
||||||
|
SynchronizeTransform: 1
|
||||||
|
ActiveSceneSynchronization: 0
|
||||||
|
SceneMigrationSynchronization: 1
|
||||||
|
SpawnWithObservers: 1
|
||||||
|
DontDestroyWithOwner: 0
|
||||||
|
AutoObjectParentSync: 1
|
||||||
|
SyncOwnerTransformWhenParented: 1
|
||||||
|
AllowOwnerToParent: 0
|
||||||
|
--- !u!114 &2417536914360261273
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 7059514996416789454}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e96cb6065543e43c4a752faaa1468eb1, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Unity.Netcode.Runtime::Unity.Netcode.Components.NetworkTransform
|
||||||
|
ShowTopMostFoldoutHeaderGroup: 1
|
||||||
|
NetworkTransformExpanded: 0
|
||||||
|
AutoOwnerAuthorityTickOffset: 1
|
||||||
|
PositionInterpolationType: 0
|
||||||
|
RotationInterpolationType: 0
|
||||||
|
ScaleInterpolationType: 0
|
||||||
|
PositionLerpSmoothing: 1
|
||||||
|
PositionMaxInterpolationTime: 0.1
|
||||||
|
RotationLerpSmoothing: 1
|
||||||
|
RotationMaxInterpolationTime: 0.1
|
||||||
|
ScaleLerpSmoothing: 1
|
||||||
|
ScaleMaxInterpolationTime: 0.1
|
||||||
|
AuthorityMode: 1
|
||||||
|
TickSyncChildren: 0
|
||||||
|
UseUnreliableDeltas: 0
|
||||||
|
SyncPositionX: 1
|
||||||
|
SyncPositionY: 1
|
||||||
|
SyncPositionZ: 1
|
||||||
|
SyncRotAngleX: 1
|
||||||
|
SyncRotAngleY: 1
|
||||||
|
SyncRotAngleZ: 1
|
||||||
|
SyncScaleX: 1
|
||||||
|
SyncScaleY: 1
|
||||||
|
SyncScaleZ: 1
|
||||||
|
PositionThreshold: 0.001
|
||||||
|
RotAngleThreshold: 0.01
|
||||||
|
ScaleThreshold: 0.01
|
||||||
|
UseQuaternionSynchronization: 0
|
||||||
|
UseQuaternionCompression: 0
|
||||||
|
UseHalfFloatPrecision: 0
|
||||||
|
InLocalSpace: 0
|
||||||
|
SwitchTransformSpaceWhenParented: 0
|
||||||
|
Interpolate: 1
|
||||||
|
SlerpPosition: 0
|
||||||
--- !u!1 &7094911519708027617
|
--- !u!1 &7094911519708027617
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ namespace MegaKoop.Game.Networking
|
|||||||
[DefaultExecutionOrder(-500)]
|
[DefaultExecutionOrder(-500)]
|
||||||
public class LobbyGameSceneCoordinator : MonoBehaviour
|
public class LobbyGameSceneCoordinator : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private static LobbyGameSceneCoordinator Instance;
|
||||||
|
|
||||||
[SerializeField] private string characterSceneName = "CharacterScene";
|
[SerializeField] private string characterSceneName = "CharacterScene";
|
||||||
[SerializeField] private float spawnRadius = 3f;
|
[SerializeField] private float spawnRadius = 3f;
|
||||||
[SerializeField] private float minimumSpawnSpacing = 2.5f;
|
[SerializeField] private float minimumSpawnSpacing = 2.5f;
|
||||||
@@ -28,6 +30,14 @@ namespace MegaKoop.Game.Networking
|
|||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
|
// Singleton to avoid double spawners (e.g., one from DontDestroyOnLoad and one from scene contents)
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
{
|
||||||
|
// Another coordinator already exists and persists; remove this duplicate.
|
||||||
|
Destroy(gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Instance = this;
|
||||||
DontDestroyOnLoad(gameObject);
|
DontDestroyOnLoad(gameObject);
|
||||||
SceneManager.sceneLoaded += HandleSceneLoaded;
|
SceneManager.sceneLoaded += HandleSceneLoaded;
|
||||||
}
|
}
|
||||||
@@ -58,7 +68,12 @@ namespace MegaKoop.Game.Networking
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Already in the target scene (e.g., during hot reload).
|
// Already in the target scene (e.g., during hot reload). Avoid double-spawn.
|
||||||
|
if (hasSpawned)
|
||||||
|
{
|
||||||
|
Debug.Log("[LobbyGameSceneCoordinator] BeginGame called but players already spawned; ignoring.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
loadPending = false;
|
loadPending = false;
|
||||||
hasSpawned = false;
|
hasSpawned = false;
|
||||||
SpawnPlayersInScene(SceneManager.GetActiveScene());
|
SpawnPlayersInScene(SceneManager.GetActiveScene());
|
||||||
@@ -131,11 +146,13 @@ namespace MegaKoop.Game.Networking
|
|||||||
|
|
||||||
hasSpawned = true;
|
hasSpawned = true;
|
||||||
|
|
||||||
|
// Proactively remove any previously spawned character clones (e.g., from a duplicate coordinator)
|
||||||
|
DespawnExistingClones(scene, template);
|
||||||
|
|
||||||
Vector3 basePosition = template.transform.position;
|
Vector3 basePosition = template.transform.position;
|
||||||
Quaternion baseRotation = template.transform.rotation;
|
Quaternion baseRotation = template.transform.rotation;
|
||||||
Transform parent = template.transform.parent;
|
Transform parent = template.transform.parent;
|
||||||
|
|
||||||
// Hide template so only spawned copies are visible.
|
|
||||||
template.SetActive(false);
|
template.SetActive(false);
|
||||||
|
|
||||||
int total = Mathf.Max(1, pendingPlayers.Count);
|
int total = Mathf.Max(1, pendingPlayers.Count);
|
||||||
@@ -155,6 +172,28 @@ namespace MegaKoop.Game.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void DespawnExistingClones(Scene scene, GameObject template)
|
||||||
|
{
|
||||||
|
// Destroy any GameObjects in the scene that look like spawned player avatars, excluding the template hierarchy.
|
||||||
|
foreach (var root in scene.GetRootGameObjects())
|
||||||
|
{
|
||||||
|
// Skip the template root itself
|
||||||
|
if (root == template) continue;
|
||||||
|
|
||||||
|
// Heuristic: if it has a SteamCharacterNetworkBridge or ThirdPersonCharacterController, treat it as a character clone
|
||||||
|
var bridge = root.GetComponentInChildren<SteamCharacterNetworkBridge>(true);
|
||||||
|
var tpc = root.GetComponentInChildren<ThirdPersonCharacterController>(true);
|
||||||
|
if (bridge != null || tpc != null)
|
||||||
|
{
|
||||||
|
// Avoid deleting the template if nested under a different root (shouldn't happen)
|
||||||
|
if (!template.transform.IsChildOf(root.transform) && !root.transform.IsChildOf(template.transform))
|
||||||
|
{
|
||||||
|
UnityEngine.Object.Destroy(root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static GameObject FindWizardTemplate(Scene scene)
|
private static GameObject FindWizardTemplate(Scene scene)
|
||||||
{
|
{
|
||||||
foreach (var root in scene.GetRootGameObjects())
|
foreach (var root in scene.GetRootGameObjects())
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ namespace MegaKoop.Game.Networking
|
|||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
|
#if STEAMWORKSNET
|
||||||
|
if (!MegaKoop.Steam.SteamManager.Initialized)
|
||||||
|
#else
|
||||||
if (!SteamBootstrap.IsInitialized)
|
if (!SteamBootstrap.IsInitialized)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -34,7 +38,11 @@ namespace MegaKoop.Game.Networking
|
|||||||
|
|
||||||
public void Send(CSteamID recipient, NetworkMessageType type, byte[] payload, EP2PSend sendType = EP2PSend.k_EP2PSendReliable)
|
public void Send(CSteamID recipient, NetworkMessageType type, byte[] payload, EP2PSend sendType = EP2PSend.k_EP2PSendReliable)
|
||||||
{
|
{
|
||||||
|
#if STEAMWORKSNET
|
||||||
|
if (!MegaKoop.Steam.SteamManager.Initialized)
|
||||||
|
#else
|
||||||
if (!SteamBootstrap.IsInitialized)
|
if (!SteamBootstrap.IsInitialized)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,63 +499,109 @@ PrefabInstance:
|
|||||||
m_AddedGameObjects: []
|
m_AddedGameObjects: []
|
||||||
m_AddedComponents: []
|
m_AddedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: b5051c49d05768c73a8c42e1967fe4b2, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: b5051c49d05768c73a8c42e1967fe4b2, type: 3}
|
||||||
--- !u!1001 &1563379673
|
--- !u!1 &1706180857
|
||||||
PrefabInstance:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1706180863}
|
||||||
|
- component: {fileID: 1706180862}
|
||||||
|
- component: {fileID: 1706180861}
|
||||||
|
- component: {fileID: 1706180860}
|
||||||
|
- component: {fileID: 1706180859}
|
||||||
|
- component: {fileID: 1706180858}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: SteamServices
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!114 &1706180858
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1706180857}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 46f2c531c179d29e39aa831ff5290c20, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::MegaKoop.Game.Networking.LobbyGameSceneCoordinator
|
||||||
|
characterSceneName: CharacterScene
|
||||||
|
spawnRadius: 3
|
||||||
|
minimumSpawnSpacing: 2.5
|
||||||
|
--- !u!114 &1706180859
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1706180857}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c3923950963f6f6a98a81fda48267e6e, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::MegaKoop.Game.Networking.SteamP2PTransport
|
||||||
|
defaultSendType: 2
|
||||||
|
listenChannel: 0
|
||||||
|
--- !u!114 &1706180860
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1706180857}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 83320aed3c99a87b692932447a34631e, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::MegaKoop.Game.Networking.SteamCoopNetworkManager
|
||||||
|
lobbyManager: {fileID: 0}
|
||||||
|
p2pTransport: {fileID: 0}
|
||||||
|
--- !u!114 &1706180861
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1706180857}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4845f8cb316c7f740b1c39a4a21e4174, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::MegaKoop.Steam.SteamLobbyService
|
||||||
|
--- !u!114 &1706180862
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1706180857}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: c571869ecd8ac364d8c6fc0c27a36a4b, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier: Assembly-CSharp::MegaKoop.Steam.SteamManager
|
||||||
|
--- !u!4 &1706180863
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1706180857}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Modification:
|
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||||
serializedVersion: 3
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_TransformParent: {fileID: 0}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_Modifications:
|
m_ConstrainProportionsScale: 0
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
m_Children: []
|
||||||
propertyPath: m_LocalPosition.x
|
m_Father: {fileID: 0}
|
||||||
value: 6.9005165
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.y
|
|
||||||
value: 0.00000023841858
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalPosition.z
|
|
||||||
value: -2.1558924
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.w
|
|
||||||
value: 1
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalRotation.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.x
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.y
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 1117541129888199087, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_LocalEulerAnglesHint.z
|
|
||||||
value: 0
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
- target: {fileID: 7059514996416789454, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
propertyPath: m_Name
|
|
||||||
value: Wizard
|
|
||||||
objectReference: {fileID: 0}
|
|
||||||
m_RemovedComponents: []
|
|
||||||
m_RemovedGameObjects: []
|
|
||||||
m_AddedGameObjects: []
|
|
||||||
m_AddedComponents: []
|
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: fe75fe22781f92b369675fdfc9657f7d, type: 3}
|
|
||||||
--- !u!1001 &1770640151
|
--- !u!1001 &1770640151
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -855,6 +901,75 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!1001 &8888013435869854006
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 2809934685114486836, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: Wizard
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 2809934685114486836, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_IsActive
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3969508485497161681, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: GlobalObjectIdHash
|
||||||
|
value: 3747971393
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 3969508485497161681, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: InScenePlacedSourceGlobalObjectIdHash
|
||||||
|
value: 614518350
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 6.9005165
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: 0.00000023841858
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: -2.1558924
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 7143292874099811358, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: ae082cf2d3a36684fb23d8ec0e643150, type: 3}
|
||||||
--- !u!1660057539 &9223372036854775807
|
--- !u!1660057539 &9223372036854775807
|
||||||
SceneRoots:
|
SceneRoots:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -867,4 +982,5 @@ SceneRoots:
|
|||||||
- {fileID: 1857588276}
|
- {fileID: 1857588276}
|
||||||
- {fileID: 196170898}
|
- {fileID: 196170898}
|
||||||
- {fileID: 1770640151}
|
- {fileID: 1770640151}
|
||||||
- {fileID: 1563379673}
|
- {fileID: 8888013435869854006}
|
||||||
|
- {fileID: 1706180863}
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ namespace MegaKoop.UI
|
|||||||
private Button applyButton;
|
private Button applyButton;
|
||||||
private Button backButton;
|
private Button backButton;
|
||||||
|
|
||||||
|
private bool _initialized;
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
// Získání UI Document
|
// Získání UI Document
|
||||||
@@ -70,6 +72,20 @@ namespace MegaKoop.UI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize only after attached to a panel to avoid DPI/pixelsPerPoint issues
|
||||||
|
root.RegisterCallback<AttachToPanelEvent>(OnAttachedToPanel);
|
||||||
|
if (root.panel != null)
|
||||||
|
{
|
||||||
|
// Already attached (domain reload case)
|
||||||
|
OnAttachedToPanel(default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAttachedToPanel(AttachToPanelEvent evt)
|
||||||
|
{
|
||||||
|
if (_initialized) return;
|
||||||
|
_initialized = true;
|
||||||
|
|
||||||
// Přidání USS stylů (pokud nejsou už v UXML)
|
// Přidání USS stylů (pokud nejsou už v UXML)
|
||||||
if (mainMenuStyles != null && !root.styleSheets.Contains(mainMenuStyles))
|
if (mainMenuStyles != null && !root.styleSheets.Contains(mainMenuStyles))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,25 +80,46 @@ namespace MegaKoop.UI
|
|||||||
// Steam Integration
|
// Steam Integration
|
||||||
private SteamLobbyService steam;
|
private SteamLobbyService steam;
|
||||||
|
|
||||||
|
private bool _initialized;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
if (uiDocument == null)
|
if (uiDocument == null)
|
||||||
uiDocument = GetComponent<UIDocument>();
|
uiDocument = GetComponent<UIDocument>();
|
||||||
|
|
||||||
if (uiDocument != null)
|
if (uiDocument == null)
|
||||||
{
|
{
|
||||||
|
Debug.LogError("UIDocument not found on MultiplayerLobbyController!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
root = uiDocument.rootVisualElement;
|
root = uiDocument.rootVisualElement;
|
||||||
|
if (root == null)
|
||||||
|
{
|
||||||
|
Debug.LogError("rootVisualElement is null on MultiplayerLobbyController!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize only after attached to a panel to avoid DPI/pixelsPerPoint issues
|
||||||
|
root.RegisterCallback<AttachToPanelEvent>(OnAttachedToPanel);
|
||||||
|
if (root.panel != null)
|
||||||
|
{
|
||||||
|
// Already attached (domain reload case)
|
||||||
|
OnAttachedToPanel(default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAttachedToPanel(AttachToPanelEvent evt)
|
||||||
|
{
|
||||||
|
if (_initialized) return;
|
||||||
|
_initialized = true;
|
||||||
|
|
||||||
InitializeElements();
|
InitializeElements();
|
||||||
RegisterEvents();
|
RegisterEvents();
|
||||||
EnsureSteamServices();
|
EnsureSteamServices();
|
||||||
RegisterSteamEvents();
|
RegisterSteamEvents();
|
||||||
SetupInitialState();
|
SetupInitialState();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogError("UIDocument not found on MultiplayerLobbyController!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user