Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: advanced debug menu #1781

Merged
merged 60 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
11bd359
base structure
NickKhalow Aug 6, 2024
89c1342
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 7, 2024
3f00c59
ConnectionStatusPanel dependencies propagation
NickKhalow Aug 8, 2024
bdc4a51
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 8, 2024
fb0bfaf
ui
NickKhalow Aug 8, 2024
fc1acf4
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 9, 2024
e2000d1
StatusEntry base
NickKhalow Aug 9, 2024
903a972
fields naming for status entries
NickKhalow Aug 9, 2024
2d28050
StatusEntry refs
NickKhalow Aug 9, 2024
57b3137
BadgeView
NickKhalow Aug 9, 2024
bd422ed
add settings
NickKhalow Aug 9, 2024
6d53c41
UpdateCursorInputSystem ensure has mouse
NickKhalow Aug 9, 2024
0ccc47e
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 9, 2024
4485ce3
bind status
NickKhalow Aug 9, 2024
5471301
bind panel
NickKhalow Aug 9, 2024
f15c0c8
add panel to MainUIController.cs
NickKhalow Aug 9, 2024
483842f
fix mistype
NickKhalow Aug 9, 2024
3c45fa7
remove Awake
NickKhalow Aug 9, 2024
3210ac8
pass mvcManager
NickKhalow Aug 12, 2024
e4de7a7
ErrorPopup View/Controller
NickKhalow Aug 12, 2024
2142d22
ErrorPopup pass state to view
NickKhalow Aug 12, 2024
a68717d
IUserInAppInitializationFlow integration
NickKhalow Aug 12, 2024
e58cb1c
UpdateStatusEntry clarify
NickKhalow Aug 12, 2024
b14ed42
add popup to Global Plugins Settings
NickKhalow Aug 12, 2024
ec0dc43
override connection quality for debug purposes
NickKhalow Aug 12, 2024
d8a04e9
connection quality in panel
NickKhalow Aug 12, 2024
63f4d0c
CurrentSceneInfo
NickKhalow Aug 12, 2024
1ada589
display scene status
NickKhalow Aug 12, 2024
7c0d180
show button
NickKhalow Aug 12, 2024
6e2e326
StatusFrom remove redundant code
NickKhalow Aug 12, 2024
8b19219
rollback quality
NickKhalow Aug 12, 2024
4541830
pass cancellation token SceneStatusOnUpdate
NickKhalow Aug 13, 2024
11d8891
safe cancel and dispose
NickKhalow Aug 13, 2024
526e917
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 13, 2024
fa36e2d
lost quality support, delay initialization flow
NickKhalow Aug 13, 2024
beb142f
update width
NickKhalow Aug 13, 2024
13f45bd
remove extra whitespaces
NickKhalow Aug 13, 2024
0f50b31
add error popup to addressables
NickKhalow Aug 13, 2024
74f0bcf
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 13, 2024
a9814e4
fix popup prefab
NickKhalow Aug 13, 2024
5351761
fix button transitions
NickKhalow Aug 13, 2024
39b9556
ConnectionStatusPanelController disposal event subscriptions
NickKhalow Aug 13, 2024
f79537f
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 13, 2024
d4bc9b4
Polish ConnectionStatusPanel UI
RominaMarchetti Aug 13, 2024
be16e34
Merge branch 'feat/connection-status-panel' of https://github.com/dec…
RominaMarchetti Aug 13, 2024
c6b0a72
Polish ErrorPopup UI
RominaMarchetti Aug 13, 2024
39bf916
fix dependencies
NickKhalow Aug 14, 2024
6abaf74
CommandLineArgs base
NickKhalow Aug 14, 2024
3344bc6
remove object matching
NickKhalow Aug 14, 2024
847b211
Merge branch 'main' into feat/connection-status-panel
NickKhalow Aug 14, 2024
9df8aa9
Update button colour and position
RominaMarchetti Aug 14, 2024
141d4f3
Update selected color
RominaMarchetti Aug 14, 2024
30fb257
Merge remote-tracking branch 'origin/feat/connection-status-panel' in…
NickKhalow Aug 15, 2024
49c6855
Merge branch 'main' into feat/advanced-debug-menu
NickKhalow Aug 15, 2024
28c10a0
bind conditional debug allowance
NickKhalow Aug 15, 2024
888a0d7
visibility by flag
NickKhalow Aug 15, 2024
686931d
Merge branch 'main' into feat/advanced-debug-menu
NickKhalow Aug 15, 2024
8fb595f
support blocking of free camera
NickKhalow Aug 15, 2024
894a848
Merge branch 'main' into feat/advanced-debug-menu
NickKhalow Aug 16, 2024
81d6f87
fix merge error
NickKhalow Aug 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class LoginFromDebugPanelSystem : BaseUnityLoopSystem
private readonly IWeb3VerifiedAuthenticator web3Authenticator;
private readonly IMVCManager mvcManager;
private readonly IRealmData realmData;
private readonly DebugWidgetVisibilityBinding widgetVisibility;
private readonly DebugWidgetVisibilityBinding? widgetVisibility;
private CancellationTokenSource? cancellationTokenSource;

public LoginFromDebugPanelSystem(World world,
Expand All @@ -35,16 +35,16 @@ public LoginFromDebugPanelSystem(World world,
this.mvcManager = mvcManager;
this.realmData = realmData;

debugContainerBuilder.AddWidget("Web3 Authentication")
.SetVisibilityBinding(widgetVisibility = new DebugWidgetVisibilityBinding(false))
debugContainerBuilder.TryAddWidget("Web3 Authentication")
?.SetVisibilityBinding(widgetVisibility = new DebugWidgetVisibilityBinding(false))
.AddSingleButton("Login", Login)
.AddSingleButton("Open Auth UI", OpenAuthenticationFlow)
.AddSingleButton("Logout", Logout);
}

protected override void Update(float t)
{
widgetVisibility.SetVisible(realmData.Configured);
widgetVisibility?.SetVisible(realmData.Configured);
}

private void Logout()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class OwnAvatarLoaderFromDebugMenuSystem : BaseUnityLoopSystem
{
private readonly Entity ownPlayerEntity;
private readonly IRealmData realmData;
private readonly DebugWidgetVisibilityBinding widgetVisibility;
private readonly DebugWidgetVisibilityBinding? widgetVisibility;

private CancellationTokenSource? fetchProfileCancellationToken;

Expand All @@ -35,14 +35,14 @@ public OwnAvatarLoaderFromDebugMenuSystem(
this.ownPlayerEntity = ownPlayerEntity;
this.realmData = realmData;

debugContainerBuilder.AddWidget("Profile: Avatar Shape")
.SetVisibilityBinding(widgetVisibility = new DebugWidgetVisibilityBinding(false))
debugContainerBuilder.TryAddWidget("Profile: Avatar Shape")
?.SetVisibilityBinding(widgetVisibility = new DebugWidgetVisibilityBinding(false))
.AddStringFieldWithConfirmation("0x..", "Set Address", UpdateProfileForOwnAvatar);
}

protected override void Update(float t)
{
widgetVisibility.SetVisible(realmData.Configured);
widgetVisibility?.SetVisible(realmData.Configured);
}

private void UpdateProfileForOwnAvatar(string profileId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public partial class InstantiateRandomAvatarsSystem : BaseUnityLoopSystem
private readonly IEntityParticipantTable entityParticipantTable;
private readonly IComponentPool<Transform> transformPool;

private readonly DebugWidgetVisibilityBinding debugVisibilityBinding;
private readonly DebugWidgetVisibilityBinding? debugVisibilityBinding;
private readonly ElementBinding<ulong> totalAvatarsInstantiated;

private SingleInstanceEntity camera;
Expand Down Expand Up @@ -86,17 +86,17 @@ AvatarRandomizerAsset avatarRandomizerAsset
transformPool = componentPools;
this.avatarRandomizerAsset = avatarRandomizerAsset;

debugBuilder.AddWidget("Avatar Debug")
.SetVisibilityBinding(debugVisibilityBinding = new DebugWidgetVisibilityBinding(false))
debugBuilder.TryAddWidget("Avatar Debug")
?.SetVisibilityBinding(debugVisibilityBinding = new DebugWidgetVisibilityBinding(false))
.AddIntFieldWithConfirmation(30, "Instantiate", AddRandomAvatar)
.AddSingleButton("Instantiate Self Replica", AddRandomSelfReplicaAvatar)
.AddControl(new DebugConstLabelDef("Total Avatars"), new DebugLongMarkerDef(totalAvatarsInstantiated = new ElementBinding<ulong>(0), DebugLongMarkerDef.Unit.NoFormat))
.AddSingleButton("Destroy All Avatars", DestroyAllAvatars)
.AddSingleButton("Destroy Random Amount of Avatars", DestroyRandomAmountOfAvatars)
.AddSingleButton("Randomize Wearables of Avatars", RandomizeWearablesOfAvatars);

debugBuilder.AddWidget("Avatar Creator")
.AddStringFieldsWithConfirmation(3, "Instantiate Male", InstantiateMaleAvatar)
debugBuilder.TryAddWidget("Avatar Creator")
?.AddStringFieldsWithConfirmation(3, "Instantiate Male", InstantiateMaleAvatar)
.AddStringFieldsWithConfirmation(3, "Instantiate Female", InstantiateFemaleAvatar);
}

Expand Down Expand Up @@ -125,7 +125,7 @@ private void InstantiateFemaleAvatar(string[] urn)

private void SetDebugViewActivity()
{
debugVisibilityBinding.SetVisible(realmData.Configured && defaultWearableState.GetDefaultWearablesState(World).ResolvedState == DefaultWearablesComponent.State.Success);
debugVisibilityBinding?.SetVisible(realmData.Configured && defaultWearableState.GetDefaultWearablesState(World).ResolvedState == DefaultWearablesComponent.State.Success);
}

private void RandomizeWearablesOfAvatars()
Expand Down
1 change: 1 addition & 0 deletions Explorer/Assets/DCL/AvatarRendering/DemoScripts/csc.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-nullable:enable

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ namespace DCL.CharacterCamera.Systems
public partial class ApplyCinemachineCameraInputSystem : BaseUnityLoopSystem
{
private readonly DCLInput input;
private bool isFreeCameraAllowed;

internal ApplyCinemachineCameraInputSystem(World world, DCLInput input) : base(world)
internal ApplyCinemachineCameraInputSystem(World world, DCLInput input, bool isFreeCameraAllowed) : base(world)
{
this.input = input;
}
Expand Down Expand Up @@ -65,7 +66,7 @@ private void Apply([Data] float dt, ref CameraComponent camera, ref CameraInput
break;
}

cameraInput.SetFreeFly = input.Camera.ToggleFreeFly!.WasPressedThisFrame();
cameraInput.SetFreeFly = isFreeCameraAllowed && input.Camera.ToggleFreeFly!.WasPressedThisFrame();
cameraInput.SwitchState = input.Camera.SwitchState!.WasPressedThisFrame();
cameraInput.ChangeShoulder = input.Camera.ChangeShoulder!.WasPressedThisFrame();

Expand Down Expand Up @@ -108,11 +109,9 @@ private static void ApplyFreeCameraMovement(float dt, in CameraComponent camera,
Transform cameraTransform = camera.Camera.transform;

cinemachineTransform.localPosition += ((cameraTransform.forward * cameraInput.FreeMovement.y) +
(cameraTransform.up * cameraInput.FreePanning.y) +
(cameraTransform.right * cameraInput.FreeMovement.x))
* cinemachinePreset.FreeCameraData.Speed * dt;


(cameraTransform.up * cameraInput.FreePanning.y) +
(cameraTransform.right * cameraInput.FreeMovement.x))
* cinemachinePreset.FreeCameraData.Speed * dt;
}

private static void ApplyPOV(CinemachinePOV cinemachinePOV, in CameraInput cameraInput)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public ApplyCinemachineSettingsSystem(World world, IDebugContainerBuilder debugB
sensitivitySlider = new ElementBinding<float>(currentSens);
noiseSlider = new ElementBinding<float>(0.5f);

debugBuilder.AddWidget("Camera")
.AddFloatSliderField("Sensitivity", sensitivitySlider, 0.01f, 100f)
debugBuilder.TryAddWidget("Camera")
?.AddFloatSliderField("Sensitivity", sensitivitySlider, 0.01f, 100f)
.AddToggleField("Enable Noise", OnNoiseChange, false)
.AddFloatSliderField("Noise Value", noiseSlider, 0, 20);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,37 @@ public partial class CalculateCharacterVelocitySystem : BaseUnityLoopSystem
private SingleInstanceEntity fixedTick;
private SingleInstanceEntity entitySettings;

private readonly ElementBinding<float> cameraRunFov;
private readonly ElementBinding<float> cameraFovSpeed;
private readonly ElementBinding<float> walkSpeed;
private readonly ElementBinding<float> jogSpeed;
private readonly ElementBinding<float> runSpeed;
private readonly ElementBinding<float> jogJumpHeight;
private readonly ElementBinding<float> runJumpHeight;
private readonly ElementBinding<float> jumpHold;
private readonly ElementBinding<float> jumpHoldGravity;
private readonly ElementBinding<float> gravity;
private readonly ElementBinding<float> airAcc;
private readonly ElementBinding<float> maxAirAcc;
private readonly ElementBinding<float> airDrag;
private readonly ElementBinding<float> stopTime;
private readonly ElementBinding<float> cameraRunFov = new (0);
private readonly ElementBinding<float> cameraFovSpeed = new (0);
private readonly ElementBinding<float> walkSpeed = new (0);
private readonly ElementBinding<float> jogSpeed = new (0);
private readonly ElementBinding<float> runSpeed = new (0);
private readonly ElementBinding<float> jogJumpHeight = new (0);
private readonly ElementBinding<float> runJumpHeight = new (0);
private readonly ElementBinding<float> jumpHold = new (0);
private readonly ElementBinding<float> jumpHoldGravity = new (0);
private readonly ElementBinding<float> gravity = new (0);
private readonly ElementBinding<float> airAcc = new (0);
private readonly ElementBinding<float> maxAirAcc = new (0);
private readonly ElementBinding<float> airDrag = new (0);
private readonly ElementBinding<float> stopTime = new (0);

public CalculateCharacterVelocitySystem(World world, IDebugContainerBuilder debugBuilder) : base(world)
{
debugBuilder.AddWidget("Locomotion: Base")
.AddFloatField("Camera Run FOV", cameraRunFov = new ElementBinding<float>(0))
.AddFloatField("Walk Speed", walkSpeed = new ElementBinding<float>(0))
.AddFloatField("Jog Speed", jogSpeed = new ElementBinding<float>(0))
.AddFloatField("Run Speed", runSpeed = new ElementBinding<float>(0))
.AddFloatField("Jog Jump Height", jogJumpHeight = new ElementBinding<float>(0))
.AddFloatField("Run Jump Height", runJumpHeight = new ElementBinding<float>(0))
.AddFloatField("Jump Hold Time", jumpHold = new ElementBinding<float>(0))
.AddFloatField("Jump Hold Gravity Scale", jumpHoldGravity = new ElementBinding<float>(0))
.AddFloatField("Gravity", gravity = new ElementBinding<float>(0))
.AddFloatField("Air Acceleration", airAcc = new ElementBinding<float>(0))
.AddFloatField("Max Air Acceleration", maxAirAcc = new ElementBinding<float>(0))
.AddFloatField("Air Drag", airDrag = new ElementBinding<float>(0))
.AddFloatField("Grounded Stop Time", stopTime = new ElementBinding<float>(0))
debugBuilder.TryAddWidget("Locomotion: Base")
?.AddFloatField("Camera Run FOV", cameraRunFov)
.AddFloatField("Walk Speed", walkSpeed)
.AddFloatField("Jog Speed", jogSpeed)
.AddFloatField("Run Speed", runSpeed)
.AddFloatField("Jog Jump Height", jogJumpHeight)
.AddFloatField("Run Jump Height", runJumpHeight)
.AddFloatField("Jump Hold Time", jumpHold)
.AddFloatField("Jump Hold Gravity Scale", jumpHoldGravity)
.AddFloatField("Gravity", gravity)
.AddFloatField("Air Acceleration", airAcc)
.AddFloatField("Max Air Acceleration", maxAirAcc)
.AddFloatField("Air Drag", airDrag)
.AddFloatField("Grounded Stop Time", stopTime)
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,21 @@ public partial class FeetIKSystem : BaseUnityLoopSystem

private FeetIKSystem(World world, IDebugContainerBuilder debugBuilder) : base(world)
{
debugBuilder.AddWidget("Locomotion: Feet IK")
.AddToggleField("Enabled", evt => { feetIkIsEnabled = evt.newValue; }, true)
.AddFloatField("IK Change Speed", ikWeightChangeSpeed = new ElementBinding<float>(0))
.AddFloatField("IK Position Speed", ikPositionChangeSpeed = new ElementBinding<float>(0))
.AddFloatField("IK Distance", ikDistance = new ElementBinding<float>(0))
.AddFloatField("Spherecast Width", spherecastWidth = new ElementBinding<float>(0))
.AddFloatField("Twist Limit X", twistLimitX = new ElementBinding<float>(0))
.AddFloatField("Twist Limit Y", twistLimitY = new ElementBinding<float>(0));
ikWeightChangeSpeed = new ElementBinding<float>(0);
ikPositionChangeSpeed = new ElementBinding<float>(0);
ikDistance = new ElementBinding<float>(0);
spherecastWidth = new ElementBinding<float>(0);
twistLimitX = new ElementBinding<float>(0);
twistLimitY = new ElementBinding<float>(0);

debugBuilder.TryAddWidget("Locomotion: Feet IK")
?.AddToggleField("Enabled", evt => { feetIkIsEnabled = evt.newValue; }, true)
.AddFloatField("IK Change Speed", ikWeightChangeSpeed)
.AddFloatField("IK Position Speed", ikPositionChangeSpeed)
.AddFloatField("IK Distance", ikDistance)
.AddFloatField("Spherecast Width", spherecastWidth)
.AddFloatField("Twist Limit X", twistLimitX)
.AddFloatField("Twist Limit Y", twistLimitY);
}

public override void Initialize()
Expand Down Expand Up @@ -89,6 +96,7 @@ in CharacterPlatformComponent platformComponent
// Debug stuff and enable/disable mechanic
UpdateToggleStatus(ref feetIKComponent, avatarBase);
if (feetIKComponent.IsDisabled) return;

if (!feetIKComponent.Initialized)
InitializeFeetComponent(ref feetIKComponent, avatarBase);

Expand Down Expand Up @@ -182,6 +190,7 @@ private static void ApplyLegIK(
if (Physics.SphereCast(rayOrigin, settings.FeetIKSphereSize, rayDirection, out RaycastHit hitInfo, rayDistance, PhysicsLayers.CHARACTER_ONLY_MASK))
{
Vector3 targetPosition = hitInfo.point + positionOffset;

// lerp towards the target position
legIKTarget.position = Vector3.MoveTowards(legIKTarget.position, targetPosition, settings.IKPositionSpeed * dt);
var rotationCorrection = Quaternion.FromToRotation(Vector3.up, hitInfo.normal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ public partial class HandsIKSystem : BaseUnityLoopSystem

private HandsIKSystem(World world, IDebugContainerBuilder debugBuilder) : base(world)
{
debugBuilder.AddWidget("Locomotion: Hands IK")
.AddToggleField("Enabled", evt => { handsIkSystemIsEnabled = evt.newValue; }, true)
.AddFloatField("Wall Distance", wallDistance = new ElementBinding<float>(0))
.AddFloatField("IK Weight Speed", ikWeightSpeed = new ElementBinding<float>(0));
wallDistance = new ElementBinding<float>(0);
ikWeightSpeed = new ElementBinding<float>(0);

debugBuilder.TryAddWidget("Locomotion: Hands IK")
?.AddToggleField("Enabled", evt => { handsIkSystemIsEnabled = evt.newValue; }, true)
.AddFloatField("Wall Distance", wallDistance)
.AddFloatField("IK Weight Speed", ikWeightSpeed);
}

public override void Initialize()
Expand Down Expand Up @@ -106,6 +109,7 @@ private static void ApplyHandIK(
var targetWeight = 0;

Debug.DrawRay(rayOrigin, rayDirection * rayDistance, Color.blue, dt);

if (Physics.SphereCast(rayOrigin, settings.FeetIKSphereSize, rayDirection, out RaycastHit hitInfo, rayDistance, PhysicsLayers.CHARACTER_ONLY_MASK))
{
handIKTarget.position = Vector3.MoveTowards(handIKTarget.position, hitInfo.point, settings.IKPositionSpeed * dt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ public partial class HeadIKSystem : BaseUnityLoopSystem

private HeadIKSystem(World world, IDebugContainerBuilder builder) : base(world)
{
builder.AddWidget("Locomotion: Head IK")
.AddToggleField("Enabled", (evt) => { headIKIsEnabled = evt.newValue; }, true)
.AddFloatField("Vertical Limit", verticalLimit = new ElementBinding<float>(0))
.AddFloatField("Horizontal Limit", horizontalLimit = new ElementBinding<float>(0))
.AddFloatField("Horizontal Reset", horizontalReset = new ElementBinding<float>(0))
.AddFloatField("Rotation Speed", speed = new ElementBinding<float>(0));
verticalLimit = new ElementBinding<float>(0);
horizontalLimit = new ElementBinding<float>(0);
horizontalReset = new ElementBinding<float>(0);
speed = new ElementBinding<float>(0);

builder.TryAddWidget("Locomotion: Head IK")
?.AddToggleField("Enabled", (evt) => { headIKIsEnabled = evt.newValue; }, true)
.AddFloatField("Vertical Limit", verticalLimit)
.AddFloatField("Horizontal Limit", horizontalLimit)
.AddFloatField("Horizontal Reset", horizontalReset)
.AddFloatField("Rotation Speed", speed);
}

public override void Initialize()
Expand Down
2 changes: 1 addition & 1 deletion Explorer/Assets/DCL/Chat/MessageBus/IChatMessagesBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void CreateTestChatEntry()
messagesBus.Send(StringUtils.GenerateRandomString(UnityEngine.Random.Range(1, 250)));
}

debugContainerBuilder.AddWidget("Chat")!.AddControl(new DebugButtonDef("Create chat message", CreateTestChatEntry), null!);
debugContainerBuilder.TryAddWidget("Chat")?.AddControl(new DebugButtonDef("Create chat message", CreateTestChatEntry), null!);

return messagesBus;
}
Expand Down
3 changes: 3 additions & 0 deletions Explorer/Assets/DCL/CommandLine.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Explorer/Assets/DCL/CommandLine/CommandLineArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

namespace DCL.CommandLine
{
public class CommandLineArgs : ICommandLineArgs
NickKhalow marked this conversation as resolved.
Show resolved Hide resolved
{
private readonly IReadOnlyList<string> parsedValues;
private static readonly HashSet<string> ALWAYS_IN_EDITOR = new ()
{
ICommandLineArgs.DEBUG_FLAG
};

public CommandLineArgs()
{
parsedValues = Environment.GetCommandLineArgs();

if (Application.isEditor)
parsedValues = parsedValues.Union(ALWAYS_IN_EDITOR).ToList();
}

public bool HasFlag(string flagName) =>
parsedValues.Contains(flagName);
}
}
3 changes: 3 additions & 0 deletions Explorer/Assets/DCL/CommandLine/CommandLineArgs.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading