Skip to content

Commit

Permalink
fix: Leave UI when screensettings is none
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Jul 16, 2024
1 parent fa4a95d commit 817e6fc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Assets/JCSUnity/Scripts/Settings/JCS_ScreenSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public bool ShouldSpawnResizablePanels()
{
switch (SCREEN_TYPE)
{
case JCS_ScreenType.NONE:
case JCS_ScreenType.FIT_ALL:
case JCS_ScreenType.MIXED:
return false;
Expand All @@ -195,6 +196,15 @@ public bool IsResponsive()
return false;
}

/// <summary>
/// Return true if current screen type is none.
/// </summary>
/// <returns></returns>
public bool IsNone()
{
return SCREEN_TYPE == JCS_ScreenType.NONE;
}

/// <summary>
/// Return the starting screen size by the current screen type.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ protected void SetParentObjectByMode()
Transform parentObject;

// if is Resize UI is enable than add Dialogue under resize ui transform
if (JCS_UISettings.instance.RESIZE_UI)
if (JCS_UISettings.instance.RESIZE_UI && !JCS_ScreenSettings.instance.IsNone())
parentObject = resizeUI.transform;
// Else we add it directly under the Canvas
else
Expand Down
4 changes: 2 additions & 2 deletions Assets/JCSUnity/Scripts/UI/JCS_Canvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void Awake()
this.mAppRect = this.GetComponent<RectTransform>();
this.mCanvas = this.GetComponent<Canvas>();

if (JCS_UISettings.instance.RESIZE_UI)
if (JCS_UISettings.instance.RESIZE_UI && !JCS_ScreenSettings.instance.IsNone())
{
// resizable UI in order to resize the UI correctly
mResizeUI = JCS_Util.Instantiate(RESIZE_UI_PATH).GetComponent<JCS_ResizeUI>();
Expand All @@ -93,7 +93,7 @@ private void Awake()

private void Start()
{
if (JCS_UISettings.instance.RESIZE_UI)
if (JCS_UISettings.instance.RESIZE_UI && !JCS_ScreenSettings.instance.IsNone())
{
if (mResizeUI == null)
return;
Expand Down
7 changes: 5 additions & 2 deletions Assets/JCSUnity/Scripts/UI/JCS_PanelRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ protected override void Awake()
{
base.Awake();

// NOTE: not sure is this the correct position for the code or not.
DoResize();
if (!JCS_ScreenSettings.instance.IsNone())
{
// NOTE: not sure is this the correct position for the code or not.
DoResize();
}
}

protected override void Start()
Expand Down

0 comments on commit 817e6fc

Please sign in to comment.