Skip to content

Commit

Permalink
removed scene loading from this panel now pushed from server
Browse files Browse the repository at this point in the history
  • Loading branch information
dooly123 committed Jan 31, 2025
1 parent 28fbc10 commit 7bfd3c2
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,17 +482,25 @@ public void LoadAndOrSaveDefaultDeviceConfigs(string directoryPath)
}
public void Update()
{
if (!hasPendingActions) return;

while (mainThreadActions.TryDequeue(out var action))
{
action.Invoke();
}

// Reset flag once all actions are executed
hasPendingActions = !mainThreadActions.IsEmpty;
}
private static readonly ConcurrentQueue<Action> mainThreadActions = new ConcurrentQueue<Action>();

public static void EnqueueOnMainThread(Action action)
{
Debug.Log("Enqueueing Action on Main Thread...");
if (action == null) return;

mainThreadActions.Enqueue(action);
hasPendingActions = true;
}
private static readonly ConcurrentQueue<Action> mainThreadActions = new ConcurrentQueue<Action>();
private static volatile bool hasPendingActions = false;
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using Basis.Scripts.Drivers;
using Basis.Scripts.BasisSdk.Players;
using Basis.Scripts.Common;
using Basis.Scripts.Networking;
using System.Threading.Tasks;
namespace Basis.Scripts.UI.UI_Panels
{
public class BasisSetUserName : MonoBehaviour
Expand Down Expand Up @@ -69,9 +67,10 @@ public async void HasUserName()
BasisNetworkManagement.Instance.Password = Password.text;
BasisNetworkManagement.Instance.IsHostMode = HostMode.isOn;
ushort.TryParse(Port.text, out BasisNetworkManagement.Instance.Port);
await CreateAssetBundle();
BasisNetworkManagement.Instance.Connect();
Ready.interactable = false;
BasisDebug.Log("connecting to default");
Destroy(this.gameObject);
}
}
else
Expand All @@ -82,20 +81,6 @@ public async void HasUserName()
}
}

public async Task CreateAssetBundle()
{
BasisDebug.Log("connecting to default");
if (BundledContentHolder.Instance.UseAddressablesToLoadScene)
{
await BasisSceneLoadDriver.LoadSceneAddressables(BundledContentHolder.Instance.DefaultScene.BasisRemoteBundleEncrypted.BundleURL);
}
else
{
await BasisSceneLoadDriver.LoadSceneAssetBundle(BundledContentHolder.Instance.DefaultScene);
}
Destroy(this.gameObject);
}

public void ToggleAdvancedSettings()
{
if (AdvancedSettingsPanel != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12571,7 +12571,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
m_PresetInfoIsWorld: 1
--- !u!114 &5910152550907529390
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
26 changes: 13 additions & 13 deletions Basis/Packages/com.basis.sdk/Prefabs/UI/HamBurgerMenu.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 537365749, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -677,7 +677,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
m_PresetInfoIsWorld: 0
--- !u!114 &1722851449925555937
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -840,7 +840,7 @@ MonoBehaviour:
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 7560644369638521980}
m_TargetGraphic: {fileID: 4622692067458527518}
m_OnClick:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -941,8 +941,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 537365749, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -1170,8 +1170,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 537365749, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -1267,7 +1267,7 @@ MonoBehaviour:
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 3415764880421936090}
m_TargetGraphic: {fileID: 4622692067458527518}
m_OnClick:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -1625,8 +1625,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 537365749, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -1722,7 +1722,7 @@ MonoBehaviour:
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 4664179792899613891}
m_TargetGraphic: {fileID: 4622692067458527518}
m_OnClick:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -2318,7 +2318,7 @@ MonoBehaviour:
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 4667714145155378152}
m_TargetGraphic: {fileID: 4622692067458527518}
m_OnClick:
m_PersistentCalls:
m_Calls: []
Expand Down
28 changes: 14 additions & 14 deletions Basis/Packages/com.basis.sdk/Prefabs/UI/LoggerUI.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -210,7 +210,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 1
m_PresetInfoIsWorld: 0
--- !u!114 &8203571039923661912
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -387,8 +387,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -1122,7 +1122,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1416001251597111091}
m_HandleRect: {fileID: 1148281366858664862}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 0.99999297
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down Expand Up @@ -1851,8 +1851,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -2108,8 +2108,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -2267,8 +2267,8 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 2f40c57d4ed9f194189003a5de9fa264, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
Expand Down Expand Up @@ -3022,7 +3022,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 2275870819125436332}
m_HandleRect: {fileID: 112455574951124153}
m_Direction: 0
m_Value: 1
m_Value: 0
m_Size: 0.99997824
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down Expand Up @@ -3433,7 +3433,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -291.48706, y: 259.99756}
m_AnchoredPosition: {x: -291.51083, y: 259.98486}
m_SizeDelta: {x: 550, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &6191721095122422979
Expand Down
Loading

0 comments on commit 7bfd3c2

Please sign in to comment.