Skip to content

Commit

Permalink
set scale command for dashboard specific
Browse files Browse the repository at this point in the history
  • Loading branch information
ANU-CHEEKI-BREEKI committed Nov 15, 2023
1 parent ca44051 commit 792ac0b
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 38 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- silenced exceptions during dashboard initialization for non static commands
- fixed "silence" commands execution
- changed console.set-theme command. removed unnecessary args. auto complete now able to handle argument values selection quickly
- console.set-theme command. removed unnecessary args. auto complete now able to handle argument values selection quickly
- set scale command for dashboard specific

## [2.1.0] - 2023-11-13
### Added
Expand Down
23 changes: 10 additions & 13 deletions Runtime/Scripts/IngameDebug/Console/UI/UICanvasScaler.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
Expand Down Expand Up @@ -30,7 +27,6 @@ public class UICanvasScaler : MonoBehaviour
#endif
;


private int ScaleStep
{
get => PlayerPrefs.GetInt(PrefsSaveUIScale_ScaleStep, _step);
Expand Down Expand Up @@ -63,7 +59,7 @@ private void Awake()
public void RefreshConsoleScale() => ConsoleScale(CurrentScale);
private void ResetInput() => _exact.text = CurrentScale.ToString() + "%";

[DebugCommand(Name = "scale", Description = "Set console ui scale.")]
[DebugCommand(Name = "scale", Description = "Set console ui scale.", DisplayOptions = CommandDisplayOptions.Console)]
private void ConsoleScale(
[OptVal("50", "75", "100", "125", "150", "200")]
[OptAltNames("v")]
Expand All @@ -74,17 +70,18 @@ private void ConsoleScale(
)
{
if (step)
{
ScaleStep = Mathf.Clamp(value, 1, 50);
}
else
{
CurrentScale = Mathf.Clamp(value, 50, 200);
ResetInput();
_scaler.referenceResolution = _initialResolutionReference / (CurrentScale / 100f);
SetScale(value);
}

DebugConsole.ExecuteCommand("console.refresh-size", silent: true);
}
[DebugCommand(Description = "Set console ui scale.", DisplayOptions = CommandDisplayOptions.Dashboard)]
private void SetScale([OptVal("100", "125", "150", "200")][OptAltNames("v")] int value)
{
CurrentScale = Mathf.Clamp(value, 50, 200);
ResetInput();
_scaler.referenceResolution = _initialResolutionReference / (CurrentScale / 100f);
DebugConsole.ExecuteCommand("console.refresh-size", silent: true);
}
}
}
96 changes: 72 additions & 24 deletions Samples/SceneSetUp/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -219,32 +219,32 @@ PrefabInstance:
- target: {fileID: 526189891292746220, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 526189891292746220, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 526189891292746220, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.x
value: 176.09607
value: 0
objectReference: {fileID: 0}
- target: {fileID: 526189891292746220, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.y
value: 71.203
value: 0
objectReference: {fileID: 0}
- target: {fileID: 526189891292746220, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 93.048035
value: 0
objectReference: {fileID: 0}
- target: {fileID: 526189891292746220, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -35.6015
value: 0
objectReference: {fileID: 0}
- target: {fileID: 605016588552259219, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
Expand Down Expand Up @@ -1019,32 +1019,32 @@ PrefabInstance:
- target: {fileID: 4018730508193053001, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4018730508193053001, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4018730508193053001, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.x
value: 176.09607
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4018730508193053001, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.y
value: 71.203
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4018730508193053001, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 636.33624
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4018730508193053001, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -35.6015
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4023082736054306661, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
Expand Down Expand Up @@ -1649,32 +1649,32 @@ PrefabInstance:
- target: {fileID: 6492709255893453176, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6492709255893453176, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6492709255893453176, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.x
value: 176.09607
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6492709255893453176, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.y
value: 71.203
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6492709255893453176, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 274.1441
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6492709255893453176, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -35.6015
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6582050061693897910, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
Expand Down Expand Up @@ -2344,32 +2344,32 @@ PrefabInstance:
- target: {fileID: 8704572330661924015, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8704572330661924015, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8704572330661924015, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.x
value: 176.09607
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8704572330661924015, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_SizeDelta.y
value: 71.203
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8704572330661924015, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 455.24017
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8704572330661924015, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -35.6015
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8802655401579821646, guid: 99382c5606fb97d438f5f9eff0421582,
type: 3}
Expand Down Expand Up @@ -2671,6 +2671,38 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_AllowHDROutput: 1
m_UseScreenCoordOverride: 0
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
m_TaaSettings:
quality: 3
frameInfluence: 0.1
jitterScale: 1
mipBias: 0
varianceClampScale: 0.9
contrastAdaptiveSharpening: 0
--- !u!1 &410087039
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2778,6 +2810,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Version: 3
m_UsePipelineSettings: 1
m_AdditionalLightsShadowResolutionTier: 2
m_LightLayerMask: 1
m_RenderingLayers: 1
m_CustomShadowLayers: 0
m_ShadowLayerMask: 1
m_ShadowRenderingLayers: 1
m_LightCookieSize: {x: 1, y: 1}
m_LightCookieOffset: {x: 0, y: 0}
m_SoftShadowQuality: 0
--- !u!1 &609722453
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2851,6 +2894,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IsGlobal: 1
priority: 0
blendDistance: 0
weight: 1
sharedProfile: {fileID: 0}
--- !u!4 &832575519
Transform:
m_ObjectHideFlags: 0
Expand Down

0 comments on commit 792ac0b

Please sign in to comment.